/* ---------------------------- */
/* XMLHTTPRequest Enable */
/* ---------------------------- */
var http = createXmlHttpRequest();

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function getSottoCat(id_cat,id_subcat){
		
var http_request=createXmlHttpRequest()
	http_request.onreadystatechange = function() {
	if(http_request.readyState == 4) {
		
		var xmldoc = http_request.responseXML;
		var mySott = document.formSearch.id_sub;
		if(mySott.disabled==true){
			mySott.disabled=false
		} 
		if(xmldoc==null){
			mySott.disabled=true	
		} else {
			
			var arr = xmldoc.getElementsByTagName('sott');
			var subcat = MM_findObj('id_sub');
			
			for (var i=subcat.options.length-1;i>=0;i--)
				subcat.options[i]=null
				subcat.options[subcat.options.length]=new Option("Sub-categories","");
				for(var i = 0;i<arr.length;i++){
					v_id_s=arr[i].getElementsByTagName("id_sub")[0].firstChild.nodeValue
					subcat.options[subcat.options.length]=new Option( arr[i].getElementsByTagName("name")[0].firstChild.nodeValue,v_id_s);
					
					if(id_subcat==v_id_s){
						var	s_index=i+1
					}
					
				}
				if(s_index!=""){
						subcat.selectedIndex=s_index
				}
		}
		
	}     
}

http_request.open('GET', 'ajax/getSottoCategorie.php?id_c='+id_cat, true);
http_request.send(null);
}
