function openAskForm() {
     var tmp = document.getElementById("send_form_cont");
     checkWideScreen();     
     tmp.style.top = (myHeight/2+myTop-200) + "px";
     tmp.style.display = "block";
     return false;
}

function checkWideScreen(){
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
    myTop = window.pageYOffset;
    myLeft = window.pageXOffset;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
    myTop = document.documentElement.scrollTop;
    myLeft = document.documentElement.scrollLeft;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
    myTop = document.body.scrollTop;
    myLeft = document.body.scrollLeft;
  }
}

	function CheckForm(){	
	  var error=0;
	  var mf=document.forms['zakaz'];		
	    if (mf.fio.value=='' && error==0) {
	      alert('Заполните, пожалуйста, поле \"ФИО\"');
		  mf.fio.focus();
		  error=1;
	    }
		if (!mf.email.value.match(/^\s*[a-zA-Z0-9._-]+\@[^\s:,]+\.[^\s:,]+$/i) && error==0) {
	    alert('Заполните, пожалуйста, поле \"Е-mail\" корректным e-mail адресом');
			mf.email.focus();
			error=1;
	  }
			
		if (mf.about.value=='' && error==0) {
	      alert('Введите, пожалуйста, текст сообщения');
		  mf.about.focus();
		  error=1;
	    }
		if (!mf.code.value.match(/^\d{4}$/) && error==0) {
	    alert('Введите, пожалуйста, четыре цифры кода');
		  mf.code.focus();
		  error=1;
	    }
	    if (error==0) {
	       //mf.submit();
				script = document.createElement("script");
				script.src = "/sendmail.phtml?fio="+mf.fio.value+"&email="+mf.email.value+"&ref="+escape(location.href)+"&code="+mf.code.value+"&phone="+mf.phone.value+"&about="+mf.about.value;			
				document.body.appendChild(script);				 
	    }			
	 }
