function check_format(){
if (form1.format.value==6)
	{
	wid.style.display="";
	hei.style.display="";
	}
else
	{
	var $format_w=new Array(51,68,102,100,68,100);
	var $format_h=new Array(75,75,75,100,100,150);
	wid.style.display="none";
	hei.style.display="none";
	form1.width.value=$format_w[form1.format.value];
	form1.height.value=$format_h[form1.format.value];
	}
}

function check_block(){
if (form1.in_block_st.value==1){
	in_bl.style.display="";
	}
else{
	in_bl.style.display="none";
	form1.in_block.value=form1.in_block_st.value;
	}
}

function check_in_block(){
var $x=form1.in_block.value;
if (($x<=450)&&($x>=25)){
form1.in_block.value=parseInt($x);
i_alert.innerHTML="ok";
i_alert.style.color="green";
return true;
}
else{
i_alert.innerHTML="Недопустимое значение. Введите число от 25 до 450";
i_alert.style.color="red";
return false;
}
}

function check_width(){
var $x=form1.width.value;
if (($x>=20)&&($x<=204)){
	w_alert.innerHTML="ok";
	w_alert.style.color="green";
	return true;
	}
else{
	w_alert.innerHTML="Недопустимое значение. Введите число от 20 до 204";
	w_alert.style.color="red";
	return false;
	}
}

function check_height(){
var $x=form1.height.value;
if (($x>=20)&&($x<=150)){
	h_alert.innerHTML="ok";
	h_alert.style.color="green";
	return true;
	}
else{
	h_alert.innerHTML="Недопустимое значение. Введите число от 20 до 150";
	h_alert.style.color="red";
	return false;
	}
}

function check_total(){
var $x=form1.total.value;
if ($x<300){
    t_alert.innerHTML="Недопустимое значение. Минимальный тираж 300 блоков";
    t_alert.style.color="red";
    return false;
   	}
else if ($x>10000){
    t_alert.innerHTML="Тиражи более 10000 просчитываются индивидуально. <a href='index.php?cont=6&lang=rus&sub=0'>Свяжитесь с нами</a> ";
    t_alert.style.color="red";
    return false;
	}
	else {
    t_alert.innerHTML="ok";
    t_alert.style.color="green";
    return true;
	}
}

function check_all(){
	$t1=check_in_block();
	$t2=check_width();
	$t3=check_height();
	$t4=check_total();
	if ($t1&&$t2&&$t3&&$t4){
	var $adr="calc_result.php?w=";
	$adr=$adr+form1.width.value+"&h="+form1.height.value+"&i="+form1.in_block.value+"&t="+form1.total.value+"&c="+form1.colors.value;
	location.href=$adr;
	}
}
