
//Requestor Affiliation display variables 
var rdfsCorporate = "No";
var userIsShipper = "No";
var userIsConsignee = "No";
var userIsThirdParty = "No";
var iAmCount = 0;
var payment = "No selection made";
var stepSeven = "No";

function notSendToTerminal(){
    if(document.BOL.do_not_send.checked){
        alert("Note: By checking this box your BOL will NOT be sent to the terminal.");
    }
}

function save(){	

	if(document.BOL.chkRequest_Shipper.checked){
		rdfsCorporate = "Yes";	
	}else{
		rdfsCorporate = "No";
	}
	
	
	//if ( document.BOL.chkRequest_Shipper[1].checked){
	//	userIsShipper = "Shipper";
	//	iAmCount = iAmCount + 1;
	//}else{
	//	userIsShipper = "";	
	//}
	//if ( document.BOL.chkRequest_Shipper[2].checked){
	//	userIsConsignee = "Consignee";
	//	iAmCount = iAmCount + 1;
	//}else{
	//	userIsConsignee = "";	
	//}
	//if ( document.BOL.chkRequest_Shipper[3].checked){
	//	userIsThirdParty = "Third Party";
	//	iAmCount = iAmCount + 1;
	//}else{
	//	userIsThirdParty = "";	
	//}
	
	
	if(document.BOL.Prepaid[0].checked){
		payment = "PrePaid";
	}
	if(document.BOL.Prepaid[1].checked){
		payment = "Collect";	
	}
	
	formUpdate();
	iAmCount = 0;

}

function formUpdate() {
	var output;
	output = "";
	
//////////////////
// Request Aff
//////////////////

	//update RDFS Corporate
	document.getElementById('contentRequestAffRDFS').innerHTML = rdfsCorporate;
	
	//update I Am...
	//if(userIsShipper == "Shipper"){
	//	output = "Shipper";
	//}
	//if(userIsConsignee == "Consignee"){
	//	if(output != ""){
	//		output = output + ", Consignee";
	//	}else{
	//		output = "Consignee";	
	//	}
	//}
	//if(userIsThirdParty == "Third Party"){
	//	if(output != ""){
	//		output = output + ", Third Party";
	//	}else{
	//		output = "Third Party";	
	//	}
	//}
	//if(output == ""){
	//	output = "No selection made";
	//}
	//document.getElementById('contentRequestAffIam').innerHTML = output;
	
	//update payment type
	document.getElementById('contentRequestAffPayment').innerHTML  = payment;

//////////////////
// Request Info
//////////////////
	
	//update name
	document.getElementById('contentRequestInfoName').innerHTML = document.BOL.txtRequest_Name.value;
	
	//update email
	document.getElementById('contentRequestInfoEmail').innerHTML = document.BOL.txtRequest_Email.value;
	
	//update phone
	document.getElementById('contentRequestInfoPhone').innerHTML = document.BOL.txtRequest_Phone.value;
	
	//update ext
	document.getElementById('contentRequestInfoExt').innerHTML = document.BOL.txtRequest_Ext.value;
	
//////////////////
// COD Remit
//////////////////

	//update amount
	document.getElementById('contentCODAmount').innerHTML = document.BOL.CODAmount.value;
	
	//update fee
	if(document.BOL.COD[0].checked){
		document.getElementById('contentCODFee').innerHTML = document.BOL.COD[0].value;
	}
	if(document.BOL.COD[1].checked){
		document.getElementById('contentCODFee').innerHTML = document.BOL.COD[1].value;	
	}
	
	//update company check
	if(document.BOL.CODAcceptCheck.checked){
		document.getElementById('contentCODCheck').innerHTML = "Yes";
	}
	
	
	//update company
	document.getElementById('contentCODCompany').innerHTML = document.BOL.CODName.value;
	
	//update name/contact
	document.getElementById('contentCODContact').innerHTML = document.BOL.CODContact.value;

    //update address
	document.getElementById('contentCODAddress').innerHTML = document.BOL.CODAddress.value;
	document.getElementById('contentCODCity').innerHTML = document.BOL.CODCity.value;
	document.getElementById('contentCODState').innerHTML = document.BOL.CODState[document.BOL.CODState.selectedIndex].value;
	document.getElementById('contentCODZip').innerHTML = document.BOL.CODZip.value;
	
	if(document.BOL.CODUSA[0].checked){
		output = document.BOL.CODUSA[0].value;
	}
	if(document.BOL.CODUSA[1].checked){
		output = document.BOL.CODUSA[1].value;					   
	}
	
	document.getElementById('contentCODCountry').innerHTML = output;
	
	//output = document.BOL.CODAddress.value + " " + document.BOL.CODCity.value + ", ";
	//output = output + document.BOL.CODState[document.BOL.CODState.selectedIndex].value + " ";
	//output = output + document.BOL.CODZip.value + " ";
	//document.getElementById('contentCODAddress').innerHTML = output;
	output = ""
	
//////////////////
// Shipper Info
//////////////////
	document.getElementById('contentShipperCompany').innerHTML = document.BOL.ShipName.value;
	document.getElementById('contentShipperName').innerHTML = document.BOL.ContactName.value;
	
	//update address
	
	document.getElementById('contentShipperAddress').innerHTML = document.BOL.ShipAddress.value;
	document.getElementById('contentShipperCity').innerHTML = document.BOL.ShipCity.value;
	document.getElementById('contentShipperState').innerHTML = document.BOL.ShipState[document.BOL.ShipState.selectedIndex].value;
	document.getElementById('contentShipperZip').innerHTML = document.BOL.ShipZip.value;
	
	if(document.BOL.ShipUSA[0].checked){
		output = document.BOL.ShipUSA[0].value;
	}
	if(document.BOL.ShipUSA[1].checked){
		output = document.BOL.ShipUSA[1].value;					   
	}
	
	document.getElementById('contentShipperCountry').innerHTML = output;
	
	
	//output = document.BOL.ShipAddress.value + " " + document.BOL.ShipCity.value + ", ";
	//output = output + document.BOL.ShipState[document.BOL.ShipState.selectedIndex].value + " ";
	//output = output + document.BOL.ShipZip.value + " " + document.BOL.ShipUSA.value;
	//document.getElementById('contentShipperAddress').innerHTML = output;
	output = "";
	
	document.getElementById('contentShipperPhone').innerHTML = document.BOL.ShipPhone.value;
	document.getElementById('contentShipperExt').innerHTML = document.BOL.ShipExt.value;
	document.getElementById('contentShipperEmail').innerHTML = document.BOL.ShipEmail.value;
	document.getElementById('contentShipperReady').innerHTML = document.BOL.freighttime.value;
	document.getElementById('contentShipperPickup').innerHTML = document.BOL.closepickuptime.value;


/////////////////////
// Consignee Info
/////////////////////
	document.getElementById('contentConsigneeCompany').innerHTML = document.BOL.ConName.value;
	document.getElementById('contentConsigneeName').innerHTML = document.BOL.ConsigneeName2.value;
	
	//update address
	document.getElementById('contentConsigneeAddress').innerHTML = document.BOL.ConAddress.value;
	document.getElementById('contentConsigneeCity').innerHTML = document.BOL.ConCity.value;
	document.getElementById('contentConsigneeState').innerHTML = document.BOL.ConState[document.BOL.ConState.selectedIndex].value;
	document.getElementById('contentConsigneeZip').innerHTML = document.BOL.ConZip.value;
	
	if(document.BOL.ConUSA[0].checked){
		output = document.BOL.ConUSA[0].value;
	}
	if(document.BOL.ConUSA[1].checked){
		output = document.BOL.ConUSA[1].value;					   
	}
	
	document.getElementById('contentConsigneeCountry').innerHTML = output;
	
	output = "";
	
	document.getElementById('contentConsigneePhone').innerHTML = document.BOL.ConPhone.value;
	document.getElementById('contentConsigneeExt').innerHTML = document.BOL.ConExt.value;
	document.getElementById('contentConsigneeEmail').innerHTML = document.BOL.ConEmail.value;

	
	if(document.BOL.CBD[0].checked){
		document.getElementById('contentConact').innerHTML = "Yes";
	}else{
		document.getElementById('contentConact').innerHTML = "No";
	}
///////////////////////
// Third Party Info
///////////////////////
	document.getElementById('contentThirdPartyCompany').innerHTML = document.BOL.TPName.value;
	document.getElementById('contentThirdPartyName').innerHTML = document.BOL.TPContact.value;
	
	//update address
	
	document.getElementById('contentThirdPartyAddress').innerHTML = document.BOL.TPAddress.value;
	document.getElementById('contentThirdPartyCity').innerHTML = document.BOL.TPCity.value;
	document.getElementById('contentThirdPartyState').innerHTML = document.BOL.TPState[document.BOL.TPState.selectedIndex].value;
	document.getElementById('contentThirdPartyZip').innerHTML = document.BOL.TPZip.value;
	
	if(document.BOL.TPUSA[0].checked){
		output = document.BOL.TPUSA[0].value;
	}
	if(document.BOL.TPUSA[1].checked){
		output = document.BOL.TPUSA[1].value;					   
	}
	
	document.getElementById('contentThirdPartyCountry').innerHTML = output;
	
	output = "";

	document.getElementById('contentThirdPartyPhone').innerHTML = document.BOL.TPPhone.value;
	document.getElementById('contentThirdPartyExt').innerHTML = document.BOL.TPExt.value;
	document.getElementById('contentThirdPartyEmail').innerHTML = document.BOL.TPEmail.value;


///////////////////////
// Commodities
///////////////////////

var commodities = new Array();
var x = 0;
var holder = "";

	if(document.BOL.DESC1.value != ""){commodities[x] = document.BOL.DESC1.value;x++;}
	if(document.BOL.DESC2.value != ""){commodities[x] = document.BOL.DESC2.value;x++;}
	if(document.BOL.DESC3.value != ""){commodities[x] = document.BOL.DESC3.value;x++;}
	if(document.BOL.DESC4.value != ""){commodities[x] = document.BOL.DESC4.value;x++;}
	if(document.BOL.DESC5.value != ""){commodities[x] = document.BOL.DESC5.value;x++;}
	if(document.BOL.DESC6.value != ""){commodities[x] = document.BOL.DESC6.value;x++;}
	if(document.BOL.DESC7.value != ""){commodities[x] = document.BOL.DESC7.value;x++;}
	if(document.BOL.DESC8.value != ""){commodities[x] = document.BOL.DESC8.value;x++;}
	if(document.BOL.DESC9.value != ""){commodities[x] = document.BOL.DESC9.value;x++;}
	if(document.BOL.DESC10.value != ""){commodities[x] = document.BOL.DESC10.value;x++;}


if(commodities.length > 0){
	holder = "Commodities entered:";
	holder = holder + "<ul>";
	for(i=0;i<commodities.length;i++){
		holder = holder + "<li>" + commodities[i] + "</li>";
	}
	holder = holder + "</ul>";
	document.getElementById('contentComm').innerHTML = holder;
}else{
	document.getElementById('contentComm').innerHTML = "No commodities entered.";	
}

///////////////////////
// Shipment Specifics
///////////////////////

	document.getElementById('contentShipSpecDate').innerHTML = document.BOL.shipDate.value;
	document.getElementById('contentShipSpecProNumber').innerHTML = document.BOL.ProNumber.value;
	document.getElementById('contentShipSpecInstructions').innerHTML = document.BOL.Special_Instr.value;


///////////////////////
// Reference Numbers
///////////////////////
	document.getElementById('contentRefNumBOL').innerHTML = document.BOL.BolNum.value;
	
	//if(document.BOL.Added.checked){document.getElementById('contentRefNumCopy').innerHTML = "Yes"}else{document.getElementById('contentRefNumCopy').innerHTML = "No"}
	
	var refNum = new Array();
	var x2 = 0;
	var holder2 = "";
	
	if(document.BOL.cr1.value != ""){refNum[x2] = document.BOL.cr1.value;x2++;}
	if(document.BOL.cr2.value != ""){refNum[x2] = document.BOL.cr2.value;x2++;}
	if(document.BOL.cr3.value != ""){refNum[x2] = document.BOL.cr3.value;x2++;}
	if(document.BOL.cr4.value != ""){refNum[x2] = document.BOL.cr4.value;x2++;}
	if(document.BOL.cr5.value != ""){refNum[x2] = document.BOL.cr5.value;x2++;}
	if(document.BOL.cr6.value != ""){refNum[x2] = document.BOL.cr6.value;x2++;}
	if(document.BOL.cr7.value != ""){refNum[x2] = document.BOL.cr7.value;x2++;}
	if(document.BOL.cr8.value != ""){refNum[x2] = document.BOL.cr8.value;x2++;}
	if(document.BOL.cr9.value != ""){refNum[x2] = document.BOL.cr9.value;x2++;}
	if(document.BOL.cr10.value != ""){refNum[x2] = document.BOL.cr10.value;x2++;}
	
	
	if(refNum.length > 0){
		holder2 = "Reference numbers entered:";
		holder2 = holder2 + "<ul>";
		for(i=0;i<refNum.length;i++){
			holder2 = holder2 + "<li>" + refNum[i] + "</li>";
		}
		holder2 = holder2 + "</ul>";
		document.getElementById('contentRefNum').innerHTML = holder2;
	}else{
		document.getElementById('contentRefNum').innerHTML = "No reference numbers entered.";	
	}

///////////////////////
// Liability
///////////////////////

	document.getElementById('contentLiabilityValue').innerHTML = document.BOL.ALCDV.value;
	document.getElementById('contentLiabilityPer').innerHTML = document.BOL.Per[document.BOL.Per.selectedIndex].value;

	document.getElementById('contentLiabilityRequested').innerHTML = document.BOL.Excess.value;
	
	

///////////////////////////////
// Additional Service Options
///////////////////////////////
	var addService = new Array();
	var holder3 = "";
	var x3 = 0;

		
		if(document.BOL.ASCheckbox[0].checked){addService[x3] = document.BOL.ASCheckbox[0].value;x3++;}
		if(document.BOL.ASCheckbox[1].checked){addService[x3] = document.BOL.ASCheckbox[1].value;x3++;}
		if(document.BOL.ASCheckbox[2].checked){addService[x3] = document.BOL.ASCheckbox[2].value;x3++;}
		if(document.BOL.ASCheckbox[3].checked){addService[x3] = document.BOL.ASCheckbox[3].value;x3++;}
		if(document.BOL.ASCheckbox[4].checked){addService[x3] = document.BOL.ASCheckbox[4].value;x3++;}
		if(document.BOL.ASCheckbox[5].checked){addService[x3] = document.BOL.ASCheckbox[5].value;x3++;}
		if(document.BOL.ASCheckbox[6].checked){addService[x3] = document.BOL.ASCheckbox[6].value;x3++;}
		if(document.BOL.ASCheckbox[7].checked){addService[x3] = document.BOL.ASCheckbox[7].value;x3++;}
		if(document.BOL.ASCheckbox[8].checked){addService[x3] = document.BOL.ASCheckbox[8].value;x3++;}
		if(document.BOL.ASCheckbox[9].checked){addService[x3] = document.BOL.ASCheckbox[9].value;x3++;}
		if(document.BOL.ASCheckbox[10].checked){addService[x3] = document.BOL.ASCheckbox[10].value;x3++;}
		if(document.BOL.ASCheckbox[11].checked){addService[x3] = document.BOL.ASCheckbox[11].value;x3++;}
		if(document.BOL.ASCheckbox[12].checked){addService[x3] = document.BOL.ASCheckbox[12].value;x3++;}
		if(document.BOL.ASCheckbox[13].checked){addService[x3] = document.BOL.ASCheckbox[13].value;x3++;}
		if(document.BOL.ASCheckbox[14].checked){addService[x3] = document.BOL.ASCheckbox[14].value;x3++;}
		if(document.BOL.ASCheckbox[15].checked){addService[x3] = document.BOL.ASCheckbox[15].value;x3++;}
		if(document.BOL.ASCheckbox[16].checked){addService[x3] = document.BOL.ASCheckbox[16].value;x3++;}
		if(document.BOL.ASCheckbox[17].checked){addService[x3] = document.BOL.ASCheckbox[17].value;x3++;}
		if(document.BOL.ASCheckbox[18].checked){addService[x3] = document.BOL.ASCheckbox[18].value;x3++;}
		if(document.BOL.ASCheckbox[19].checked){addService[x3] = document.BOL.ASCheckbox[19].value;x3++;}
		if(document.BOL.ASCheckbox[20].checked){addService[x3] = document.BOL.ASCheckbox[20].value;x3++;}

	
	//alert(addService.length);
	
	if(addService.length > 0){
		holder3 = "Additional services selected:";
		holder3 = holder3 + "<ul>";
		for(w=0;w<addService.length;w++){
			holder3 = holder3 + "<li>" + addService[w] + "</li>";
		}
		holder3 = holder3 + "</ul>";
		document.getElementById('contentAdditional').innerHTML = holder3;
	}else{
		document.getElementById('contentAdditional').innerHTML = "No additional services selected.";	
	}
//////////////////
// Copy
//////////////////
var copyofholder = "";
document.getElementById('conentCopyEmail').innerHTML = document.BOL.ADDC.value;
if(document.BOL.do_not_send.checked){
	document.getElementById('contentCopyNo').innerHTML = "<i>(BOL will not be sent to terminal)</i>";	
}else{
	document.getElementById('contentCopyNo').innerHTML = "";	
}
copyofholder = "<ul>"
if(document.BOL.SC.checked){copyofholder = copyofholder + "<li>" + document.BOL.SC.value + "</li>";}
if(document.BOL.CC.checked){copyofholder = copyofholder + "<li>" + document.BOL.CC.value + "</li>";}
if(document.BOL.TPC.checked){copyofholder = copyofholder + "<li>" + document.BOL.TPC.value + "</li>";}
if(document.BOL.Other.checked){copyofholder = copyofholder + "<li>" + document.BOL.Other.value + "</li>";}

if(copyofholder == ""){
	document.getElementById('contentCopyOf').innerHTML = "No copies selected"; 
}else{
document.getElementById('contentCopyOf').innerHTML = copyofholder; 
}
}
function cancel(){
	return true;
}
function one(){
	document.getElementById('PAGE1').style.display='block';
	document.getElementById('PAGE2').style.display='none';
	document.getElementById('PAGE3').style.display='none';
	document.getElementById('PAGE4').style.display='none';
	document.getElementById('PAGE5').style.display='none';
	
	document.getElementById('navlist').innerHTML = "<li id='active'><a href='javascript:one();'>To Begin</a></li><li><a href='javascript:two();'>Address Information</a></li><li><a href='javascript:three();'>About Shipment Pt. 1</a></li><li><a href='javascript:four();'>About Shipment Pt. 2</a></li><li><a href='javascript:five();'>Conclusion</a></li>";
}
function two(){
	document.getElementById('PAGE2').style.display='block';
	document.getElementById('PAGE1').style.display='none';
	document.getElementById('PAGE3').style.display='none';
	document.getElementById('PAGE4').style.display='none';
	document.getElementById('PAGE5').style.display='none';
	
	document.getElementById('navlist').innerHTML = "<li><a href='javascript:one();'>To Begin</a></li><li id='active'><a href='javascript:two();'>Address Information</a></li><li><a href='javascript:three();'>About Shipment Pt. 1</a></li><li><a href='javascript:four();'>About Shipment Pt. 2</a></li><li><a href='javascript:five();'>Conclusion</a></li>";
}
function three(){
	document.getElementById('PAGE3').style.display='block';
	document.getElementById('PAGE1').style.display='none';
	document.getElementById('PAGE2').style.display='none';
	document.getElementById('PAGE4').style.display='none';
	document.getElementById('PAGE5').style.display='none';
	
	document.getElementById('navlist').innerHTML = "<li><a href='javascript:one();'>To Begin</a></li><li><a href='javascript:two();'>Address Information</a></li><li id='active'><a href='javascript:three();'>About Shipment Pt. 1</a></li><li><a href='javascript:four();'>About Shipment Pt. 2</a></li><li><a href='javascript:five();'>Conclusion</a></li>";
}
function four(){
	document.getElementById('PAGE4').style.display='block';
	document.getElementById('PAGE1').style.display='none';
	document.getElementById('PAGE2').style.display='none';
	document.getElementById('PAGE3').style.display='none';
	document.getElementById('PAGE5').style.display='none';
	
	document.getElementById('navlist').innerHTML = "<li><a href='javascript:one();'>To Begin</a></li><li><a href='javascript:two();'>Address Information</a></li><li><a href='javascript:three();'>About Shipment Pt. 1</a></li><li id='active'><a href='javascript:four();'>About Shipment Pt. 2</a></li><li><a href='javascript:five();'>Conclusion</a></li>";
}
function five(){
	document.getElementById('PAGE5').style.display='block';
	document.getElementById('PAGE1').style.display='none';
	document.getElementById('PAGE2').style.display='none';
	document.getElementById('PAGE3').style.display='none';
	document.getElementById('PAGE4').style.display='none';
	
	document.getElementById('navlist').innerHTML = "<li><a href='javascript:one();'>To Begin</a></li><li><a href='javascript:two();'>Address Information</a></li><li><a href='javascript:three();'>About Shipment Pt. 1</a></li><li><a href='javascript:four();'>About Shipment Pt. 2</a></li><li id='active'><a href='javascript:five();'>Conclusion</a></li>";
}
function showZip(){
	if(document.getElementById('ZIPDIV').style.display == 'none'){
		document.getElementById('ZIPDIV').style.display = 'block';
		document.getElementById('ZIPDIVLINK').innerHTML = 'Hide Zipcode Pickups';
	}else{
		document.getElementById('ZIPDIV').style.display = 'none';
		document.getElementById('ZIPDIVLINK').innerHTML = 'Show Zipcode Pickups';	
	}
}
function ADCChange(){
    if (document.BOL.Other.checked) {
		document.getElementById('ADDCDiv').style.display = 'block';	
	}else{
		document.getElementById('ADDCDiv').style.display = 'none';
	}
}

function checkErrors(section){
	if (section == "ShipperInfo"){
		var e = false;
		if(document.BOL.ShipName.value == ''){alert('Shipper company name must be filled in.');	e = 'True';}
		if(document.BOL.ContactName.value == ''){alert('Shipper contact name must be filled in.');e = 'True';}
		if(document.BOL.ShipAddress.value == ''){alert('Shipper address must be filled in.');e = 'True';}
		if(document.BOL.ShipCity.value == ''){alert('Shipper city must be filled in.');	e = 'True';}
		if(document.BOL.ShipState.selectedIndex == '0'){alert('Shipper state must be selected.'); e = 'True';}
		if(document.BOL.ShipZip.value == ''){alert('Shipper zip must be filled in.'); e = 'True';}
		if(document.BOL.ShipPhone.value == ''){alert('Shipper phone must be filled in.'); e = 'True';}
		
		if(isPhone(document.BOL.ShipPhone.value) == false){ alert('Shipper Phone is not a valid format. Please complete this field'); e = 'True';}
		if(document.BOL.ShipEmail.value == ''){alert('Shipper email must be filled in.'); e = 'True';}
		if(document.BOL.ShipEmail.value.indexOf('@') < '1'){ alert('Shipper email is not a valid Email. Please complete this field.'); e = 'True';}
		if(document.BOL.ShipEmail.value.indexOf('.') < '1'){ alert('Shipper email is not a valid Email. Please complete this field.'); e = 'True';}
		if(document.BOL.freighttime.value == ''){alert('Shipper freight time must be filled in.');	e = 'True';}
		if(document.BOL.closepickuptime.value == ''){alert('Shipper pickup time must be filled in.');	e = 'True';}
		
		if(e){
			shoh('ShipperInfo');
			shoh('ConsigneeInfo');
		}
		
	}
	
	if (section == "ConsigneeInfo"){
		
		if(document.BOL.ConName.value == ""){alert('Consignee company must be filled in.'); e = 'True';}	
		if(document.BOL.ConAddress.value == ""){alert('Consignee address must be filled in.'); e = 'True';}
		if(document.BOL.ConCity.value == ""){alert('Consignee city must be filled in.'); e = 'True';}
		if(document.BOL.ConState.selectedIndex == '0'){alert('Consignee state must be selected.'); e = 'True';}
		if(document.BOL.ConZip.value == ''){alert('Consignee zip must be filled in.'); e = 'True';}	

	if(e){
			
			shoh('ConsigneeInfo');
			shoh('ThirdPartyInfo');
		}
	
	}
	
	if (section == "RefNumbers"){
	
		if((document.BOL.BolNum.value == "") && (document.BOL.chkGenerateBOL.checked == false)){alert('BOL Number must be filled in.'); e = 'True';}	
		
		// this is handled differently than other sections b/c also needs to control going to next tabbed page
	    if(e){
			return false;
		}
		else {
		    return true;
		}
	}
	
	if (section == "CODRem"){
	
	    // check for valid currency amount
	    if (document.BOL.CODAmount.value != "") {
	        if (validCurrency("CODAmount") != true) {e = 'True';}
	        if (document.BOL.CODAmount.value > 9999) {alert('COD Amount cannot be > 9999'); e = 'True';}
	        if (!(document.BOL.COD[0].checked || document.BOL.COD[1].checked)) {alert('A COD fee type must be selected'); e = 'True';}
	        if (document.BOL.CODName.value == "") {alert("Company Name is required"); e = 'True';}
	        if (document.BOL.CODAddress.value == "") {alert("Company Address is required"); e = 'True';}
	        if (document.BOL.CODCity.value == "") {alert("Company City is required"); e = 'True';}
	        if (document.BOL.CODState.value == "") {alert("Company State is required"); e = 'True';}
	        if (document.BOL.CODZip.value == "") {alert("Company Zip is required"); e = 'True';}
	        if (!(document.BOL.CODUSA[0].checked || document.BOL.CODUSA[1].checked)) {alert('A COD Country must be selected'); e = 'True';}
	    }
	    if(e){
			return false;
		}
		else {
		    return true;
		}
	}
	
	if (section == "Commodities"){
	
	    // at least 1 commodity line required
	    //at least 1 commodity is required so start by checking first line
	    if (document.BOL.HU1.value == "" && document.BOL.HUT1.value == "------" && document.BOL.P1.value == "" && document.BOL.PT1.value == "------")
	    {
	        alert("A Commodity Handling Unit #/Type or a Package Unit #/Type is required");
	        e = 'True';
	    }
	    else
	    {
	        //should be either handling unit # and type or packaging unit# and type
	        if ((document.BOL.HU1.value == "" || document.BOL.HUT1.value == "------") && (document.BOL.P1.value == "" || document.BOL.PT1.value == "------"))
	        {
	            alert("A Commodity Handling Unit # and Type or a Package Unit# and Type is required");
	            e = 'True';
	        }
	    }
    	
	    if (document.BOL.Weight1.value == "")
	    {
	        alert("A commodity weight is required");
	        e = 'True';
	    }
    	
	    if (document.BOL.C1.value == "------")
	    {
	        alert("A commodity class is required");
	        e = 'True';
	    }
    	
	    if (document.BOL.DESC1.value == "")
	    {
	        alert("A commodity description is required");
	        e = 'True';
	    }
		
		if (document.BOL.Haz1.checked == true)
		{
		    if (document.BOL.NMFC1.value == "")
		    {
		        alert ("NMFC Item 1 is required when Hazardous Materials Checkbox 1 is selected.");
			    e = 'True'; 
			}
			if (document.BOL.Sub1.value == "")
			{
			    alert ("NMFC Sub 1 is required when Hazardous Materials Checkbox 1 is selected");
			    e = 'True'; 
			}

			if (document.BOL.HazMatContact.value == "")
			{
			    alert("The emergency contact name is required when Hazardous Materials Checkbox 1 is selected");
			    e = 'True';
			}
			if (document.BOL.HazMatPhone.value == "")
			{
			    alert("The emergency contact phone# is required when Hazardous Materials Checkbox 1 is selected");
			    e = 'True';
			}
		}	
		   
		if (document.BOL.Haz2.checked == true)
		{
		    if (document.BOL.NMFC2.value == "")
		    {
		        alert ("NMFC Item 2 is required when Hazardous Materials Checkbox 2 is selected.");
			    e = 'True'; 
			}
			if (document.BOL.Sub2.value == "")
			{
			    alert ("NMFC Sub 2 is required when Hazardous Materials Checkbox 2 is selected");
			    e = 'True'; 
			}

			if (document.BOL.HazMatContact.value == "")
			{
			    alert("The emergency contact name is required when Hazardous Materials Checkbox 2 is selected");
			    e = 'True';
			}
			if (document.BOL.HazMatPhone.value == "")
			{
			    alert("The emergency contact phone# is required when Hazardous Materials Checkbox 2 is selected");
			    e = 'True';
			}
		}
			
		if (document.BOL.Haz3.checked == true)
		{
		    if (document.BOL.NMFC3.value == "")
		    {
		        alert ("NMFC Item 3 is required when Hazardous Materials Checkbox 3 is selected.");
			    e = 'True'; 
			}
			if (document.BOL.Sub3.value == "")
			{
			    alert ("NMFC Sub 3 is required when Hazardous Materials Checkbox 3 is selected");
			    e = 'True'; 
			}

			if (document.BOL.HazMatContact.value == "")
			{
			    alert("The emergency contact name is required when Hazardous Materials Checkbox 3 is selected");
			    e = 'True';
			}
			if (document.BOL.HazMatPhone.value == "")
			{
			    alert("The emergency contact phone# is required when Hazardous Materials Checkbox 3 is selected");
			    e = 'True';
			}
		}	
		   
		if (document.BOL.Haz4.checked == true)
		{
		    if (document.BOL.NMFC4.value == "")
		    {
		        alert ("NMFC Item 4 is required when Hazardous Materials Checkbox 4 is selected.");
			    e = 'True'; 
			}
			if (document.BOL.Sub4.value == "")
			{
			    alert ("NMFC Sub 4 is required when Hazardous Materials Checkbox 4 is selected");
			    e = 'True'; 
			}

			if (document.BOL.HazMatContact.value == "")
			{
			    alert("The emergency contact name is required when Hazardous Materials Checkbox 4 is selected");
			    e = 'True';
			}
			if (document.BOL.HazMatPhone.value == "")
			{
			    alert("The emergency contact phone# is required when Hazardous Materials Checkbox 4 is selected");
			    e = 'True';
			}
		}	
		   
		if (document.BOL.Haz5.checked == true)
		{
		    if (document.BOL.NMFC5.value == "")
		    {
		        alert ("NMFC Item 5 is required when Hazardous Materials Checkbox 5 is selected.");
			    e = 'True'; 
			}
			if (document.BOL.Sub5.value == "")
			{
			    alert ("NMFC Sub 5 is required when Hazardous Materials Checkbox 5 is selected");
			    e = 'True'; 
			}

			if (document.BOL.HazMatContact.value == "")
			{
			    alert("The emergency contact name is required when Hazardous Materials Checkbox 5 is selected");
			    e = 'True';
			}
			if (document.BOL.HazMatPhone.value == "")
			{
			    alert("The emergency contact phone# is required when Hazardous Materials Checkbox 5 is selected");
			    e = 'True';
			}
		}	
		
		if (document.BOL.Haz6.checked == true)
		{
		    if (document.BOL.NMFC6.value == "")
		    {
		        alert ("NMFC Item 6 is required when Hazardous Materials Checkbox 6 is selected.");
			    e = 'True'; 
			}
			if (document.BOL.Sub6.value == "")
			{
			    alert ("NMFC Sub 6 is required when Hazardous Materials Checkbox 6 is selected");
			    e = 'True'; 
			}

			if (document.BOL.HazMatContact.value == "")
			{
			    alert("The emergency contact name is required when Hazardous Materials Checkbox 6 is selected");
			    e = 'True';
			}
			if (document.BOL.HazMatPhone.value == "")
			{
			    alert("The emergency contact phone# is required when Hazardous Materials Checkbox 6 is selected");
			    e = 'True';
			}
		}	
		
		if (document.BOL.Haz7.checked == true)
		{
		    if (document.BOL.NMFC7.value == "")
		    {
		        alert ("NMFC Item 7 is required when Hazardous Materials Checkbox 7 is selected.");
			    e = 'True'; 
			}
			if (document.BOL.Sub7.value == "")
			{
			    alert ("NMFC Sub 7 is required when Hazardous Materials Checkbox 7 is selected");
			    e = 'True'; 
			}

			if (document.BOL.HazMatContact.value == "")
			{
			    alert("The emergency contact name is required when Hazardous Materials Checkbox 7 is selected");
			    e = 'True';
			}
			if (document.BOL.HazMatPhone.value == "")
			{
			    alert("The emergency contact phone# is required when Hazardous Materials Checkbox 7 is selected");
			    e = 'True';
			}
		}	
		
		if (document.BOL.Haz8.checked == true)
		{
		    if (document.BOL.NMFC8.value == "")
		    {
		        alert ("NMFC Item 8 is required when Hazardous Materials Checkbox 8 is selected.");
			    e = 'True'; 
			}
			if (document.BOL.Sub8.value == "")
			{
			    alert ("NMFC Sub 8 is required when Hazardous Materials Checkbox 8 is selected");
			    e = 'True'; 
			}

			if (document.BOL.HazMatContact.value == "")
			{
			    alert("The emergency contact name is required when Hazardous Materials Checkbox 8 is selected");
			    e = 'True';
			}
			if (document.BOL.HazMatPhone.value == "")
			{
			    alert("The emergency contact phone# is required when Hazardous Materials Checkbox 8 is selected");
			    e = 'True';
			}
		}	
		
		if (document.BOL.Haz9.checked == true)
		{
		    if (document.BOL.NMFC9.value == "")
		    {
		        alert ("NMFC Item 9 is required when Hazardous Materials Checkbox 9 is selected.");
			    e = 'True'; 
			}
			if (document.BOL.Sub9.value == "")
			{
			    alert ("NMFC Sub 9 is required when Hazardous Materials Checkbox 9 is selected");
			    e = 'True'; 
			}

			if (document.BOL.HazMatContact.value == "")
			{
			    alert("The emergency contact name is required when Hazardous Materials Checkbox 9 is selected");
			    e = 'True';
			}
			if (document.BOL.HazMatPhone.value == "")
			{
			    alert("The emergency contact phone# is required when Hazardous Materials Checkbox 9 is selected");
			    e = 'True';
			}
		}	
		
		if (document.BOL.Haz10.checked == true)
		{
		    if (document.BOL.NMFC10.value == "")
		    {
		        alert ("NMFC Item 10 is required when Hazardous Materials Checkbox 10 is selected.");
			    e = 'True'; 
			}
			if (document.BOL.Sub10.value == "")
			{
			    alert ("NMFC Sub 10 is required when Hazardous Materials Checkbox 10 is selected");
			    e = 'True'; 
			}

			if (document.BOL.HazMatContact.value == "")
			{
			    alert("The emergency contact name is required when Hazardous Materials Checkbox 10 is selected");
			    e = 'True';
			}
			if (document.BOL.HazMatPhone.value == "")
			{
			    alert("The emergency contact phone# is required when Hazardous Materials Checkbox 10 is selected");
			    e = 'True';
			}
		}	
		//this stops the Commodities section from saving and closing and also stops the Shipment Specifics section from opening
	    if(e){
			
			shoh('Commodities');
			shoh('ShipmentSpecifics');
		}	
	}
}

// phone number - strip out delimiters and check for 10 digits

function checkPhoneNumber (strng) {
var error = "";

if (strng == "") {
   error = "You didn't enter a phone number.\n";
}

var stripped = strng.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters
    if (isNaN(parseInt(stripped))) {
       error = "The phone number contains illegal characters.";
  
    }
    if (!(stripped.length == 10)) {
	error = "Please enter phone number in a format of ###-###-####.";
    } 

if(error != "") { 
	alert(error);
	
	//shoh('RequestInfo');
	//shoh('ShipperInfo');
	//one();
	return false;
	//strng.focus();
}else{
	return true;	
}
}

function checkUserEmail (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter an email address.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "The email address contains illegal characters.\n";
       }
    }
if(error != "") { 
	alert(error);
	
	return false;
}else{
	return true;	
} 
}

function validCurrency(strFieldName)
{
    var fldCheck = eval('document.forms[0].' + strFieldName);
    var exp = "^[-]?([1-9]{1}[0-9]{0,}(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|\.[0-9]{1,2})$";
    
    if(fldCheck.value.match(exp))
        return true;
    else
    {
        alert("Valid Currency field can only contain numbers plus a decimal - ####.##");
        return false;
    }
}