function CheckForm_step1(){

var err_color = '#FDB3B5';
var ok_color = '#FFFFFF';

var name1 = document.Send.name1.value;
var name2 = document.Send.name2.value;
var tel = document.Send.tel.value;
var tel_comm = document.Send.tel_comm.value;
var email = document.Send.email.value;



if(name1=="")
{
	document.Send.name1.style.backgroundColor = err_color;
	alert('Заполните поле Фамилия');
	return false;
}
else
{
	document.Send.name1.style.backgroundColor = ok_color;
}




if(name2=="")
{
	document.Send.name2.style.backgroundColor = err_color;
	alert('Заполните поле Имя Отчество');
	return false;
}
else
{
	document.Send.name2.style.backgroundColor = ok_color;
}



if(tel_comm=="")
{
	document.Send.tel_comm.style.backgroundColor = err_color;
	alert('Заполните поле Контактный телефон');
	return false;
}
else
{
	document.Send.tel_comm.style.backgroundColor = ok_color;
}



if(tel=="")
{
	document.Send.tel.style.backgroundColor = err_color;
	alert('Заполните поле Телефон организации');
	return false;
}
else
{
	document.Send.tel.style.backgroundColor = ok_color;
}





if(email=="")
{
	document.Send.email.style.backgroundColor = err_color;
	alert('Заполните поле E-mail');
	return false;
}
else
{
	document.Send.email.style.backgroundColor = ok_color;
}




var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,6})$/;
if (!email.match(reg)){
	document.Send.email.style.backgroundColor = err_color;
	alert("Пожалуйста, введите e-mail правильно");
	return false;
}
else
{
	document.Send.email.style.backgroundColor = ok_color;
}




var firma = document.Send.firma.value;
var inn = document.Send.inn.value;
var kpp = document.Send.kpp.value;

if(firma=="" )
{
	document.Send.firma.style.backgroundColor = err_color;
	alert('Заполните поля название формы');
	return false;
}
else
{
	document.Send.firma.style.backgroundColor = ok_color;
}





if(inn==""){
	document.Send.inn.style.backgroundColor = err_color;
	alert('Заполните ИНН');
	return false;
}
else
{
	document.Send.inn.style.backgroundColor = ok_color;
}


if(inn.length != "10" && inn.length != "12")
{
	document.Send.inn.style.backgroundColor = err_color;
	alert('введите ИНН 10 или 12 цифр');
	return false;
}
else
{
	document.Send.inn.style.backgroundColor = ok_color;
}




if(inn.length == "10")
{	
	if(kpp.length != 9)
	{
		alert('Заполните КПП');
		return false;
	}
}




var addr1 = document.Send.addr1.value;

if(addr1=="")
{
	document.Send.addr1.style.backgroundColor = err_color;
	alert('Заполните поле Юридический адрес');
	return false;
}
else
{
	document.Send.addr1.style.backgroundColor = ok_color;
}


var addr2 = document.Send.addr2.value;
if(addr2=="")
{
	document.Send.addr2.style.backgroundColor = err_color;
	alert('Заполните поле Фактический адрес');
	return false;
}
else
{
	document.Send.addr2.style.backgroundColor = ok_color;
}

if(document.Send.ifnc != undefined){

var ifnc = document.Send.ifnc.value;
if(ifnc=="")
{
	document.Send.ifnc.style.backgroundColor = err_color;
	alert('Заполните поле Код ИФНС');
	return false;
}
else
{
	document.Send.ifnc.style.backgroundColor = ok_color;
}

}


var ogrn = document.Send.ogrn.value;

if(ogrn=="")
{
	document.Send.ogrn.style.backgroundColor = err_color;
	alert('Заполните поле ОГРН');
	return false;
}
else
{
	if(ogrn.length != 13)
	{
		document.Send.ogrn.style.backgroundColor = err_color;
		alert('Ошибка в ОГРН');
		return false;
	}
	else
	{
		document.Send.ogrn.style.backgroundColor = ok_color;
	}
}



/* BANK */

var bank = document.Send.bank.value;
if(bank=="")
{
	document.Send.bank.style.backgroundColor = err_color;
	alert('Заполните Название банка');
	return false;
}
else
{
	document.Send.bank.style.backgroundColor = ok_color;
}


var bik = document.Send.bik.value;
if(bik=="")
{
	document.Send.bik.style.backgroundColor = err_color;
	alert('Заполните Бик');
	return false;
}
else
{
	document.Send.bik.style.backgroundColor = ok_color;
}


var rs = document.Send.rs.value;
var ks = document.Send.ks.value;

if(rs=="")
{
	document.Send.rs.style.backgroundColor = err_color;
	alert('Заполните Р/c');
	return false;
}
else
{
	document.Send.rs.style.backgroundColor = ok_color;
}


if(ks=="")
{
	document.Send.ks.style.backgroundColor = err_color;
	alert('Заполните К/c ');
	return false;
}
else
{
	document.Send.ks.style.backgroundColor = ok_color;
}





var f1 = document.Send.f1.value;
var f2 = document.Send.f2.value;
var f3 = document.Send.f3.value;
var f4 = document.Send.f4.value;
var f5 = document.Send.f5.value;

if(f1=="")
{
	document.Send.f1.style.backgroundColor = err_color;
	alert('Заполните информацию о руководителе: Фамилия');
	return false;
}
else
{
	document.Send.f1.style.backgroundColor = ok_color;
}



if(f2=="")
{
	document.Send.f2.style.backgroundColor = err_color;
	alert('Заполните информацию о руководителе: Имя');
	return false;
}
else
{
	document.Send.f2.style.backgroundColor = ok_color;
}


if(f3=="")
{
	document.Send.f3.style.backgroundColor = err_color;
	alert('Заполните информацию о руководителе: Отчество');
	return false;
}
else
{
	document.Send.f3.style.backgroundColor = ok_color;
}


if(f4=="")
{
	document.Send.f4.style.backgroundColor = err_color;
	alert('Заполните информацию о руководителе: Должность');
	return false;
}
else
{
	document.Send.f4.style.backgroundColor = ok_color;
}


if(f5=="")
{
	document.Send.f5.style.backgroundColor = err_color;
	alert('Заполните информацию о руководителе: E-mail ');
	return false;
}
else
{
	document.Send.f5.style.backgroundColor = ok_color;
}








var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,6})$/;
if(!f5.match(reg))
{
	document.Send.f5.style.backgroundColor = err_color;
	alert("Пожалуйста, введите e-mail правильно");
	return false;
}
else
{
	document.Send.f5.style.backgroundColor = ok_color;
}




var ecp2 = document.Send.ecp2.value;
var ecp3 = document.Send.ecp3.value;
var ecp4 = document.Send.ecp4.value;

if(ecp2=="" || ecp3=="" || ecp4=="")
{
	alert('Заполните паспортные данные верно');
	return false;
}


} // END function CheckForm_step1







function CheckForm_step3(){


var nametarif = document.subm.tarif;

}














function inn_f(){

var inn = document.Send.inn.value;

	if(inn.length==12){

		document.getElementById('kppstr').style.display = 'none';
    	//visible = false;
	}else{
		document.getElementById('kppstr').style.display = '';
	}
}






function numbersonly(myfield, e, dec) {
  var key;
  var keychar;

  if (window.event)
    key = window.event.keyCode;
  else if (e)
    key = e.which;
  else
    return true;
  keychar = String.fromCharCode(key);

  // control keys
  if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) )
    return true;
  // numbers
  else if ((("0123456789").indexOf(keychar) > -1))
    return true;

  // decimal point jump
  else if (dec && (keychar == ".")) {
    myfield.form.elements[dec].focus();
    return false;
  } else
    return false;
}






function active(n){
	document.getElementById(n).disabled = false;
}




function deactive(n){
	document.getElementById(n).disabled = true;
}




function fnchecked(blnchecked){
	if(blnchecked){
		document.getElementById("div1").style.display = "none";
	}else{
		document.getElementById("div1").style.display = "";
	}
}





function tarifs(s,n){

	document.getElementById("tar").value = s;
	document.getElementById("tar_name").value = n;
	dop();
}




function dop(){

var r_mn = new Array();
var r_s = new Array();
var d = new Array();

//for(var i=1; i<16; i++){
	
for(var i=1; i<30; i++){

var obj_mn = document.subm['mn'+i];
var obj_s = document.subm['s'+i];

if(obj_mn !== undefined && obj_s !== undefined){
 
	if(obj_mn.type == "checkbox"){

		if (obj_mn.checked){
			r_mn[i] = 1;
			r_s[i] = obj_s.value;
		}else{
			r_mn[i] = 0;
			r_s[i] = 0;
		}
	}else{
		r_mn[i] = obj_mn.value;
		r_s[i] = obj_s.value;
	}
	d[i] = r_s[i]*r_mn[i];
}
else{
	r_mn[i] = 0;
	r_s[i] = 0;
	d[i] = 0;
}

}

var rub = " рублей";
var f_tar = document.getElementById("tar").value;
document.getElementById("total").value = Number(f_tar)+d[1]+d[2]+d[3]+d[4]+d[5]+d[6]+d[7]+d[8]+d[9]+d[10]+d[11]+d[12]+d[13]+d[14]+d[15]+d[16]+d[17]+d[18]+d[19]+d[20]+d[21]+d[22]+d[23]+d[24]+d[25]+d[26]+d[27]+d[28]+d[29]+rub;
}

/*
var f_tar = document.getElementById("tar").value;
document.getElementById("total").value = Number(f_tar)+d[1]+d[2]+d[3]+d[4]+d[5]+d[6]+d[7]+d[8]+d[9]+d[10]+d[11]+d[12]+d[13]+d[14]+d[15]+rub;
}
*/



function kn(e){
 var key = (typeof e.charCode == 'undefined' ? e.keyCode : e.charCode);
  if (e.ctrlKey || e.altKey || key < 58)    return true;
  else    return false;
}
