﻿// JScript 文件


function StringLength(Name){
    if(Name == null || Name == "undefined") return 0;
	return Name.replace( /[^\x00-\xff]/g,'mm').length; 
 }
 function ResetVcode(Obj,VUrl){
    var date = new Date();
    var mim = date.getTime();
    var splits = "?";
    if(VUrl.indexOf("?") > 0)
        splits = "&";
    Obj.src = VUrl+splits+"time="+mim
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function checkPassword(o){
    var len = o.value.length;
    if(len < 6){
        MM_findObj("pw").innerHTML = "太短";
        MM_findObj("pw1").style.backgroundColor = "red";  
        MM_findObj("pw2").style.backgroundColor = "red";
        MM_findObj("pw3").style.backgroundColor = "red";
        MM_findObj("pw4").style.backgroundColor = "red";
    }
    else if(len <= 10){
        MM_findObj("pw").innerHTML = "可以";
        MM_findObj("pw1").style.backgroundColor = "blue";            
        MM_findObj("pw2").style.backgroundColor = "blue";
        MM_findObj("pw3").style.backgroundColor = "blue";
        MM_findObj("pw4").style.backgroundColor = "blue";
        if(o.value.replace(/[\d+$]/g,'') != '' && o.value.replace(/[A-Za-z]/g,'') != ''){   
            MM_findObj("pw").innerHTML = "极佳";     
            MM_findObj("pw1").style.backgroundColor = "green";            
            MM_findObj("pw2").style.backgroundColor = "green";
            MM_findObj("pw3").style.backgroundColor = "green";
            MM_findObj("pw4").style.backgroundColor = "green";
        }
    }
    else if(len > 10){
        MM_findObj("pw").innerHTML = "太长";
        MM_findObj("pw1").style.backgroundColor = "red";            
        MM_findObj("pw2").style.backgroundColor = "red";
        MM_findObj("pw3").style.backgroundColor = "red";
        MM_findObj("pw4").style.backgroundColor = "red";
    }  
}

function  clearText(Obj){
    Obj.value = "";
}
function gotourl(url){
    document.location = url ;
}
