//************************************************************
// The following code and functions are used for page tracking
// and are referred from the following pages
// designandgo/home?openform
//************************************************************

/* Create a new XMLHttpRequest object to talk to the Web server */
var xmlHttp = false;
a = pageTrack()

if(xmlHttp && xmlHttp.readyState != 0) 
{  xmlHttp.abort()  }

function pageTrack() 
{ 
 var xmlHttp = null;
  try{
    xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
  }catch(e){
    try{
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch(oc){
      xmlHttp = null;
    }
  }
  if(!xmlHttp && typeof XMLHttpRequest != "undefined") {
    xmlHttp = new XMLHttpRequest();
  }

var fromURL = document.referrer;
	if (fromURL=="") fromURL = location.href;
	//alert(fromURL);
	//alert(fromURL.lastIndexOf("lcorder.nsf"));
	//alert(location);
	/*
	if (fromURL.lastIndexOf("lcorder.nsf") == -1 )
		{   var url1 = "track?openform&fp=" + fromURL + "&tp=" + location; }   	
	else
		{   var url1 = "/designandgo/lcorder.nsf/track?openform&fp=" + fromURL+ "&tp=" + location; 	}
	*/	
	var url1 = "/designandgo/lcorder.nsf/track?openform&fp=" + fromURL + "&tp=" + location;    	
	//alert(url1);
	// Open a connection to the server
	xmlHttp.open("GET", url1, true);
	// Setup a function for the server to run when it's done
	xmlHttp.onreadystatechange = xmlhttpChange
	// Send the request
	xmlHttp.send();
	xmlHttp = false;
}
function xmlhttpChange()
{
// if xmlhttp shows "loaded"
if (xmlHttp.readyState==4)
  {
  // if "OK"
  if (xmlHttp.status==200)
    {
    // ...some code here...
    }
  else
    {
    //alert("Test")
    }
  }
}


function showHint(str,cg)
{
	if (str.length==0)
	{ 
		document.getElementById("txtUser").innerHTML=""
		return
	}
	 var xmlHttp1 = null;
	  try{
    		xmlHttp1 = new ActiveXObject("Msxml2.XMLHTTP");
			//alert("1");
		  }catch(e){
				    try{
			    		  xmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");
						  			
					    } 
						catch(oc)
						{ xmlHttp1 = null;				}
				  }
	  if(!xmlHttp1) 
	  { xmlHttp1 = new XMLHttpRequest(); }	
	//xmlHttp1=GetXmlHttpObject()
	if (xmlHttp1==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="/designandgo/lcorder.nsf/UserCheck?openagent&cg=" + cg + "&un=" + str
	//url=url+"?q="+str
	//url=url+"&sid="+Math.random()
	alert(url);

				//alert("11");
	xmlHttp1.open("GET",url,true)
					//alert("12");
	xmlHttp1.onreadystatechange=stateChanged;	
			alert("13");
	xmlHttp1.send()
				alert("14");
}

function stateChanged() 
{ 
			alert("State");
alert(xmlHttp1.status);
//alert(xmlHttp1.readyState);
	//if (xmlHttp1.readyState==4 || xmlHttp1.readyState=="complete")
//	{ 
		document.getElementById("txtUser").innerHTML=xmlHttp1.responseText 
//	} 
} 
