var reqStatus

var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}


function RSchange() {

 if (xmlhttp.readyState==4) {
	//alert(xmlhttp.status);
	if(xmlhttp.status == 200) {
		//alert(xmlhttp.responseText);
		if (typeof netscape != 'undefined' && typeof netscape.security !=
			'undefined') {
			 netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
			 var strTest = xmlhttp.responseText;
		     var xmldoc = xmlhttp.responseXML;
		  }else{
			var strTest = xmlhttp.responseText;
		    var xmldoc = xmlhttp.responseXML;
		  }
		
		parseNodes(xmldoc, strTest);		
	} else {
		if(xmlhttp.status!=200){
		hideThrobber();
		alert("Invalid Zip Code");
		reqStatus = false;
		}
	}
 	//processResult(fileStatus);
	//alert(xmlhttp.responseText);
 }
  
}

function postRequest(reqPage, parameters) {

	if(xmlhttp) {
		xmlhttp.open('POST', reqPage, false);
		xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlhttp.setRequestHeader("Content-length", parameters.length);
		xmlhttp.setRequestHeader("Connection", "close");
		xmlhttp.onreadystatechange=RSchange;
		xmlhttp.send(parameters);
	
	}
}

function sendRequest(reqPage) {
if (xmlhttp) { 
  if (typeof netscape != 'undefined' && typeof netscape.security !=
	'undefined') {
	 netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
	 xmlhttp.open("GET", reqPage, true);
  }else{
  	 xmlhttp.open("GET", reqPage, true);
  }
  //alert(reqPage);
  
  xmlhttp.onreadystatechange=RSchange;
  if (typeof netscape != 'undefined' && typeof netscape.security !=
	'undefined') {
	 netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
	 xmlhttp.send(null);
  }else{
  	 xmlhttp.send(null);
  }
  
  
 }
}

function parseNodes(objXML, strText){

			//  The follwoing block of code allows the return XML page to be displayed in a browser window
			//   The debug option for a CFM page can be set to yes to view page errors.
			
				/*		
				  myWin= open("", "displayWindow", "");
				
				  // open document for further output
				  myWin.document.open();
				  // create document
				  var objXmlElem = objXML.documentElement;
				  
				  alert(objXmlElem.getElementsByTagName('State')[0].firstChild.data);
				  
				  myWin.document.write(strText);
				
				  // close the document - (not the window!)
				  myWin.document.close();  
		
				 
				  
				  return;  */	
		
				//alert(strText);
				
		switch(pageOpt){
		
			case 'page1':
			
				document.getElementById('mainContent').innerHTML = strText;
				break;
		
		}
				
		 return;
			
}

