// This code makes Dinger Jeff's Hero 

	var chooseFrame = null;
	
	// this function resets all of the boxes to their default "please Choose" and clears the input box
	function reset()
	{
		var Box1=document.getElementById("contactortype");
		var Box2=document.getElementById("frame");
		var Box3=document.getElementById("powerpole");
		var Box4=document.getElementById("coilvoltage");
		var Box5=document.getElementById("auxcontacts");
		var TxtBox=document.getElementById("parttextfield");
		
		Box1.selectedIndex = 0;
		Box2.selectedIndex = 0;
		Box3.selectedIndex = 0;
		Box4.selectedIndex = 0;
		Box5.selectedIndex = 0;
		TxtBox.value = "";
		
	}
		
	
	function typeSelect()
	{
	
		var x=0;
	
		var framesNonr = new Array("AE9", "AE12", "AE16", "AE26", "AE30", "AE40", "AE50", "AE63", "AE75", "AE95", "AE110");	
		var framesMech = new Array("AE9M", "AE12M", "AE16M", "AE26M", "AE30M", "AE40M", "AE50M", "AE63M", "AE75M", "AE95M", "AE110M");
		var framesRev = new Array("AE9R", "AE12R", "AE16R", "AE26R", "AE30R", "AE40R", "AE50R", "AE63R", "AE75R", "AE95R", "AE110R");	

		var Box1=document.getElementById("contactortype");
		var Box2=document.getElementById("frame");
		var TxtBox=document.getElementById("parttextfield");
		
		
		if (Box1.selectedIndex == 1)
		{
			chooseFrame = framesNonr;
		}
		
		if (Box1.selectedIndex == 2)
		{
			chooseFrame = framesMech;
		}
		
		if (Box1.selectedIndex == 3)
		{
			chooseFrame = framesRev;
		}
		
		if (Box1.selectedIndex == 0)
		{
			chooseFrame = null;
		}
		
		// Clear Box 2
		Box2.options.length = 0;		
		
		// if Box one says "Please select" we should put only one element into the select
		if (Box1.selectedIndex == 0)
		{
			var y=document.createElement('option');
			y.text = "Please Select";
			Box2.options[0] = y;
		}
		// fill the select box with necessary data
		for (x = 0; x <= chooseFrame.length; x++)
		{
			var y=document.createElement('option');
			
			if (x == 0)
			{
				y.text = "Please Select";
				//Box2.add(y, null);
				Box2.options[0] = y;
			}
			else
			{
				y.text = chooseFrame[x-1];
				Box2.options[x] = y;
			}
		}
		// clear the text box
		TxtBox.value = "";
			
		
	}
	
	
	function valueSelect()
	{
		var firstNumber = null;
		var secondNumber = null;
		var thirdNumber = null;
		var fourthNumber = null;
				
		// variables to hold form objects
		
		var Box2=document.getElementById("frame");
		var Box3=document.getElementById("powerpole");
		var Box4=document.getElementById("coilvoltage");
		var Box5=document.getElementById("auxcontacts");
		var TxtBox=document.getElementById("parttextfield");
		
		// arrays to hold text values that correspond to the Selected Items in the Drop Downs		

		var Poles = new Array("30", "40", "22");		
		var Voltages = new Array("80", "81", "83", "86", "87", "88", "89");		
		var Contacts = new Array("00", "11");
					
		/*********** first number *******************/

		if (Box2.selectedIndex == 0)
		{
			firstNumber = null;
		}
		else
		{
			firstNumber = chooseFrame[Box2.selectedIndex - 1];
		}
		
		/************ Second Number ****************/
		if (Box3.selectedIndex == 0)
		{
			secondNumber = null;
		}
		else
		{
			secondNumber = Poles[Box3.selectedIndex - 1];
		}
		
		/************ Third Number *****************/
		if (Box4.selectedIndex == 0)
		{
			fourthNumber = null;
		}
		else
		{
			fourthNumber = Voltages[Box4.selectedIndex - 1];
		}
		
		/************ Fourth Number ***************/
		
		if (Box5.selectedIndex == 0)
		{
			thirdNumber = null;
		}
		else
		{
			thirdNumber = Contacts[Box5.selectedIndex - 1];
		}
		
		/****************Display Output****************/
		
		if (firstNumber != null && secondNumber != null && thirdNumber != null && fourthNumber != null)
		{
			TxtBox.value = firstNumber + "-" + secondNumber + "-" + thirdNumber + "-" + fourthNumber;
		}
		else
		{
			// if they return any of the lists to "Please Select" then clear the output
			TxtBox.value = "";
		}
	
	}

