/* Begin : common ajax functions*/
function createAjaxObj(){
var httprequest=false
	if (window.XMLHttpRequest){ // if Mozilla, Safari etc
			httprequest=new XMLHttpRequest()
			if (httprequest.overrideMimeType)
				httprequest.overrideMimeType('text/xml')
	}
	else if (window.ActiveXObject){ // if IE
			try {
				httprequest=new ActiveXObject("Msxml2.XMLHTTP");
			} 
			catch (e){
			try{
				httprequest=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){}
			}
	}
return httprequest
}

var ajaxpack = new Object()
ajaxpack.basedomain = "http://" + window.location.hostname
ajaxpack.ajaxobj = createAjaxObj()
ajaxpack.filetype = "txt"

ajaxpack.postAjaxRequest = function(url, parameters, callbackfunc, filetype){
ajaxpack.ajaxobj = createAjaxObj() //recreate ajax object to defeat cache problem in IE
if (this.ajaxobj){
	this.filetype = filetype
	this.ajaxobj.onreadystatechange = callbackfunc;
	this.ajaxobj.open('POST', url, true);
	this.ajaxobj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	this.ajaxobj.setRequestHeader("Content-length", parameters.length);
	this.ajaxobj.setRequestHeader("Connection", "close");
	this.ajaxobj.send(parameters);
}
}
/* End : common ajax functions*/

/* Begin : function for Show contact details */
function showcontact(id){
			poststr = "id=" +id;
			var url ='index.php?option=com_qcontacts&task=fnShowDetails';
			ajaxpack.postAjaxRequest(url, poststr, fnShowDetails,"txt");
}

function fnShowDetails(){
		var myajax = ajaxpack.ajaxobj
		var myfiletype = ajaxpack.filetype
		if (myajax.readyState == 4){	
				sStr=unescape(myajax.responseText);
				document.getElementById("conDtls").innerHTML=sStr;
		}
}	
/* End : function for Show contact details */



/* Begin : function for Show contact details */
function SendResultMail(){
		var Email=document.getElementById("fromEmail").value;
		var Name=document.getElementById("fromName").value;
		var CatResult=document.getElementById("strCatResult").value;
		if(Email=="")
		{
			alert("Please Enter email adress");
			return false;
		}
		poststr= "Email=" +Email+"&Name="+Name+"&CatResult="+CatResult;
		var url ='index.php?option=com_faq&task=SendResultMail';
		ajaxpack.postAjaxRequest(url, poststr, fnSendResultMail,"txt");
}

function fnSendResultMail(){
		var myajax = ajaxpack.ajaxobj
		var myfiletype = ajaxpack.filetype
		if (myajax.readyState == 4){	
				sStr=unescape(myajax.responseText);
				alert(sStr);
		}
}	
/* End : function for Show contact details */

function fnShowSelectedMenu(){
	var hdnItemid=document.getElementById("hdnItemid").value;
	if(hdnItemid==84 || hdnItemid==90 || hdnItemid==91 || hdnItemid==99){
		document.getElementById("item84").className="parent active item84";
	}
}
