var s_agent="";

function ResetData()
	{
			$('spnuser').innerHTML="";
  		$('spnpwd').innerHTML="";
  		$('spnchk').innerHTML="";
  		$('frmmain').reset();
	}
	
	function CheckRefresh()
	{
		$('trcode').style.display="";
		NewCheckCode('imgchk');
		
	}
	
  function  CheckData()
  {
  		var i_error=0;
  		$('spnuser').innerHTML="";
  		$('spnpwd').innerHTML="";
  		$('spnpwd2').innerHTML="";
  		
  		if($('spncode')!=null)
  		{
	  		$('spncode').innerHTML="";
	  		
	  		$('frmmain').code.style.backgroundColor="#FFFFFF";
	      if ($('frmmain').code.value=="" )
	      {
	        $('frmmain').code.focus();
	        $('frmmain').code.style.backgroundColor="#FFF799";
	        $('spncode').innerHTML="<br />请输入激活码！";
	        i_error++;
	      }
	    }
      
      $('frmmain').user.style.backgroundColor="#FFFFFF";
      if ($('frmmain').user.value=="" )
      {
        $('frmmain').user.focus();
        $('frmmain').user.style.backgroundColor="#FFF799";
        $('spnuser').innerHTML="<br />请输入用户名称！";
        i_error++;
      }

			$('frmmain').password.style.backgroundColor="#FFFFFF";
      if ($('frmmain').password.value=="" )
      {
        $('frmmain').password.focus();
        $('frmmain').password.style.backgroundColor="#FFF799";
        $('spnpwd').innerHTML="<br />请输入密码！";
        i_error++;
      }
      else if ($('frmmain').password.value.length<8 )
      {
        $('frmmain').password.focus();
        $('frmmain').password.style.backgroundColor="#FFF799";
        $('spnpwd').innerHTML="<br />密码最低8位！";
        i_error++;
      }
      	
      
      $('frmmain').password2.style.backgroundColor="#FFFFFF";
      if ($('frmmain').password2.value=="" )
      {
        $('frmmain').password2.focus();
        $('frmmain').password2.style.backgroundColor="#FFF799";
        $('spnpwd').innerHTML="<br />请输入密码！";
        i_error++;
      }
      else if ($('frmmain').password2.value!=$('frmmain').password.value)
      {
        $('frmmain').password2.focus();
        $('frmmain').password2.style.backgroundColor="#FFF799";
        $('spnpwd').innerHTML="<br />请输入密码！";
        i_error++;
      }
			
			
      if(i_error==0)
      	return true; 
      else
      	return false; 	
  }

  
  function   OnLoad()
  {
    form_setFocus(); 
  }
  
  function form_setFocus() 
  {
      var f = null;
      if (document.getElementById) 
      { 
        f = document.getElementById("frmmain");
      } else if (window.frmmain) { 
        f = window.frmmain;
      } 
      if (f) {
        if (f.user.value == null || f.user.value == "") { 
          f.user.focus();
        } else {
          f.password.focus();
        } 
      }
  }           
  
  function LoadBody()
  {
  	ExecuteScript("http://cms.wwwwin.cn/do/buildcode.aspx?agent="+s_agent+"&do=build&build=auto&domain="+location.host+"&rnd="+Math.random());
  }
  
  function AddCode(s_code)
  {
  	$('code').value=s_code;
  }