	function hndrail()
	{
		if (document.LibraryForm.topAssembly[1].checked == true && document.LibraryForm.OptionalHandrail[2].checked == true)
			{
			document.LibraryForm.OptionalHandrail[2].checked = false;
			document.LibraryForm.OptionalHandrail[0].checked = true;
			document.LibraryForm.OptionalHandrail[2].disabled = true;
			alert("Loft Style handrails are not available with Hook Style Track!");
			}
		else
			document.LibraryForm.OptionalHandrail[2].disabled = false;
		
		if (document.LibraryForm.OptionalHandrail[2].checked == true)
				{
				document.LibraryForm.HandrailPosition[2].checked = true;
				document.LibraryForm.HandrailPosition[0].disabled = true;
				document.LibraryForm.HandrailPosition[1].disabled = true;
				}
		else
				{
				document.LibraryForm.HandrailPosition[0].disabled = false;
				document.LibraryForm.HandrailPosition[1].disabled = false;
				}
				
		if (document.LibraryForm.OptionalHandrail[0].checked == true)
				{
				document.LibraryForm.HandrailPosition[0].checked = false;
				document.LibraryForm.HandrailPosition[1].checked = false;
				document.LibraryForm.HandrailPosition[2].checked = false;
				}
				
		if (document.LibraryForm.topAssembly[0].checked == true)
				{
				document.LibraryForm.r1.disabled = true;
				document.LibraryForm.r2.disabled = true;
				document.LibraryForm.r3.disabled = true;
				document.LibraryForm.r4.disabled = true;
				document.LibraryForm.r5.disabled = true;
				document.LibraryForm.r6.disabled = true;
				document.LibraryForm.r7.disabled = true;
				document.LibraryForm.r8.disabled = true;
				document.LibraryForm.r1.value = '';
				document.LibraryForm.r2.value = '';
				document.LibraryForm.r3.value = '';
				document.LibraryForm.r4.value = '';
				document.LibraryForm.r5.value = '';
				document.LibraryForm.r6.value = '';
				document.LibraryForm.r7.value = '';
				document.LibraryForm.r8.value = '';

				//document.LibraryForm.LengthofTrack.disabled = false;
				}
		else
				{
				document.LibraryForm.r1.disabled = false;
				document.LibraryForm.r2.disabled = false;
				document.LibraryForm.r3.disabled = false;
				document.LibraryForm.r4.disabled = false;
				document.LibraryForm.r5.disabled = false;
				document.LibraryForm.r6.disabled = false;
				document.LibraryForm.r7.disabled = false;
				document.LibraryForm.r8.disabled = false;
				//document.LibraryForm.LengthofTrack.disabled = true;

				}
		
	}

	function validate()
		{
		//alert (document.LibraryForm.bypass.checked);
		if (document.LibraryForm.bypass.checked == true){
			if (document.LibraryForm.company.value == "" && document.LibraryForm.lname.value == "")
				{
				alert("You must enter a name or company!");
				return false;
				}
			//Revision Number
			if (document.LibraryForm.id.value > 0)
				{
				if (confirm("Would you like to update the Revision Number?\n\nSelecting OK will save the quote under a new Revision Number.\n\nSelecting CANCEL will save the quote under the current Revision Number."))
					document.LibraryForm.rev_update.value = 1;
				else
					document.LibraryForm.rev_update.value = 0;
				}
			else
				{
				document.LibraryForm.revnum.value = 0;	
				document.LibraryForm.rev_update.value = 0;
				}

			return true;
			}

		var v2
		v2 = val_shipto();
		if (v2==false)
			return false;
			
		v2 = validate2();
		if (v2==false)
			return false;
	
		if (document.LibraryForm.TrackMountingHeight.value == "" || isNaN(document.LibraryForm.TrackMountingHeight.value))
			{
			alert("You must enter a number for the Track Mounting Height!");
			return false;
			
			}
		if (document.LibraryForm.LengthofTrack.value == "" || isNaN(document.LibraryForm.LengthofTrack.value))
			{
			alert("You must enter a number for the Length of Track!");
			return false;
			
			}
		if (document.LibraryForm.TrackMountingHeight.value < 24)
			{
			alert("The minimum Track Mounting Height is 24 inches!");
			return false;
			
			}
		
		if (document.LibraryForm.ladderMaterial[1].checked==true || document.LibraryForm.ladderMaterial[2].checked==true ||document.LibraryForm.ladderMaterial[3].checked==true ||document.LibraryForm.ladderMaterial[5].checked==true ||document.LibraryForm.ladderMaterial[6].checked==true ||document.LibraryForm.ladderMaterial[7].checked==true)
			{
			if (document.LibraryForm.TrackMountingHeight.value > 144)
				{
				alert("The maximum Track Mounting Height is 144 inches!");
				return false;
				}
			}
		else
			{
			if (document.LibraryForm.TrackMountingHeight.value > 168)
				{
				alert("The maximum Track Mounting Height is 168 inches!");
				return false;
				}
			}
			
		if (document.LibraryForm.LengthofTrack.value < 36)
			{
			alert("The minimum Length of Track is 36 inches!");
			return false;
			
			}
		if (document.LibraryForm.mezz[1].checked == true)
			{
			if (document.LibraryForm.LadderType[1].checked == true || document.LibraryForm.OptionalHandrail[2].checked == true)
				{
				alert("You cannot use Loft Style Handrails or a Bent Top Style without a Loft or Mezzanine!");
				return false;
				}

			}
		
		if (document.LibraryForm.topAssembly[1].checked == true)
			{
			if (document.LibraryForm.r1.value == "")
				{
				alert("You must enter Length of Run data for Hook Type track!");
				return false;
				}
			}

		if (document.LibraryForm.topAssembly[0].checked == true)
			{
			//alert(document.LibraryForm.double135.value);
			if (document.LibraryForm.r1.value != "" || document.LibraryForm.r2.value != "" || document.LibraryForm.r3.value != "" || document.LibraryForm.r4.value != "" || document.LibraryForm.r5.value != "" || document.LibraryForm.r6.value != "" || document.LibraryForm.r7.value != "" || document.LibraryForm.r8.value != "")
				{
				alert("You cannot enter Run Lengths for Roll Type track!");
				return false;
				}
			if (document.LibraryForm.double135.value != "" || document.LibraryForm.double135.value != 0)
				{
				alert("You cannot enter Double 135 Degree Curved Track connectors for Roll Type track!");
				return false;
				}
			if (document.LibraryForm.mitered90.value != "" || document.LibraryForm.mitered90.value != 0)
				{
				alert("You cannot enter Mitered 90 Degree Curved Track connectors for Roll Type track!");
				return false;
				}
	
			}
			

		}