function CheckSpec(theBox, theMenu) {
	if (theBox.checked == true) {
		theMenu.disabled = false;
	} else {
		theMenu.disabled = true;
	}
}

function MenuSpec(theMenu, theField) {
	if (theMenu.value == "Other...") {
		theField.disabled = false;
	}
}

function ClearDefault(theField, defaultValue) {
	// If the contents of the field has not been changed
	// and the field is in focus, clear it for quicker input.
	if (theField.value == defaultValue) {
		theField.value = '';
	}
}

function cntryreq(cntryval, stateid) {
	var cntry = document.getElementById(stateid);

	if (cntryval != "United States of America") {
		cntry.removeAttribute('class');
	} else {
		cntry.className = 'required';
	}
}

function RestoreDefault(theField, defaultValue, theParent, theParentDefault) {
	// If the field is blurred and the contents have not
	// been changed from the default, restore the default text.
	if ((theField.value == '') || (theField.value == defaultValue)) {
		theField.value = defaultValue;
		
		if (theParent.nodeName == "SELECT") {
			theField.disabled = true;
		}
		
		theParent.value = theParentDefault;
	}
}

function LRestDef(theField, defaultValue) {
	if ((theField.value == '') || (theField.value == defaultValue)) {
		theField.value = defaultValue;
	}
}

function TwoMenuField(switcher, switchee, textField) {
	if (switcher.value == "Other...") {
		//switcher.disabled = true;
		//switchee.disabled = true;
		textField.disabled = false;
	} else {
		//switcher.disabled = false;
		//switchee.disabled = false;
		textField.disabled = true;
	}
}

/*
 *
 *
 *
 */
 
var menuIds = new Array('intBoltedHybrid', 'extBoltedHybrid', 'intShopWeld', 'extShopWeld', 'intFieldWeld', 'extFieldWeld');

function switchCoatings(tankType) {
	var intCoatings = null;
	var extCoatings = null;
	
	switch (tankType) {
		case "Field-Weld":
			intCoatings = "intFieldWeld";
			extCoatings = "extFieldWeld";
		case "Shop-Weld":
			intCoatings = "intShopWeld";
			extCoatings = "extShopWeld";
		default:
			intCoatings = "intBoltedHybrid";
			extCoatings = "extBoltedHybrid";
	}

	hideAll();
	showDiv(intCoatings, extCoatings);
}

function hideAll() {
	for (var i = 0; i < menuIds.length; i++) {
		hideDiv(menuIds[i]);
	}
}

function hideDiv(intCoatingList, extCoatingList) {
	if (document.getElementById) {
		document.getElementById(intCoatingList).style.display = 'none';
		document.getElementById(extCoatingList).style.display = 'none';
	} else {
		if (document.layers) {
			document.intCoatingList.display = 'none';
			document.extCoatingList.display = 'none';
		} else {
			document.all.intCoatingList.style.display = 'none';
			document.all.extCoatingList.style.display = 'none';
		}
	}
}

function showDiv(intCoatingList, extCoatingList) {
	if (document.getElementById) {
		document.getElementById(intCoatingList).style.display = 'block';
		document.getElementById(extCoatingList).style.display = 'block';
	} else {
		if (document.layers) {
			document.intCoatingList.display = 'block';
			document.extCoatingList.display = 'block';
		} else {
			document.all.intCoatingList.style.display = 'block';
			document.all.extCoatingList.style.display = 'block';
		}
	}
}

function disableHoppers(master, var1, var2, var3) {
	if (master.value == "Flat bottom") {
		var1.disabled = true;
		var2.disabled = true;
		var3.disabled = true;
	} else {
		var1.disabled = false;
		var2.disabled = false;
		var3.disabled = false;
	}
}