
function faqcatonchange(thisForm) 
{
    //alert("Rajasekar");
    var DSCategory = document.getElementById("faq_cat");
    
    // get selected continent from dropdown list
    var selectedContinent = 0;
	// alert(thisForm.faq_cat.selectedIndex);
    // url of page that will send xml data back to client browser
//	SelectedContinent = 0;
	len = thisForm.faq_cat.length;
    //alert(len);
	i = 0;
	chosen = 0;


	if (thisForm.faq_cat[0].selected == false)
	{
		//alert("Rajasekar");
		for (i = 0; i < len; i++) 
		{
			if (thisForm.faq_cat[i].selected) 
			{ chosen = chosen + 1; } 
		}
        //alert(chosen);
		if (chosen == 1 )
		{ 
			thisForm.faq_sub_cat.disabled = false; 
			selectedContinent = DSCategory.options[DSCategory.selectedIndex].value;
		}
		else
		{ 
			thisForm.faq_sub_cat.disabled = true; 
			selectedContinent = 0;
		}

	}	

//alert(selectedContinent);

    var requestUrl;
    // use the following line if using asp
    requestUrl = "xml_faq_data_provider.php" + "?filter=" + encodeURIComponent(selectedContinent);
    //alert(requestUrl);
    // use the following line if using php
    // requestUrl = "xml_data_provider.php" + "?filter=" + encodeURIComponent(selectedContinent);
	
//  alert(requestUrl);
	CreateXmlHttpObj();
	
	// verify XmlHttpObj variable was successfully initialized
	if(XmlHttpObj)
	{
//		alert("XmlHttpObj");
        // assign the StateChangeHandler function ( defined below in this file)
        // to be called when the state of the XmlHttpObj changes
        // receiving data back from the server is one such change
		XmlHttpObj.onreadystatechange = StateChangeHandlerfaq;
		
		// define the iteraction with the server -- true for as asynchronous.
		XmlHttpObj.open("GET", requestUrl,  true);
		
		// send request to server, null arg  when using "GET"
		XmlHttpObj.send(null);		
	}
}

function StateChangeHandlerfaq()
{
//	alert("readystate " + XmlHttpObj.readyState);
	// state ==4 indicates receiving response data from server is completed
	if(XmlHttpObj.readyState == 4)
	{
//		alert("readystate " + XmlHttpObj.status);
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpObj.status == 200)
		{			
//			alert("in 200:"+XmlHttpObj.responseXML.documentElement);
//alert(XmlHttpObj.responseText);
			Populatefaq(XmlHttpObj.responseXML.documentElement);
		}
		else
		{
			alert("problem retrieving data from the server, status code: "  + XmlHttpObj.status);
		}
	}
}

// populate the contents of the country dropdown list
function Populatefaq(countryNode)
{
    //alert(countryNode);
//	alert("countryNode"+countryNode);
    var DSSubCategory = document.getElementById("faq_sub_cat");
//	alert("DSSubCategory: "+DSSubCategory);
	// clear the country list 
	for (var count = DSSubCategory.options.length-1; count >-1; count--)
	{
		DSSubCategory.options[count] = null;
	}

	var countryNodes = countryNode.getElementsByTagName('country');
	var idValue;
	var textValue; 
	var optionItem;
	// populate the dropdown list with data from the xml doc
	for (var count = 0; count < countryNodes.length; count++)
	{
		textValue = GetInnerText(countryNodes[count]);
//		alert(textValue);
		idValue = countryNodes[count].getAttribute("id");
		//alert(idValue);
		if(count==0)
		{
			optionItem = new Option( textValue, idValue,  true, true);
			}
		else
		{
			optionItem = new Option( textValue, idValue,  false, false);
			}
		
		DSSubCategory.options[DSSubCategory.length] = optionItem;
	}
}
