	// JavaScript Document
	var xmlhttp
	
	function showCD(str,str2,str3)
	{
		xmlhttp=GetXmlHttpObject();
		if (xmlhttp==null)
	  	{
	  		alert ("Your browser does not support AJAX!");
	  		return;
	  	}
		var url="FormPagInf_edd.php";
		url=url+"?engine_1="+str+"&engine_2="+str2+"&engine_3="+str3;
		url=url+"&sid="+Math.random();
		xmlhttp.onreadystatechange=stateChanged;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}
	
	function stateChanged()
	{
		if (xmlhttp.readyState==4)
		{
			document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
		}
	}
	//otro
	function showCD2(str,str2,str3)
	{
		xmlhttp=GetXmlHttpObject();
		if (xmlhttp==null)
	 	{
		  alert ("Your browser does not support AJAX!");
		  return;
		}
		var url="FormPagInf_edd.php";
		url=url+"?engine_1="+str+"&engine_2="+str2+"&engine_3="+str3;
		url=url+"&sid="+Math.random();
		xmlhttp.onreadystatechange=stateChanged2;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}
	
	function stateChanged2()
	{
		if (xmlhttp.readyState==4)
		{
			document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
		}
	}
	
	//fin otro
	function showCD3(str,str2,str3)
	{
		xmlhttp=GetXmlHttpObject();
		if (xmlhttp==null)
	    {
	 	  alert ("Your browser does not support AJAX!");
		  return;
		}
		var url="FormPagInf_edd.php";
		url=url+"?engine_1="+str+"&engine_2="+str2+"&engine_3="+str3;
		url=url+"&sid="+Math.random();
		xmlhttp.onreadystatechange=stateChanged3;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}
	
	function stateChanged3()
	{
		if (xmlhttp.readyState==4)
		{
			document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
		}
	}
	//fin otrtrto
	function GetXmlHttpObject()
	{
		if (window.XMLHttpRequest)
		{
		  // code for IE7+, Firefox, Chrome, Opera, Safari
		  return new XMLHttpRequest();
		}
		if (window.ActiveXObject)
		{
		  // code for IE6, IE5
		  return new ActiveXObject("Microsoft.XMLHTTP");
		}
		return null;
	}
	 
	 
	 
	 
	 
/****************************************************************************************/
	function enviarConsultaModelEngine1()
	{
 


		xmlhttp=GetXmlHttpObject();
		if (xmlhttp==null)
	    {
	 	  alert ("Your browser does not support AJAX!");
		  return;
		}
		
		countryID = document.getElementById('country').value;
		statesID = document.getElementById('states').value;

		model_id1 = document.getElementById('model_1').value;
		engine_id1 = document.getElementById('engine_1').value;

		model_id2 = document.getElementById('model_2').value;
		engine_id2 = document.getElementById('engine_2').value;

		model_id3 = document.getElementById('model_3').value;
		engine_id3 = document.getElementById('engine_3').value;
		
	
 //--------------------------------------MODIFICACION DE CODIGO COMIENZA---------------------------------------

		
		var url="example.php";
		url=url+"?country="+countryID+"&state="+statesID+"&model_1="+model_id1+"&engine_1="+engine_id1+"&model_2="+model_id2+"&engine_2="+engine_id2+"&model_3="+model_id3+"&engine_3="+engine_id3;
		 

		if(document.getElementById("engine_3").value > 0  ){				 
			valuetotal3 = Number(document.getElementById('msrpprice3').value); 
			factoryTotal  = Number(0);
			optionFactory3 = "";				 
			counterOption3 = document.getElementById('factoryOptionCounter3').value; 				 
			for(i=1;i<=counterOption3;i++){ 		 
				tempstring = eval("document.getElementById('check3Factory" + i + "').checked");
				if (eval("document.getElementById('check3Factory" + i + "').checked")){
					valuetotal3 += 	(Number(eval("document.getElementById('check3Factory" + i + "').value")));
					factoryTotal += 	(Number(eval("document.getElementById('check3Factory" + i + "').value")));
				}
				optionFactory3 += tempstring + ",";			 
			}
			url=url+"&optionFactory3="+optionFactory3;
			url=url+"&factoryTotal3="+factoryTotal;

			//COLOR SECTION
			optionColor3 = "";
			counterOption3 = document.getElementById('colorOptionCounter3').value; 		
			for(i=1;i<=counterOption3;i++){ 		 
				if (eval("document.getElementById('radio3Color" + i + "').checked")){
					optionColor3 += "t,";
				}else{
					optionColor3 += "f,";
				}
			}

			//----END COLOR SECTION







			accessoryTotal3  = Number(0);
			optionAccessory3 = "";				 
			counterOption3 = document.getElementById('accessoryOptionCounter3').value; 				 
			for(i=1;i<=counterOption3;i++){ 
				if(eval("document.getElementById('check3Accessory" + i + "').disabled")){
					tempstring = '';	
				}else{
					tempstring = eval("document.getElementById('check3Accessory" + i + "').checked");

				}				
			//	tempstring = eval("document.getElementById('check3Accessory" + i + "').checked");
				if (eval("document.getElementById('check3Accessory" + i + "').checked")){
					valuetotal3 += 	(Number(eval("document.getElementById('check3Accessory" + i + "').value")));
					accessoryTotal3+= 	(Number(eval("document.getElementById('check3Accessory" + i + "').value")));
				}
				optionAccessory3 += tempstring + ",";			 
			}
			url=url+"&optionAccessory3="+optionAccessory3; 
			url=url+"&valuetotal3="+valuetotal3;
			url=url+"&accessoryTotal3="+accessoryTotal3;
		}



		if(document.getElementById("engine_2").value > 0  ){

			valuetotal2 = Number(document.getElementById('msrpprice2').value); 
			factoryTotal  = Number(0);
			optionFactory2 = "";
			counterOption2 = document.getElementById('factoryOptionCounter2').value; 
			for(i=1;i<=counterOption2;i++){ 		 
				if(eval("document.getElementById('check2Factory" + i + "').disabled")){
					tempstring = '';	
				}else{
					tempstring = eval("document.getElementById('check2Factory" + i + "').checked");

				}

				//tempstring = eval("document.getElementById('check2Factory" + i + "').checked");
				if (eval("document.getElementById('check2Factory" + i + "').checked")){
					valuetotal2 += 	(Number(eval("document.getElementById('check2Factory" + i + "').value")));
					factoryTotal += 	(Number(eval("document.getElementById('check2Factory" + i + "').value")));
				}
				optionFactory2 += tempstring + ",";
			}
			url=url+"&optionFactory2="+optionFactory2;
			url=url+"&factoryTotal2="+factoryTotal;



			//COLOR SECTION
			optionColor2 = "";
			counterOption2 = document.getElementById('colorOptionCounter2').value; 		
			for(i=1;i<=counterOption2;i++){ 		 
				if (eval("document.getElementById('radio2Color" + i + "').checked")){
					optionColor2 += "t,";
				}else{
					optionColor2 += "f,";
				}
			}
			url=url+"&optionColor2="+optionColor2;
			//----END COLOR SECTION





			accessoryTotal2 = Number(0);
			optionAccessory2 = "";
			counterOption2 = document.getElementById('accessoryOptionCounter2').value; 
			for(i=1;i<=counterOption2;i++){ 		 
				if(eval("document.getElementById('check2Accessory" + i + "').disabled")){
					tempstring = '';	
				}else{
					tempstring = eval("document.getElementById('check2Accessory" + i + "').checked");

				}

//				tempstring = eval("document.getElementById('check2Accessory" + i + "').checked");
				if (eval("document.getElementById('check2Accessory" + i + "').checked")){
					valuetotal2 += 	(Number(eval("document.getElementById('check2Accessory" + i + "').value")));
					accessoryTotal2+= 	(Number(eval("document.getElementById('check2Accessory" + i + "').value")));

				}
				optionAccessory2 += tempstring + ",";
			 
			}
			url=url+"&optionAccessory2="+optionAccessory2;
			url=url+"&valuetotal2="+valuetotal2;
			url=url+"&accessoryTotal2="+accessoryTotal2;
		}


 
//--------------------------------------MODIFICACION DE CODIGO ACABA---------------------------------------
 
		xmlhttp.onreadystatechange=stateChangedModelEngine1;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}
	
	function stateChangedModelEngine1()
	{
		if (xmlhttp.readyState==1)
		{
			document.getElementById("loading").innerHTML= "<img src=images/loading2.gif>";
		}
		if (xmlhttp.readyState==4)
		{
			document.getElementById("loading").innerHTML= "";
			document.getElementById("tableReport").innerHTML=xmlhttp.responseText;
		}
	}
/****************************************************************************************/
/****************************************************************************************/
	function enviarConsultaModelEngine2()
	{
 








		xmlhttp=GetXmlHttpObject();
		if (xmlhttp==null)
	    {
	 	  alert ("Your browser does not support AJAX!");
		  return;
		}
		
		countryID = document.getElementById('country').value;
		statesID = document.getElementById('states').value;

		model_id1 = document.getElementById('model_1').value;
		engine_id1 = document.getElementById('engine_1').value;

		model_id2 = document.getElementById('model_2').value;
		engine_id2 = document.getElementById('engine_2').value;

		model_id3 = document.getElementById('model_3').value;
		engine_id3 = document.getElementById('engine_3').value;

			

//--------------------------------------MODIFICACION DE CODIGO---------------------------------------
		var url="example.php";
		url=url+"?country="+countryID+"&state="+statesID+"&model_1="+model_id1+"&engine_1="+engine_id1+"&model_2="+model_id2+"&engine_2="+engine_id2+"&model_3="+model_id3+"&engine_3="+engine_id3;



		if(document.getElementById("engine_3").value > 0  ){				 
			valuetotal3 = Number(document.getElementById('msrpprice3').value); 
			factoryTotal  = Number(0);
			optionFactory3 = "";				 
			counterOption3 = document.getElementById('factoryOptionCounter3').value; 				 
			for(i=1;i<=counterOption3;i++){ 	
				if(eval("document.getElementById('check3Factory" + i + "').disabled")){
					tempstring = '';	
				}else{
					tempstring = eval("document.getElementById('check3Factory" + i + "').checked");

				}
				
//				tempstring = eval("document.getElementById('check3Factory" + i + "').checked");
				if (eval("document.getElementById('check3Factory" + i + "').checked")){
					valuetotal3 += 	(Number(eval("document.getElementById('check3Factory" + i + "').value")));
					factoryTotal += 	(Number(eval("document.getElementById('check3Factory" + i + "').value")));
				}
				optionFactory3 += tempstring + ",";			 
			}
			url=url+"&optionFactory3="+optionFactory3;
			url=url+"&factoryTotal3="+factoryTotal;



			//COLOR SECTION
			optionColor3 = "";
			counterOption3 = document.getElementById('colorOptionCounter3').value; 		
			for(i=1;i<=counterOption3;i++){ 		 
				if (eval("document.getElementById('radio3Color" + i + "').checked")){
					optionColor3 += "t,";
				}else{
					optionColor3 += "f,";
				}
			}
			url=url+"&optionColor3="+optionColor3;
			//----END COLOR SECTION





			accessoryTotal3 = Number(0);
			optionAccessory3 = "";				 
			counterOption3 = document.getElementById('accessoryOptionCounter3').value; 				 
			for(i=1;i<=counterOption3;i++){ 		 
				
				if(eval("document.getElementById('check3Accessory" + i + "').disabled")){
					tempstring = '';	
				}else{
					tempstring = eval("document.getElementById('check3Accessory" + i + "').checked");

				}				
				//tempstring = eval("document.getElementById('check3Accessory" + i + "').checked");
				if (eval("document.getElementById('check3Accessory" + i + "').checked")){
					valuetotal3 += 	(Number(eval("document.getElementById('check3Accessory" + i + "').value")));
					accessoryTotal3+= 	(Number(eval("document.getElementById('check3Accessory" + i + "').value")));
				}
				optionAccessory3 += tempstring + ",";			 
			}
			url=url+"&optionAccessory3="+optionAccessory3; 
			url=url+"&valuetotal3="+valuetotal3;
			url=url+"&accessoryTotal3="+accessoryTotal3;
		}



		if(document.getElementById("engine_1").value > 0  ){

			valuetotal1 = Number(document.getElementById('msrpprice1').value); 

			factoryTotal  = Number(0);		
 			optionFactory1 = "";
			counterOption1 = document.getElementById('factoryOptionCounter1').value; 
			for(i=1;i<=counterOption1;i++){ 
				
				if(eval("document.getElementById('check1Factory" + i + "').disabled")){
					tempstring = '';	
				}else{
					tempstring = eval("document.getElementById('check1Factory" + i + "').checked");

				}


				//tempstring = eval("document.getElementById('check1Factory" + i + "').checked");
				if (eval("document.getElementById('check1Factory" + i + "').checked")){
					valuetotal1 += 	(Number(eval("document.getElementById('check1Factory" + i + "').value")));
					factoryTotal += 	(Number(eval("document.getElementById('check1Factory" + i + "').value")));
				}
				optionFactory1 += tempstring + ",";
			}
			url=url+"&optionFactory1="+optionFactory1;
			url=url+"&factoryTotal1="+factoryTotal;
 
			//COLOR SECTION
			optionColor1 = "";
			counterOption1 = document.getElementById('colorOptionCounter1').value; 		
			for(i=1;i<=counterOption1;i++){ 		 
				if (eval("document.getElementById('radio1Color" + i + "').checked")){
					optionColor1 += "t,";
				}else{
					optionColor1 += "f,";
				}
			}
			url=url+"&optionColor1="+optionColor1;
			//----END COLOR SECTION
			accessoryTotal1  = Number(0);
			optionAccessory1 = "";
			counterOption1 = document.getElementById('accessoryOptionCounter1').value; 
			for(i=1;i<=counterOption1;i++){ 	
				if(eval("document.getElementById('check1Accessory" + i + "').disabled")){
					tempstring = '';	
				}else{
					tempstring = eval("document.getElementById('check1Accessory" + i + "').checked");

				}				
				//tempstring = eval("document.getElementById('check1Accessory" + i + "').checked");
				if (eval("document.getElementById('check1Accessory" + i + "').checked")){
					valuetotal1 += 	(Number(eval("document.getElementById('check1Accessory" + i + "').value")));
					accessoryTotal1+= 	(Number(eval("document.getElementById('check1Accessory" + i + "').value")));

				}
				optionAccessory1 += tempstring + ",";
			}
			url=url+"&optionAccessory1="+optionAccessory1;
			url=url+"&valuetotal1="+valuetotal1;
			url=url+"&accessoryTotal1="+accessoryTotal1;
		}

 
	 


//--------------------------------------MODIFICACION DE CODIGO---------------------------------------





		xmlhttp.onreadystatechange=stateChangedModelEngine2;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}
	
	function stateChangedModelEngine2()
	{
		if (xmlhttp.readyState==1)
		{
			document.getElementById("loading").innerHTML= "<img src=images/loading2.gif>";
		}
		if (xmlhttp.readyState==4)
		{
			document.getElementById("loading").innerHTML= "";
			document.getElementById("tableReport").innerHTML=xmlhttp.responseText;
		}
	}
/****************************************************************************************/
/****************************************************************************************/
	function enviarConsultaModelEngine3()
	{

			 
		xmlhttp=GetXmlHttpObject();
		if (xmlhttp==null)
	    {
	 	  alert ("Your browser does not support AJAX!");
		  return;
		}
		
		countryID = document.getElementById('country').value;
		statesID = document.getElementById('states').value;

		model_id1 = document.getElementById('model_1').value;
		engine_id1 = document.getElementById('engine_1').value;

		model_id2 = document.getElementById('model_2').value;
		engine_id2 = document.getElementById('engine_2').value;

		model_id3 = document.getElementById('model_3').value;
		engine_id3 = document.getElementById('engine_3').value;
			


 //--------------------------------------MODIFICACION DE CODIGO COMIENZA---------------------------------------

		var url="example.php";
		url=url+"?country="+countryID+"&state="+statesID+"&model_1="+model_id1+"&engine_1="+engine_id1+"&model_2="+model_id2+"&engine_2="+engine_id2+"&model_3="+model_id3+"&engine_3="+engine_id3;
 

		if(document.getElementById("engine_1").value > 0  ){

 
			valuetotal1 = Number(document.getElementById('msrpprice1').value); 
			factoryTotal  = Number(0);		
 			optionFactory1 = "";
			counterOption1 = document.getElementById('factoryOptionCounter1').value; 
			for(i=1;i<=counterOption1;i++){ 		 
				if(eval("document.getElementById('check1Factory" + i + "').disabled")){
					tempstring = '';	
				}else{
					tempstring = eval("document.getElementById('check1Factory" + i + "').checked");

				}

				//tempstring = eval("document.getElementById('check1Factory" + i + "').checked");
				if (eval("document.getElementById('check1Factory" + i + "').checked")){
					valuetotal1 += 	(Number(eval("document.getElementById('check1Factory" + i + "').value")));
					factoryTotal += 	(Number(eval("document.getElementById('check1Factory" + i + "').value")));
					 
					
				}
				optionFactory1 += tempstring + ",";
			}
			url=url+"&optionFactory1="+optionFactory1;
			url=url+"&factoryTotal1="+factoryTotal;
 
			//COLOR SECTION
			optionColor1 = "";
			counterOption1 = document.getElementById('colorOptionCounter1').value; 		
			for(i=1;i<=counterOption1;i++){ 		 
				if (eval("document.getElementById('radio1Color" + i + "').checked")){
					optionColor1 += "t,";
				}else{
					optionColor1 += "f,";
				}
			}
			url=url+"&optionColor1="+optionColor1;
			//----END COLOR SECTION

			accessoryTotal1  = Number(0);
			optionAccessory1 = "";
			counterOption1 = document.getElementById('accessoryOptionCounter1').value; 
			for(i=1;i<=counterOption1;i++){ 		 
				if(eval("document.getElementById('check1Accessory" + i + "').disabled")){
					tempstring = '';	
				}else{
					tempstring = eval("document.getElementById('check1Accessory" + i + "').checked");

				}				
				//tempstring = eval("document.getElementById('check1Accessory" + i + "').checked");
				if (eval("document.getElementById('check1Accessory" + i + "').checked")){
					valuetotal1 += 	(Number(eval("document.getElementById('check1Accessory" + i + "').value")));
					accessoryTotal1+= 	(Number(eval("document.getElementById('check1Accessory" + i + "').value")));

				}
				optionAccessory1 += tempstring + ",";
			}
			url=url+"&optionAccessory1="+optionAccessory1;
			url=url+"&valuetotal1="+valuetotal1;
			url=url+"&accessoryTotal1="+accessoryTotal1;
			 
		}

 



		if(document.getElementById("engine_2").value > 0  ){

			valuetotal2 = Number(document.getElementById('msrpprice2').value); 
			factoryTotal  = Number(0);
			optionFactory2 = "";
			counterOption2 = document.getElementById('factoryOptionCounter2').value; 
			for(i=1;i<=counterOption2;i++){ 		 
				if(eval("document.getElementById('check2Factory" + i + "').disabled")){
					tempstring = '';	
				}else{
					tempstring = eval("document.getElementById('check2Factory" + i + "').checked");

				}

//				tempstring = eval("document.getElementById('check2Factory" + i + "').checked");
				if (eval("document.getElementById('check2Factory" + i + "').checked")){
					valuetotal2 += 	(Number(eval("document.getElementById('check2Factory" + i + "').value")));
					factoryTotal += 	(Number(eval("document.getElementById('check2Factory" + i + "').value")));
				}
				optionFactory2 += tempstring + ",";
			}
			url=url+"&optionFactory2="+optionFactory2;
			url=url+"&factoryTotal2="+factoryTotal;



			//COLOR SECTION
			optionColor2 = "";
			counterOption2 = document.getElementById('colorOptionCounter2').value; 		
			for(i=1;i<=counterOption2;i++){ 		 
				if (eval("document.getElementById('radio2Color" + i + "').checked")){
					optionColor2 += "t,";
				}else{
					optionColor2 += "f,";
				}
			}
			url=url+"&optionColor2="+optionColor2;
			//----END COLOR SECTION






			accessoryTotal2  = Number(0);
			optionAccessory2 = "";
			counterOption2 = document.getElementById('accessoryOptionCounter2').value; 
			for(i=1;i<=counterOption2;i++){ 	
				if(eval("document.getElementById('check2Accessory" + i + "').disabled")){
					tempstring = '';	
				}else{
					tempstring = eval("document.getElementById('check2Accessory" + i + "').checked");
				}				
				//tempstring = eval("document.getElementById('check2Accessory" + i + "').checked");
				if (eval("document.getElementById('check2Accessory" + i + "').checked")){
					valuetotal2 += 	(Number(eval("document.getElementById('check2Accessory" + i + "').value")));
					accessoryTotal2+= 	(Number(eval("document.getElementById('check2Accessory" + i + "').value")));

				}
				optionAccessory2 += tempstring + ",";
			 
			}
			url=url+"&optionAccessory2="+optionAccessory2;
			url=url+"&valuetotal2="+valuetotal2;
			url=url+"&accessoryTotal2="+accessoryTotal2;
		}

 
 //--------------------------------------MODIFICACION DE CODIGO ACABA---------------------------------------







		xmlhttp.onreadystatechange=stateChangedModelEngine3;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}
	
	function stateChangedModelEngine3()
	{
		if (xmlhttp.readyState==1)
		{
			document.getElementById("loading").innerHTML= "<img src=images/loading2.gif>";
		}
		if (xmlhttp.readyState==4)
		{
			document.getElementById("loading").innerHTML= "";
			document.getElementById("tableReport").innerHTML=xmlhttp.responseText;
		}
	}
/****************************************************************************************/
