function CheckReset() {
var answer = confirm ("By clicking 'OK' you will reset and clear this form.")
if (answer)
	return true;
else
	return false;
}

// ***** Next Page Function *****
function GoNextPages1() {
    var form = document.forms[0];

    // Hide the last one, and flip the tab color back.
    currShow.style.visibility = 'hidden';

    var header = 'tab12'
    var target = ('T12');

    if (lastHeader) { 
	lastHeader.style.background = tab_off; 
	lastHeader.style.fontWeight="normal";
    }

    // Show this one, and make the tab silver
    document.all[target].style.visibility = 'visible';
    document.all[header].style.background = tab_on;
    document.all[header].style.fontWeight = 'bold';

    // Save for next go'round
    currShow=document.all[target];
    lastHeader=document.all[header];
			 
    form.txtRequest_Name.focus(); 
}

function GoNextPages2() {
var form = document.forms[0];
	// Hide the last one, and flip the tab color back.
				 currShow.style.visibility = 'hidden';
                    var header = 'tab13'
					var target = ('T13');
					if (lastHeader) { 
                        lastHeader.style.background = tab_off; 
                        lastHeader.style.fontWeight="normal";
                    }

                    // Show this one, and make the tab silver
                    document.all[target].style.visibility = 'visible';
                    document.all[header].style.background = tab_on;
                    document.all[header].style.fontWeight = 'bold';

                    // Save for next go'round
                    currShow=document.all[target];
                    lastHeader=document.all[header];
			 
			 form.ShipName.focus(); 
}

function GoNextPages3() {
var form = document.forms[0];
	// Hide the last one, and flip the tab color back.
				 currShow.style.visibility = 'hidden';
                    var header = 'tab14'
					var target = ('T14');
					if (lastHeader) { 
                        lastHeader.style.background = tab_off; 
                        lastHeader.style.fontWeight="normal";
                    }

                    // Show this one, and make the tab silver
                    document.all[target].style.visibility = 'visible';
                    document.all[header].style.background = tab_on;
                    document.all[header].style.fontWeight = 'bold';

                    // Save for next go'round
                    currShow=document.all[target];
                    lastHeader=document.all[header];
			 
			 form.ConName.focus(); 
}

function GoNextPages4() {
var form = document.forms[0];
	// Hide the last one, and flip the tab color back.
				 currShow.style.visibility = 'hidden';
                    var header = 'tab21'
					var target = ('T21');
					if (lastHeader) { 
                        lastHeader.style.background = tab_off; 
                        lastHeader.style.fontWeight="normal";
                    }

                    // Show this one, and make the tab silver
                    document.all[target].style.visibility = 'visible';
                    document.all[header].style.background = tab_on;
                    document.all[header].style.fontWeight = 'bold';

                    // Save for next go'round
                    currShow=document.all[target];
                    lastHeader=document.all[header];
			 
			 form.TPName.focus(); 
}

function GoNextPages5() {
var form = document.forms[0];
	// Hide the last one, and flip the tab color back.
				 currShow.style.visibility = 'hidden';
                    var header = 'tab22'
					var target = ('T22');
					if (lastHeader) { 
                        lastHeader.style.background = tab_off; 
                        lastHeader.style.fontWeight="normal";
                    }

                    // Show this one, and make the tab silver
                    document.all[target].style.visibility = 'visible';
                    document.all[header].style.background = tab_on;
                    document.all[header].style.fontWeight = 'bold';

                    // Save for next go'round
                    currShow=document.all[target];
                    lastHeader=document.all[header];
			 
			 form.CODAmont.focus(); 
}

function GoNextPages6() {
var form = document.forms[0];
	// Hide the last one, and flip the tab color back.
				 currShow.style.visibility = 'hidden';
                    var header = 'tab23'
					var target = ('T23');
					if (lastHeader) { 
                        lastHeader.style.background = tab_off; 
                        lastHeader.style.fontWeight="normal";
                    }

                    // Show this one, and make the tab silver
                    document.all[target].style.visibility = 'visible';
                    document.all[header].style.background = tab_on;
                    document.all[header].style.fontWeight = 'bold';

                    // Save for next go'round
                    currShow=document.all[target];
                    lastHeader=document.all[header];
			 
			 form.HU1.focus(); 
}

function GoNextPages7() {
var form = document.forms[0];
	// Hide the last one, and flip the tab color back.
				 currShow.style.visibility = 'hidden';
                    var header = 'tab24'
					var target = ('T24');
					if (lastHeader) { 
                        lastHeader.style.background = tab_off; 
                        lastHeader.style.fontWeight="normal";
                    }

                    // Show this one, and make the tab silver
                    document.all[target].style.visibility = 'visible';
                    document.all[header].style.background = tab_on;
                    document.all[header].style.fontWeight = 'bold';

                    // Save for next go'round
                    currShow=document.all[target];
                    lastHeader=document.all[header];
			 
			 form.shipDate.focus(); 
}

function GoNextPages8() {
var form = document.forms[0];
	// Hide the last one, and flip the tab color back.
				 currShow.style.visibility = 'hidden';
                    var header = 'tab31'
					var target = ('T31');
					if (lastHeader) { 
                        lastHeader.style.background = tab_off; 
                        lastHeader.style.fontWeight="normal";
                    }

                    // Show this one, and make the tab silver
                    document.all[target].style.visibility = 'visible';
                    document.all[header].style.background = tab_on;
                    document.all[header].style.fontWeight = 'bold';

                    // Save for next go'round
                    currShow=document.all[target];
                    lastHeader=document.all[header];
			 
			 form.BolNum.focus(); 
}

function GoNextPages9() {
var form = document.forms[0];
	// Hide the last one, and flip the tab color back.
				 currShow.style.visibility = 'hidden';
                    var header = 'tab32'
					var target = ('T32');
					if (lastHeader) { 
                        lastHeader.style.background = tab_off; 
                        lastHeader.style.fontWeight="normal";
                    }

                    // Show this one, and make the tab silver
                    document.all[target].style.visibility = 'visible';
                    document.all[header].style.background = tab_on;
                    document.all[header].style.fontWeight = 'bold';

                    // Save for next go'round
                    currShow=document.all[target];
                    lastHeader=document.all[header];
			 
			 form.ALCDV.focus(); 
}

function GoNextPages10() {
var form = document.forms[0];
	// Hide the last one, and flip the tab color back.
				 currShow.style.visibility = 'hidden';
                    var header = 'tab33'
					var target = ('T33');
					if (lastHeader) { 
                        lastHeader.style.background = tab_off; 
                        lastHeader.style.fontWeight="normal";
                    }

                    // Show this one, and make the tab silver
                    document.all[target].style.visibility = 'visible';
                    document.all[header].style.background = tab_on;
                    document.all[header].style.fontWeight = 'bold';

                    // Save for next go'round
                    currShow=document.all[target];
                    lastHeader=document.all[header];
			 
	}

function GoNextPages11() {
var form = document.forms[0];
	// Hide the last one, and flip the tab color back.
				 currShow.style.visibility = 'hidden';
                    var header = 'tab34'
					var target = ('T34');
					if (lastHeader) { 
                        lastHeader.style.background = tab_off; 
                        lastHeader.style.fontWeight="normal";
                    }

                    // Show this one, and make the tab silver
                    document.all[target].style.visibility = 'visible';
                    document.all[header].style.background = tab_on;
                    document.all[header].style.fontWeight = 'bold';

                    // Save for next go'round
                    currShow=document.all[target];
                    lastHeader=document.all[header];
			 
			 form.SC.focus(); 
}
//creates array for filling in saved shipper forms
function fill_shipper()
{
	if (document.BOL.selectPreviousShip.options[document.BOL.selectPreviousShip.selectedIndex].value != ""){ 
		var myDropdown=document.BOL.selectPreviousShip.options[document.BOL.selectPreviousShip.selectedIndex].value;
		var arrBOL=myDropdown.split("^");
		  //document.BOL.id.value = arrBOL[0];
		  document.BOL.ShipName.value = arrBOL[1];
		  document.BOL.ContactName.value = arrBOL[2];
		  document.BOL.ShipAddress.value = arrBOL[3];
		  document.BOL.ShipCity.value = arrBOL[4];
		  //document.BOL.ShipState.options[document.BOL.ShipState.selectedIndex].value = arrBOL[5];
		  document.BOL.ShipState.selectedIndex = findState(arrBOL[5]);
		  document.BOL.ShipZip.value = arrBOL[6];
		  document.BOL.ShipUSA.value = arrBOL[7];
		  document.BOL.ShipPhone.value = arrBOL[8];
		  document.BOL.ShipExt.value = arrBOL[9];
		  document.BOL.ShipEmail.value = arrBOL[10];
		  //document.BOL.type.value = arrBOL[11];
		  //document.BOL.userID.value = arrBOL[12];
	}
}

//creates array for filling in consignee forms
function fill_consignee()
{
	if (document.BOL.selectPreviousCon.options[document.BOL.selectPreviousCon.selectedIndex].value != ""){ 
		var myDropdown=document.BOL.selectPreviousCon.options[document.BOL.selectPreviousCon.selectedIndex].value;
		var arrBOL=myDropdown.split("^");
		  //document.BOL.id.value = arrBOL[0];
		  document.BOL.ConName.value = arrBOL[1];
		  document.BOL.ConsigneeName2.value = arrBOL[2];
		  document.BOL.ConAddress.value = arrBOL[3];
		  document.BOL.ConCity.value = arrBOL[4];
		  //document.BOL.ConState.options[document.BOL.ConState.selectedIndex].value = arrBOL[5];
		  document.BOL.ConState.selectedIndex = findState(arrBOL[5]);
		  document.BOL.ConZip.value = arrBOL[6];
		  document.BOL.ConUSA.value = arrBOL[7];
		  document.BOL.ConPhone.value = arrBOL[8];
		  document.BOL.ConExt.value = arrBOL[9];
		  document.BOL.ConEmail.value = arrBOL[10];
		  //document.BOL.type.value = arrBOL[11];
		  //document.BOL.userID.value = arrBOL[12];
	}
}

//creates array for filling in third party forms
function fill_TP()
{
	if (document.BOL.selectPreviousTP.options[document.BOL.selectPreviousTP.selectedIndex].value != ""){ 
		var myDropdown=document.BOL.selectPreviousTP.options[document.BOL.selectPreviousTP.selectedIndex].value;
		var arrBOL=myDropdown.split("^");
		  //document.BOL.id.value = arrBOL[0];
		  document.BOL.TPName.value = arrBOL[1];
		  document.BOL.TPContact.value = arrBOL[2];
		  document.BOL.TPAddress.value = arrBOL[3];
		  document.BOL.TPCity.value = arrBOL[4];
		  //document.BOL.TPState.options[document.BOL.TPState.selectedIndex].value = arrBOL[5];
		  document.BOL.TPState.selectedIndex = findState(arrBOL[5]);
		  document.BOL.TPZip.value = arrBOL[6];
		  document.BOL.TPUSA.value = arrBOL[7];
		  document.BOL.TPPhone.value = arrBOL[8];
		  document.BOL.TPExt.value = arrBOL[9];
		  document.BOL.TPEmail.value = arrBOL[10];
		  //document.BOL.type.value = arrBOL[11];
		  //document.BOL.userID.value = arrBOL[12];
	}
}
//////////////////////////////////////////////
// creates array for filling in commodities //
//////////////////////////////////////////////
function fill_comm1()
{
	if (document.BOL.selectPreviousComm1.options[document.BOL.selectPreviousComm1.selectedIndex].value != ""){ 
		var myDropdown=document.BOL.selectPreviousComm1.options[document.BOL.selectPreviousComm1.selectedIndex].value;
		var arrBOL=myDropdown.split("~~~");
		  document.BOL.NMFC1.value = arrBOL[0];
		  document.BOL.Sub1.value = arrBOL[1];
		  document.BOL.DESC1.value = arrBOL[2];
		  document.BOL.C1.selectedIndex = findClass(arrBOL[3]);	
	}
}
function fill_comm2()
{
	if (document.BOL.selectPreviousComm2.options[document.BOL.selectPreviousComm2.selectedIndex].value != ""){ 
		var myDropdown=document.BOL.selectPreviousComm2.options[document.BOL.selectPreviousComm2.selectedIndex].value;
		var arrBOL=myDropdown.split("~~~");
		  document.BOL.NMFC2.value = arrBOL[0];
		  document.BOL.Sub2.value = arrBOL[1];
		  document.BOL.DESC2.value = arrBOL[2];
		  document.BOL.C2.selectedIndex = findClass(arrBOL[3]);	
		
	}
}
function fill_comm3()
{
	if (document.BOL.selectPreviousComm3.options[document.BOL.selectPreviousComm3.selectedIndex].value != ""){ 
		var myDropdown=document.BOL.selectPreviousComm3.options[document.BOL.selectPreviousComm3.selectedIndex].value;
		var arrBOL=myDropdown.split("~~~");
		  document.BOL.NMFC3.value = arrBOL[0];
		  document.BOL.Sub3.value = arrBOL[1];
		  document.BOL.DESC3.value = arrBOL[2];
		  document.BOL.C3.selectedIndex = findClass(arrBOL[3]);	
		
	}
}
function fill_comm4()
{
	if (document.BOL.selectPreviousComm4.options[document.BOL.selectPreviousComm4.selectedIndex].value != ""){ 
		var myDropdown=document.BOL.selectPreviousComm4.options[document.BOL.selectPreviousComm4.selectedIndex].value;
		var arrBOL=myDropdown.split("~~~");
		  document.BOL.NMFC4.value = arrBOL[0];
		  document.BOL.Sub4.value = arrBOL[1];
		  document.BOL.DESC4.value = arrBOL[2];
		  document.BOL.C4.selectedIndex = findClass(arrBOL[3]);	
		
	}
}
function fill_comm5()
{
	if (document.BOL.selectPreviousComm5.options[document.BOL.selectPreviousComm5.selectedIndex].value != ""){ 
		var myDropdown=document.BOL.selectPreviousComm5.options[document.BOL.selectPreviousComm5.selectedIndex].value;
		var arrBOL=myDropdown.split("~~~");
		  document.BOL.NMFC5.value = arrBOL[0];
		  document.BOL.Sub5.value = arrBOL[1];
		  document.BOL.DESC5.value = arrBOL[2];
		  document.BOL.C5.selectedIndex = findClass(arrBOL[3]);	
		
	}
}
function fill_comm6()
{
	if (document.BOL.selectPreviousComm6.options[document.BOL.selectPreviousComm6.selectedIndex].value != ""){ 
		var myDropdown=document.BOL.selectPreviousComm6.options[document.BOL.selectPreviousComm6.selectedIndex].value;
		var arrBOL=myDropdown.split("~~~");
		  document.BOL.NMFC6.value = arrBOL[0];
		  document.BOL.Sub6.value = arrBOL[1];
		  document.BOL.DESC6.value = arrBOL[2];
		  document.BOL.C6.selectedIndex = findClass(arrBOL[3]);	
		
	}
}
function fill_comm7()
{
	if (document.BOL.selectPreviousComm7.options[document.BOL.selectPreviousComm7.selectedIndex].value != ""){ 
		var myDropdown=document.BOL.selectPreviousComm7.options[document.BOL.selectPreviousComm7.selectedIndex].value;
		var arrBOL=myDropdown.split("~~~");
		  document.BOL.NMFC7.value = arrBOL[0];
		  document.BOL.Sub7.value = arrBOL[1];
		  document.BOL.DESC7.value = arrBOL[2];
		  document.BOL.C7.selectedIndex = findClass(arrBOL[3]);	
		
	}
}
function fill_comm8()
{
	if (document.BOL.selectPreviousComm8.options[document.BOL.selectPreviousComm8.selectedIndex].value != ""){ 
		var myDropdown=document.BOL.selectPreviousComm8.options[document.BOL.selectPreviousComm8.selectedIndex].value;
		var arrBOL=myDropdown.split("~~~");
		  document.BOL.NMFC8.value = arrBOL[0];
		  document.BOL.Sub8.value = arrBOL[1];
		  document.BOL.DESC8.value = arrBOL[2];
		  document.BOL.C8.selectedIndex = findClass(arrBOL[3]);
}
}
function fill_comm9()
{
	if (document.BOL.selectPreviousComm9.options[document.BOL.selectPreviousComm9.selectedIndex].value != ""){ 
		var myDropdown=document.BOL.selectPreviousComm9.options[document.BOL.selectPreviousComm9.selectedIndex].value;
		var arrBOL=myDropdown.split("~~~");
		  document.BOL.NMFC9.value = arrBOL[0];
		  document.BOL.Sub9.value = arrBOL[1];
		  document.BOL.DESC9.value = arrBOL[2];
		  document.BOL.C9.selectedIndex = findClass(arrBOL[3]);
}
}
function fill_comm10()
{
	if (document.BOL.selectPreviousComm10.options[document.BOL.selectPreviousComm10.selectedIndex].value != ""){ 
		var myDropdown=document.BOL.selectPreviousComm10.options[document.BOL.selectPreviousComm10.selectedIndex].value;
		var arrBOL=myDropdown.split("~~~");
		  document.BOL.NMFC10.value = arrBOL[0];
		  document.BOL.Sub10.value = arrBOL[1];
		  document.BOL.DESC10.value = arrBOL[2];
		  document.BOL.C10.selectedIndex = findClass(arrBOL[3]);	

	}
}

function findState(myState)
{
	var stateIndex = 0;
	var arrStates = new Array("Select One", "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "District of Columbia", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "PR", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming", "Canada", "Alberta", "British Columbia", "Manitoba", "New Brunswick", "Newfoundland", "Nova Scotia", "Ontario", "Prince Edward Isle", "Province of Quebec", "Saskatchewan", "Yukon");
	for (var x = 1; x < arrStates.length; x++)
   {
	   if(myState == arrStates[x]){
				stateIndex = x;
				//return x;
			}
   }
	return stateIndex;
}

function findClass(myClass) {
    var classIndex = 0;
    var arrClasses = new Array("------", "50", "55", "60", "65", "70", "77.5", "85", "92.5", "100", "110", "125", "150", "175", "200", "250", "300", "400", "500");
    for (var i = 1; i < arrClasses.length; i++) {
        if (myClass == arrClasses[i]) {
            classIndex = i
        }
    }
    return classIndex;
}
