
			
			
			function RequestSelectUpdate(DataRequest, QueryValues, TargetSelect)
			{
				ClearOptions (TargetSelect);
				AddOptions(TargetSelect ,"Please Wait .....","");
				var xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
				if (xmlhttp)
				 {
						
					var RequestParams ="?DataRequest=" + DataRequest +"&QueryValues=" + escape(QueryValues) ;
					xmlhttp.open("GET", "http://www.iphonecar.co.uk/includes/SelectUpdate.asp" + RequestParams, false);
					xmlhttp.send(null);
					LoadOptions(TargetSelect,xmlhttp.responseText);

				}
			}
			
			function ClearOptions(TargetSelect)
			{

				var TargetSel= document.getElementById (TargetSelect);
				while (TargetSel.options.length > 0)
				{
					TargetSel.removeChild (TargetSel.options[0]);
				}
			}
			
			function AddOptions(TargetSelect,optText,optValue)
			{
				var TargetSel= document.getElementById (TargetSelect);
				var newOpt =document.createElement("option");
				if (document.all)
					{newOpt.innerText=optText;}
				else
					{newOpt.textContent=optText;}
				newOpt.value = optValue;
				TargetSel.appendChild (newOpt);
			}	
				
				
			function LoadOptions(TargetSelect, OptionValueList)
			{
				ClearOptions (TargetSelect);
				//AddOptions(TargetSelect,"  Select From List  ","");
				var optText
				var optValue
				var optTextoptValue = OptionValueList.split("|::|");
				var elementCount = 0
					
				while (elementCount < optTextoptValue.length)
				{
				optText = optTextoptValue[elementCount].split("|:|")[0];
				optValue= optTextoptValue[elementCount].split("|:|")[1];
					
					
				AddOptions(TargetSelect,optText,optValue);
					
				elementCount = elementCount + 1;
				}
				//document.getElementById (TargetSelect).focus();
			}

			// ///////////////////////////////////////////////////////////////////////////////////////// //

			function LoadMakes(sel_num)
			{		
				var QueryValues;
							
				QueryValues = 'v';
				
				ClearOptions ('model_' + sel_num );

				AddOptions('model_' + sel_num  ,"- - - - - - - - - - - - - - - - - - - - - - - - -","");
				
				ClearOptions ('year_' + sel_num );

				AddOptions('year_' + sel_num  ,"- - - - - - - - - - - - -","");
				
				RequestSelectUpdate('Makes', QueryValues, 'make_' + sel_num  );

			}

			function LoadModels(sel_num)
			{		
				var QueryValues;
				
				QueryValues = document.getElementById( 'make_' + sel_num ).value;			
				
				ClearOptions ('year_' + sel_num );

				AddOptions('year_' + sel_num  ,"- - - - - - - - - - - - -","");
				
				RequestSelectUpdate('ModelsByMake', QueryValues, 'model_' + sel_num  );

			}

			function LoadYears(sel_num)
			{		
				var QueryValues;
				
				QueryValues = document.getElementById( 'make_' + sel_num ).value + '|:|' + document.getElementById( 'model_' + sel_num ).value ;			
				
				RequestSelectUpdate('YearsByMakeModel', QueryValues, 'year_' + sel_num  );

			}

			// ///////////////////////////////////////////////////////////////////////////////////////// //
