// JavaScript Document	
function getCategory(catid) {		
	
	var strURL="ajaxlisting.php?st=1&catid="+catid;	
	var req = GetXmlHttpObject();	
	if (req) {
		
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {					
					document.getElementById('makediv').innerHTML=req.responseText;						
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
		
		req.open("GET", strURL, true);
		req.send(null);
	}		
}
function getMake(catid) {		
	
	var strURL="ajaxlisting.php?st=2&catid="+catid;	
	var req = GetXmlHttpObject();	
	if (req) {
		
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {					
					document.getElementById('makedivid').innerHTML=req.responseText;						
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
		
		req.open("GET", strURL, true);
		req.send(null);
	}		
}

function getModel(catid,makeid) {		
	var strURL="ajaxlisting.php?st=3&catid="+catid+"&makeid="+makeid;
	var req = GetXmlHttpObject();	
	if (req) {		
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {						
					document.getElementById('modeldiv').innerHTML=req.responseText;						
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}	
		//alert(strURL);
		req.open("GET", strURL, true);
		req.send(null);
	}			
}

function getCatMake(catid) {		
	var strURL="ajaxlisting.php?st=4&catid="+catid;
	var req = GetXmlHttpObject();	
	if (req) {		
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {						
					document.getElementById('catmakediv').innerHTML=req.responseText;						
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}	
		//alert(strURL);
		req.open("GET", strURL, true);
		req.send(null);
	}			
}


function getModelYear(catid,makeid) {		
	var strURL="ajaxlisting.php?st=5&catid="+catid+"&makeid="+makeid;
	var req = GetXmlHttpObject();	
	if (req) {		
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {						
					document.getElementById('makemodeldiv').innerHTML=req.responseText;						
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}	
		//alert(strURL);
		req.open("GET", strURL, true);
		req.send(null);
	}			
}

function getYears(catid,makeid,modelid) {		
	var strURL="ajaxlisting.php?st=6&catid="+catid+"&makeid="+makeid+"&modelid="+modelid;
	var req = GetXmlHttpObject();	
	if (req) {		
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {						
					document.getElementById('yeardiv').innerHTML=req.responseText;						
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}	
		//alert(strURL);
		req.open("GET", strURL, true);
		req.send(null);
	}			
}

//chanage listing feature/General
function getListType(str) 
{		
	if(str=="")
		return false
	
	var strURL="ajaxlisting.php?st=7&listtype="+str	
	var req = GetXmlHttpObject();	
	if (req) {
		
		req.onreadystatechange = function() 
		{			
			if (req.readyState == 4) 
			{					
				if (req.status == 200) {					
					document.getElementById('divlisttype').innerHTML=req.responseText;
					//alert(req.responseText);
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}				
		req.open("GET", strURL, true);
		req.send(null);
	}		
}



///change Page Referesh by Cat
function getPageRefresh(str) 
{		
	if(str=="")
		return false
	
	var strURL="mg_make.php?categoryid="+str	
	var req = GetXmlHttpObject();	
	if (req) {
		
		req.onreadystatechange = function() 
		{			
			if (req.readyState == 4) 
			{					
				if (req.status == 200) {					
					document.getElementById('norefresh').innerHTML=req.responseText;
					//alert(req.responseText);
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}				
		req.open("GET", strURL, true);
		req.send(null);
	}		
}