
function OpenNewPage(url,w,h)
{		   	    
	window.open (url,'newwindow','height='+h+',width='+w+',top=100,left=150,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no, status=no')
}

function user()
{
    var txtemail = document.all.TextBox1.value;    
     if(txtemail == "")
    {
        alert("请输入帐号");
    }
    else
    {
        OpenNewPage("checkUser.aspx?value="+txtemail+"&type=1",10,10);       
    }
}
function getCitys()
{
     var txt = document.all.s2.options[document.all.s2.selectedIndex].value;
     var txt1 = document.all.s1.options[document.all.s1.selectedIndex].value;
     document.all.TextBox3.value = txt;
     document.all.TextBox4.value = txt1;
     if(txt1 == "省份")
     {
       document.all.TextBox3.value = "";
       document.all.TextBox4.value = "";
     }
}
function email()
{
    var txtemail = document.all.TextBox4.value;  
    if(txtemail == "")
    {
        alert("请输入邮箱");
    }
    else
    {
        OpenNewPage("checkUser.aspx?value="+txtemail+"&type=2",10,10); 
    }
}

//判断是不是选了企业会员
function usertype()
{
  if(document.all.RadioButton1.checked)
  {
     document.all.GS.style.display = "none";     
  }
  else
  {
     document.all.GS.style.display = "";         
  }    
}

/*会员后台的连接*/
function ShowPage(url)
{
    parent.ifr.location.href = url;  
}
/*是否要修改密码*/
function IsChangePwd()
{
  if(document.all.CheckBox1.checked)
  {
     document.all.TextBox3.style.display = "";
     document.all.TextBox4.style.display = "";      
         
  }
  else
  {
     document.all.TextBox3.style.display = "none";
     document.all.TextBox4.style.display = "none";   
      document.all.TextBox3.value = "";
     document.all.TextBox4.value = "";
  } 
}

function checkBox1()
{
	if(document.all.CheckBox1.checked)
	{
	   document.all.DropDownList3.style.display = "none";
	}
	else
	{
	   document.all.DropDownList3.style.display = "";	
	}
}
function checkBox2()
{
	if(document.all.CheckBox2.checked)
	{
	   document.all.Dropdownlist5.style.display = "none";
	}
	else
	{
	   document.all.Dropdownlist5.style.display = "";	
	}
}

//图片按照比例缩小
function DrawImage(ImgD,W,H){ 
  var flag=false; 
  var image=new Image(); 
  image.src=ImgD.src; 
  if(image.width>0 && image.height>0){ 
    flag=true; 
    if(image.width/image.height>= W/H){ 
      if(image.width>W){
        ImgD.width=W; 
        ImgD.height=(image.height*H)/image.width; 
      }
	  else{ 
        ImgD.width=image.width;
        ImgD.height=image.height; 
      } 
      ImgD.alt= ""; 
    } 
    else{ 
      if(image.height>H){
        ImgD.height=H; 
        ImgD.width=(image.width*W)/image.height; 
      }
	  else{ 
        ImgD.width=image.width;
        ImgD.height=image.height; 
      } 
      ImgD.alt=""; 
    } 
  }
} 



var xmlHttp;

function createXMLHttpRequest() { //创建一个xmlHttpRequest对象
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    else if (window.XMLHttpRequest)
    {
        xmlHttp = new XMLHttpRequest();
    }
}

function dealAct(url){
     //请求页面url
    createXMLHttpRequest();
    xmlHttp.onreadystatechange = handleStateChange; //请求状态改变事件触发handleStateChange功能
    xmlHttp.open("GET",url+"&"+Math.random()); //采用get方法提交数据
    xmlHttp.send(null);    
   // alert(url+"&"+Math.random());
}

function handleStateChange(){
    if(xmlHttp.readystate == 4){    //表示请求状态 4为完成
            if(xmlHttp.status == 200){ //http状态指示码，200表示ok
                     // document.getElementById("d").innerHTML = xmlHttp.responseText; //将服务器返回信息作为文本插入到infoId指示的容器中。
                }
        }
        else"";
}

function showmycode(obj)
{	
	if(document.getElementById("showcode").style.display == "")
	{
	}
	else
	{
		document.getElementById("showcode").style.display = "";
		document.getElementById("showcode").innerHTML = "<font style=\"font-size:14px;color:red;\"><img onclick=\"this.src='/code.Aspx?'+Math.random();\" align=\"absmiddle\" src=\"/code.Aspx?"+Math.random()+"\"/></font><br />如果您无法识别验证码，请点图片更换!";	
	}
}
function showCodes(objID)
{
    
    if(document.getElementById("DIVCode")!= null)
    {
        var div = document.getElementById("DIVCode");
        //document.body.removeChild(div);
        document.getElementById("getcode").removeChild(div);
                 
         var newDiv = document.createElement("div");
	    newDiv.id = "DIVCode";
	    newDiv.style.position = "absolute";
	    newDiv.style.zIndex = "9999";
	    newDiv.style.width = "120px";
	    newDiv.style.height = "30px";
	    newDiv.style.top = "-42px";
	    newDiv.style.left = "5px"; // 屏幕居中
	    newDiv.style.background = "#fff";
	    newDiv.style.border = "1px solid #2D5391";
	    newDiv.style.padding = "5px";
	    newDiv.innerHTML = "<font style=\"font-size:14px;color:red;\"><img align=\"absmiddle\" src=\"../code.Aspx?"+Math.random()+"\"/></font>";
	    document.getElementById("getcode").appendChild(newDiv);
	    //document.body.appendChild(newDiv);
    }
    else
    {    
        
        var newDiv = document.createElement("div");
	    newDiv.id = "DIVCode";
	    newDiv.style.position = "absolute";
	    newDiv.style.zIndex = "9999";
	    newDiv.style.width = "120px";
	    newDiv.style.height = "30px";
	    newDiv.style.top = "-42px";
	    newDiv.style.left = "5px"; // 屏幕居中
	    newDiv.style.background = "#fff";
	    newDiv.style.border = "1px solid #2D5391";
	    newDiv.style.padding = "5px";
	    newDiv.innerHTML = "<font style=\"font-size:14px;color:red;\"><img align=\"absmiddle\" src=\"/code.Aspx?"+Math.random()+"\"/></font>";
	    document.getElementById("getcode").appendChild(newDiv);
	    	    
	    //document.body.appendChild(newDiv);
        /*
        var newDiv = document.createElement("div");
	    newDiv.id = "DIVCode";
	    newDiv.style.position = "absolute";
	    newDiv.style.zIndex = "9999";
	    newDiv.style.width = "120";
	    newDiv.style.height = "50px";
	    newDiv.style.top = "-5x";
	    newDiv.style.left = "80px"; // 屏幕居中
	    newDiv.style.background = "#efefef";
	    newDiv.style.border = "1px solid #2D5391";
	    newDiv.style.padding = "5px";
	    newDiv.innerHTML = "<font style=\"font-size:14px;color:red;\"><img align=\"absmiddle\" src=\"images/loading.gif\"/></font>";
	    document.body.appendChild(newDiv);
	    */
	    
	}
	
}
function hideCode(objID)
{
    if(document.getElementById("DIVCode")!= null)
    {        
        document.getElementById("DIVCode").style.display="none";
    }
}  

function csstype()
{//onfocus
	var rndtxt = document.getElementById("Label23").getElementsByTagName("input");
	
	if(document.getElementById("TextBox13")!=null)
	{
		document.getElementById("TextBox13").onfocus = function()
		{
			var ac=0;
			document.getElementById("txtuserName").value = Math.random();
			for(var i=0; i < rndtxt.length;i++)
			{				
				ac += rndtxt[i].value *1;
			}
			
			document.getElementById("txtjs").value = ac;	
		}		
	}
	
}