	var http_request = false;
	var tempTxt;
	function GetXmlHttpObject()
		{
		var xmlHttp=null;
		try
		  {
		  // Firefox, Opera 8.0+, Safari
		  xmlHttp=new XMLHttpRequest();
		  }
		catch (e)
		  {
		  // Internet Explorer
		  try
			{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
		  catch (e)
			{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
		  }
		return xmlHttp;
		}
	
	function makeRequest(url,txt) {
		http_request = false;
		tempTxt=txt;
	/*
		if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
			if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
			// See note below about this line
			}
		} else if (window.ActiveXObject) { // IE
			try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
			try {
			http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	*/
	http_request=GetXmlHttpObject();
	if (!http_request) {
	alert('Giving up :( Cannot create an XMLHTTP instance');
	return false;
	}
	//alert(url);
	http_request.onreadystatechange = alertContents;
	http_request.open('GET', url,true);
	http_request.send(null);
	
	}
	
	function alertContents() {
		if (http_request.readyState == 4) {
			if (http_request.status == 200) {
		//alert(tempTxt);
				document.getElementById(tempTxt).innerHTML=http_request.responseText;
				if(fob('sub_category').disabled){
				alert('There is no model for this make');
				}
			} 
			else {
				alert('There was a problem with the request.');
			}
		}
		else if (http_request.readyState < 4)
		{
			document.getElementById(tempTxt).innerHTML = "Loading...";
		}
	}

function fob(x)
{
	return document.getElementById(x);
}
function change_list(x)
{	
	obj_enabled(0,'years');
	var url="make_sublist.php";
	url=url+"?category="+fob(x).value;
	
	if(fob(x).value!="")
	{
		makeRequest(url, "sub_cat_id");
	}

}
function change_list2(x,y)
{	
	
	//match=y;
	///obj_enabled(0,'years');
	//alert(fob(x).value);
	//return false;
	var url="make_sublist.php";
	url=url+"?step=step2&model="+ y +"&category="+fob(x).value;
	//alert(url);
	//return false;
	if(fob(x).value!="")
	{
		makeRequest(url, "sub_cat_id");
	}

}

function change_list3(x,y)
{	
	
	//match=y;
	///obj_enabled(0,'years');
	//alert(fob(x).value);
	//return false;
    var montage=window.location.host;         
	var url="http://"+montage+"/make_sublist.php";
	url=url+"?step=step2&model="+ y +"&category="+fob(x).value;
	//alert(url);
	//return false;
	if(fob(x).value!="")
	{
		makeRequest(url, "sub_cat_id");
	}
}




function obj_enabled(x,y)
{
	
	if(x==1){
		if(fob(y) && fob(y).disabled){ fob(y).disabled=false; } 

	}else{
		if(fob(y) && !fob(y).disabled){ fob(y).disabled=true; } 
	}
		
}

function valid_form(frm){

	str="";
	if(fob('category').value==""){
		str=str+"Choose make\n";
	}
	if(fob('sub_category').disabled || fob('sub_category').value==""){
		str=str+"Choose model\n";
	}
	if(fob('years').disabled || fob('years').value==""){
		str=str+"Choose year\n";
	}
	if(str!=""){
		alert(str);
		return false;
	}
	document.frm1.submit();
	return true;
}
function valid_form2(frm){


	str="";
	temp_flag=0;

//------------------
if(fob('engine_size')){
	if(fob('engine_size').value==""){ 
		str=str+"Engine Size: Not Selected\n";
		if(temp_flag==0)
					{
						fob('engine_size').focus();
						temp_flag=1;
					}
	}
}

if(fob('transmission')){
if(fob('transmission').value==""){ 
		str=str+"Transmission: Not Selected\n";
		if(temp_flag==0)
					{
						fob('transmission').focus();
						temp_flag=1;
					}
	}
}

if(fob('fule')){
	if(fob('fule').value=="" ){
		str=str+"Fuel: Not selected\n";
		if(temp_flag==0)
					{
						fob('fule').focus();
						temp_flag=1;
					}
	}
}

if(fob('body_type')){
	if(fob('body_type').value==""){ 
		str=str+"Body: Not Selected\n";
		if(temp_flag==0)
					{
						fob('body_type').focus();
						temp_flag=1;
					}
	}
}
if(fob('colour')){
	if(fob('colour').value=="" ){
		str=str+"Colour: Not selected\n";
		if(temp_flag==0)
					{
						fob('colour').focus();
						temp_flag=1;
					}
	}
}
//------------------------
if(fob('part1')){
	if(fob('part1').value=="" || fob('part1').value=="0" ){
		str=str+"Part1: Not selected\n";
		if(temp_flag==0)
					{
						fob('part1').focus();
						temp_flag=1;
					}
	}
}

	if(fob('fullname').value=="Part Request user"){ 
		str=str+"Full Name: Please enter your full name\n";
		if(temp_flag==0)
					{
						fob('fullname').value=""
						fob('fullname').focus();
						temp_flag=1;
					}
	}
	/*
	if(fob('part2').value=="" || fob('part2').value=="0" ){
		str=str+"Part2: Not selected\n";
		if(temp_flag==0)
					{
						fob('part2').focus();
						temp_flag=1;
					}
	}
	if(fob('part2notes').value==""){ 
		str=str+"Part2 Note: Blank\n";
		if(temp_flag==0)
					{
						fob('part2notes').focus();
						temp_flag=1;
					}
	}
	if(fob('part3').value=="" || fob('part3').value=="0" ){
		str=str+"Part3: Not selected\n";
		if(temp_flag==0)
					{
						fob('part3').focus();
						temp_flag=1;
					}
	}
	if(fob('part3notes').value==""){ 
		str=str+"Part3 Note: Blank\n";
		if(temp_flag==0)
					{
						fob('part3notes').focus();
						temp_flag=1;
					}
	}
	if(fob('part4').value=="" || fob('part4').value=="0" ){
		str=str+"Part4: Not selected\n";
		if(temp_flag==0)
					{
						fob('part4').focus();
						temp_flag=1;
					}
	}
	if(fob('part4notes').value==""){ 
		str=str+"Part4 Note: Blank\n";
		if(temp_flag==0)
					{
						fob('part4notes').focus();
						temp_flag=1;
					}
	}
	*/
	if(str!=""){
		alert(str);
		return false;
	}
	
	x=validate_form(frm);
		if(x){
			alert(x);
			return false;
		}
		
	
	//document.frm1.submit();
	return true;
}
