

////// Ajax 请求 /////////////////////////////////


    function LogonEvent()
    {
    
        if( TestNamePass() == false ) return false;
        
        
        
	    $('Logon').disabled  = true;
	    
	    LogonRun(0);
    }


    function LogonRun( HaveNewLogon )
    {
        var LogonName     = _UK( $('Name').value );
        var LogonPass     = _UK( $('Pass').value );
        var LogonValidate = _UK( $('ValidateCode').value );
        var SaveInfo      = ( $('SaveInfo').checked == true ) ? "true" : "false" ;
        
        var URL = "EIC_Logon.aspx?SaveInfo="+ SaveInfo +"&HaveNewLogon="+ HaveNewLogon +"&Name="+ LogonName +"&Pass="+ LogonPass +"&Validate="+ LogonValidate +"&WindowWidth="+ window.screen.width +"&WindowHeight="+ window.screen.height;

        var PublicAjax_XMLHTTP  = PublicAjax();
		PublicAjax_XMLHTTP.open( 'GET', URL, false );
		PublicAjax_XMLHTTP.send( null );
		
		var ReturnValue = PublicAjax_XMLHTTP.responseText;
		
		
        if( ReturnValue != "OK" )
        {
	        $('Logon').disabled  = false;
	        	        
	        if( ReturnValue != "[重复]" )
	        {
	            $('ValidateImg').src = "EIC_Logon.aspx?ValidateImg=true&Time="+ new Date();
                alert( ReturnValue );
            }
            else
            {
                if( confirm('当前用户:“'+ LogonName +'”正在系统中使用，是否强制登录？') == true )
                {
                    LogonRun(1);
                }
            }
        }
        else
        {
            window.open( 'Aspx/Default_Desktop.aspx', '_self' );
        }
    }
    
    
    var LogonPublicAjax_XMLHTTP;
    function GetCookiesPassEvent()
    {
        LogonPublicAjax_XMLHTTP  = PublicAjax();
        LogonPublicAjax_XMLHTTP.open( 'GET', "EIC_Logon.aspx?GetCookiesPass=true", true );
        LogonPublicAjax_XMLHTTP.onreadystatechange = function()
        {
	        if( LogonPublicAjax_XMLHTTP.readyState == 4 && LogonPublicAjax_XMLHTTP.status == 200  )
	        {
                var ReturnV = LogonPublicAjax_XMLHTTP.responseText;   
                
                if( ReturnV != "" && $('Pass').value == "" )
                {
                    $('Pass').value = ReturnV; 
                }
	        }
        }
        LogonPublicAjax_XMLHTTP.send( null );
    }
   

//////////////////////////////////////////////


	document.oncontextmenu = function(){ return false };	
	
	
	
	function TestNamePass()
	{
	
		if( $('Name').value == "" )
		{
			alert( "用户名不能为空！" );
			$('Name').focus();
			return false;
		}
		if( $('Pass').value == "" )
		{
			alert( "密码不能为空！" );
			$('Pass').focus();
			return false;
		}

		if( $('ValidateCode').value == "" )
		{
			alert( "验证码不能为空！" );
			$('ValidateCode').focus();
			return false;
		}		
		$('Logon').focus();
		$('Logon').disabled = true;
		
		return true;
	}
	
	
//////////////////////////////////////////////



        function EIC_Logon_InputOver(e)
        {   
            e.style.border          = '#FF6C00 1px solid';
            e.style.backgroundColor = '#ffffff';
        }
        
        function EIC_Logon_InputOut(e)
        {
            e.style.border          = '#CCCCCC 1px solid';
            e.style.backgroundColor = '#F7F5FF';
        }
        
        
        
//////////////////////////////////////////////     

    // 设置定位
    function SetPostion()
    {
        $('Form').style.display = "block";
    
        var NewTop  = ( BodySize().H - IdPosition('BackImg').H ) / 2 - 35;
        var NewLeft = ( BodySize().W  - IdPosition('BackImg').W ) / 2;
    
        $('BackImg').style.top   = NewTop +"px";
        $('BackImg').style.left  = NewLeft +"px";
        
        $('SoftName').style.top  = NewTop + 126 +"px";
        $('SoftName').style.left = NewLeft + 460 +"px";
        
        $('SoftwareEdition').style.top  = NewTop + 185 +"px";
        $('SoftwareEdition').style.left = NewLeft + 460 +"px";
        

        $('Name').style.top  = NewTop + 289 +"px";
        $('Name').style.left = NewLeft + 235 +"px";
        $('Pass').style.top  = NewTop + 289 +"px";
        $('Pass').style.left = NewLeft + 420 +"px";
        
        $('ValidateImg').style.top  = NewTop + 293 +"px";
        $('ValidateImg').style.left = NewLeft + 590 +"px";
        
        $('ValidateCode').style.top  = NewTop + 289 +"px";
        $('ValidateCode').style.left = NewLeft + 630 +"px";
        
        if( IsIE6 == true || IsIE7 == true )
        {
            $('SaveInfoDiv').style.top  = NewTop + 292 +"px";
            $('SaveInfoDiv').style.left = NewLeft + 680 +"px"; 
            $('SaveInfoLabel').style.bottom = "2px";
        }
        else
        {
            $('SaveInfoDiv').style.top  = NewTop + 288 +"px";
            $('SaveInfoDiv').style.left = NewLeft + 680 +"px";
            $('SaveInfoLabel').style.bottom = "6px";
        }
        
        $('Logon').style.top  = NewTop + 293 +"px";
        $('Logon').style.left = NewLeft + 763 +"px";
        
        $('SoftInfo').style.top  = NewTop + IdPosition('BackImg').H +"px";
        $('SoftInfo').style.left = NewLeft +"px";
        
        if( $('LogonHelp') != undefined )
        {
            $('LogonHelp').style.top  = NewTop + 248 +"px";
            $('LogonHelp').style.left = NewLeft + 446 +"px";
        }
        
    }


    function LoadSet()
    {
   
        SetPostion();
        GetCookiesPassEvent();
        document.forms[0].focus();
        
        if( IsIE == true )
        {
            if( ( window.navigator.appVersion.lastIndexOf( "MSIE 9.0") == -1 ) && ( window.navigator.appVersion.lastIndexOf( "MSIE 8.0") == -1 ) )
            {
                $('SpanIsIE').style.display = "";
            }
        }
    }
    
    
    AddEvent( window, "load", LoadSet );
    AddEvent( window, "resize", SetPostion );

