
function getXMLHTTP() { //fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject('Microsoft.XMLHTTP');
			}
			catch(e){
				try{
				xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}		 	
		return xmlhttp;
    }

    function getState(countryId) {		
		
		var strURL='findState.php?country='+countryId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('statediv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}		
	}
	
	function getCity(countryId,stateId) {		
		var strURL='findCity.php?country='+countryId+'&state='+stateId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('citydiv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}
	}
    
	function getMake(vehicleId1){
		var strURL='make.php?vehicle1='+vehicleId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('makediv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}	

	function getModeltype(vehicleId1,makeId1) {		
		var strURL='submodeltype.php?vehicle1='+vehicleId1+'&make1='+makeId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('modeltypediv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}
	}	

	
	function getSubmodeltype(modelId1){
		var strURL='submodeltype.php?model1='+modelId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('submodeltypediv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}
	
	function getMakevm(vehicleId1){
		var strURL='makevm.php?vehicle1='+vehicleId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('makediv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}

	function getModeltypevm(vehicleId1,makeId1) {		
		var strURL='top.php?vehicle1='+vehicleId1+'&make1='+makeId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('modeltypediv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}
	}	

	
	function getSubmodeltypevm(modelId1){
		var strURL='top.php?model1='+modelId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('submodeltypediv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}

	function getMake2(vehicleId1){
		var strURL='make2.php?vehicle1='+vehicleId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('makediv2').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}

	function getModeltype2(vehicleId1,makeId1) {		
		var strURL='submodeltype2.php?vehicle1='+vehicleId1+'&make1='+makeId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('modeltypediv2').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}
	}	

	
	function getSubmodeltype2(modelId1){
		var strURL='submodeltype2.php?model1='+modelId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('submodeltypediv2').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}
	
	function getMake1(vehicleId1){
		var strURL='make1.php?vehicle1='+vehicleId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('makediv1').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}

	function getModeltype1(vehicleId1,makeId1) {		
		var strURL='submodeltype1.php?vehicle1='+vehicleId1+'&make1='+makeId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('modeltypediv1').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}
	}	

	
	function getSubmodeltype1(modelId1){
		var strURL='submodeltype1.php?model1='+modelId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('submodeltypediv1').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}
	
	function gettranstype1(modelId1){
		var strURL='submodeltype1.php?trans1='+modelId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('transtypediv1').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}
	
	function gettranstype(modelId1){
		var strURL='submodeltype.php?trans1='+modelId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('transtypediv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}

	function getenginetype(modelId1){
		var strURL='submodeltype.php?enginetype1='+modelId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('enginetypediv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}

	function getenginevalue(modelId1){
		var strURL='submodeltype.php?enginevalue1='+modelId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('enginevaluediv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}
	
	function gettransstatus(modelId1){
		var strURL='submodeltype.php?transtatus1='+modelId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('transtatusdiv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}
	
	function gettranstypevm(modelId1){
		var strURL='top.php?trans1='+modelId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('transtypediv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}

	function getenginetypevm(modelId1){
		var strURL='top.php?enginetype1='+modelId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('enginetypediv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}

	function getenginevaluevm(modelId1){
		var strURL='top.php?enginevalue1='+modelId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('enginevaluediv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}
	
	function gettransstatusvm(modelId1){
		var strURL='top.php?transtatus1='+modelId1;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('transtatusdiv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}
	
	
	function getorgtype(industryid){
		var strURL='make.php?industrytypeid='+industryid;
		var req = getXMLHTTP();
		
		if (req) {			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('orgtypediv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}	
	}
	
	// 01-02-2010 Indrani added new fuction to populate category and subcategory
	function getmainCategory(categoryId) {		
		
		var strURL='make.php?categoryid='+categoryId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('subcatdiv').innerHTML=req.responseText;						
					} else {
						alert(req.statusText);
					}
				}				
			}			
			req.open('GET', strURL, true);
			req.send(null);
		}		
	}

	//01-02-2010 Indrani added function to display add form page in same window itself.
	function submitad(){  
    	location.href='http://classified.communityhooks.org/classified/index.php?md=add_form&ct='+document.chsct.ct.value;
	} 
	
function showonlyone(choose) 
{
	chooseid = document.getElementById('newboxes'+choose);
	c = document.getElementById(choose);
	if(choose == '1') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; }	}
	else if(choose == '2') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }
	else if(choose == '3') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }
	else if(choose == '4') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }
	else if(choose == '5') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }
	else if(choose == '6') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }
	else if(choose == '7') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }
	else if(choose == '8') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }
	else if(choose == '9') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }
	else if(choose == '10') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }
	else if(choose == '11') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }
	else if(choose == '12') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }
	else if(choose == '13') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '14') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '15') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '16') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '17') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '18') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '19') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '20') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '21') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '22') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '23') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '24') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '25') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '26') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '27') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '28') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '29') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '30') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	
	else if(choose == '31') { if(chooseid.style.display == 'none'){ chooseid.style.display = 'block'; }else{ chooseid.style.display = 'none'; } }	

}

var type = 'IE';	//Variable used to hold the browser name
BrowserSniffer();

//detects the capabilities of the browser
function BrowserSniffer() {
	if (navigator.userAgent.indexOf('Opera')!=-1 && document.getElementById) type='OP';		//Opera
	else if (document.all) type='IE';														//Internet Explorer e.g. IE4 upwards
	else if (document.layers) type='NN';													//Netscape Communicator 4
	else if (!document.all && document.getElementById) type='MO';							//Mozila e.g. Netscape 6 upwards
	else type = 'IE';		//I assume it will not get here
}
function Show(str,str1,r1,r2){ 
x = document.getElementById(str); 
x.style.visibility = 'visible';
x.style.position = 'relative'; 
y = document.getElementById(str1); 
y.style.visibility = 'hidden'; 
y.style.position = 'relative'; 
document.getElementById(r2).style.display='block';  
document.getElementById(r1).style.display='none'; 
} 
function Show1(str,str1,r1,r2){ 
x = document.getElementById(str); 
x.style.visibility = 'visible';
x.style.position = 'relative'; 
y = document.getElementById(str1); 
y.style.visibility = 'hidden'; 
y.style.position = 'relative'; 
document.getElementById(r2).style.display='block';  
document.getElementById(r1).style.display='none'; 
} 