//<!--
// Ajax (JavaScript) - July 2009
// J Matthew Gaskill ©2009 Cobalt Horizons Corporation

if( typeof XMLHttpRequest == "undefined" ) XMLHttpRequest = function() {
  try { return new ActiveXObject("Msxml2.XMLHTTP.6.0") } catch(e) {}
  try { return new ActiveXObject("Msxml2.XMLHTTP.3.0") } catch(e) {}
  try { return new ActiveXObject("Msxml2.XMLHTTP") } catch(e) {}
  try { return new ActiveXObject("Microsoft.XMLHTTP") } catch(e) {}
  throw new Error( "This browser does not support XMLHttpRequest." )
};

function UpdateStage(id){
	PanelWidth = '250px';

	var xhReq = new XMLHttpRequest();
	switch(id){
		case "Pricing":
		xhReq.open("GET", "content/pricing.php", true);
		break;
		
		case "About":
		xhReq.open("GET", "content/about.php", true);
		break;
		
		case "Biography":
		xhReq.open("GET", "content/biography.php", true);
		break;

		case "FAQ":
		xhReq.open("GET", "content/faq.php", true);
		break;
		
		case "Rinnai":
		xhReq.open("GET", "content/rinnai.php", true);
		break;
		
		case "Noritz":
		xhReq.open("GET", "content/noritz.php", true);
		break;
		
		case "Takagi":
		xhReq.open("GET", "content/takagi.php", true);
		break;
		
		case "RootX":
		xhReq.open("GET", "content/rootx.php", true);
		break;
		
		case "BioClean":
		xhReq.open("GET", "content/bioclean.php", true);
		break;
		
		case "Newsletter":
		xhReq.open("GET", "content/newsletter.php", true);
		break;
		
		case "Employment":
		xhReq.open("GET", "content/employment.php", true);
		PanelWidth = '1px';
		break;
		
		default:
		alert('unknown menu item');
		break;
	}

	xhReq.onreadystatechange = function(){
		if(xhReq.readyState != 4){ return; }
		Stage.innerHTML = xhReq.responseText;
		Panel.style.width = PanelWidth;
	};
	xhReq.send(null);
}

function Send(id,action){
	if(typeof action == 'undefined'){ action = ''; }
//	if(!action){ var action = ''; }

	var output = document.getElementById(id + "_output");
	output.innerHTML = "Processing Request...";

	var xhReqSend = new XMLHttpRequest();
	var params = Serialize(id);

	xhReqSend.open("POST", "content/process.php", true); 
	xhReqSend.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");                  

	xhReqSend.onreadystatechange = function(){
		if(xhReqSend.readyState != 4){ return; }
		output.innerHTML = xhReqSend.responseText;
	};
	xhReqSend.send(params + "&action=" + action);

	return(false);
}
//-->