var fl=0;
var month2=["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"];
function trim(s) {return s.replace(/(^\s*)|(\s*$)/g,"");}
function ajax8(n) {if (n!=1&&n!=4&&n!=6&&n!=14&&n!=28) {document.getElementById("reg").innerHTML='<input id="region" type="text" name="region" class="inp2" maxlength="24">'; return;} else {var obj; if (self.XMLHttpRequest) {try {obj=new XMLHttpRequest();} catch (e) {}} else if (self.ActiveXObject) try {obj=new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try {obj=new ActiveXObject("Microsoft.XMLHTTP");} catch(e) {};} obj.open("get","/ajax8.php?n="+n,true); obj.onreadystatechange=function() {if (obj.readyState==4) document.getElementById("reg").innerHTML=obj.responseText;}; obj.send(null);}}
function isValidEmail(addr) {var n,pair=["..",".@","@.","@-",".-","-.","._","_.","-_","_-"],addr=trim(addr); if (addr!=addr.replace(/[^0-9_a-zA-Z@.-]+/,"")) return false; n=addr.lastIndexOf("."); if (addr.indexOf(".")<=0||addr.indexOf("@")<=0 || n<addr.length-7 || n>addr.length-3 || addr.indexOf("@")!=addr.lastIndexOf("@")) return false; for (n=0;n<pair.length;) if (addr.indexOf(pair[n++])>=0) return false; return true;}
function hint() {document.getElementById("status").innerHTML='<a href="/sendpass.html">Восстановить пароль</a>';}
function enter() {document.getElementById("form4").innerHTML='<table cellpadding="0" cellspacing="0" class="aform"><tr><td class="txt4">E-mail:</td><td colspan="2"><input id="login" type="text" maxlength="32" onfocus="hint()"></td></tr><tr><td class="txt4">Пароль:</td><td><input id="passwd" type="password" maxlength="16" onfocus="hint()"></td><td><input id="btn3" type="button" value=">>>" title="Войти" onclick="ajaxauth()"></td></tr><tr><td id="status" colspan="3" class="txt3"><a href="/sendpass.html">Восстановить пароль</a></td></tr></table>';}
function ajaxauth() {var req2; if (self.XMLHttpRequest) {try {req2=new XMLHttpRequest();} catch (e) {}} else if (self.ActiveXObject) try {req2=new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try {req2=new ActiveXObject("Microsoft.XMLHTTP");} catch (e) {}}; req2.open("post","/auth.php",true); req2.onreadystatechange = function() {if (req2.readyState==4) {document.getElementById("status").innerHTML='<span style="color:#eee">'+req2.responseText+"</span>"; if (req2.responseText=="OK") location.href="/edinenie/anketa.html"; else document.getElementById("passwd").value="";}}; req2.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); req2.send("user="+document.getElementById("login").value+"&pass="+document.getElementById("passwd").value);}
function chkDate() {var st=(!fl || !document.getElementById("bdd").selectedIndex || !document.getElementById("bdm").selectedIndex || !document.getElementById("bdy").selectedIndex); document.getElementById("saveall").disabled=st; return st;}
function chkEmail(email) {if (isValidEmail(trim(document.getElementById("email").value))) {if (!chkDate()) document.getElementById("sendpass").submit();} else {alert("Указан некорректный E-mail!"); fl=0; document.getElementById("email").focus();}}
function agreement() {document.getElementById("saveall").disabled=!document.getElementById("cb").checked;}
