function regname()
{var str=document.getElementById('reg_name').value;var filter=/^[€-Ÿ]{2,}( +)?([€-Ÿ]{2,})?( +)?$/i;if(filter.test(str)){document.getElementById('name_div2').style.visibility="hidden";document.getElementById('name_pic2').style.visibility="visible";}else{document.getElementById('name_pic2').style.visibility="hidden";document.getElementById('name_div2').style.visibility="visible";}}
function regcity()
{var str=document.getElementById('reg_city').value;var filter=/^[€-Ÿ]{2,}( +)?([€-Ÿ]{2,})?( +)?$/i;if(filter.test(str)){document.getElementById('city_div2').style.visibility="hidden";document.getElementById('city_pic2').style.visibility="visible";}else{document.getElementById('city_pic2').style.visibility="hidden";document.getElementById('city_div2').style.visibility="visible";}}
function regsurname()
{var str=document.getElementById('reg_surname').value;var filter=/^[€-Ÿ]{2,}( +)?([€-Ÿ]{2,})?( +)?$/i;if(filter.test(str)){document.getElementById('surname_div2').style.visibility="hidden";document.getElementById('surname_pic2').style.visibility="visible";}else{document.getElementById('surname_pic2').style.visibility="hidden";document.getElementById('surname_div2').style.visibility="visible";}}
function regmail()
{var str=document.getElementById('reg_email').value;var filter=/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i;if(filter.test(str)){document.getElementById('mail2_div').style.visibility="hidden";document.getElementById('mail2_pic').style.visibility="visible";}else{document.getElementById('mail2_pic').style.visibility="hidden";document.getElementById('mail2_div').style.visibility="visible";}}
function regphone()
{var str=document.getElementById('reg_phone').value;var filter=/^(?:8|\+3)??\d{10}$/i;if(filter.test(str)){document.getElementById('phone_div2').style.visibility="hidden";document.getElementById('phone_pic2').style.visibility="visible";}else{document.getElementById('phone_pic2').style.visibility="hidden";document.getElementById('phone_div2').style.visibility="visible";}}
function loginname()
{var log=document.getElementById('login_n').value;poststr="reg_log="+log;$.ajax({type:"GET",url:"reg_log.php",data:poststr,success:function(html)
{$('#answer').text(html.split("*")[1]);document.getElementById('answer4').value=html.split("*")[2];}});return false;}
function validate_reginfo()
{var strLogin=document.getElementById('login_n').value;var strTLogin=document.getElementById('answer4').value;if(strTLogin==1)
{alert(ERROR_INPUT_LOGIN);return false;}
var filterLogin=/^[€-ŸA-Z0-9]{2,}( +)?([€-ŸA_Z0-9]{2,})?( +)?$/i;if(!filterLogin.test(strLogin))
{alert(ERROR_INPUT_LOGIN);return false;}
var strPass=document.getElementById('lpassag').value;var strFPass=document.getElementById('fpassag').value;if(strFPass!==strPass)
{alert(ERROR_INPUT_PASS);return false;}
var strFName=document.getElementById('reg_name').value;var filterFName=/^[€-Ÿ]{2,}( +)?([€-Ÿ]{2,})?( +)?$/i;if(!filterFName.test(strFName))
{alert(ERROR_INPUT_NAME);return false;}
var strSName=document.getElementById('reg_surname').value;var filterSName=/^[€-Ÿ]{2,}( +)?([€-Ÿ]{2,})?( +)?$/i;if(!filterSName.test(strSName))
{alert(ERROR_INPUT_NAME);return false;}
var strEmail=document.getElementById('reg_email').value;var filterEmail=/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i;if(!filterEmail.test(strEmail))
{alert(ERROR_INPUT_EMAIL);return false;}
var strPhone=document.getElementById('reg_phone').value;var filterPhone=/^(?:8|\+3)??\d{10}$/i;if(!filterPhone.test(strPhone))
{alert(ERROR_INPUT_PHONE);return false;}
var strCity=document.getElementById('reg_city').value;var filterCity=/^[€-Ÿ]{2,}( +)?([€-Ÿ]{2,})?( +)?$/i;if(!filterCity.test(strCity))
{alert(ERROR_INPUT_CITY);return false;}
return true;}
function validate_regedit()
{var strFName=document.getElementById('reg_name').value;var filterFName=/^[€-Ÿ]{2,}( +)?([€-Ÿ]{2,})?( +)?$/i;if(!filterFName.test(strFName))
{alert(ERROR_INPUT_NAME);return false;}
var strSName=document.getElementById('reg_surname').value;var filterSName=/^[€-Ÿ]{2,}( +)?([€-Ÿ]{2,})?( +)?$/i;if(!filterSName.test(strSName))
{alert(ERROR_INPUT_NAME);return false;}
var strEmail=document.getElementById('reg_email').value;var filterEmail=/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i;if(!filterEmail.test(strEmail))
{alert(ERROR_INPUT_EMAIL);return false;}
var strPhone=document.getElementById('reg_phone').value;var filterPhone=/^(?:8|\+3)? ?\(\d{1,5}\)? ?\d{1,7}$/i;if(!filterPhone.test(strPhone))
{alert(ERROR_INPUT_PHONE);return false;}
var strCity=document.getElementById('reg_city').value;var filterCity=/^[€-Ÿ]{2,}( +)?([€-Ÿ]{2,})?( +)?$/i;if(!filterCity.test(strCity))
{alert(ERROR_INPUT_CITY);return false;}
return true;}
function validate_renew()
{var strPass=document.getElementById('fpassag').value;var strFPass=document.getElementById('lpassag').value;if(strFPass!==strPass)
{alert(ERROR_INPUT_PASS);return false;}
return true;}
function passequal()
{var fpass=document.getElementById('fpassag').value;var lpass=document.getElementById('lpassag').value;poststr="fpass="+fpass+"&lpass="+lpass;$.ajax({type:"GET",url:"reg_pass.php",data:poststr,success:function(html)
{$('#answer2').text(html.split("*")[1]);$('#answer3').text(html.split("*")[2]);$('#answer4').text(html.split("*")[1]);$('#answer5').text(html.split("*")[2]);}});return false;}
function enterlog()
{var enlog=document.getElementById('enlog').value;var enpass=document.getElementById('enpass').value;poststr="enlog="+enlog+"&enpass="+enpass;$.ajax({type:"GET",url:"enter_log.php",data:poststr,success:function(html)
{var loginEn=html.split("*")[1];var passEn=html.split("*")[0];var status=html.split("*")[2];if(status==0)
{alert('‚àøà ó÷åòíàß çàïèñü çàáëîêèðîâàíà');}
else
{if(loginEn==0)
{alert('‚û íå ïðàâèëüíî óêàçàëè ëîãèí èëè ïàðîëü');}
else
{if(passEn==0)
{alert('‚û íå ïðàâèëüíî óêàçàëè ëîãèí èëè ïàðîëü');}}
if(loginEn==1&&passEn==1)
{$('#log').submit();}}}});return false;}
