// JavaScript Document
var xmlhttp ;
//alert('HI');
try{
xmlhttp = new createXMLObj();
//alert('xmlhttp = '+xmlhttp);
}catch(EXC){}
var sid,stag,style,power;
var navName2,navplatform2,brNum2,javaEnb2,brAppVersion2,screenResol2,brLang2,visited2,colordepth2,refer2,timeZone2,pageCount2;

function getpagecontent(sid1,stag1,style1,power1,navName1,navplatform1,brNum1,javaEnb1,brAppVersion1,screenResol1,brLang1,visited1,colordepth1,refer1,timeZone1,pageCount1)
{
//alert(sid1);
this.sid=sid1;
this.stag=splitString(stag1);
this.style=style1;
this.power=splitString(power1);
this.navName2=splitString(navName1);
//alert(navName1);
this.navplatform2=splitString(navplatform1);
this.brNum2=splitString(brNum1);
this.javaEnb2=splitString(javaEnb1);
this.brAppVersion2=splitString(brAppVersion1);
this.screenResol2=splitString(screenResol1);
this.brLang2=splitString(brLang1);
this.visited2=splitString(visited1);
this.colordepth2=splitString(colordepth1);
this.refer2=splitString(refer1);
this.timeZone2=splitString(timeZone1);
this.pageCount2=splitString(pageCount1);
var fileurl = 'http://ihelpchat.com/WebOperator/Operator/Banner.aspx?sid='+sid1+'&sTag='+stag1+'&style='+style1+'&powertext='+power1+'&brName='+navName1+'&platform='+navplatform1+'&brVer='+brNum1+'&isJava='+javaEnb1+'&brAppVer='+brAppVersion1+'&scrRes='+screenResol1+'&lang='+brLang1+'&visited='+visited1+'&clrdepth='+colordepth1+'&refer='+refer1+'&timezone='+timeZone1+'&pagecount='+pageCount1; 
//This is the path to the file we just finished making
//alert(fileurl);
//file we just finished making
try{
    xmlhttp.open('GET', fileurl, true); //Open the file through GET, and add the page we want to retrieve as a GET variable **
    //alert(handlehHttpReceivedata);
    xmlhttp.onreadystatechange = handlehHttpReceivedata;
    //alert('xmlhttp2 = '+xmlhttp);
    if (window.XMLHttpRequest) {
            xmlhttp.send(null); //Nullify the XMLHttpRequest
        }
        else if (window.ActiveXObject) {
            req.send("");
        }
     }
    catch(EXX){
        //if (XML_HTTP_REQUEST_SENT & mState) {
        //    return NS_ERROR_FAILURE;
        //}
    }   
}

function handlehHttpReceivedata() 
{
  //alert(xmlhttp.readyState)
  if (xmlhttp.readyState == 4) 
  {
   results = xmlhttp.responseText;
   //alert(results);
	if(results !='' && xmlhttp.status == 200)
	{	    
		//alert(document.getElementById("divWebChat"));
		pagecontentdiv = document.getElementById("divWebChat");
		pagecontentdiv.innerHTML = "";
		pagecontentdiv.innerHTML = results;
	}
	else
	{
	    return;
		//document.getElementById("vaildcheck").innerHTML="Please check Username and Password";
	}
	//alert(navigator.userAgent);
	//alert('sid==>>'+ sid +'stag===>>'+ stag +'style ===>>'+ style +'invite ===>>'+ invite +');
	//alert(stag);
	//alert('getpagecontent('+ sid +',"'+ stag +'",'+ style +','+ invite +',"'+navName2+'","'+navplatform2+'","'+brNum2+'","'+javaEnb2+'","'+brAppVersion2+'","'+screenResol2+'","'+brLang2+'","'+visited2+'","'+colordepth2+'","'+refer2+'","'+timeZone2+'");');
	setTimeout('getpagecontent('+ sid +',"'+ stag +'",'+ style +','+ power +',"'+navName2+'","'+navplatform2+'","'+brNum2+'","'+javaEnb2+'","'+brAppVersion2+'","'+screenResol2+'","'+brLang2+'","'+visited2+'","'+colordepth2+'","'+refer2+'","'+timeZone2+'");',20000); //executes the next data query in 4 seconds
  }
}

function createXMLObj()
{
    var xmlHttpReq=false;
        if (window.XMLHttpRequest) { // Mozilla, Safari, ...
            xmlHttpReq = new XMLHttpRequest();
            //alert('Def='+xmlHttpReq);
            if (xmlHttpReq.overrideMimeType) {
                xmlHttpReq.overrideMimeType('text/xml');
                // See note below about this line
            }
        } 
        else if (window.ActiveXObject) { // IE
            try {
                xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
                //alert('Ms='+xmlHttpReq);
                } 
                catch (e) {
                           try {
                                xmlHttpReq =new ActiveXObject("Microsoft.XMLHTTP");
                                //alert('Mi='+xmlHttpReq);
                               } 
                             catch (e) {}
                          }
         }

        if (!xmlHttpReq) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        return xmlHttpReq;
}


function splitString(st){
    try{
        var f=st.indexOf("'");
        //alert(f);
        st=st.substring(f+1,st.length);
        //alert(status1);
        if(f!=-1)
        st=st.substring(0,(st.length)-1);
        //alert(status1);
        }
        catch(ex){}
        return st;
    }

