﻿var xmlhttp;
function createHTTP(){
if(window.ActiveXObject){xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
else if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}}
function startHTTP(p)
{
if(p.length>5)
{
document.getElementById("errorw1").style.display="none";
createHTTP();
xmlhttp.onreadystatechange=StateDO;
xmlhttp.open("GET","Asy/regc.aspx?username="+p+"&date="+Date(),true);
xmlhttp.send(null);}
else
{
document.getElementById("td11").innerHTML="<img src='imgs/false1.gif'>";
document.getElementById("errorw1").style.display="block";
}
}  
function StateDO()
{
if(xmlhttp.readystate==4)
{if(xmlhttp.status==200)
{
if(xmlhttp.responsetext=="T") {document.getElementById("td11").innerHTML="<img src='imgs/true1.gif'>";}
if(xmlhttp.responsetext=="F"){document.getElementById("td11").innerHTML="<img src='imgs/false1.gif'>";}
}
}
}
function startHTTP2(p2)
{createHTTP();xmlhttp.onreadystatechange=StateDO2;xmlhttp.open("GET","Asy/regc.aspx?email="+p2+"&date="+Date(),true);
xmlhttp.send(null);} 
function StateDO2()
{
if(xmlhttp.readystate==4)
{if(xmlhttp.status==200)
{
if(xmlhttp.responsetext=="T") {document.getElementById("td41").innerHTML="<img src='imgs/true1.gif'>";}
if(xmlhttp.responsetext=="F"){document.getElementById("td41").innerHTML="<img src='imgs/false1.gif'>";}
}
}
}
function bindprovice()
{
var objm = document.getElementById("Select1");
var sind = objm.selectedIndex;
var val = objm.options[sind].innerText;
if(val=="中国")
{
    document.getElementById("HiddenField1").value="中国";
    document.getElementById("fmr1").style.display="block";
    document.getElementById("fmr2").style.display="none";}
    else{document.getElementById("fmr1").style.display="none";
    document.getElementById("HiddenField1").value="其它国家和地区";
    document.getElementById("fmr2").style.display="block";}
}

function startHTTP3()
{
document.getElementById("chkpics").src="rega.aspx";
createHTTP();xmlhttp.onreadystatechange=StateDO3;
xmlhttp.open("GET","Asy/GetProviceCity.aspx?country=cn",true);
xmlhttp.send(null);}

function StateDO3()
{if(xmlhttp.readystate==4)
{if(xmlhttp.status==200){
var f= xmlhttp.responsetext.split(",");
for(i =0;i<f.length;i++)
{document.getElementById("Select2").add(new Option(f[i])); }
}}}

function bindh3()
{var obj1 = document.getElementById("Select3");
    var inde = obj1.selectedIndex;
    var valu = obj1.options[inde].innerText;
    document.getElementById("HiddenField3").value=valu;}

function startHTTP4()
{document.getElementById("Select3").options.length=0;
var ind = document.getElementById("Select2").selectedIndex;
var selevaule = document.getElementById("Select2").options[ind].innerText;
document.getElementById("HiddenField2").value=selevaule;
if(ind!=0)
{createHTTP();
xmlhttp.onreadystatechange=StateDO4;
xmlhttp.open("GET","Asy/GetProviceCity.aspx?provice="+ind,true);
xmlhttp.send(null);}} 

function StateDO4()
{if(xmlhttp.readystate==4)
{if(xmlhttp.status==200){ var f2= xmlhttp.responsetext.split(",");
for(i =0;i<f2.length;i++){document.getElementById("Select3").add(new Option(f2[i])); }
}}}

function checkStrong(sPW){ 
var modes="";for (i=0;i<sPW.length;i++)
{modes+=CharMode(sPW.charCodeAt(i));}
return bitTotal(modes);}
function bitTotal(num)
{var tempnum=num.toString().charAt(0);
for(i=0;i<num.length;i++)
{ var fb = true;
for(j=0;j<tempnum.length;j++)
{if(num.charAt(i)==tempnum.charAt(j)){fb=false;}}if(fb==true){tempnum+=num.charAt(i);}}
return tempnum.length;} 

function CharMode(iN){ 
if (iN>=48 && iN <=57) //数字 
return "1";
if (iN>=65 && iN <=90) //大写字母 
return "2";
if (iN>=97 && iN <=122) //小写 
return "4";
else return "8";//特殊字符 
}
var Lcolor,Scolor,Hcolor,Ecolor;
function pwStrength(pwd)
{
Lcolor="#ff3300"; 
Scolor="#FF6633"; 
Hcolor="#FF9900"; 
Ecolor="#33CC00"; 
if (pwd==null||pwd=='')
{ 
document.getElementById("errword1").style.display="block";
document.getElementById("strongs").innerHTML="";
document.getElementById("Lo").style.background="#eee"; 
} 
else if(pwd.toString().length>0)
{   
document.getElementById("errword1").style.display="none";
if(pwd.toString().length<6)
{
    document.getElementById("td21").innerHTML="<img src='imgs/false1.gif'>";
    document.getElementById("strongs").innerHTML="<span style='color:#ff0000'>太短</span>";
    document.getElementById("Lo").style.backgroundColor="#ff0000"; 
    document.getElementById("So").style.backgroundColor="#eee"; 
    document.getElementById("Ho").style.backgroundColor="#eee"; 
    document.getElementById("Eo").style.backgroundColor="#eee"; 
}
if(pwd.toString().length>5)
{
    document.getElementById("td21").innerHTML="<img src='imgs/true1.gif'>";
    var fleng= checkStrong(pwd);
    switch(fleng.toString())
    {
        case "1":document.getElementById("strongs").innerHTML="<span style='color:#ff3300'>太弱</span>";
                document.getElementById("Lo").style.backgroundColor=Lcolor;
                document.getElementById("So").style.backgroundColor="#eee";
                document.getElementById("Ho").style.backgroundColor="#eee";
                document.getElementById("Eo").style.backgroundColor="#eee";
                break;
        case "2":document.getElementById("strongs").innerHTML="<span style='color:#FF6633'>一般</span>";
                document.getElementById("Lo").style.backgroundColor=Scolor;
                document.getElementById("So").style.backgroundColor=Scolor;
                document.getElementById("Ho").style.backgroundColor="#eee";
                document.getElementById("Eo").style.backgroundColor="#eee";
                break;
        case "3":document.getElementById("strongs").innerHTML="<span style='color:#FF9900'>很强</span>";
                document.getElementById("Lo").style.backgroundColor=Hcolor;
                document.getElementById("So").style.backgroundColor=Hcolor;
                document.getElementById("Ho").style.backgroundColor=Hcolor;
                document.getElementById("Eo").style.backgroundColor="#eee";
                break;
        case "4":document.getElementById("strongs").innerHTML="<span style='color:#33CC00'>最强</span>";
                document.getElementById("Lo").style.backgroundColor=Ecolor;
                document.getElementById("So").style.backgroundColor=Ecolor;
                document.getElementById("Ho").style.backgroundColor=Ecolor;
                document.getElementById("Eo").style.backgroundColor=Ecolor;break;}}}}
function checkpwddd()
{var pwd1 = document.getElementById("_ctl0_ContentPlaceHolder1_Text2").value;
var pwd2 = document.getElementById("Text3").value;
if(pwd1!=pwd2 || pwd2==""){document.getElementById("errword2").style.display="block";
document.getElementById("doubpwd").innerHTML="<img src='imgs/false1.gif'>"; }
else{document.getElementById("errword2").style.display="none";
document.getElementById("doubpwd").innerHTML="<img src='imgs/true1.gif'>"; }
}

function isEmail(str)
{var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/; 
if(reg.test(str))
{document.getElementById("errword3").style.display="none";
document.getElementById("td41").innerHTML="<img src='imgs/true1.gif'>";} 
else{document.getElementById("errword3").style.display="block";
document.getElementById("td41").innerHTML="<img src='imgs/false1.gif'>";}}

function retnewpic()
{document.getElementById("chkpics").src= "Asy/rega.aspx?datetime="+Date();}
function checkques()
{   var tx5= document.getElementById("_ctl0_ContentPlaceHolder1_Text5");
if(tx5.value.length>4){document.getElementById("td51").innerHTML="<img src='imgs/true1.gif'>";}
else{document.getElementById("td51").innerHTML="<img src='imgs/false1.gif'>";}
}
function checkans(ans)
{if(document.getElementById("_ctl0_ContentPlaceHolder1_Text6").value.length>4)
{document.getElementById("td61").innerHTML="<img src='imgs/true1.gif'>";}
else{document.getElementById("td61").innerHTML="<img src='imgs/false1.gif'>";}}
function displaytable(val)
{
    if(val=="T")
    {
        document.getElementById("minfo").style.display="block";
    }
    else{document.getElementById("minfo").style.display="none";}
}
window.onload=retnewpic;