<!--
//Used for Do you Know and Awareness information

// stores the reference to the XMLHttpRequest object
var xmlHttp = createXmlHttpRequestObject();
var q;
// retrieves the XMLHttpRequest object
function createXmlHttpRequestObject(){
	// will store the reference to the XMLHttpRequest object
    var xmlHttp;
    // if running Internet Explorer
    if(window.ActiveXObject){
		try{
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch (e){
			xmlHttp = false;
		}
	}else{ // if running Mozilla or other browsers
		try{
			xmlHttp = new XMLHttpRequest();
		}catch (e){
			xmlHttp = false;
		}
	}
    // return the created object or display an error message
    if (!xmlHttp){
    	alert("Error creating the XMLHttpRequest object.");
	}else{
		return xmlHttp;
	}
}

function start_process(){
	//q=document.getElementById("add6").value+document.getElementById("add7").value;
	q=document.getElementById('xfind').value;
	if(q.length<10) {
		showInfo("Phone Number must be 10-digit.",1);
		return;
	}
	showInfo("<img src='./../images/progressbar.gif'>");
	process();
}
// make asynchronous HTTP request using the XMLHttpRequest object
function process(){
	// proceed only if the xmlHttp object isn't busy
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
		// execute the quickstart.php page from the server
		var url="./main_ajax.php?q="+q;
		xmlHttp.open("GET", url, true);
		// define the method to handle server responses
		xmlHttp.onreadystatechange = handleServerResponse;
		// make the server request
		xmlHttp.send(null);
	}else{
		// if the connection is busy, try again after one second
		setTimeout('process()', 1000);
	}
}

// executed automatically when a message is received from the server
function handleServerResponse(){
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4){
		// status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200){
			myDoc = xmlHttp.responseXML.documentElement;
			var x="======================================================";
			var x1=x+"<br />";
			var x2="<br />"+x;
			var id=myDoc.getElementsByTagName("id").item(0).firstChild.data;
			myMSG=""; p=0;
			if((id==0) || (id==1)){
				myMSG=x1+myDoc.getElementsByTagName("name").item(0).firstChild.data+x2;
				p=1;
			}else if(id>1){
				var x=myDoc.getElementsByTagName("name");
				for(i=0;i<x.length;i++){
					//myMSG+="<li>"+x.item(i).firstChild.data+"</li>";
					myMSG+=x.item(i).firstChild.data+"<br />";
					p=2;
				}
				//myMSG=x1+"<ul>"+myMSG+"</ul>"+x2;
				myMSG=x1+myMSG+x2;
			}
			if(p<1){
				setTimeout('process()', 1000);
			}else{
				showInfo(myMSG,id);
			}
		}else{
			// a HTTP status different than 200 signals an error
			alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
	}
}
function showInfo(){
	p='spanInfo';
	m= 'No data found with the Phone Number you provided.<br /><a href="main.php">';
	m+='Click Here to Register your info!</a>';
	document.getElementById(p).innerHTML ="<br />"+(arguments[1]==0?m:arguments[0]);
}
//Moving Back to Top
// --> 

