var http;
function getModelCombo(start,iCal)
{
	document.getElementById("divShowLoading").style.display="";
	var ext = '';
		if(document.getElementById("totsub")){
			var totsub = document.getElementById("totsub").value;
			var stringtype='';
			for(i=0;i<totsub;i++){
				if(document.getElementById("rel_"+i)){
					if(document.getElementById("rel_"+i).checked == true){
						var subval= document.getElementById("rel_"+i).value;
						stringtype +=",";
						stringtype +=subval;
					}
					
				}
			}
			if(stringtype !='')
			ext+='&subval='+stringtype;
		}
		if(document.getElementById("orderby")){
			var orderby = document.getElementById("orderby").value;
			if(orderby != ''){
				ext+='&orderby='+orderby;
			}
		}
		if(iCal !='')
		ext+='&iCCategoryId='+iCal;
		if(document.getElementById("keyword")){
			if(document.getElementById("keyword")){
				var keyword = document.getElementById("keyword").value;
				if(keyword !='')
				ext+='&keyword='+keyword;
			}
		}
		if(document.getElementById("make")){
			var make = document.getElementById("make").value;
			if(make !='')
			ext+='&make='+make;
		}
		if(document.getElementById("location")){
			var location = document.getElementById("location").value;
			if(location !='')
			ext+='&location='+location;
		}
		if(document.getElementById("model")){
			var model = document.getElementById("model").value;
			if(model !='')
			ext+='&model='+model;
		}
		if(document.getElementById("price")){
			var price = document.getElementById("price").value;
			if(price !='')
			ext+='&price='+price;
		}

		if(document.getElementById("iParentId").value == 0)
			ext+= "&iParentId="+document.getElementById("iParentId").value;
		
		var url = SITE_AJAX_URL+"classifiedlist.php?&start="+start+"&rec_limit="+rec_limit+ext;
		//alert(url);
		if (window.XMLHttpRequest)
	  	{
	  		http=new XMLHttpRequest()
	  		http.open("GET",url,true)
		  	http.onreadystatechange=getmodelCombo;
		  	http.send(null)
	  	}
		// code for IE
		else if (window.ActiveXObject)
	  	{
	  		http=new ActiveXObject("Microsoft.XMLHTTP")
	    	if (http)
	    	{
	    		http.open("GET",url,true)
	    		http.onreadystatechange=getmodelCombo;
	    		http.send()
	    	}
	  	}
}
function getmodelCombo()
{
	if (http.readyState == 4) 
	{	
      	isWorking = false;
    	if (http.responseText.indexOf('invalid') == -1) 
		{
			
			var html1 = '';
    		var xmlDocument = http.responseXML; 
			var modelcombo 	= decode64(xmlDocument.getElementsByTagName('modelcombo').item(0).firstChild.data);
			if(xmlDocument.getElementsByTagName('ical').item(0))
				var iCal = xmlDocument.getElementsByTagName('ical').item(0).firstChild.data;
			else
				var iCal = '';
			
			if(document.getElementById('modelsel')){
				html1+='<table border="0" width="97%" cellpadding="2" cellspacing="0">'; 
					html1+='<tr>';
						html1+='<TD width="19%">'+LBL_MODEL+'</TD>';
						html1+='<td width="1%" align="right">:</TD>';
						html1+='<td>'+modelcombo+'</td>';
				html1+='</tr></table>';		
			document.getElementById('modelsel').innerHTML = html1;
			}
			getClassified(start,iCal,'make');
		}
	}
	
}		
