// Measurement calculator javascript code
// Written by Kurt Frank
// Port City Professional Software
// www.portcityprofessionalsoftware.com
// Translatede/adapted to Norwegian version, Ole Chr. Synnes, ThrottleStore.Com

function NoCalcPossible() {
	SetAnswer(" - ", "Ingen modeller passer. Ring for hjelp!", "00");
}

function SetAnswer(pnum, pdesc, pid) {
	document.aspnetForm.prodnumber.value = pnum;
	document.aspnetForm.proddescription.value = pdesc;
	if (pid == "00") {
		document.aspnetForm.btnThing.disabled=true;
	}
}

function JumpToProd() {
	document.aspnetForm.btnThing.disabled=false;
}

function calcMeasureCalc() {

  document.aspnetForm.circ.value = document.aspnetForm.circ.value.replace(",",".").replace(" ","");
  document.aspnetForm.leng.value = document.aspnetForm.leng.value.replace(",",".").replace(" ","");

  if (document.aspnetForm.prodtype.value == "HA") 
    {
		//document.aspnetForm.prodnumber.value ="HA-13";
		if ((document.aspnetForm.circ.value >= 19.5) && (document.aspnetForm.circ.value <= 24.5) && (document.aspnetForm.leng.value <= 44)) 
	    {
		  document.aspnetForm.prodnumber.value ="HA-13";
		  document.aspnetForm.proddescription.value = "Half Arm - S (liten voksen)";
		  if(document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$HalfArmSize != null)
		  {
    		  document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$HalfArmSize.selectedIndex = 0;
	    	  document.aspnetForm.ctl00_ContentPlaceHolder1_attList_HalfArmSize.selectedIndex = 0;
	      }
		}  
		else
	    {
		  if ((document.aspnetForm.circ.value >= 24.5) && (document.aspnetForm.leng.value <= 51)) 
			{
			  document.aspnetForm.prodnumber.value ="HA-15";
			  document.aspnetForm.proddescription.value = "Half Arm - Regular (normal voksen halv arm)";
		      if(document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$HalfArmSize != null)
		      {
    		      document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$HalfArmSize.selectedIndex = 1;
    		      document.aspnetForm.ctl00_ContentPlaceHolder1_attList_HalfArmSize.selectedIndex = 1;
    		  }
			}
		  else
			{
			  NoCalcPossible();  
			}
		}		
    }
  else
    {
		if (document.aspnetForm.prodtype.value == "FA") 
		  {
			//document.aspnetForm.prodnumber.value ="FA-12";
			if ((document.aspnetForm.circ.value >= 15) && (document.aspnetForm.circ.value <= 17) && (document.aspnetForm.leng.value <= 40)) 
			  {
				document.aspnetForm.prodnumber.value ="FA-12";
				document.aspnetForm.proddescription.value = "Full Arm - XS (ekstra liten)";
		          if(document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$FullArmSize != null)
		          {
    		          document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$FullArmSize.selectedIndex = 0;
	    	          document.aspnetForm.ctl00_ContentPlaceHolder1_attList_FullArmSize.selectedIndex = 0;
	              }
			  }  
			else
			  {
				if ((document.aspnetForm.circ.value >= 17) && (document.aspnetForm.circ.value <= 22) && (document.aspnetForm.leng.value <= 56)) 
				  {
					document.aspnetForm.prodnumber.value = "FA-14";
					document.aspnetForm.proddescription.value = "Full Arm - S (liten)";
		              if(document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$FullArmSize != null)
		              {
    		              document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$FullArmSize.selectedIndex = 1;
	    	              document.aspnetForm.ctl00_ContentPlaceHolder1_attList_FullArmSize.selectedIndex = 1;
	                  }
				  }
			  
				else 
				{
				  if ((document.aspnetForm.circ.value >= 22) && (document.aspnetForm.circ.value <= 28) && (document.aspnetForm.leng.value <= 71)) 
				  {
					document.aspnetForm.prodnumber.value = "FA-16";
					document.aspnetForm.proddescription.value = "Full Arm - M (normal)";
		              if(document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$FullArmSize != null)
		              {
    		              document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$FullArmSize.selectedIndex = 2;
	    	              document.aspnetForm.ctl00_ContentPlaceHolder1_attList_FullArmSize.selectedIndex = 2;
	                  }
				  }  
				  else 
				  {
					if ((document.aspnetForm.circ.value >= 28) && (document.aspnetForm.leng.value <= 80)) 
					  {
						document.aspnetForm.prodnumber.value ="FA-18";
						document.aspnetForm.proddescription.value = "Full Arm - L (stor)";
		                  if(document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$FullArmSize != null)
		                  {
    		                  document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$FullArmSize.selectedIndex = 3;
	    	                  document.aspnetForm.ctl00_ContentPlaceHolder1_attList_FullArmSize.selectedIndex = 3;
	                      }
					  }
					else
					  {
					    NoCalcPossible();  
					  }
				  }
				}
			  }	
		  }
		else
		  {
			if (document.aspnetForm.prodtype.value == "HL") 
			  {
				if ((document.aspnetForm.circ.value >= 25) && (document.aspnetForm.circ.value <= 33) && (document.aspnetForm.leng.value <= 53)) 
				  {
					document.aspnetForm.prodnumber.value ="HL-13";
					document.aspnetForm.proddescription.value = "Half Leg - S (liten)";
		              if(document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$HalfLegSize != null)
		              {
    		              document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$HalfLegSize.selectedIndex = 0;
	    	              document.aspnetForm.ctl00_ContentPlaceHolder1_attList_HalfLegSize.selectedIndex = 0;
	                  }
				  }  
				else
				  {
					if ((document.aspnetForm.circ.value >= 33) && (document.aspnetForm.leng.value <= 60)) 
					  {
						document.aspnetForm.prodnumber.value ="HL-15";
						document.aspnetForm.proddescription.value = "Half Leg - L (stor)";
		                  if(document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$HalfLegSize != null)
		                  {
    		                  document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$HalfLegSize.selectedIndex = 1;
	    	                  document.aspnetForm.ctl00_ContentPlaceHolder1_attList_HalfLegSize.selectedIndex = 1;
	                      }
					  }
					else
					  {
						NoCalcPossible();  
					  }
				  }		
			}
			else
			{
			  if (document.aspnetForm.prodtype.value == "FL") 
			    {
				  //document.aspnetForm.prodnumber.value ="FL-12";
				  if ((document.aspnetForm.circ.value >= 19) && (document.aspnetForm.circ.value <= 28) && (document.aspnetForm.leng.value <= 48)) 
					{
						document.aspnetForm.prodnumber.value ="FL-12";
						document.aspnetForm.proddescription.value = "Full Leg - XS (ekstra liten helt ben, barn)";
		                  if(document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$FullLegSize != null)
		                  {
    		                  document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$FullLegSize.selectedIndex = 0;
	    	                  document.aspnetForm.ctl00_ContentPlaceHolder1_attList_FullLegSize.selectedIndex = 0;
	                      }
					}  
				  else
					{
					  if ((document.aspnetForm.circ.value >= 35) && (document.aspnetForm.circ.value <= 45) && (document.aspnetForm.leng.value <= 73)) 
						{
							document.aspnetForm.prodnumber.value = "FL-14";
							document.aspnetForm.proddescription.value = "Full Leg - S (liten helt ben)";
		                      if(document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$FullLegSize != null)
		                      {
    		                      document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$FullLegSize.selectedIndex = 1;
	    	                      document.aspnetForm.ctl00_ContentPlaceHolder1_attList_FullLegSize.selectedIndex = 1;
	                          }

						}
					  else 
						{
						  if ((document.aspnetForm.circ.value >= 42) && (document.aspnetForm.circ.value <= 53) && (document.aspnetForm.leng.value <= 84)) 
							{
								document.aspnetForm.prodnumber.value = "FL-16";
								document.aspnetForm.proddescription.value = "Full Leg - M (normal helt ben)";
		                          if(document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$FullLegSize != null)
		                          {
    		                          document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$FullLegSize.selectedIndex = 2;
	    	                          document.aspnetForm.ctl00_ContentPlaceHolder1_attList_FullLegSize.selectedIndex = 2;
	                              }
							}  
						  else 
							{
							  if ((document.aspnetForm.circ.value >= 53) && (document.aspnetForm.leng.value <= 94)) 
								{
									document.aspnetForm.prodnumber.value ="FL-18";
									document.aspnetForm.proddescription.value = "Full Leg - L (stor hel arm)";
		                              if(document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$FullLegSize != null)
		                              {
    		                              document.aspnetForm.ctl00$ContentPlaceHolder1$ProductTopDisplay1$attList$FullLegSize.selectedIndex = 3;
	    	                              document.aspnetForm.ctl00_ContentPlaceHolder1_attList_FullLegSize.selectedIndex = 3;
	                                  }
								}
							  else
								{
									NoCalcPossible();  
								}
							}
						}
					}	
				}
			}
		  }  
	}
}
//  End -->
