function getHTTPObject()
{
	// code for Mozilla, etc.
	if (window.XMLHttpRequest)
  	{
  		xmlhttp=new XMLHttpRequest()
  	}
// code for IE
	else if (window.ActiveXObject)
  	{
  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  	}
	return xmlhttp;
}
var http = getHTTPObject();

function change_faq(catid)
{
  //get url of ajax file
	
	var url = ajax_url + "ajax_faq.php";
	url = url + "?iFCategoryId="+ catid;
  http.open("GET", url, true);
	http.onreadystatechange = addnewsletteremail;
  http.send(null);
}

function addnewsletteremail()
{
	if (http.readyState == 4)
	{
   	var xmlDocument = http.responseXML; 
   	var total = xmlDocument.getElementsByTagName('total').item(0).firstChild.data;
   	
   	onlyquestion = '<table width="100%" border="0" align="center" cellpadding="2" cellspacing="2">';
    if(total <= 0)
    {
      onlyquestion = onlyquestion + '<tr><td align=center colspan=2>No Record Found.</td></tr>'
    }
    for(i=0;i<total;i++)
     {
     
        onlyquestion = onlyquestion + '<tr><td width="2%"><img src="images/arrow-blue.gif"></td><td width="98%" class="faq">'+"<a href=Faq/#"+xmlDocument.getElementsByTagName("iFaqId")[i].childNodes[0].nodeValue +'><strong>'+xmlDocument.getElementsByTagName('tQuestion')[i].childNodes[0].nodeValue+'</strong></a>'+'</td></tr>';
        
     }
     
     onlyquestion = onlyquestion + "<tr>";
     onlyquestion = onlyquestion + "<td>"+'<img src="images/spacer.gif" height="5">'+"</td>"
     onlyquestion = onlyquestion + "</tr>";
     onlyquestion = onlyquestion + '</table>'
     answer = '<table width="100%" border="0" align="center" cellpadding="2" cellspacing="2">';
     for(i=0;i<total;i++)
     {
        answer = answer +'<tr><td class="graybg-faq skyblue-light"><a id='+xmlDocument.getElementsByTagName('iFaqId')[i].childNodes[0].nodeValue +'></a>'+ xmlDocument.getElementsByTagName('tQuestion')[i].childNodes[0].nodeValue+'</td></tr><tr><td><span class="graybg-faq"> A.</span>&nbsp;'+xmlDocument.getElementsByTagName('tAnswer')[i].childNodes[0].nodeValue+'</td></tr><tr><td height="20" align="right"><a href="Faq/#top"><img src="images/returntop.gif" border="0" /></a></td></tr>';
        
                  if(i<(total-1))
                    answer = answer+'<tr><td>&nbsp;</td></tr>';
        
     }
     answer = answer + '</table>'
     document.getElementById('onlyquestion1').innerHTML = onlyquestion;
     document.getElementById('answer1').innerHTML = answer;
	}
}

