// JScript File

var myclose = false;
var objLogout = null;

function ConfirmClose()

{
   if (event.clientY < 0)
   {  
        event.returnValue = 'Are you sure to close the browser?';
        setTimeout('myclose=false',100);
        myclose=true;
        
   }

}

function LogoutUser(type)
{
    if (myclose==true)
    {        
        Logout(type);
    }
}

    function Logout(type)
    {
        try
        {
             objLogout = new XMLHttpRequest();
        }
        catch(ex)
        {
            try
            {
                objLogout=new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch(e)
            {
                try
                {
                    objLogout=new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch(e1)
                {
                    objLogout=null;
                }
            }
        }                      
         
        if (type=='1')
         {            
            objLogout.onreadystatechange=Process_Response_Logout;
            objLogout.open("GET","../BrowserCloseLogout.aspx",true);
            objLogout.send(null);            
         }
        
        if (type=='2')
         {            
            objLogout.onreadystatechange=Process_Response_Logout;
            objLogout.open("GET","BrowserCloseLogout.aspx",true);
            objLogout.send(null);            
         }
        return false;
    }   
    
    
    function Process_Response_Logout()
	{
	    
		if(objLogout.readyState == 4)
		{
		    
			if(objLogout.status == 200)
			{
				
		    }
			
		}
	}
	
	
	