// JavaScript Document
var divid="";
function CreateXmlHttp()
{
    //Creating object of XMLHTTP in IE
    try
    {
        XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
        try
        {
            XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(e)
        {
            XmlHttp = null;
        }
    }
    //Creating object of XMLHTTP in Mozilla and Safari
    if(!XmlHttp && typeof XMLHttpRequest != "undefined")
    {
        XmlHttp = new XMLHttpRequest();
    }
}

function HandleResponse()
{	
    if(XmlHttp.readyState == 4)
    {  
        if(XmlHttp.status == 200)
        {  
			str = XmlHttp.responseText
			//alert(str);
			var lastDot = str.lastIndexOf("####____123____####");
			if(lastDot >= 0){
				document.getElementById('mainDiv').innerHTML="&nbsp;"
				window.location = 'login.php';
			}else{
				document.getElementById('mainDiv').innerHTML=str
			}
            //document.getElementById(divid).innerHTML=XmlHttp.responseText
        }
        else
        {
            //alert("There was a problem retrieving data from the server." );
        }
    }else{
		document.getElementById(divid).innerHTML='<div align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:14px; color:#666666"><b>Loading...</b><div><img src="images/loading-41.gif" width="94" height="17" alt="Loading..."></div></div>';	
	}
}
var divid2="";
function CreateXmlHttp2()
{
    //Creating object of XMLHTTP in IE
    try
    {
        XmlHttp2 = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
        try
        {
            XmlHttp2 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(e)
        {
            XmlHttp2 = null;
        }
    }
    //Creating object of XMLHTTP in Mozilla and Safari
    if(!XmlHttp2 && typeof XMLHttpRequest != "undefined")
    {
        XmlHttp2 = new XMLHttpRequest();
    }
}
function HandleResponse2()
{	
    if(XmlHttp2.readyState == 4)
    {  
        if(XmlHttp2.status == 200)
        {  
			//alert(XmlHttp2.responseText);
            document.getElementById(divid2).innerHTML=XmlHttp2.responseText
        }
        else
        {
            //alert("There was a problem retrieving data from the server." );
        }
    }else{
		document.getElementById(divid2).innerHTML='<div align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:14px; color:#666666"><b>Loading...</b><div><img src="images/loading-41.gif" width="94" height="17" alt="Loading..."></div></div>';	
	}
}


//-----------------------------------------------

function CreateXmlHttp3()
{
    //Creating object of XMLHTTP in IE
    try
    {
        XmlHttp3 = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
        try
        {
            XmlHttp3= new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(e)
        {
            XmlHttp3 = null;
        }
    }
    //Creating object of XMLHTTP in Mozilla and Safari
    if(!XmlHttp3 && typeof XMLHttpRequest != "undefined")
    {
        XmlHttp3 = new XMLHttpRequest();
    }
}
function HandleResponse3()
{	
    if(XmlHttp3.readyState == 4)
    {  
        if(XmlHttp3.status == 200)
        {  
			str3 = XmlHttp3.responseText
			var lastDot3 = str3.lastIndexOf("###");	//alert(lastDot3);
			var start=lastDot3+3; 	//alert(start);
			var str4=str3.substr(start);	 //alert(str4);
			if(lastDot3 >= 0) {
				document.title ="ADWINDS / "+str4;
				
			}else{
				document.title ="ADWINDS"
			}			
        }
        else
        {
            //alert("There was a problem retrieving data from the server." );
        }
    }
}

