var please_wait = null;
function makePOSTRequest(url, param) {
		//alert('queryString is ' + param);
	http_request = false;
	  	if (please_wait != null) {
		document.getElementById('targetDiv').innerHTML = please_wait;
	}
	  // Mozilla, Safari,...
	if (window.XMLHttpRequest) { 
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
		// set type accordingly to anticipated content type
		http_request.overrideMimeType('text/html');
		} //Now set ajax for IE below
	} else if (window.ActiveXObject) { 
		try {
		http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request) {
		alert('Cannot create XMLHTTP instance');
		return false;
	}
	http_request.onreadystatechange = alertContents;
	http_request.open('POST', url, true);
	//Need line below for POST
	http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	////////////////// these two lines below are optional
	//http_request.setRequestHeader("Content-length", parameters.length);
	//http_request.setRequestHeader("Connection", "close");
	http_request.send(param);
	//var empty = '';
	//param = empty;
	//alert('empty: ' + param);
}

function alertContents() {
	//alert('state is' + http_request.readyState);
	//alert('status is ' + http_request.status);
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			result = http_request.responseText;
			document.getElementById('targetDiv').innerHTML = result;
			document.getElementById('targetDiv').style.display ="block";
		  	//document.getElementById('formDiv').style.display = "none";
			//document.getElementById('formDiv').style.zIndex = "1";
			
		} 
		else {
			http_request.responseText = "Ooops!! Houston, we have a problem... Please contact the webmaster of this website ASAP!";
			alert('There was a problem with the request');
		}
	}
}
function getGeoMorph(vars) {
	//alert('vars is ' + vars);
	var reach_arr = vars.split(":");
	//  Get the searchmac value and populate the scatform with it
	var reachname = reach_arr[0];
	//alert('reachname is ' + reachname);
	var attribute = reach_arr[1];
	//alert('attribute is ' + attribute);
	var param = "reachname=" + encodeURI(reachname) + "&attribute=" + encodeURI(attribute);
	//alert('param is ' + param);
	
	//document.scatform.modemmac.value=modemmac;
	// Set the select boxes back to empty
	//var empty = '';
	//document.getElementById("reach_attrib.php").value=empty;
	//document.getElementById("id").value=empty;
	//Pass the processing page and query string to the XMLHTTPRequest function here
	makePOSTRequest('reach_attrib.php', param);
}
/*
function getemailform(obj) {
	var myindex = this.elements;
	alert('myindex0: ' + myindex[0]);
	var deleteid = myindex[0].value;
	var networkid = myindex[1].value;
	var acctnum = myindex[2].value;
	var modemmac = myindex[3].value;

	//var deleteid = document.emailform.index("deleteid").value;
	//var networkid = document.getElementById("networkid").value;
	//var acctnum = document.getElementById("acctnum").value;
	//var modemmac = document.getElementById("modemmac").value;
	var param = "deleteid=" + encodeURI(deleteid) + "&networkid=" + encodeURI(networkid) + "&acctnum=" + encodeURI(acctnum) + "&modemmac=" + encodeURI(modemmac);
	makePOSTRequest('emaildeletion.php', param);
	//var empty = null;
	//param = empty;
	//alert ('param after sending: ' + param);
}
*/
function set_loading_message(msg) {
	please_wait = msg;
}
set_loading_message('<center><b>Searching...</b><br /><br /><img src="images/loader.gif" /></center>');





