var url = "http://leadchat.com/demo5/varifycall.php?param="; // The server-side script



function handleHttpResponse() {



  if (http.readyState == 4) {



    // Split the comma delimited response into an array



    results = http.responseText;

	//alert(results);

    if(results=="y")

	{

		window.open("http://leadchat.com/demo5/init_chat.php","newWindow1","resizable=no,top=200,left=300,height=200,width=400,scrollbars=yes");

		return false;

	}

	else

	{
		window.setTimeout("checkcall()",3000);

		return false;

	}

  }

}

function checkcall() {

  var uValue = "";

  http.open("GET", url + escape(uValue), true);

  http.onreadystatechange = handleHttpResponse;

  http.send(null);

  
//window.setTimeout("checkcall()",10000);
 }



function getHTTPObject() {



  var xmlhttp;



  /*@cc_on



  @if (@_jscript_version >= 5)



    try {



      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

	  



    } catch (e) {



      try {



        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");



      } catch (E) {



        xmlhttp = false;



      }



    }



  @else



  xmlhttp = false;



  @end @*/



  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {



    try {



      xmlhttp = new XMLHttpRequest();



    } catch (e) {



      xmlhttp = false;



    }



  }



  return xmlhttp;



}



var http = getHTTPObject(); 



function HandleOnClose() {

  window.open("http://leadchat.com/demo5/refresh_stat.php","newWindow2","resizable=no,top=10,left=100,height=1,width=1,scrollbars=yes");	 

}

function checkforcall(){

	//window.open("init_chat.php","newWindow","resizable=no,top=10,left=100,height=100,width=100,scrollbars=yes");	

} 

//window.onload=checkforcall;

//window.onload=checkcall;

window.onunload=HandleOnClose;

