//Global XMLHTTP Request object
		var XmlHttp;

		//Creating and setting the instance of appropriate XMLHTTP Request object to a “XmlHttp” variable  
		function CreateXmlHttp()
		{
			//Creating object of XMLHTTP in IE
			try
			{
				XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e)
			{
				try
				{
					XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
				} 
				catch(oc)
				{
					XmlHttp = null;
				}
			}
			//Creating object of XMLHTTP in Mozilla and Safari 
			if(!XmlHttp && typeof XMLHttpRequest != "undefined") 
			{
				XmlHttp = new XMLHttpRequest();
			}
		}
		
		function Models1OnChange()
		{			
			var ddlManufacturer = document.getElementById("VehicleSearch1a_dlEngMfcs");
			var ddlYear = document.getElementById("VehicleSearch1a_dlYears");
			var ddlModel = document.getElementById("VehicleSearch1a_dlModels");
			var imgButton = document.getElementById("VehicleSearch1a_cmdSearch");
			ModelsOnChange(imgButton, ddlManufacturer, ddlYear, ddlModel);
		}
		
		function Models2OnChange()
		{
			var ddlManufacturer = document.getElementById("VehicleSearch1a_dlEngMfcs2");
			var ddlYear = document.getElementById("VehicleSearch1a_dlYears2");
			var ddlModel = document.getElementById("VehicleSearch1a_dlModels2");
			var imgButton = document.getElementById("VehicleSearch1a_cmdSearch2");
			ModelsOnChange(imgButton, ddlManufacturer, ddlYear, ddlModel);
		}
		
		function ModelsOnChange(imgButton, ddlMan, ddlYear, ddlModel)
		{
			var txtEngMfcs = document.getElementById("VehicleSearch1a_tbEngMfc");
			var txtYear = document.getElementById("VehicleSearch1a_tbYear");
			var txtModel = document.getElementById("VehicleSearch1a_tbModel");
			
			if (txtEngMfcs != null)
				txtEngMfcs.value = ddlMan.options[ddlMan.selectedIndex].value;
				
			if (txtYear != null)
				txtYear.value = ddlYear.options[ddlYear.selectedIndex].value;
				
			if (txtModel != null)
				txtModel.value = ddlModel.options[ddlModel.selectedIndex].value;
			
			imgButton.style.display = 'block';
		}
		
		function Manufacturers1OnChange()
		{
			var ddlYear = document.getElementById("VehicleSearch1a_dlYears");
			var ddlMan = document.getElementById("VehicleSearch1a_dlEngMfcs");
			var imgButton = document.getElementById("VehicleSearch1a_cmdSearch");
			DisplayLoading(ddlYear);
			HideSearch(imgButton);
			ManufacturersOnChange(ddlMan);
		}
		
		function Manufactuers2OnChange()
		{
			var ddlYear = document.getElementById("VehicleSearch1a_dlYears2");
			var ddlMan = document.getElementById("VehicleSearch1a_dlEngMfcs2");
			var imgButton = document.getElementById("VehicleSearch1a_cmdSearch2");
			DisplayLoading(ddlYear);
			HideSearch(imgButton);
			ManufacturersOnChange(ddlMan);
		}

		function ManufacturersOnChange(ddlMan) 
		{
			var selectedManufacturer = ddlMan.options[ddlMan.selectedIndex].value;
			
			// URL to get years for a given Manufacturer
			var requestUrl = AjaxServerPageName + "?Manufacturer=" + encodeURIComponent(selectedManufacturer);
			CreateXmlHttp();
			
			// If browser supports XMLHTTPRequest object
			if(XmlHttp)
			{
				//Setting the event handler for the response
				XmlHttp.onreadystatechange = HandleResponse;
				
				//Initializes the request object with GET (METHOD of posting), 
				//Request URL and sets the request as asynchronous.
				XmlHttp.open("GET", requestUrl,  true);
				
				//Sends the request to server
				XmlHttp.send(null);		
			}
		}
		
		function Years1OnChange()
		{
			var ddlModel = document.getElementById("VehicleSearch1a_dlModels");
			var ddlManufacturer = document.getElementById("VehicleSearch1a_dlEngMfcs");
			var ddlYear = document.getElementById("VehicleSearch1a_dlYears");
			DisplayLoading(ddlModel);
			YearsOnChange(ddlYear, ddlManufacturer);
		}
		
		function Years2OnChange()
		{
			var ddlModel = document.getElementById("VehicleSearch1a_dlModels2");
			var ddlManufacturer = document.getElementById("VehicleSearch1a_dlEngMfcs2");
			var ddlYear = document.getElementById("VehicleSearch1a_dlYears2");
			DisplayLoading(ddlModel);
			YearsOnChange(ddlYear, ddlManufacturer);
		}

		function YearsOnChange(ddlYear, ddlManufacturer) 
		{
			//Getting the selected year, manufacturer from year/manufacturer combo box.
			var selectedYear = ddlYear.options[ddlYear.selectedIndex].value;
			var selectedManufacturer = ddlManufacturer.options[ddlManufacturer.selectedIndex].value;
			
			// URL to get makes for a given Manufacturer/Year
			var requestUrl = AjaxServerPageName + "?Manufacturer="+ encodeURIComponent(selectedManufacturer) +"&Year=" + encodeURIComponent(selectedYear);
			CreateXmlHttp();
			
			// If browser supports XMLHTTPRequest object
			if(XmlHttp)
			{
				//Setting the event handler for the response
				XmlHttp.onreadystatechange = HandleResponse;
				
				//Initializes the request object with GET (METHOD of posting), 
				//Request URL and sets the request as asynchronous.
				XmlHttp.open("GET", requestUrl,  true);
				
				//Sends the request to server
				XmlHttp.send(null);		
			}
		}

		//Called when response comes back from server
		function HandleResponse()
		{
			// To make sure receiving response data from server is completed
			if(XmlHttp.readyState == 4)
			{
				// To make sure valid response is received from the server, 200 means response received is OK
				if(XmlHttp.status == 200)
				{			
					ClearDropDownLists(XmlHttp.responseText);
				}
				else
				{
					alert("There was a problem retrieving data from the server." );
				}
			}
		}
		
		function ClearDropDownLists(responseText)
		{
			if (responseText != null)
			{
				var ddlMake;
				if (document.getElementById("VehicleSearch1a_dlModels") == null)
				{
					ddlMake = document.getElementById("VehicleSearch1a_dlModels2");
				}
				
				if (document.getElementById("VehicleSearch1a_dlModels2") == null)
				{
					ddlMake = document.getElementById("VehicleSearch1a_dlModels")
				}
				
				var ddlYear;
				if (document.getElementById("VehicleSearch1a_dlYears") == null)
				{
					ddlYear = document.getElementById("VehicleSearch1a_dlYears2");
				}

				if (document.getElementById("VehicleSearch1a_dlYears2") == null)
				{
					ddlYear = document.getElementById("VehicleSearch1a_dlYears")
				}	
			
				var whichDdl = responseText.split("|");
				if (whichDdl[0] == "MAKES")
				{
					ClearDropDownList(ddlMake);

					if (ddlMake != null)
					{
						ddlMake.disabled = false;
						var ddlOptions = whichDdl[1].split(",");
						var textValue;
						
						if (whichDdl.length > 0)
						{
							//Insert starter
							ddlMake.options[0] = new Option("Select Model", "-1", true, true);
							//START DEFECT DontKnow BJS 5/2/06
							ddlMake.options[1] = new Option("Don't Know", " ", false, false);
							//END DEFECT
							for (var count = 0; count < ddlOptions.length; count++)
							{
								textValue = ddlOptions[count];
								
								ddlMake.options[count+2] = new Option(textValue, textValue, false, false);
							}
						}
						else
						{
							ddlMake.options[0] = new Option("No Models", "-1", true, true);
						}
					}
				}
				
				if (whichDdl[0] == "YEARS")
				{
					ClearDropDownList(ddlYear);
					ClearDropDownList(ddlMake);
					
					if (ddlYear != null)
					{			
						ddlYear.disabled = false;
						var ddlOptions = whichDdl[1].split(",");
						var textValue;
						
						if (whichDdl.length > 0)
						{
							//Insert starter
							ddlYear.options[0] = new Option("Select Year", "-1", true, true);
							for (var count = 0; count < ddlOptions.length; count++)
							{
								textValue = ddlOptions[count];
								
								ddlYear.options[count+1] = new Option(textValue, textValue, false, false);
							}
						}
						else
						{
							ddlYear.options[0] = new Option("No Years", "-1", true, true);
						}
					}
				}
			}
		}
		
		function ClearDropDownList(ddl)
		{
			if (ddl != null)
			{
				if (ddl.options != null)
				{
					for (var count = ddl.options.length-1; count >-1; count--)
					{
						ddl.options[count] = null;
					}
				}
				
				ddl.disabled = true;
			}
		}
		
		function HideSearch(imgButton)
		{
			if (imgButton != null)
			{
				imgButton.style.display = 'none';
			}
		}
		
		function DisplayLoading(ddl)
		{
			if (ddl != null)
			{
				ClearDropDownList(ddl);
				ddl.options[0] = new Option("Loading...", "-1", true, true);
			}
		}
		
		function LoadManufacturers() 
		{
			// URL to get makes for a given Manufacturer/Year
			var requestUrl = AjaxServerPageName + "?Load=1";
			CreateXmlHttp();
			
			// If browser supports XMLHTTPRequest object
			if(XmlHttp)
			{
				//Setting the event handler for the response
				XmlHttp.onreadystatechange = HandleLoadResponse;
				
				//Initializes the request object with GET (METHOD of posting), 
				//Request URL and sets the request as asynchronous.
				XmlHttp.open("GET", requestUrl,  true);
				
				//Sends the request to server
				XmlHttp.send(null);		
			}
		}
		
		function HandleLoadResponse()
		{
			// To make sure receiving response data from server is completed
			if(XmlHttp.readyState == 4)
			{
				// To make sure valid response is received from the server, 200 means response received is OK
				if(XmlHttp.status == 200)
				{			
					var ddlMan;
					if (document.getElementById("VehicleSearch1a_dlEngMfcs") == null)
					{
						ddlMan = document.getElementById("VehicleSearch1a_dlEngMfcs2");
					}
					
					if (document.getElementById("VehicleSearch1a_dlEngMfcs2") == null)
					{
						ddlMan = document.getElementById("VehicleSearch1a_dlEngMfcs")
					} 
					
					var ddlOptions = XmlHttp.responseText.split(",");
					var textValue;
					
					//Insert starter
					ddlMan.options[0] = new Option("Select Manufacturer", "-1", true, true);
					for (var count = 0; count < ddlOptions.length; count++)
					{
						textValue = ddlOptions[count];
						ddlMan.options[count+1] = new Option(textValue, textValue, false, false);
					}
				}
				else
				{
					alert("There was a problem retrieving data from the server." );
				}
			}
		}