function check_mail(email)
{ var re = new RegExp("^[\\w\\.-]+@[\\w\\.-]+\\.[A-Za-z]{2,}");
  return (re.test(email));
}
function rstr() {
	$('subm').style.display='';
	$('send1').style.display='none';
	$('c_name').value='';
	$('c_text').value='';
	$('c_email').value='';
}
function shownext() {
	$('subm').style.display='none';
	$('send1').style.display='';
	id = setTimeout("rstr()",5000);
}
function checkdata() {
	ok=0;
	if (document.contact_form.c_name.value=="") {
		document.contact_form.c_name.style.backgroundColor='#E7E5E1';
		document.contact_form.c_name.focus;
		//document.getElementById('emsg').innerHTML='Введите имя!';
		
	} else {
		document.contact_form.c_name.style.backgroundColor='#fff';
		//document.getElementById('emsg').innerHTML='';
		ok++;
	}
	if (!check_mail(document.contact_form.c_email.value)) {
		document.contact_form.c_email.style.backgroundColor='#E7E5E1';
		document.contact_form.c_email.focus;
		//document.getElementById('emsg').innerHTML='Введите корректный адрес электронной почты!';
		
	} else {
		document.contact_form.c_email.style.backgroundColor='#fff';
		//document.getElementById('emsg').innerHTML='';
		ok++;
	}
	if (document.contact_form.c_text.value=="") {
		document.contact_form.c_text.style.backgroundColor='#E7E5E1';
		document.contact_form.c_text.focus;
		//document.getElementById('emsg').innerHTML='Введите корректные данные!';
		
	} else {
		document.contact_form.c_text.style.backgroundColor='#fff';
		//document.getElementById('emsg').innerHTML='';
		ok++;
	}
	if (ok==3) {
	var frm=$('contact_form');
	act = frm.action;
	var c_n=$('c_name');
	cn = c_n.value;
	var c_e=$('c_email');
	ce = c_e.value;
	var c_t=$('c_text');
	ct = c_t.value;	
	new Ajax.Updater('',act,
    {
      method: 'post',
      parameters: { c_name: cn, c_email:ce, c_text: ct},
      onComplete: shownext()
    });
	} else {
		//document.getElementById('emsg').innerHTML='Введите корректные данные!';
		return false;
	}
}