var xmlHttp;
var current_page;

function GetXmlHttpObject() { 
	var objXMLHttp=null;
	if (window.XMLHttpRequest) {
		objXMLHttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject) {
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
} 

function loadContent(name) {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	current_page = name;
	
	document.getElementById(current_page + "_status").innerHTML=getSmallLoaderView();

	var url="php/load_faq.php?category=" + name;
	xmlHttp.onreadystatechange=loadContentComplete;
	xmlHttp.open("POST",url,true);
	xmlHttp.send(null);	
}

function loadContentComplete() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
		document.getElementById("pageContent").innerHTML=xmlHttp.responseText;
		document.getElementById(current_page + "_status").innerHTML="";
		initSwitchContent();
	}
}

function initSwitchContent() {
	
	eval("var helpcontent=new switchcontent('switchgroup1', 'div');");
	eval("helpcontent.setStatus('<img src=\"../images/minus.png\" /> ', '<img src=\"../images/plus.png\" /> ');");
	eval("helpcontent.setColor('darkred', 'black');");
	eval("helpcontent.setPersist(false);");
	eval("helpcontent.collapsePrevious(true);");
	eval("helpcontent.init();");

}
function getSmallLoaderView() {
	return "<img src='../images/loader-small.gif' border='0' />";
}
