function main_crt() {
var isname, isemail, tel, re;

var name_maxleng = 60;
var email_maxleng = 50;
var tel_maxleng = 20;

re = /([0-9a-zA-Z\.-_]+)@([0-9a-zA-Z\.-_]+)/;

isname = document.sozd.name.value;
tel = document.sozd.tel.value;
isemail = document.sozd.email.value;

while (isname.substring(0,1) == " ") isname = isname.substring(1);
while (isname.substring(isname.length-1,isname.length) == " ") isname = isname.substring(0,isname.length-1);
while (isemail.substring(0,1) == " ") isemail = isemail.substring(1);
while (isemail.substring(isemail.length-1,isemail.length) == " ") isemail = isemail.substring(0,isemail.length-1);
while (tel.substring(0,1) == " ") tel = tel.substring(1);
while (tel.substring(tel.length-1,tel.length) == " ") tel = tel.substring(0,tel.length-1);

var varning="Ошибка:";
var form2 = document.sozd;
if (form2.captcha.value.length < 1) {
    alert('Пожалуйста, введите код');
    form2.captcha.focus();
    return false;
}
if (form2.captcha.value.length != 4) {
    alert('Вы ввели неправильный код');
    form2.captcha.focus();
    return false;
}
if (document.getElementById('sid1').value != document.getElementById('captcha1').value) {
    alert('Вы ввели неправильный код');
    form2.captcha.focus();
    return false;
}


if (isname.length==0 || isname.length > name_maxleng) {
	document.sozd.name.value ="";
	document.sozd.name.focus();
	alert("   Введите имя!   ");
	return false;
}


if (isemail.length==0 || isemail.length > email_maxleng ) {
	document.sozd.email.value ="";
	document.sozd.email.focus();
	alert("   Введите E-mail!   ");
	return false;
}


if (isemail.length > 0) {
			 var supported = 0;
			   if (window.RegExp) {
			     var tempStr = "a";
			     var tempReg = new RegExp(tempStr);
			     if (tempReg.test(tempStr)) supported = 1;
		  	   }
			   if (!supported) {
			       isValid = (isemail.indexOf(".") > 2) && (isemail.indexOf("@") > 0);
			   } else {
				  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
				  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
				  var r3 = new RegExp("[а-яА-Я]");
			       isValid = (!r1.test(isemail) && r2.test(isemail) && !r3.test(isemail));
		       }
		       if (!isValid) {
		       	  alert("Внимание! Ошибка при вводе email!  ");	
				  document.sozd.email.focus();
				  return false;	
		       }
			}


if (tel.length==0 || tel.length > tel_maxleng ) {
	document.sozd.tel.value ="";
	document.sozd.tel.focus();
	alert("   Введите номер телефона!   ");
	return false;
}


document.sozd.submit();
return true;

}


function main_podd() {

var isname, isemail, tel;

var name_maxleng = 60;
var email_maxleng = 50;
var tel_maxleng = 20;

isname = document.podd.name.value;
tel = document.podd.tel.value;
isemail = document.podd.email.value;

while (isname.substring(0,1) == " ") isname = isname.substring(1);
while (isname.substring(isname.length-1,isname.length) == " ") isname = isname.substring(0,isname.length-1);
while (isemail.substring(0,1) == " ") isemail = isemail.substring(1);
while (isemail.substring(isemail.length-1,isemail.length) == " ") isemail = isemail.substring(0,isemail.length-1);
while (tel.substring(0,1) == " ") tel = tel.substring(1);
while (tel.substring(tel.length-1,tel.length) == " ") tel = tel.substring(0,tel.length-1);


var varning="Ошибка:";
var form2 = document.podd;
if (form2.captcha.value.length < 1) {
    alert('Пожалуйста, введите код');
    form2.captcha.focus();
    return false;
}
if (form2.captcha.value.length != 4) {
    alert('Вы ввели неправильный код');
    form2.captcha.focus();
    return false;
}
if (document.getElementById('sid2').value != document.getElementById('captcha2').value) {
    alert('Вы ввели неправильный код');
    form2.captcha.focus();
    return false;
}

if (isname.length==0 || isname.length > name_maxleng) {
	document.podd.name.value ="";
	document.podd.name.focus();
	alert("   Введите имя!   ");
	return false;
}


if (isemail.length==0 || isemail.length > email_maxleng ) {
	document.podd.email.value ="";
	document.podd.email.focus();
	alert("   Введите E-mail!   ");
	return false;
}


if (isemail.length > 0) {
			 var supported = 0;
			   if (window.RegExp) {
			     var tempStr = "a";
			     var tempReg = new RegExp(tempStr);
			     if (tempReg.test(tempStr)) supported = 1;
		  	   }
			   if (!supported) {
			       isValid = (isemail.indexOf(".") > 2) && (isemail.indexOf("@") > 0);
			   } else {
				  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
				  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
				  var r3 = new RegExp("[а-яА-Я]");
			       isValid = (!r1.test(isemail) && r2.test(isemail) && !r3.test(isemail));
		       }
		       if (!isValid) {
		       	  alert("Внимание! Ошибка при вводе email!  ");	
				  document.podd.email.focus();
				  return false;	
		       }
			}


if (tel.length==0 || tel.length > tel_maxleng ) {
	document.podd.tel.value ="";
	document.podd.tel.focus();
	alert("   Введите номер телефона!   ");
	return false;
}


document.podd.submit();
return true;

}


function main_prod() {

var isname, isemail, tel;

var name_maxleng = 60;
var email_maxleng = 50;
var tel_maxleng = 20;

isname = document.pr_podd.name.value;
tel = document.pr_podd.tel.value;
isemail = document.pr_podd.email.value;

while (isname.substring(0,1) == " ") isname = isname.substring(1);
while (isname.substring(isname.length-1,isname.length) == " ") isname = isname.substring(0,isname.length-1);
while (isemail.substring(0,1) == " ") isemail = isemail.substring(1);
while (isemail.substring(isemail.length-1,isemail.length) == " ") isemail = isemail.substring(0,isemail.length-1);
while (tel.substring(0,1) == " ") tel = tel.substring(1);
while (tel.substring(tel.length-1,tel.length) == " ") tel = tel.substring(0,tel.length-1);

var varning="Ошибка:";
var form2 = document.pr_podd;
if (form2.captcha.value.length < 1) {
    alert('Пожалуйста, введите код');
    form2.captcha.focus();
    return false;
}
if (form2.captcha.value.length != 4) {
    alert('Вы ввели неправильный код');
    form2.captcha.focus();
    return false;
}
if (document.getElementById('sid3').value != document.getElementById('captcha3').value) {
    alert('Вы ввели неправильный код');
    form2.captcha.focus();
    return false;
}

if (isname.length==0 || isname.length > name_maxleng) {
	document.pr_podd.name.value ="";
	document.pr_podd.name.focus();
	alert("   Введите имя!   ");
	return false;
}


if (isemail.length==0 || isemail.length > email_maxleng ) {
	document.pr_podd.email.value ="";
	document.pr_podd.email.focus();
	alert("   Введите E-mail!   ");
	return false;
}


if (isemail.length > 0) {
			 var supported = 0;
			   if (window.RegExp) {
			     var tempStr = "a";
			     var tempReg = new RegExp(tempStr);
			     if (tempReg.test(tempStr)) supported = 1;
		  	   }
			   if (!supported) {
			       isValid = (isemail.indexOf(".") > 2) && (isemail.indexOf("@") > 0);
			   } else {
				  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
				  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
				  var r3 = new RegExp("[а-яА-Я]");
			       isValid = (!r1.test(isemail) && r2.test(isemail) && !r3.test(isemail));
		       }
		       if (!isValid) {
		       	  alert("Внимание! Ошибка при вводе email!  ");	
				  document.pr_podd.email.focus();
				  return false;	
		       }
			}


if (tel.length==0 || tel.length > tel_maxleng ) {
	document.pr_podd.tel.value ="";
	document.pr_podd.tel.focus();
	alert("   Введите номер телефона!   ");
	return false;
}


document.pr_podd.submit();
return true;

}


