/*
 ** File name: ctc.js
 ** Creation Date: 01/28/2008
 ** Description: Master Javascript file that uses namespace
 ** Revision	: $Revision: 1.5 $
 ** Modified by	: $Author: nnr8ssm $ $Date: 2009/06/17 23:52:19 $
 ** Checkout Tag	: $Name: V03_02_09 $
 **
 ** The use, disclosure, reproduction, modification, transfer, or transmittal
 ** of this work for any purpose in any form or by any means without the
 ** written permission of United Parcel Service is strictly prohibited.
 **
 ** Confidential, Unpublished Property of United Parcel Service.
 ** Use and Distribution Limited Solely to Authorized Personnel.
 **
 ** Copyright 2003 United Parcel Service of America, Inc. All Rights Reserved.
 */
(function(){

   timeOnlyCountries = {"countries" : ["AL","DZ","AS","AD","AO","AI","AG","AM","AW","AZ","AE","BD","BH","BB","BY","BZ","BJ","BM","BT","BO","BA","BW","VG","BN","BG","BF","BI","KH","CM","CV","KY","CF","TD","CO","CG","CK","HR","DJ","DM","EC","SV","GQ","ER","EE","ET","FO","FJ","GF","PF","GA","GM","GE","GH","GI","GL","GD","GP","GU","GN","GW","GY","HT","HN","IS","CI","JM","JO","KZ","KE","KI","KG","KW","LA","LV","LB","LS","LR","LI","LT","MK","MG","MW","MV","ML","MT","MH","MQ","MR","MU","FM","MD","MC","MN","MS","MA","MZ","MP","ME","NA","NP","AN","NC","NI","NE","NG","NF","PK","PW","PG","PY","PE","QA","RE","RW","RS","SM","SN","SC","SL","SI","SB","SA","ZA","LK","KN","LC","VC","SR","SZ","SY","TJ","TZ","TG","TO","TT","TN","TM","TC","TV","UG","UA","UY","VI","UZ","VU","VE","WF","WS","YE","ZM","ZW"]};
   euCountries = {"countries" : ["AT","BE","BG","CY","CZ","DE","DK","EE","EN","ES","FI","FR","GB","GP","GR","HU","IC","IE","IT","LT","LU","LV","MT","MQ","NB","NL","PL","PT","RE","RO","SE","SF","SI","SK","SW","WL","HO"]};
        

//////////////////////////////Time Only Function//////////////////////
function timeOnly(){
document.form1.quoteselected.value="transitTimeOnly";
document.getElementById("quick_time_cost_package_box").style.display = 'none';
document.getElementById("quick_time_cost_letter_box").style.display = 'none';
document.getElementById("detailed_time_cost_box").style.display = 'none';
document.getElementById("time_in_transit_box").style.display = 'block';

document.getElementById("detailed_time_cost_step3").style.display = 'none';
document.getElementById("noofpackagesLabel").style.display = 'block';
document.getElementById("noofpackagesValue").style.display = 'block';

document.getElementById("weightValue").style.display = 'block';
document.getElementById("weightLabelShip").style.display = 'block';
document.getElementById("weightLabelPack").style.display = 'none';
document.getElementById("sameValue").style.display = 'none';
document.getElementById("sameLabel").style.display = 'none';

if(document.getElementById("accountNumberLabel")!=null){
document.getElementById("accountNumberLabel").style.display = 'none';
}
if(document.getElementById("accountNumberField")!=null){
document.getElementById("accountNumberField").style.display = 'none';
}

var orig=getOrigin();
var dest=getDestination();

if(orig=="US" && dest=="US")
{
document.getElementById("weightValue").style.display = 'none';
document.getElementById("weightLabelShip").style.display = 'none';
document.form1.weight.value="1";
document.form1.weightType.value="LBS";
}else{
document.getElementById("weightValue").style.display = 'block';
document.getElementById("weightLabelShip").style.display = 'block';
//document.form1.weight.value="";
}

}
//////////////////////////////////////////////////////////////////////

/////////////////////////////quicktimeOnlyPackage//////////////////////////////////////////
function quicktimeOnlyPackage(){
document.form1.quoteselected.value="quickTimeCost";
document.form1.itsQuickquote.value="yes";
//document.form1.weight.value="";
document.form1.quickQuoteTypePackageLetter.value="package";
document.getElementById("quick_time_cost_package_box").style.display = 'block';
document.getElementById("quick_time_cost_letter_box").style.display = 'none';
document.getElementById("detailed_time_cost_box").style.display = 'none';
document.getElementById("time_in_transit_box").style.display = 'none';
document.getElementById("detailed_time_cost_step3").style.display = 'none';
document.getElementById("noofpackagesLabel").style.display = 'none';
document.getElementById("noofpackagesValue").style.display = 'none';
document.getElementById("weightValue").style.display = 'block';
document.getElementById("weightLabelShip").style.display = 'none';
document.getElementById("weightLabelPack").style.display = 'block';
document.getElementById("sameValue").style.display = 'none';
document.getElementById("sameLabel").style.display = 'none';

if(document.getElementById("accountNumberLabel")!=null){
document.getElementById("accountNumberLabel").style.display = 'block';
}
if(document.getElementById("accountNumberField")!=null){
document.getElementById("accountNumberField").style.display = 'block';
}
//jeevan CTC-July 08
if(document.form1.isModifyClicked.value == 'true'){
var weightForPacakge = document.form1.modWeight.value;
if(weightForPacakge  != 'null')
	document.form1.weight.value = weightForPacakge;
}
}///////////////////////////////////////////////////////////////////////

/////////////////////////////quicktimeOnlyLetter//////////////////////////////////////////
function quicktimeOnlyLetter(){
document.form1.quoteselected.value="quickTimeCost";
document.form1.itsQuickquote.value="yes";
document.form1.weight.value="1";
document.form1.weightType.value="LBS";
document.form1.quickQuoteTypePackageLetter.value="letter";
document.getElementById("quick_time_cost_package_box").style.display = 'none';
document.getElementById("quick_time_cost_letter_box").style.display = 'block';
document.getElementById("detailed_time_cost_box").style.display = 'none';
document.getElementById("time_in_transit_box").style.display = 'none';
document.getElementById("detailed_time_cost_step3").style.display = 'none';
document.getElementById("noofpackagesLabel").style.display = 'none';
document.getElementById("noofpackagesValue").style.display = 'none';
document.getElementById("weightValue").style.display = 'none';
document.getElementById("weightLabelShip").style.display = 'none';
document.getElementById("weightLabelPack").style.display = 'none';
document.getElementById("sameValue").style.display = 'none';
document.getElementById("sameLabel").style.display = 'none';

if(document.getElementById("accountNumberLabel")!=null){
document.getElementById("accountNumberLabel").style.display = 'block';
}
if(document.getElementById("accountNumberField")!=null){
document.getElementById("accountNumberField").style.display = 'block';
}
}
////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////timeCostOnly//////////////////////////////////////////
function timeCostOnly(){
document.form1.quoteselected.value="estimateTimeCost.x";
document.getElementById("quick_time_cost_package_box").style.display = 'none';
document.getElementById("quick_time_cost_letter_box").style.display = 'none';
document.getElementById("detailed_time_cost_box").style.display = 'block';
document.getElementById("time_in_transit_box").style.display = 'none';
document.getElementById("detailed_time_cost_step3").style.display = 'block';
document.getElementById("noofpackagesLabel").style.display = 'block';
document.getElementById("noofpackagesValue").style.display = 'block';
document.getElementById("weightValue").style.display = 'none';
document.getElementById("weightLabelShip").style.display = 'none';
document.getElementById("weightLabelPack").style.display = 'none';
document.getElementById("sameValue").style.display = 'none';
document.getElementById("sameLabel").style.display = 'none';

if(document.getElementById("accountNumberLabel")!=null){
document.getElementById("accountNumberLabel").style.display = 'block';
}
if(document.getElementById("accountNumberField")!=null){
document.getElementById("accountNumberField").style.display = 'block';
}

var requestor;

if(document.form1.IpaRequestor!=null)
 requestor=document.form1.IpaRequestor.value;


var origCC=getOrigin();
var destCC=getDestination();
var pkgNum=document.form1.packages.value;
var origZip=getOrigPostal();
var destZip=getDestPostal();
var origCity=getOrigCity();
var destCity=getDestCity();


 var nps = document.getElementById("numberPackagesSelect");
		if (nps != null)
		{
			if (nps.options != null)
			{
				var np = nps.options[nps.selectedIndex].value;
				var num=eval(np);
				if (num == 1){
		document.getElementById("sameValue").style.display = "none";
		document.getElementById("sameLabel").style.display = "none";
				}else if(num>1){
		document.getElementById("sameValue").style.display = "";
		document.getElementById("sameLabel").style.display = "";
         	}
            }
		}
var qtype=document.form1.quoteselected.value;
if(origCC=="US"||origCC=="PR"){
	document.form1.usPR.value="true";
 if(qtype=="estimateTimeCost.x")
  document.getElementById("international").style.display = 'block';

}else if(qtype=="estimateTimeCost.x"){
    document.getElementById("international").style.display = 'none';
	removeSelection();

}
if(requestor=="IpaRequestor"){
 document.getElementById("international").style.display = 'none';
removeSelection();
}

if(origCC == "VN" || destCC == "AF"){
document.getElementById("declaredValueField").style.display = 'none';
}else{
document.getElementById("declaredValueField").style.display = 'block';
}

//below is for modify option.---start
ctcAjaxCallFunction(origCC,destCC,pkgNum,origZip,destZip,origCity,destCity);

if(document.form1.isModifyClicked.value == 'true')
{//start of if condition for Modify Link
	if(document.form1.modWeight.value!='null')
		document.form1.weight1.value = document.form1.modWeight.value;
	if(document.form1.modWeightUnit.value != 'null')
		document.getElementById("weightDropDown").value = document.form1.modWeightUnit.value;
	if(document.form1.modDimUnit.value != 'null')
		document.getElementById("dimUnitDrop").value = document.form1.modDimUnit.value;


	if(document.form1.modLength.value!='null')
		document.form1.length1.value = document.form1.modLength.value;
	if(document.form1.modWidth.value!='null')
		document.form1.width1.value = document.form1.modWidth.value;
	if(document.form1.modHeight.value!='null')
		document.form1.height1.value = document.form1.modHeight.value;
	if(document.form1.modDeclValue.value!='null')
		document.form1.currency1.value = document.form1.modDeclValue.value;

	if(document.form1.modValueAdded.value != 'null')
		document.getElementById("valueAdded").checked = "checked";

	if(document.form1.modDropOfChoice.value != 'null')
	{
		if(document.form1.modDropOfChoice.value =='CC')
			document.getElementById("i_will_pay").checked="checked";
		else if(document.form1.modDropOfChoice.value =='DO')
			document.getElementById("i_will_drop_off").checked="checked";
		else
		{
			document.getElementById("i_will_schedule").checked="checked";
			document.form1.pickupMethod.value = document.form1.modPickUpMethod.value;
		}

	}

	if(document.form1.modDailyPickUp.value != 'null')
	{
		if(document.form1.modDailyPickUp.value =='YES')
			document.getElementById("dailyyes").checked="checked";
		else
			document.getElementById("dailyno").checked="checked";
	}
	var modCustomValue = document.form1.modCustomValue.value;
	if(modCustomValue  != 'null')
	{
		document.getElementById("currencyScalar").value = modCustomValue ;
	}
	

	
	if(document.form1.accType.value!=null && document.form1.accType.value=="01")
	{
	 document.getElementById("dailyPickupHideShow").style.display = 'none';
	}else{
	document.getElementById("dailyPickupHideShow").style.display = 'block';
	}
	
	//fix LAN issue
	
	
	if(document.form1.modRequestor.value!=null && document.form1.modRequestor.value=="LAN"){

	if(document.form1.modOrigCity.value!=null){
	document.form1.origCity.value=document.form1.modOrigCity.value;
	}
	
	if(document.form1.modOrigZip.value!=null){
	document.form1.origPostal.value=document.form1.modOrigZip.value;
	}
	
	
	}
	
	
	if(document.form1.modSameValue.value!=null){
	   var yn=document.form1.modSameValue.value;

	   if(yn=="NO"){
	   
	   for(var k =0;k<document.form1.sameValues.options.length;k++)
		{
		if(document.form1.sameValues.options[k].value == yn)
		{
		document.form1.sameValues.options[k].selected="SELECTED";
		}
    	}
    	var pkgType;
		if(document.form1.shipmentType!=null){
		pkgType=document.form1.shipmentType[0].checked;
		}
		document.getElementById("weightValue1").style.display = "none";
		document.getElementById("weightLabel1").style.display = "none";
		document.getElementById("packDimensions").style.display = "none";
		document.getElementById("enter_dimensions").style.display = "none";
		document.getElementById("valueAdded1").style.display = "none";
		document.getElementById("valueAdded").style.display = "none";
		document.form1.width1.value="";
		document.form1.height1.value="";
		document.form1.length1.value="";
		document.form1.weight1.value="";
		document.form1.currency1.value="";
		document.form1.valueAdded.checked=false;
		if(pkgType==false){
			document.getElementById("detailed_time_cost_step3").style.display = "none";
		}
		
	   }
	}
	
}//end of modify link

//end




}
//////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////isTimeOnly///////////////////////////////////////////////////
function isTimeOnly(orig){
//changed

   	var timeOnlyFlag = false;
	var len = timeOnlyCountries.countries.length;
		for (i=0;i<len;i++)
		{
			if (timeOnlyCountries.countries[i] == orig)
			{
				timeOnlyFlag = true;
				break;
			}
		}
		return timeOnlyFlag;
}
//////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////updateWeightAndDimensions///////////////////////////////////////////////////////////////////
function updateWeightAndDimensions(weight_dimension){

 var WeightUnitArray=weight_dimension.split("_");
 var weightUnit=WeightUnitArray[0];
 var dimensionUnit=WeightUnitArray[1];
 var origCountry=getOrigin();


 	 if(origCountry=="CA")
  	 {
	 document.getElementById("weightDropDown").style.display = "";
	 document.getElementById("kgsStatic").style.display = 'none';
	 document.getElementById("lbsStatic").style.display = 'none';
	 document.getElementById("dimUnitDrop").style.display = "";
	 document.getElementById("inStatic").style.display = 'none';
	 document.getElementById("cmStatic").style.display = 'none';
	 }

	 if(origCountry!="CA")
	 {
	 	if(weightUnit=="LBS")
	 	{
	 	  document.getElementById("lbsStatic").style.display ="";
		  document.getElementById("weightDropDown").style.display = "none";
	      document.getElementById("kgsStatic").style.display ="none";
          document.form1.weightType.value="LBS";
          document.form1.shipWeightUnit.value="LBS";

	 	}
	 	else if (weightUnit=="KGS")
	 	{
	 	 document.getElementById("lbsStatic").style.display ="none";
		 document.getElementById("kgsStatic").style.display ="";
         document.getElementById("weightDropDown").style.display = "none";
         document.form1.weightType.value="KGS";
         document.form1.shipWeightUnit.value="KGS";


	 	}

	 	if(dimensionUnit=="CM")
	 	{
	 	document.getElementById("dimUnitDrop").style.display = 'none';
	 	document.getElementById("inStatic").style.display = 'none';
	 	document.getElementById("cmStatic").style.display = "";
	 	document.form1.metricUnit.value="CM";
	 	document.form1.diUnit.value="CM";
	    }else if (dimensionUnit=="INCHES")
	    {
	    document.getElementById("dimUnitDrop").style.display = 'none';
	    document.getElementById("inStatic").style.display = "";
	    document.getElementById("cmStatic").style.display = 'none';
	    document.form1.metricUnit.value="IN";
	    document.form1.diUnit.value="IN";
	 	}
	 }
}
/////////////////////////////////updateDeclaredValue//////////////////////////////////////////////////////////////////

function updateDeclaredValue(decVal)
{
document.form1.origCurrency.value=decVal;
document.getElementById('declaredValueUnit').innerHTML =decVal;
}
///////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////createPackageList/////////////////////////////////////////////////////////

function createPackageList(list)
{

    for(i=document.form1.container.options.length-1;i>=0;i--)
	{
	document.form1.container.remove(i);
	}

	var packageListArray=list.split("_");
	 var optn = document.createElement("OPTION");
      optn.text = document.form1.selectpackaging.value;
	  optn.value = "-1";
	  document.form1.container.options.add(optn);

	for(i=0;i<packageListArray.length;i++)
	{
	if(packageListArray[i]=="02"){
      var optn = document.createElement("OPTION");
      optn.text = document.form1.mypacking.value;
	  optn.value = packageListArray[i];
	  document.form1.container.options.add(optn);
	}

    if(packageListArray[i]=="01"){
     var optn = document.createElement("OPTION");
      optn.text = document.form1.upsletter.value;
	  optn.value = packageListArray[i];
	  document.form1.container.options.add(optn);
	}

   if(packageListArray[i]=="21"){
	   var optn = document.createElement("OPTION");
      optn.text = document.form1.expressbox.value;
	  optn.value = packageListArray[i];
	  document.form1.container.options.add(optn);
	}

    if(packageListArray[i]=="21S"){
		var optn = document.createElement("OPTION");
      optn.text = document.form1.smallbox.value;
	  optn.value = packageListArray[i];
	  document.form1.container.options.add(optn);
	}


    if(packageListArray[i]=="21M"){
		var optn = document.createElement("OPTION");
      optn.text = document.form1.mediumbox.value;
	  optn.value = packageListArray[i];
	  document.form1.container.options.add(optn);
	}

    if(packageListArray[i]=="21L"){
		var optn = document.createElement("OPTION");
      optn.text = document.form1.largebox.value;
	  optn.value = packageListArray[i];
	  document.form1.container.options.add(optn);
	}

    if(packageListArray[i]=="03"){
		var optn = document.createElement("OPTION");
      optn.text = document.form1.tube.value;
	  optn.value = packageListArray[i];
	  document.form1.container.options.add(optn);
	}

   if(packageListArray[i]=="04"){
	  var optn = document.createElement("OPTION");
      optn.text = document.form1.pack.value;
	  optn.value = packageListArray[i];
	  document.form1.container.options.add(optn);
	}

    if(packageListArray[i]=="25"){
		var optn = document.createElement("OPTION");
      optn.text = document.form1.tenkg.value;
	  optn.value = packageListArray[i];
	  document.form1.container.options.add(optn);
	}


  if(packageListArray[i]=="24"){
	  var optn = document.createElement("OPTION");
      optn.text = document.form1.twentyfivekg.value;
	  optn.value = packageListArray[i];
	  document.form1.container.options.add(optn);
	}
	}

		//if user clicks back button
		if(document.form1.containerSelected.value!=null){
		var back_Cont=document.form1.containerSelected.value;
		var temp;
			for(var k =0;k<document.form1.container.options.length;k++)
			{
			if(document.form1.container.options[k].value == back_Cont)
				{
				document.form1.container.options[k].selected="SELECTED";
				temp = document.form1.container.options[k].value;
				break;
				}
			}

		if(temp == '01')
		{
		document.getElementById("packDimensions").style.display = "none";
		document.getElementById("enter_dimensions").style.display = "none";
		}

		}


	// added ctc module logic to select pkg type 

	var ctcModuleRequester=document.form1.requestor.value;
	var ctcModulePkgType=document.form1.ctcModPkgType.value;

	if(ctcModuleRequester=="ctcmodule"){
	var tempFlag;
	for(var k =0;k<document.form1.container.options.length;k++)
	{
	if(document.form1.container.options[k].value == ctcModulePkgType)
	{
		document.form1.container.options[k].selected="SELECTED";
		tempFlag = document.form1.container.options[k].value;
		break;
	}
	}
	
	if(tempFlag == '01')
	{
		document.getElementById("packDimensions").style.display = "none";
		document.getElementById("enter_dimensions").style.display = "none";
	}
	if(tempFlag != '01')
	{
	   document.getElementById("enter_dimensions").style.display = "";
	}
 	}

	// end of  ctc module logic 


	if(document.form1.isModifyClicked.value != 'true'){
	if(document.form1.ratingPackType!=null){
	if(document.form1.ratingPackType.value!=null){
		var ratingPackType=document.form1.ratingPackType.value;

	if(ratingPackType=="L"){
	ratingPackType="21L";
	}

	if (ratingPackType=="M"){
   	ratingPackType="21M";
	}

	if (ratingPackType=="S"){
   	ratingPackType="21S";
	}




var tempFlag;
for(var k =0;k<document.form1.container.options.length;k++)
{
	if(document.form1.container.options[k].value == ratingPackType)
	{
		document.form1.container.options[k].selected="SELECTED";
		tempFlag = document.form1.container.options[k].value;
		break;
	}
}
	
	if(tempFlag == '01')
	{
		document.getElementById("packDimensions").style.display = "none";
		document.getElementById("enter_dimensions").style.display = "none";
	}
	if(tempFlag != '01')
	{
		
		//document.getElementById("packDimensions").style.display = "";
		document.getElementById("enter_dimensions").style.display = "";
	}
	
	//fix
	
	if(tempFlag!="-1"&&tempFlag!="02"&&tempFlag!="01"){
		$.ajax({type: 'POST',
		url: '/ctc/CTCAjaxServlet',
		dataType: 'html',
		data:"requestType=dimensions&container="+tempFlag,
		success: function(data){
        var dims=data.split("_");

        if(dims[0]!=null){
        document.form1.length1.value=dims[0];
        }

        if(dims[1]!=null){
        document.form1.width1.value=dims[1];
        }

        if(dims[2]!=null){
        document.form1.height1.value=dims[2];
        }

        }

        });
		}
	
	
	//end of fix
	
	
	
}
}
}



	if(document.form1.isModifyClicked.value == 'true')
{//start of if condition for Modify Link
var tempContainer = document.form1.modContainer.value;

var tempFlag;
for(var k =0;k<document.form1.container.options.length;k++)
{
	if(document.form1.container.options[k].value == tempContainer)
	{
		document.form1.container.options[k].selected="SELECTED";
		tempFlag = document.form1.container.options[k].value;
		break;
	}
}

	if(tempFlag == '01')
	{
		document.getElementById("packDimensions").style.display = "none";
		document.getElementById("enter_dimensions").style.display = "none";
	}

	var ipa = document.form1.modRequestor.value;
	if(ipa != 'null' && (ipa == 'IpaRequestor' || ipa == 'LanRequestor'))
	{
		if(ipa == 'IpaRequestor')
		{
			document.getElementById("international").style.display = 'none';
			document.getElementById("dailyPickupHideShow").style.display = 'none';
			origFindPostalArea.style.display = "none";
		}

		transitTimeOnlyRadio.style.display = "none";
		quickTimeCostRadioPackage.style.display = "none";
    		quickTimeCostRadioLetter.style.display="none";
       	estimateTimeCostRadio.style.display = "none";
		estimateTimeCostStatic.style.display = "";
	}
}//end of modify link option

}
//////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////submitAccountNumber///////////////////////////////////////
function submitAccountNumber(form)
{
document.form1.fromaddORcountry.value="account";
var rad_val;
for (var i=0; i < document.form1.destResident.length; i++)
   {
   if (document.form1.destResident[i].checked)
      {
      rad_val = document.form1.destResident[i].value;
      }
  }
document.form1.resComDet.value=rad_val;
document.form1.packageLetter.value=document.form1.quickQuoteTypePackageLetter.value;
document.form1.quoteType.value="null";
commonF();
for(var t=0;t<document.form1.quoteType.length;t++)
{
document.form1.quoteType[t].value="null";
}

document.form1.onChangeAccValue.value=document.form1.accountNumber.value;

form.submit();
return true;
}
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////fillHidden////////////////////////////////////////////////////////
function fillHidden(){
document.form1.shipmenttype.value="smallPkg";
document.form1.nextclicked.value="next";
document.form1.shipmentTypeFreight.value="smallORPallet";
commonF();
document.form1.datevalue.value=document.form1.shipDate.value;
document.form1.noofpackages.value=document.form1.packages.value;
return true;
}
//////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////submitToAddress//////////////////////////////////////////////
function submitToAddress(form) {
document.form1.fromaddORcountry.value="address";
commonF();
//document.form1.quoteselected.value="null";
document.form1.packageLetter.value=document.form1.quickQuoteTypePackageLetter.value;
document.form1.nextclicked.value="null";
document.form1.quoteType.value="null";
for(var t=0;t<document.form1.quoteType.length;t++)
{
document.form1.quoteType[t].value="null";
}
if(!form.toAddressBook[0].selected){
form.toAddressBook.selectedIndex
form.submit();
return true;
}
}
//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////submitFromAddress/////////////////////////////////////////////////
function submitFromAddress(form) {
document.form1.fromaddORcountry.value="address";
commonF()
//document.form1.quoteselected.value="null";
document.form1.packageLetter.value=document.form1.quickQuoteTypePackageLetter.value;
document.form1.nextclicked.value="null";
document.form1.quoteType.value="null";

for(var t=0;t<document.form1.quoteType.length;t++)
{
document.form1.quoteType[t].value="null";
}
if(!form.fromAddressBook[0].selected){
form.fromAddressBook.selectedIndex
form.submit();
return true;
}
}
//////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////popZipFinderOrig///////////////////////////////////////////////
function popZipFinderOrig() {
var s=document.form1.origCity.value;
var new_link="/ctc/findZip?calledBy=orig&city="+s;
window.open(new_link,"zipWindow","top=100,status=1,resizable=yes,width=615,height=384");
}
//////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////popZipFinderDest///////////////////////////////////////////////
function popZipFinderDest() {
var s=document.form1.destCity.value;
var new_link="/ctc/findZip?calledBy=dest&city="+s;
window.open(new_link,"zipWindow","top=100,status=1,resizable=yes,width=615,height=384");
}

//////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////hideShowFields///////////////////////////////////////////////

function hideShowFields(form){
var YesNo=document.form1.sameValue.selectedIndex;
var flag=document.form1.sameValue.options[YesNo].value;

var pkgType;
if(document.form1.shipmentType!=null){
pkgType=document.form1.shipmentType[0].checked;
}


if(flag=="YES"){
//document.getElementById("detailed_time_cost_step3").style.display = 'block';
document.getElementById("weightValue1").style.display = "";
document.getElementById("weightLabel1").style.display = "";
document.getElementById("packDimensions").style.display = "";
document.getElementById("enter_dimensions").style.display = "";
document.getElementById("valueAdded1").style.display = "";
document.getElementById("valueAdded").style.display = "";
if(pkgType==false){
document.getElementById("detailed_time_cost_step3").style.display = "";
}
}else if(flag=="NO"){
document.getElementById("weightValue1").style.display = "none";
document.getElementById("weightLabel1").style.display = "none";
document.getElementById("packDimensions").style.display = "none";
document.getElementById("enter_dimensions").style.display = "none";
document.getElementById("valueAdded1").style.display = "none";
document.getElementById("valueAdded").style.display = "none";
document.form1.width1.value="";
document.form1.height1.value="";
document.form1.length1.value="";
document.form1.weight1.value="1";
document.form1.currency1.value="";
document.form1.valueAdded.checked=false;
if(pkgType==false){
document.getElementById("detailed_time_cost_step3").style.display = "none";
}

}
}
//////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////hideFields on Error Page onLoad///////////////////////////////////////////////

function hideFields(form){
document.getElementById("weightValue1").style.display = "none";
document.getElementById("weightLabel1").style.display = "none";
document.getElementById("packDimensions").style.display = "none";
document.getElementById("enter_dimensions").style.display = "none";
document.getElementById("valueAdded1").style.display = "none";
document.getElementById("valueAdded").style.display = "none";
}
//////////////////////////////////////////////////////////////////////////////////



///////////////////////////////////submitPkgNumber///////////////////////////////////////////////

function submitPkgNumber(form){

var orig = getOrigin();
var dest = getDestination();
var localeString=document.form1.loc.value;
var transitTimeOnlyRadio=document.getElementById("transitTimeOnlyRadio");
var quickTimeCostRadioPackage= document.getElementById("quickTimeCostRadioPackage");
var quickTimeCostRadioLetter = document.getElementById("quickTimeCostRadioLetter");
var quickQuoteDisclaimer=document.getElementById("quickQuoteDisclaimer");
var estimateTimeCostRadio = document.getElementById("estimateTimeCostRadio");
var	estimateTimeCostStatic = document.getElementById("estimateTimeCostStatic");
var transitTimeOnlyStatic = document.getElementById("transitTimeOnlyStatic");
var time_in_transit_box = document.getElementById("time_in_transit_box");



   if(localeString=="en_US"){
		 if (orig == "US" && dest == "US")
	      {
		var nps = document.getElementById("numberPackagesSelect");
		if (nps != null)
		{
			if (nps.options != null)
			{
				var np = nps.options[nps.selectedIndex].value;
				if (np == "1")
				{	// show all
        			transitTimeOnlyRadio.style.display = "";
        	        quickTimeCostRadioPackage.style.display ="";
			        quickTimeCostRadioLetter.style.display="";
					quickQuoteDisclaimer.style.display="";
        			estimateTimeCostRadio.style.display = "";
					transitTimeOnlyStatic.style.display="none";
            		time_in_transit_box.style.display="none";

				}
				else
				{

				    transitTimeOnlyRadio.style.display = "";
        	        quickTimeCostRadioPackage.style.display ="none";
			        quickTimeCostRadioLetter.style.display="none";
					quickQuoteDisclaimer.style.display="none";
        			estimateTimeCostRadio.style.display = "";
					transitTimeOnlyStatic.style.display="none";
					time_in_transit_box.style.display="none";
				}
			}
		}
	}else  if(orig != "US" && dest != "US")
		 {
		transitTimeOnlyRadio.style.display = "";
        quickTimeCostRadioPackage.style.display ="none";
        quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
		estimateTimeCostRadio.style.display = "";
		transitTimeOnlyStatic.style.display="none";
		time_in_transit_box.style.display="none";
		}
   	else if(orig=="US" && dest!="US")
		{
        transitTimeOnlyRadio.style.display = "";
        quickTimeCostRadioPackage.style.display ="none";
		quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
        estimateTimeCostRadio.style.display = "";
		transitTimeOnlyStatic.style.display="none";
		time_in_transit_box.style.display="none";
        }
	else if(orig!="US" && dest=="US")
		{
        transitTimeOnlyRadio.style.display = "";
        quickTimeCostRadioPackage.style.display ="none";
		quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
        estimateTimeCostRadio.style.display = "";
		transitTimeOnlyStatic.style.display="none";
		time_in_transit_box.style.display="none";
        }
    }
    
    

  //end of hide show quote type logic

  //show / hide same values

    var qtype=document.form1.quoteselected.value;
     

if(document.form1.IpaRequestor!=null){
if(document.form1.IpaRequestor.value=="IpaRequestor"){
qtype="estimateTimeCost.x";
}
}

if(document.form1.IpaRequestor!=null){
if(document.form1.IpaRequestor.value=="LanRequestor"){

document.getElementById("transitTimeOnlyRadio").style.display = "none";
document.getElementById("quickTimeCostRadioPackage").style.display = "none";
document.getElementById("quickTimeCostRadioLetter").style.display = "none";
document.getElementById("quickQuoteDisclaimer").style.display = "none";
document.getElementById("estimateTimeCostRadio").style.display = "none";
document.getElementById("transitTimeOnlyStatic").style.display = "none";
document.getElementById("estimateTimeCostStatic").style.display = "";
document.getElementById("time_in_transit_box").style.display = "none";
document.getElementById("detailed_time_cost_step3").style.display = "";
document.getElementById("detailed_time_cost_box").style.display = "";

}
}


if(qtype=="estimateTimeCost.x"){

       var nps = document.getElementById("numberPackagesSelect");
		if (nps != null)
		{
			if (nps.options != null)
			{
				var np = nps.options[nps.selectedIndex].value;
				var num=eval(np);
				if (num == 1){
		document.getElementById("sameValue").style.display = "none";
		document.getElementById("sameLabel").style.display = "none";
        document.getElementById("weightValue1").style.display = "";
		document.getElementById("weightLabel1").style.display = "";
		document.getElementById("packDimensions").style.display = "";
		document.getElementById("enter_dimensions").style.display = "";
		document.getElementById("valueAdded1").style.display = "";
		document.getElementById("valueAdded").style.display = "";

		document.form1.sameValues.value="YES";
		
		hideShowFields(form1);

		$.ajax({type: 'POST',
		url: '/ctc/CTCAjaxServlet',
		dataType: 'html',
		data:"requestType=nopackages&origCountry="+orig+"&destCountry="+dest+"&packages="+num,
		success: function(data){
        createPackageList(data);
        }
        });
				}else if(num>1){
		document.getElementById("sameValue").style.display = "";
		document.getElementById("sameLabel").style.display = "";
		//add logic to packaging type

		$.ajax({type: 'POST',
		url: '/ctc/CTCAjaxServlet',
		dataType: 'html',
		data:"requestType=nopackages&origCountry="+orig+"&destCountry="+dest+"&packages="+num,
		success: function(data){
        createPackageList(data);
        }
        });


		//end of add logic packaging type



         	}
            }
		}


}else{

document.getElementById("sameValue").style.display = "none";
document.getElementById("sameLabel").style.display = "none";

}

}

/***************** Error Page Logic *********************************************/

///////////////////////////////////submitPkgNumber for Error page///////////////////////////////////////////////

function submitErrorPg(form){

 var qtype=document.form1.quoteselected.value;
 var requestor=document.form1.requestor.value;
 var qtype_letter_pkgl;
 if(document.form1.quickQuoteTypePackageLetter!=null){
 var qtype_letter_pkg=document.form1.quickQuoteTypePackageLetter.value;
 }
 var pkgType=document.form1.shipmentType[0].checked;
 var palletType=document.form1.pallet_logic.value;
 
 
 

if(qtype=="estimateTimeCost.x")
{
if(getOrigin()=="VN" ||getDestination() == "AF")
{
document.getElementById("declaredValueField").style.display = 'none';
}
else
{
document.getElementById("declaredValueField").style.display = 'block';
}
}

	if(qtype=="estimateTimeCost.x"||requestor=="AE"){

        // AE requestor is for CARES
		document.getElementById("detailed_time_cost_step3").style.display = 'block';
		document.getElementById("noofpackagesLabel").style.display = 'block';
		document.getElementById("noofpackagesValue").style.display = 'block';
		document.getElementById("weightValue").style.display = 'none';
		document.getElementById("weightLabel").style.display = 'none';

       var nps = document.getElementById("numberPackagesSelect");
		if (nps != null)
		{
			if (nps.options != null)
			{
				var np = nps.options[nps.selectedIndex].value;
				var num=eval(np);
				if (num == 1){
					document.getElementById("sameValue").style.display = "none";
					document.getElementById("sameLabel").style.display = "none";
			    }else if(num>1){
					document.getElementById("sameValue").style.display = "";
					document.getElementById("sameLabel").style.display = "";
         		}
            }
		}
		
		

	   hideShowFields_ErrorPg();
	    // Retail label text logic
	   
	   if(document.form1.origCountry.value=="US"){
	     if(document.form1.dropOffChoice1[0]!=null){
	  	  if(document.form1.dropOffChoice1[0].checked==true){
				retailShow();
	  	 	} else {
				retailHide();
	   		}
	   	  }
	 	}

	} else if(qtype=="transitTimeOnly"){
		document.getElementById("detailed_time_cost_step3").style.display = 'none';
		document.getElementById("noofpackagesLabel").style.display = 'block';
		document.getElementById("noofpackagesValue").style.display = 'block';
        // For "US to US" origin/destination the "Total Shipment Weight" will not display as per FDD rules
		if(getOrigin()=="US" && getDestination()=="US"){
		 	document.getElementById("weightValue").style.display = 'none';
			document.getElementById("weightLabel").style.display = 'none';
		}else {
			document.getElementById("weightValue").style.display = 'block';
			document.getElementById("weightLabel").style.display = 'block';
		}
		document.getElementById("sameValue").style.display = 'none';
		document.getElementById("sameLabel").style.display = 'none';
		if(palletType=="true"){
			smallPkgPalletRow.style.display = "";
		} else {
		   if(getOrigin()=="PL" && getDestination()=="PL"){
				 smallPkgPalletRow.style.display = "";
		   }
		}

    } else {

	     document.getElementById("detailed_time_cost_step3").style.display = 'none';
		 document.getElementById("noofpackagesLabel").style.display = 'none';
		 document.getElementById("noofpackagesValue").style.display = 'none';
		 document.getElementById("sameValue").style.display = 'none';
 		 document.getElementById("sameLabel").style.display = 'none';

		if(qtype_letter_pkg=="package"){
			document.getElementById("weightValue").style.display = 'block';
			document.getElementById("weightLabel").style.display = 'block';
		} else {
			document.form1.weight.value="1";
			document.form1.weightType.value="LBS";
			document.getElementById("weightValue").style.display = 'none';
			document.getElementById("weightLabel").style.display = 'none';
    	}
	}


   // Exclusive for Cares (Customer automated response)
	if(requestor=="AE"){
		 if(document.form1.destinationtype.value==""||document.form1.destinationtype.value=="null"){
			document.form1.destResident[0].checked=true;
		 } else  if (document.form1.destinationtype.value=="01"){ // Residential
			document.form1.destResident[1].checked=true;
		 } else  if (document.form1.destinationtype.value=="03"){ // deteremine my address
			document.form1.destResident[2].checked=true;
		 } else {
			document.form1.destResident[0].checked=true;
		 }

    } // end of CARES special logic
    
   //Exclusive for HTML Tool 
	if(requestor=="CTCHTMLTool"){
	  if(document.form1.diUnit.value=="null"){
	   document.form1.diUnit.value=document.form1.HTML_length_std.value;
	  }
   }// end of HTML Tool special logic
   
}

///////////////////////////////////retailShow///////////////////////////////////////////////

function retailShow(){
	var retailText = document.getElementById("negotiatedLabel");
	var abrStatus=document.form1.isAccountSelected.value;
	if(abrStatus=="yes") {
			if(retailText!=null){
				retailText.style.display = "";
			}
	}       
 }
//////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////retailHide///////////////////////////////////////////////
function retailHide(){
	var retailText = document.getElementById("negotiatedLabel");
	if(retailText!=null)
		retailText.style.display = "none";
 }
//////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////hideShowFields_ErrorPg///////////////////////////////////////////////

function hideShowFields_ErrorPg(form){
var YesNo=document.form1.sameValue.selectedIndex;
var pkgType=document.form1.shipmentType[0].checked;
var sameflag=document.form1.sameValue.options[YesNo].value;
var qtype=document.form1.quoteselected.value;
var requestor=document.form1.requestor.value;
var smallPkgPalletRow = document.getElementById("smallPkgPalletRow");
var orig=getOrigin();
var dest=getDestination();
var gbPallet=document.form1.isSelectedAccountGBPalletEnabled.value;

  if (gbPallet!=null && gbPallet=="true"){ //GB Pallet
    	if ((orig=="GB" || orig=="EN" || orig=="SF" || orig=="WL" || orig=="NB" )&&( dest=="GB" || dest=="EN" || dest=="SF" || dest=="WL" || dest=="NB" ))
	      smallPkgPalletRow.style.display = "";

   }else{
      try {
			 if(orig=="PL" && dest=="PL") // Normal pallet
				 smallPkgPalletRow.style.display = "";
		     else
				smallPkgPalletRow.style.display = "none";
		}catch (err){
			  if(smallPkgPalletRow!=null)
				smallPkgPalletRow.style.display = "none";
	    }

    }



	if(sameflag=="YES"){
		document.getElementById("weightValue1").style.display = 'block';
		document.getElementById("weightLabel1").style.display = 'block';
		document.getElementById("enter_dimensions").style.display = 'block';
		document.getElementById("valueAdded1").style.display = 'block';
		document.getElementById("valueAdded").style.display = 'block';
		if(qtype=="estimateTimeCost.x"||requestor=="AE"){
			document.getElementById("detailed_time_cost_step3").style.display = 'block';
		}

		if(pkgType==true){ // shipment Type is package
			document.form1.isPallet.value="false";
			document.getElementById("packageLabel").style.display = 'block';
			document.getElementById("palletLabel").style.display = 'none';
			document.getElementById("packaging").style.display = 'block';
			document.getElementById("pkgWeight").style.display ='block';
			document.getElementById("palletWeight").style.display = 'none';
			document.getElementById("packDimensions").style.display ='block';
			document.getElementById("palletDimensions").style.display = 'none';
			document.getElementById("pallet_required").style.display = 'none';

		 } else{// Shipment Type is Pallet
			document.form1.isPallet.value="true";
			document.getElementById("packageLabel").style.display = 'none';
			document.getElementById("palletLabel").style.display = 'block';
			document.getElementById("packaging").style.display = 'none';
			document.getElementById("pkgWeight").style.display = 'none';
			document.getElementById("palletWeight").style.display = 'block';
			document.getElementById("packDimensions").style.display = 'none';
			document.getElementById("palletDimensions").style.display = 'block';
			document.getElementById("pallet_required").style.display = '';
		}
	}else{ // Same value is "NO"
		document.getElementById("weightValue1").style.display = 'none';
		document.getElementById("weightLabel1").style.display = 'none';
		document.getElementById("packDimensions").style.display = 'none';
		document.getElementById("enter_dimensions").style.display = 'none';
		document.getElementById("valueAdded1").style.display = 'none';
		document.getElementById("valueAdded").style.display = 'none';
		document.form1.width1.value="";
		document.form1.height1.value="";
		document.form1.length1.value="";
		document.form1.weight1.value="1";
		document.form1.currency1.value="";
		document.form1.valueAdded.checked=false;
		if(pkgType==true){ // shipment Type is package
			document.form1.isPallet.value="false";
			document.getElementById("packageLabel").style.display = 'block';
			document.getElementById("palletLabel").style.display = 'none';
			document.getElementById("packaging").style.display = 'block';
			document.getElementById("detailed_time_cost_step3").style.display = 'block';
		} else{ // Shipment Type is Pallet
			document.form1.isPallet.value="true";
			document.getElementById("packageLabel").style.display = 'none';
			document.getElementById("palletLabel").style.display = 'block';
			document.getElementById("packaging").style.display = 'none';
			document.getElementById("pkgWeight").style.display = 'none';
			document.getElementById("palletWeight").style.display = 'none';
			document.getElementById("packDimensions").style.display = 'none';
			document.getElementById("palletDimensions").style.display ='none';
			document.getElementById("pallet_required").style.display = 'none';
			document.getElementById("detailed_time_cost_step3").style.display = 'none';
		}
	  }
}

/********************* End of Error Page Logic ***********************************/
//////////////////////////////////////////////////////////////////////////////////


/////////////////////////////////hideQuoteTypeSmallPKG_ErrorPg/////////////////////////////////////////////////

function hideQuoteTypeSmallPKG_ErrorPg(form){
	document.getElementById("isPallet").value="false";
	document.getElementById("packageLabel").style.display = 'block';
	document.getElementById("palletLabel").style.display = 'none';
	document.getElementById("packaging").style.display = "";
	document.getElementById("pkgWeight").style.display = "";
	document.getElementById("palletWeight").style.display = "none";
	document.getElementById("packDimensions").style.display = "";
	document.getElementById("palletDimensions").style.display = "none";

}

/////////////////////////////hideQuoteTypePallet/////////////////////////////////////////////////////
function hideQuoteTypePallet_ErrorPg(form){
	document.getElementById("isPallet").value="true";
	document.getElementById("packageLabel").style.display = 'none';
	document.getElementById("palletLabel").style.display = 'block';
	document.getElementById("packaging").style.display = "none";
	document.getElementById("pkgWeight").style.display = "none";
	document.getElementById("palletWeight").style.display = "";
	document.getElementById("packDimensions").style.display = "none";
	document.getElementById("palletDimensions").style.display = "";

}

/////////////////////////////getPackageDimension/////////////////////////////////////////////////////

function getPackageDimension(form){
		var index=document.form1.container.options[document.form1.container.selectedIndex].value;
		var same_value_index=document.form1.sameValues.options[document.form1.sameValues.selectedIndex].value;

	if(same_value_index=="NO"){
      document.getElementById("enter_dimensions").style.display = 'none';
	  document.getElementById("packDimensions").style.display = 'none';
	  document.getElementById("palletDimensions").style.display = 'none';

	 } else {
		if(index!="01"){
			document.getElementById("enter_dimensions").style.display = 'block';
			document.getElementById("packDimensions").style.display = 'block';
		}

		if(index=="02" || index=="-1"){
		document.form1.length1.value="";
        document.form1.width1.value="";
        document.form1.height1.value="";
		}

		if(index!="-1"&&index!="02"&&index!="01"){
		$.ajax({type: 'POST',
		url: '/ctc/CTCAjaxServlet',
		dataType: 'html',
		data:"requestType=dimensions&container="+index,
		success: function(data){
        //updateDimenstionsField(data);
        var dims=data.split("_");

        if(dims[0]!=null){
        document.form1.length1.value=dims[0];
        }

        if(dims[1]!=null){
        document.form1.width1.value=dims[1];
        }

        if(dims[2]!=null){
        document.form1.height1.value=dims[2];
        }

        }

        });
		}

		if(index=="01"){
			//hideDomestionsField();
			document.form1.length1.value="";
			document.form1.width1.value="";
			document.form1.height1.value="";
			document.getElementById("enter_dimensions").style.display = 'none';
			document.getElementById("packDimensions").style.display = 'none';
		}
	 }



}

//////////////////////////////////////////////////////////////////////////////////



////////////////////////////////commonF//////////////////////////////////////////////////
function commonF()
{
  if(document.form1.destResident[0].checked)
  {
    document.form1.destinationtype.value="02";
  }
  else if(document.form1.destResident[1].checked)
  {
    document.form1.destinationtype.value="01";
  }
  else if(document.form1.destResident[2].checked)
  {
    document.form1.destinationtype.value="03";
  }
}
//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////hideQuoteTypeSmallPKG/////////////////////////////////////////////////

function hideQuoteTypeSmallPKG(form){
document.getElementById("packaging").style.display = "";
document.getElementById("pkgWeight").style.display = "";
document.getElementById("palletWeight").style.display = "none";
document.getElementById("packDimensions").style.display = "";
document.getElementById("palletDimensions").style.display = "none";
document.getElementById("packageLabel").style.display = "";
document.getElementById("palletLabel").style.display = "none";
document.getElementById("pallet_required").style.display = "none";
}
//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////hideQuoteTypePallet/////////////////////////////////////////////////////
function hideQuoteTypePallet(form){
document.getElementById("packaging").style.display = "none";
document.getElementById("pkgWeight").style.display = "none";
document.getElementById("palletWeight").style.display = "";
document.getElementById("packDimensions").style.display = "none";
document.getElementById("palletDimensions").style.display = "";
document.getElementById("packageLabel").style.display = "none";
document.getElementById("palletLabel").style.display = "";
document.getElementById("pallet_required").style.display = "";
//test
document.getElementById("enter_dimensions").style.display = "";

}

//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////

<!-- IAC STARTS FROM HERE -->
//////////////////////////////////////////////////////////////////////////////////
////////////////////////////////getOrigin//////////////////////////////////////////////////
function getOrigin()
{   var origCountry;

	if(document.form1.origCountry!=null){
	var origIndex=document.form1.origCountry.selectedIndex;
	if(origIndex!=null){
    origCountry=document.form1.origCountry.options[origIndex].value;
    }else{
    if(document.getElementById("origCountryValue")!=null){
    origCountry=document.getElementById("origCountryValue").value;
    }
    if(document.getElementById("origCountryValue")==null){
    origCountry=document.form1.origCountry.value;
    }
    }
    }else {
    origCountry=document.getElementById("origCountryValue").value;
    }


	return origCountry;
}
//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////getDestination/////////////////////////////////////////////
function getDestination()
{   var destCountry;

	if(document.form1.destCountry!=null){
	var destIndex=document.form1.destCountry.selectedIndex;
		if(destIndex!=null)
			{
		   destCountry=document.form1.destCountry.options[destIndex].value;
			}else{
			if(document.getElementById("destCountryValue")!=null){
			destCountry=document.getElementById("destCountryValue").value;
			}
			if(document.getElementById("destCountryValue")==null){
    		destCountry=document.form1.destCountry.value;
    	}
		}
	}else{
	destCountry=document.getElementById("destCountryValue").value;
	}
   
	  //work around for madiera
    
    if(destCountry=="PT-30"){
    destCountry="PT";
    }
   
    
	return destCountry;
}
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
function getOrigPostal()
{
var origPostal=document.getElementById("origPostalValue").value;
return origPostal;
}

function getDestPostal(){
var destPostal=document.getElementById("destPostalValue").value;
return destPostal;

}

function getOrigCity(){
var origCity=document.getElementById("origCityValue").value;
return origCity;
}

function getDestCity(){
var destCity=document.getElementById("destCityValue").value;
return destCity;
}

/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
////////////////////////////////handleCustomsAndDocsNoComVal///////////////////////////////////////////////////

function handleCustomsAndDocsNoComVal(orig,dest)
{
        var localeString=document.form1.loc.value;


	var timeonlycountry = isTimeOnly(orig);

	var customsArea1=document.getElementById("customsArea1");
	var docsNoComValArea=document.getElementById("docsNoComValArea");

	var requestor;
	if(document.form1.IpaRequestor!=null)
	requestor=document.form1.IpaRequestor.value;


	if (orig == dest)
	{
		customsArea1.style.display = "none";
		docsNoComValArea.style.display = "none";
	}
	else
	{
		var len = euCountries.countries.length;
		var euOrigFlag = false;
		var euDestFlag = false;
		for (i=0;i<len;i++)
		{
			if (euCountries.countries[i] == orig)
			{
				euOrigFlag = true;
			}
			if (euCountries.countries[i] == dest)
			{
				euDestFlag = true;
			}
		}


		if (euOrigFlag == true && euDestFlag == true)
		{

			customsArea1.style.display = "none";
			docsNoComValArea.style.display = "none";
		}
		else
		{
            customsArea1.style.display = "";
			docsNoComValArea.style.display = "";

		}
	}

if(requestor=="LanRequestor"){
	docsNoComValArea.style.display = "none";
}

}


//////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////myFromCountryChangeFunction////////////////////////////////////////////////
function myFromCountryChangeFunction()
{

removeQuoteSelection();
var requestInd=document.getElementById("ipaRequest");
var orig = getOrigin();
var dest = getDestination();
var localeString=document.form1.loc.value;
var requestor;

if(document.form1.IpaRequestor!=null)
 requestor=document.form1.IpaRequestor.value;


    var origPostal = getOrigPostal();
	var transitTimeOnlyRadio=document.getElementById("transitTimeOnlyRadio");
	var quickTimeCostRadioPackage= document.getElementById("quickTimeCostRadioPackage");
	var quickTimeCostRadioLetter = document.getElementById("quickTimeCostRadioLetter");
	var quickQuoteDisclaimer=document.getElementById("quickQuoteDisclaimer");
	var estimateTimeCostRadio = document.getElementById("estimateTimeCostRadio");
	var	estimateTimeCostStatic = document.getElementById("estimateTimeCostStatic");
    var transitTimeOnlyStatic = document.getElementById("transitTimeOnlyStatic");
	var time_in_transit_box = document.getElementById("time_in_transit_box");
	var detailed_time_cost_step3=document.getElementById("detailed_time_cost_step3");
    var detailed_time_cost_box=document.getElementById("detailed_time_cost_box");


	// check time only countries
	var timeOnlyFlag = isTimeOnly(orig);
	var timeOnlyContextFlag=false;


   if (orig == "PL" && dest == "PL")
	{
		var smallPkgPalletRow = document.getElementById("smallPkgPalletRow");
        smallPkgPalletRow.style.display = "";


 	}else{
 	    var smallPkgPalletRow = document.getElementById("smallPkgPalletRow");
 	    if(smallPkgPalletRow!=null){
         smallPkgPalletRow.style.display = "none";
         
        	
			document.getElementById("packageLabel").style.display = 'block';
			document.getElementById("palletLabel").style.display = 'none';
			document.getElementById("packaging").style.display = 'block';
			document.getElementById("pkgWeight").style.display ='block';
			document.getElementById("palletWeight").style.display = 'none';
			document.getElementById("packDimensions").style.display ='block';
			document.getElementById("palletDimensions").style.display = 'none';
			document.getElementById("pallet_required").style.display = 'none';
			
			document.getElementById("palletRadio").checked=false;
			document.getElementById("smallPkgRadio").checked=true;
         
         }
    }

   	   if(localeString!="en_US" && timeOnlyContextFlag==false ||timeOnlyFlag==false)
		{
		transitTimeOnlyRadio.style.display = "";
        quickTimeCostRadioPackage.style.display ="none";
        quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
		estimateTimeCostRadio.style.display = "";
		estimateTimeCostStatic.style.display="none"
        transitTimeOnlyStatic.style.display="none";
		time_in_transit_box.style.display="none";
		}


    if(localeString=="en_US"){
		 if (orig == "US" && dest == "US")
	      {
		var nps = document.getElementById("numberPackagesSelect");
		if (nps != null)
		{
			if (nps.options != null)
			{
				var np = nps.options[nps.selectedIndex].value;
				if (np == "1")
				{	transitTimeOnlyRadio.style.display = "";
        	        quickTimeCostRadioPackage.style.display ="";
			        quickTimeCostRadioLetter.style.display="";
					quickQuoteDisclaimer.style.display="";
        			estimateTimeCostRadio.style.display = "";
					transitTimeOnlyStatic.style.display="none";
            		time_in_transit_box.style.display="none";

				}
				else
				{
				    transitTimeOnlyRadio.style.display = "";
        	        quickTimeCostRadioPackage.style.display ="none";
			        quickTimeCostRadioLetter.style.display="none";
					quickQuoteDisclaimer.style.display="none";
        			estimateTimeCostRadio.style.display = "";
					transitTimeOnlyStatic.style.display="none";
					time_in_transit_box.style.display="none";
				}
			}
		}
	}else  if(orig != "US" && dest != "US")
		 {
		transitTimeOnlyRadio.style.display = "";
        quickTimeCostRadioPackage.style.display ="none";
        quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
		estimateTimeCostRadio.style.display = "";
		transitTimeOnlyStatic.style.display="none";
		time_in_transit_box.style.display="none";
		}
   	else if(orig=="US" && dest!="US")
		{
        transitTimeOnlyRadio.style.display = "";
        quickTimeCostRadioPackage.style.display ="none";
		quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
        estimateTimeCostRadio.style.display = "";
		transitTimeOnlyStatic.style.display="none";
		time_in_transit_box.style.display="none";
        }
	else if(orig!="US" && dest=="US")
		{
		if(timeOnlyFlag == false){
		transitTimeOnlyRadio.style.display = "";
        quickTimeCostRadioPackage.style.display ="none";
		quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
        estimateTimeCostRadio.style.display = "";
		transitTimeOnlyStatic.style.display="none";
		time_in_transit_box.style.display="none";
		}else{
		transitTimeOnlyRadio.style.display = "none";
        quickTimeCostRadioPackage.style.display ="none";
		quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
        estimateTimeCostRadio.style.display = "none";
		transitTimeOnlyStatic.style.display="";
		time_in_transit_box.style.display="";
    	}



		}
    }
    if(orig=="VN" || dest=="AF"){
	document.getElementById("declaredValueField").style.display = 'none';
	}else{
document.getElementById("declaredValueField").style.display = 'block';
}

	 if(requestor=="IpaRequestor" || requestor=="LanRequestor")
	{

			transitTimeOnlyRadio.style.display = "none";
			quickTimeCostRadioPackage.style.display = "none";
    		quickTimeCostRadioLetter.style.display="none";
            quickQuoteDisclaimer.style.display="none";
    		estimateTimeCostRadio.style.display = "none";
			transitTimeOnlyStatic.style.display="none";
    		estimateTimeCostStatic.style.display=""
			time_in_transit_box.style.display="none";
			detailed_time_cost_step3.style.display="";
            detailed_time_cost_box.style.display="none";

	var internationalArea = document.getElementById("international");
	if(orig=="US"||orig=="PR"){
     if(internationalArea!=null)
     internationalArea.style.display = 'block';
	}else{
	if(internationalArea!=null)
    internationalArea.style.display = 'none';
	removeSelection();
	}
	timeCostOnly();
	hideShowFields(form1);
 	}

	//////////////END OF QUOTE TYPE HIDE /SHOW/////////////////////////////////////////

if (document.form1.palletEligable.value=="true"){
   if ((orig=="GB" || orig=="EN" || orig=="SF" || orig=="WL" || orig=="NB" )&&( dest=="GB" || dest=="EN" || dest=="SF" || dest=="WL" || dest=="NB" )){
	var smallPkgPalletRow = document.getElementById("smallPkgPalletRow");
        smallPkgPalletRow.style.display = "";
	}else{
		var smallPkgPalletRow = document.getElementById("smallPkgPalletRow");
        if(smallPkgPalletRow!=null){
         smallPkgPalletRow.style.display = "none";
         
        	document.getElementById("packageLabel").style.display = 'block';
			document.getElementById("palletLabel").style.display = 'none';
			document.getElementById("packaging").style.display = 'block';
			document.getElementById("pkgWeight").style.display ='block';
			document.getElementById("palletWeight").style.display = 'none';
			document.getElementById("packDimensions").style.display ='block';
			document.getElementById("palletDimensions").style.display = 'none';
			document.getElementById("pallet_required").style.display = 'none';
			document.getElementById("palletRadio").checked=false;
			document.getElementById("smallPkgRadio").checked=true;
         
         
         }
	}
}

//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////


   ///////////////////////////Find Postal////////////////////
   	var origFindPostalArea = document.getElementById("origFindPostalArea");
    var destFindPostalArea = document.getElementById("destFindPostalArea");


	if (localeString == "en_US")
	{

		// hide/show find postal code area
		if (orig == "US" && dest == "US")
		    {
          origFindPostalArea.style.display = "";
		  destFindPostalArea.style.display="";
	    	}
	 	else if (orig != "US" && dest == "US")
			{
          origFindPostalArea.style.display = "none";
		  destFindPostalArea.style.display="";
           }
		else if (orig == "US" && dest != "US")
		   {
          origFindPostalArea.style.display = "";
  		  destFindPostalArea.style.display="none";
          }
		 else if(orig != "US" && dest != "US")
		  {
		  origFindPostalArea.style.display = "none";
  		  destFindPostalArea.style.display="none";
		  }
        }else{
	      origFindPostalArea.style.display = "none";
		  destFindPostalArea.style.display="none";
	}

       ///////////////////////////Find Postal////////////////////




 	//handleDestType(orig,dest);

	//////////////////////////////////////////DESTINATION TYPE//////////////////////////

     var determineDestRadio=document.getElementById("determineDestRadio");
 if((localeString=="en_US")||(localeString=="en_PR")||(localeString=="es_PR")||(localeString=="fr_CA")||(localeString=="en_CA"))
	{
		if((orig == "US" || orig=="PR" || orig=="CA")&&(dest == "US" || dest == "CA"))
		{
		determineDestRadio.style.display = "";
		}else
		{
		if(determineDestRadio!=null)
		determineDestRadio.style.display = "none";
	    }
	}else{
        if(determineDestRadio!=null)
        determineDestRadio.style.display = "none";
	}

   ///////////////////////////////////////END DESTINATION TYPE//////////////////////////



   ///////////////////////Handle Custom Value//////////////////////////////////////////


   handleCustomsAndDocsNoComVal(orig,dest);



   ////////////////////////End of Handle Custom Value /////////////////////////////////

var pkgNum=document.form1.packages.value;
var origZip=getOrigPostal();
var destZip=getDestPostal();
var origCity=getOrigCity();
var destCity=getDestCity();

var qtype=document.form1.quoteselected.value;


 if(qtype=="estimateTimeCost.x")
	{
	document.getElementById("costRadio").checked=true;
	
	var internationalArea = document.getElementById("international");

	if(orig=="US"||orig=="PR"){

     if(internationalArea!=null)
     internationalArea.style.display = 'block';

	}else{

	if(internationalArea!=null)
    internationalArea.style.display = 'none';
	removeSelection();
	}

	timeCostOnly();
	hideShowFields(form1);

	}

if(qtype=="transitTimeOnly"){
if(orig=="US" && dest=="US")
{
document.getElementById("weightValue").style.display = 'none';
document.getElementById("weightLabelShip").style.display = 'none';
document.form1.weight.value="1";
document.form1.weightType.value="LBS";
}else{
document.getElementById("weightValue").style.display = 'block';
document.getElementById("weightLabelShip").style.display = 'block';
document.form1.weight.value="";
}
}



if(timeOnlyFlag==false && qtype=="estimateTimeCost.x"){
ctcAjaxCallFunction(orig,dest,pkgNum,origZip,destZip,origCity,destCity);
}


if (timeOnlyFlag == true)
	{
		transitTimeOnlyRadio.style.display = "none";
		quickTimeCostRadioPackage.style.display = "none";
		quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
		estimateTimeCostRadio.style.display = "none";
		transitTimeOnlyStatic.style.display="";
		estimateTimeCostStatic.style.display="none"
		time_in_transit_box.style.display="";
		detailed_time_cost_step3.style.display="none";
        detailed_time_cost_box.style.display="none";
		//document.form1.quoteselected.value="transitTimeOnly";
		//document.form1.quoteType.value="transitTimeOnly";
		document.getElementById("timeRadio").checked=true;
		timeOnly();
	}

	if(timeOnlyFlag == false){
	    
	    
		if(document.getElementById("accountNumberLabel")!=null){
			document.getElementById("accountNumberLabel").style.display = 'block';
		 }
		if(document.getElementById("accountNumberField")!=null){
			document.getElementById("accountNumberField").style.display = 'block';
		}
    }
    
    


}

//////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////myToCountryChangeFunction///////////////////////////////


function myToCountryChangeFunction()
{

removeQuoteSelection();



var requestInd=document.getElementById("ipaRequest");
var orig = getOrigin();
var dest = getDestination();

var requestor;

if(document.form1.IpaRequestor!=null)
 requestor=document.form1.IpaRequestor.value;


 var localeString=document.form1.loc.value;


	//new
	var origPostal = document.getElementById("origPostal");

	var transitTimeOnlyRadio=document.getElementById("transitTimeOnlyRadio");
	var quickTimeCostRadioPackage= document.getElementById("quickTimeCostRadioPackage");
	var quickTimeCostRadioLetter = document.getElementById("quickTimeCostRadioLetter");
	var quickQuoteDisclaimer=document.getElementById("quickQuoteDisclaimer");
	var estimateTimeCostRadio = document.getElementById("estimateTimeCostRadio");
	var	estimateTimeCostStatic = document.getElementById("estimateTimeCostStatic");
    var transitTimeOnlyStatic = document.getElementById("transitTimeOnlyStatic");
	var time_in_transit_box = document.getElementById("time_in_transit_box");




	// check time only countries
	var timeOnlyFlag = isTimeOnly(orig);


      var timeOnlyContextFlag=false;
       var len1 = timeOnlyCountries.countries.length;
		for (i=0;i<len1;i++)
		{
			if (timeOnlyCountries.countries[i] == localeString)
			{
				timeOnlyContextFlag = true;
				break;
			}
		}



    if(orig=="VN" || dest=="AF"){
	document.getElementById("declaredValueField").style.display = 'none';
	}else{
	document.getElementById("declaredValueField").style.display = 'block';
	}

   ///////////////////////////////////////Handle Shipment Type ///////////////////////



   if (orig == "PL" && dest == "PL")
	{
		var smallPkgPalletRow = document.getElementById("smallPkgPalletRow");
        smallPkgPalletRow.style.display = "";

  	}else{
 	    var smallPkgPalletRow = document.getElementById("smallPkgPalletRow");
 	    if(smallPkgPalletRow!=null)
          smallPkgPalletRow.style.display = "none";
          
            document.getElementById("packageLabel").style.display = 'block';
			document.getElementById("palletLabel").style.display = 'none';
			document.getElementById("packaging").style.display = 'block';
			document.getElementById("pkgWeight").style.display ='block';
			document.getElementById("palletWeight").style.display = 'none';
			document.getElementById("packDimensions").style.display ='block';
			document.getElementById("palletDimensions").style.display = 'none';
			document.getElementById("pallet_required").style.display = 'none';
			document.getElementById("palletRadio").checked=false;
			document.getElementById("smallPkgRadio").checked=true;
    }



	 ///////////////////////////////////////////////////////////////////////////////////







    ///////////////////////////////////////////////////////////////////////////
     //hide /show quote type

     //End of hide /show quote type



   	   if(localeString!="en_US" && timeOnlyContextFlag==false ||timeOnlyFlag==false)
		{
		transitTimeOnlyRadio.style.display = "";
        quickTimeCostRadioPackage.style.display ="none";
        quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
		estimateTimeCostRadio.style.display = "";
		estimateTimeCostStatic.style.display="none"
        transitTimeOnlyStatic.style.display="none";
		time_in_transit_box.style.display="none";
		}


	if (timeOnlyFlag == true)
	{
		transitTimeOnlyRadio.style.display = "none";
		quickTimeCostRadioPackage.style.display = "none";
		quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
		estimateTimeCostRadio.style.display = "none";
		transitTimeOnlyStatic.style.display="";
		estimateTimeCostStatic.style.display="none"
		time_in_transit_box.style.display="";
	}

	//hide show quote type based on requestor
    if(requestor=="IpaRequestor" || requestor=="LanRequestor")
	{
	      	transitTimeOnlyRadio.style.display = "none";
			quickTimeCostRadioPackage.style.display = "none";
    		quickTimeCostRadioLetter.style.display="none";
            quickQuoteDisclaimer.style.display="none";
    		estimateTimeCostRadio.style.display = "none";
			transitTimeOnlyStatic.style.display="none";
    		estimateTimeCostStatic.style.display=""
			time_in_transit_box.style.display="none";
 	}


    if(localeString=="en_US"){
		 if (orig == "US" && dest == "US")
	      {
		var nps = document.getElementById("numberPackagesSelect");
		if (nps != null)
		{
			if (nps.options != null)
			{
				var np = nps.options[nps.selectedIndex].value;
				if (np == "1")
				{	// show all
        			transitTimeOnlyRadio.style.display = "";
        	        quickTimeCostRadioPackage.style.display ="";
			        quickTimeCostRadioLetter.style.display="";
					quickQuoteDisclaimer.style.display="";
        			estimateTimeCostRadio.style.display = "";
					transitTimeOnlyStatic.style.display="none";
            		time_in_transit_box.style.display="none";

				}
				else
				{
				    transitTimeOnlyRadio.style.display = "";
        	        quickTimeCostRadioPackage.style.display ="none";
			        quickTimeCostRadioLetter.style.display="none";
					quickQuoteDisclaimer.style.display="none";
        			estimateTimeCostRadio.style.display = "";
					transitTimeOnlyStatic.style.display="none";
					time_in_transit_box.style.display="none";
				}
			}
		}
	}else  if(orig != "US" && dest != "US")	 {
		transitTimeOnlyRadio.style.display = "";
        quickTimeCostRadioPackage.style.display ="none";
        quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
			if(timeOnlyFlag==false){
				estimateTimeCostRadio.style.display = "";
				transitTimeOnlyStatic.style.display="none";
				time_in_transit_box.style.display="none";
			} else{
				estimateTimeCostRadio.style.display = "none";
				transitTimeOnlyStatic.style.display="";
				transitTimeOnlyRadio.style.display = "none";
			}
		}
   	else if(orig=="US" && dest!="US")
		{
        transitTimeOnlyRadio.style.display = "";
        quickTimeCostRadioPackage.style.display ="none";
		quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
        estimateTimeCostRadio.style.display = "";
		transitTimeOnlyStatic.style.display="none";
		time_in_transit_box.style.display="none";
        }
	else if(orig!="US" && dest=="US")
		{

		transitTimeOnlyRadio.style.display = "";
        quickTimeCostRadioPackage.style.display ="none";
        quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
			if(timeOnlyFlag==false){
				estimateTimeCostRadio.style.display = "";
				transitTimeOnlyStatic.style.display="none";
				time_in_transit_box.style.display="none";
			} else{
				estimateTimeCostRadio.style.display = "none";
				transitTimeOnlyStatic.style.display="";
				transitTimeOnlyRadio.style.display = "none";
			}
        }
    }

	//////////////END OF QUOTE TYPE HIDE /SHOW/////////////////////////////////////////


if (document.form1.palletEligable.value=="true"){
   if ((orig=="GB" || orig=="EN" || orig=="SF" || orig=="WL" || orig=="NB" )&&( dest=="GB" || dest=="EN" || dest=="SF" || dest=="WL" || dest=="NB" )){
var smallPkgPalletRow = document.getElementById("smallPkgPalletRow");
        smallPkgPalletRow.style.display = "";
}else{
var smallPkgPalletRow = document.getElementById("smallPkgPalletRow");
 	    if(smallPkgPalletRow!=null){
         smallPkgPalletRow.style.display = "none";
         
	        document.getElementById("packageLabel").style.display = 'block';
			document.getElementById("palletLabel").style.display = 'none';
			document.getElementById("packaging").style.display = 'block';
			document.getElementById("pkgWeight").style.display ='block';
			document.getElementById("palletWeight").style.display = 'none';
			document.getElementById("packDimensions").style.display ='block';
			document.getElementById("palletDimensions").style.display = 'none';
			document.getElementById("pallet_required").style.display = 'none';
			document.getElementById("palletRadio").checked=false;
			document.getElementById("smallPkgRadio").checked=true;
         }
}
}



	var origPostal = document.getElementById("origPostal");

	///////////////////////////Find Postal////////////////////
   	var origFindPostalArea = document.getElementById("origFindPostalArea");
    var destFindPostalArea = document.getElementById("destFindPostalArea");


	if (localeString == "en_US")
	{

		// hide/show find postal code area
		if (orig == "US" && dest == "US")
		    {
          origFindPostalArea.style.display = "";
		  destFindPostalArea.style.display="";
	    	}
	 	else if (orig != "US" && dest == "US")
			{
          origFindPostalArea.style.display = "none";
		  destFindPostalArea.style.display="";
           }
		else if (orig == "US" && dest != "US")
		   {
          origFindPostalArea.style.display = "";
  		  destFindPostalArea.style.display="none";
          }
		 else if(orig != "US" && dest != "US")
		  {
		  origFindPostalArea.style.display = "none";
  		  destFindPostalArea.style.display="none";
		  }
        }else{
	      origFindPostalArea.style.display = "none";
		  destFindPostalArea.style.display="none";
	}

       ///////////////////////////Find Postal////////////////////


 	//handleDestType(orig,dest);

	//////////////////////////////////////////DESTINATION TYPE//////////////////////////

     var determineDestRadio=document.getElementById("determineDestRadio");
 if((localeString=="en_US")||(localeString=="en_PR")||(localeString=="es_PR")||(localeString=="fr_CA")||(localeString=="en_CA"))
	{
		if((orig == "US" || orig=="PR" || orig=="CA")&&(dest == "US" || dest == "CA"))
		{
		determineDestRadio.style.display = "";
		}else
		{
		if(determineDestRadio!=null)
		determineDestRadio.style.display = "none";
	    }
	}else{
        if(determineDestRadio!=null)
        determineDestRadio.style.display = "none";
	}

   ///////////////////////////////////////END DESTINATION TYPE//////////////////////////



   ///////////////////////Handle Custom Value//////////////////////////////////////////


   handleCustomsAndDocsNoComVal(orig,dest);



   ////////////////////////End of Handle Custom Value /////////////////////////////////


 //handle domestic / international block

var pkgNum=document.form1.packages.value;
var origZip=getOrigPostal();
var destZip=getDestPostal();
var origCity=getOrigCity();
var destCity=getDestCity();

var qtype=document.form1.quoteselected.value;

if(qtype=="transitTimeOnly"){
if(orig=="US" && dest=="US")
{
document.getElementById("weightValue").style.display = 'none';
document.getElementById("weightLabelShip").style.display = 'none';
document.form1.weight.value="1";
document.form1.weightType.value="LBS";

}else{
document.getElementById("weightValue").style.display = 'block';
document.getElementById("weightLabelShip").style.display = 'block';
document.form1.weight.value="";

}
}

var timeOnly=isTimeOnly(orig);

if(timeOnly==false && qtype=="estimateTimeCost.x"){
ctcAjaxCallFunction(orig,dest,pkgNum,origZip,destZip,origCity,destCity);
}


}

function ctcAjaxCallFunction(origCC,destCC,pkgNum,origZip,destZip,origCity,destCity){




	$.ajax({type: 'POST',
		url: '/ctc/CTCAjaxServlet',
	dataType: 'html',
data:"requestType=detailTimeCost&origCountry="+origCC+"&destCountry="+destCC+"&packages="+pkgNum+"&origZip="+origZip+"&destZip="+destZip+"&origCity="+origCity+"&destCity="+destCity,
success: function(data){

                var detailArray=data.split("#");

     	        if(detailArray[0]!=null){
				createPackageList(detailArray[0]);
				}

				if(detailArray[1]!=null){
				updateDeclaredValue(detailArray[1]);
				}

			    if(detailArray[2]!=null){
				updateWeightAndDimensions(detailArray[2]);
				}



				}
});


}

function submitFreight()
{
document.form1.shipmentTypeFreight.value="freightTab";
form1.submit();
}

function dismissSetPrefLink(){
document.form1.dismissLink.value="remove";
form1.submit();
}

function onInputPageLoadFunction(){


var requestInd=document.getElementById("ipaRequest");
var orig = getOrigin();
var dest = getDestination();
var localeString=document.form1.loc.value;
var requestor;

if(document.form1.IpaRequestor!=null)
 requestor=document.form1.IpaRequestor.value;


var origPostal = getOrigPostal();
var transitTimeOnlyRadio=document.getElementById("transitTimeOnlyRadio");
var quickTimeCostRadioPackage= document.getElementById("quickTimeCostRadioPackage");
var quickTimeCostRadioLetter = document.getElementById("quickTimeCostRadioLetter");
var quickQuoteDisclaimer=document.getElementById("quickQuoteDisclaimer");
var estimateTimeCostRadio = document.getElementById("estimateTimeCostRadio");
var estimateTimeCostStatic = document.getElementById("estimateTimeCostStatic");
var transitTimeOnlyStatic = document.getElementById("transitTimeOnlyStatic");
var time_in_transit_box = document.getElementById("time_in_transit_box");
var detailed_time_cost_step3=document.getElementById("detailed_time_cost_step3");
var detailed_time_cost_box=document.getElementById("detailed_time_cost_box");


// check time only countries
var timeOnlyFlag = isTimeOnly(orig);


      var timeOnlyContextFlag=false;
       var len1 = timeOnlyCountries.countries.length;
		for (i=0;i<len1;i++)
		{
			if (timeOnlyCountries.countries[i] == localeString)
			{
				timeOnlyContextFlag = true;
				break;
			}
		}


if(orig=="VN" || dest=="AF"){
document.getElementById("declaredValueField").style.display = 'none';
}else{
document.getElementById("declaredValueField").style.display = 'block';
}



     if (orig == "PL" && dest == "PL")
	{	var smallPkgPalletRow = document.getElementById("smallPkgPalletRow");
        smallPkgPalletRow.style.display = "";

    }else{
 	   var smallPkgPalletRow = document.getElementById("smallPkgPalletRow");
 	    if(smallPkgPalletRow!=null)
         smallPkgPalletRow.style.display = "none";
    }

	   if (localeString == "en_PL")
	{	var smallPkgPalletRow = document.getElementById("smallPkgPalletRow");
        smallPkgPalletRow.style.display = "";

    }else{
 	   var smallPkgPalletRow = document.getElementById("smallPkgPalletRow");
 	    if(smallPkgPalletRow!=null)
         smallPkgPalletRow.style.display = "none";
    }


    if(localeString!="en_US" && timeOnlyContextFlag==false ||timeOnlyFlag==false)
	{
	transitTimeOnlyRadio.style.display = "";
    quickTimeCostRadioPackage.style.display ="none";
    quickTimeCostRadioLetter.style.display="none";
	quickQuoteDisclaimer.style.display="none";
	estimateTimeCostRadio.style.display = "";
	estimateTimeCostStatic.style.display="none"
    transitTimeOnlyStatic.style.display="none";
	time_in_transit_box.style.display="none";

	}


	if(timeOnlyFlag == true)
	{

	transitTimeOnlyRadio.style.display = "none";
	quickTimeCostRadioPackage.style.display = "none";
	quickTimeCostRadioLetter.style.display="none";
	quickQuoteDisclaimer.style.display="none";
	estimateTimeCostRadio.style.display = "none";
	transitTimeOnlyStatic.style.display="";
	estimateTimeCostStatic.style.display="none"
	time_in_transit_box.style.display="";
	detailed_time_cost_step3.style.display="none";
    detailed_time_cost_box.style.display="none";

    if(document.getElementById("accountNumberLabel")!=null){
	 document.getElementById("accountNumberLabel").style.display = 'none';
	}
	if(document.getElementById("accountNumberField")!=null){
	document.getElementById("accountNumberField").style.display = 'none';
	}

	}



    if(localeString=="en_US"){
		 if (orig == "US" && dest == "US")
	      {
		var nps = document.getElementById("numberPackagesSelect");
		if (nps != null)
		{
			if (nps.options != null)
			{
				var np = nps.options[nps.selectedIndex].value;
				if (np == "1")
				{	// show all
        			transitTimeOnlyRadio.style.display = "";
        	        quickTimeCostRadioPackage.style.display ="";
			        quickTimeCostRadioLetter.style.display="";
					quickQuoteDisclaimer.style.display="";
        			estimateTimeCostRadio.style.display = "";
					transitTimeOnlyStatic.style.display="none";
            		time_in_transit_box.style.display="none";

				}
				else
				{
				    transitTimeOnlyRadio.style.display = "";
        	        quickTimeCostRadioPackage.style.display ="none";
			        quickTimeCostRadioLetter.style.display="none";
					quickQuoteDisclaimer.style.display="none";
        			estimateTimeCostRadio.style.display = "";
					transitTimeOnlyStatic.style.display="none";
					time_in_transit_box.style.display="none";
				}
			}
		}
	}else  if(orig != "US" && dest != "US")
		 {
		transitTimeOnlyRadio.style.display = "";
        quickTimeCostRadioPackage.style.display ="none";
        quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
			if(timeOnlyFlag==false){
				estimateTimeCostRadio.style.display = "";
				transitTimeOnlyStatic.style.display="none";
				time_in_transit_box.style.display="none";
			} else{
				estimateTimeCostRadio.style.display = "none";
				transitTimeOnlyStatic.style.display="";
				transitTimeOnlyRadio.style.display = "none";
			}

		}
   	else if(orig=="US" && dest!="US")
		{
        transitTimeOnlyRadio.style.display = "";
        quickTimeCostRadioPackage.style.display ="none";
		quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
        estimateTimeCostRadio.style.display = "";
		transitTimeOnlyStatic.style.display="none";
		time_in_transit_box.style.display="none";
        }
	else if(orig!="US" && dest=="US")
		{

		if(timeOnlyFlag == false){

		transitTimeOnlyRadio.style.display = "";
        quickTimeCostRadioPackage.style.display ="none";
		quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
        estimateTimeCostRadio.style.display = "";
		transitTimeOnlyStatic.style.display="none";
		time_in_transit_box.style.display="none";

		}else{

		transitTimeOnlyRadio.style.display = "none";
        quickTimeCostRadioPackage.style.display ="none";
		quickTimeCostRadioLetter.style.display="none";
		quickQuoteDisclaimer.style.display="none";
        estimateTimeCostRadio.style.display = "none";
		transitTimeOnlyStatic.style.display="";
		time_in_transit_box.style.display="";
    	}

		}
    }



   ///////////////////////////Find Postal////////////////////
   var origFindPostalArea = document.getElementById("origFindPostalArea");
   var destFindPostalArea = document.getElementById("destFindPostalArea");

	if (localeString == "en_US")
	{
		// hide/show find postal code area
		if (orig == "US" && dest == "US")
		    {
          origFindPostalArea.style.display = "";
		  destFindPostalArea.style.display="";
	    	}
	 	else if (orig != "US" && dest == "US")
			{
          origFindPostalArea.style.display = "none";
		  destFindPostalArea.style.display="";
           }
		else if (orig == "US" && dest != "US")
		   {
          origFindPostalArea.style.display = "";
  		  destFindPostalArea.style.display="none";
          }
		 else if(orig != "US" && dest != "US")
		  {
		  origFindPostalArea.style.display = "none";
  		  destFindPostalArea.style.display="none";
		  }
        }else{
	      origFindPostalArea.style.display = "none";
		  destFindPostalArea.style.display="none";
	}

	//////////////////////////////////////////DESTINATION TYPE//////////////////////////

     var determineDestRadio=document.getElementById("determineDestRadio");
 if((localeString=="en_US")||(localeString=="en_PR")||(localeString=="es_PR")||(localeString=="fr_CA")||(localeString=="en_CA"))
	{
		if((orig == "US" || orig=="PR" || orig=="CA")&&(dest == "US" || dest == "CA"))
		{
		determineDestRadio.style.display = "";
		}else
		{
		if(determineDestRadio!=null)
		determineDestRadio.style.display = "none";
	    }
	}else{
        if(determineDestRadio!=null)
        determineDestRadio.style.display = "none";
	}

      handleCustomsAndDocsNoComVal(orig,dest);



 var nps = document.getElementById("numberPackagesSelect");
		if (nps != null)
		{
			if (nps.options != null)
			{
				var np = nps.options[nps.selectedIndex].value;
				var num=eval(np);
				if (num == 1){
		document.getElementById("sameValue").style.display = "none";
		document.getElementById("sameLabel").style.display = "none";
				}else if(num>1){
		document.getElementById("sameValue").style.display = "";
		document.getElementById("sameLabel").style.display = "";
         	}
            }
		}

var qtype=document.form1.quoteselected.value;
var origCC=getOrigin();
var quickType=document.form1.quickQuoteTypePackageLetter.value;




if(qtype=="estimateTimeCost.x")
	{
	timeCostOnly();
	hideShowFields(form1);
	}
else if(qtype=="quickTimeCost")
	{
	if(quickType=="package")
	{
	quicktimeOnlyPackage();
	}
	else if (quickType=="letter")
	{
    quicktimeOnlyLetter();
	}
	}
else if(qtype=="transitTimeOnly")
	{
	timeOnly();
	}



var ctcModuleRequester=document.form1.requestor.value;
var ctcModulePkgType=document.form1.ctcModPkgType.value;
var ctcModuleWeight=document.form1.ctcModuleWeight.value;
if(ctcModuleRequester=="ctcmodule"){
if(document.form1.isModifyClicked.value != 'true'){
if(timeOnlyFlag == false){
timeCostOnly();
document.getElementById("costRadio").checked=true;
hideShowFields(form1);

if(ctcModuleWeight!=null){
document.form1.weight1.value=ctcModuleWeight;
}

if(document.form1.ctcModuleWeightType.value!=null && document.form1.ctcModuleWeightType.value=="kg"){

document.form1.weightType.value="KGS";
document.form1.shipWeightUnit.value="KGS";
}

  
}else if (timeOnlyFlag == true){
document.getElementById("timeRadio").checked=true;
timeOnly();
}

}


}


 if(requestor=="IpaRequestor" || requestor=="LanRequestor")
	{

			transitTimeOnlyRadio.style.display = "none";
			quickTimeCostRadioPackage.style.display = "none";
    		quickTimeCostRadioLetter.style.display="none";
            quickQuoteDisclaimer.style.display="none";
    		estimateTimeCostRadio.style.display = "none";
			transitTimeOnlyStatic.style.display="none";
    		estimateTimeCostStatic.style.display=""
			time_in_transit_box.style.display="none";
			detailed_time_cost_step3.style.display="";
            detailed_time_cost_box.style.display="none";

            document.form1.origCountry.value=orig;
            if(requestor=="LanRequestor"){
            document.form1.destCountry.value=dest;
			}

			document.form1.origCity.value=getOrigCity();
            document.form1.origPostal.value=getOrigPostal();

	var internationalArea = document.getElementById("international");

	if(orig=="US"||orig=="PR"){

     if(internationalArea!=null)
     internationalArea.style.display = 'block';

	}else{

	if(internationalArea!=null)
    internationalArea.style.display = 'none';
	removeSelection();
	}

	timeCostOnly();
	hideShowFields(form1);

 	}

 	if(requestor=="IpaRequestor"){
 	 origFindPostalArea.style.display = "none";
 	}


if (document.form1.palletEligable.value=="true")
	{
	if ((orig=="GB" || orig=="EN" || orig=="SF" || orig=="WL" || orig=="NB" )&&( dest=="GB" || dest=="EN" || dest=="SF" || dest=="WL" || dest=="NB" )){
		var smallPkgPalletRow = document.getElementById("smallPkgPalletRow");
        smallPkgPalletRow.style.display = "";
      }		
 	}else{
 	    var smallPkgPalletRow = document.getElementById("smallPkgPalletRow");
          try {
			 if(document.form1.origCountry.value=="PL" && document.form1.destCountry.value=="PL"){
				 smallPkgPalletRow.style.display = "";
			   } else {
				smallPkgPalletRow.style.display = "none";
			   }
		    }catch (err){
             var smallPkgPalletRow = document.getElementById("smallPkgPalletRow");
              if(smallPkgPalletRow!=null)
			  smallPkgPalletRow.style.display = "none";
		   }

    }

//added new logic for pallet on page refresh.

var pkgType;
if(document.form1.shipmentType!=null){
pkgType=document.form1.shipmentType[0].checked;
}


if(pkgType==false){
hideQuoteTypePallet(form1);
}

if(pkgType==true){
hideQuoteTypeSmallPKG(form1);
}



//end of added new logic for pallet



var imsStatus=document.form1.imsStatus.value;

if(imsStatus=="true"){

if(document.form1.preferenceaddresskey.value!="000"){
document.form1.fromAddressBook.value=document.form1.preferenceaddresskey.value;
}


if(document.form1.selectedAccountNumber.value!="null"){
document.form1.accountNumber.value=document.form1.selectedAccountNumber.value;
}

var fromnickSelected1;
var fromAddressUpdate1="false";

if(document.form1.fromAddressBook!=null){
	var origIndex1=document.form1.fromAddressBook.selectedIndex;
	if(origIndex1!=null){
    fromnickSelected1=document.form1.fromAddressBook.options[origIndex1].value;
   }
  }
  
  if(fromnickSelected1!=null && fromnickSelected1!="00"){
  if(document.form1.isModifyClicked.value == 'true'){
  if(document.form1.afcity.value!=document.form1.modOrigCity.value || document.form1.afpostal.value!=document.form1.modOrigZip.value || document.form1.afcountry.value!=document.form1.modOrigCountry.value){
  fromAddressUpdate1="true";
  }
  }
  }
  
	if(fromAddressUpdate1=="true"){
	document.form1.fromAddressBook.value="00";
	document.form1.origCity.value=document.form1.modOrigCity.value;
	document.form1.origPostal.value=document.form1.modOrigZip.value ;
	document.form1.origCountry.value=document.form1.modOrigCountry.value;
	}
	
	//end of fix

}


if(document.form1.isModifyClicked.value == 'true')
{

var fromAddressUpdate="false";
var toAddressUpdate="false";


//Origin ogic 
var adCity=document.form1.afcity.value;
var adZip=document.form1.afpostal.value;
var adCountry=document.form1.afcountry.value;
var usCity=document.form1.modOrigCity.value;
var usZip=document.form1.modOrigZip.value;
var usCountry=document.form1.modOrigCountry.value;

adCity=adCity.toUpperCase();
adCountry=adCountry.toUpperCase();
usCity=usCity.toUpperCase();
usCountry=usCountry.toUpperCase();


var fromnickSelected;
if(document.form1.fromAddressBook!=null){
	var origIndex=document.form1.fromAddressBook.selectedIndex;
	if(origIndex!=null){
    fromnickSelected=document.form1.fromAddressBook.options[origIndex].value;
   }
  }
  
  if(fromnickSelected!=null && fromnickSelected!="00"){
  if(adCity!=usCity || adZip!=usZip || adCountry!=usCountry){
  fromAddressUpdate="true";
  }
  }
  
	if(fromAddressUpdate=="true"){
	document.form1.fromAddressBook.value="00";
	document.form1.origCity.value=usCity;
	document.form1.origPostal.value=usZip;
	document.form1.origCountry.value=usCountry;
	}
	
	



//Destin logic 
var adtoCity=document.form1.addressCity.value;
var adtoZip=document.form1.addressZip.value;
var adtoCountry=document.form1.addressCountry.value;

var ustoCity=document.form1.modDestCity.value;
var ustoZip=document.form1.modDestZip.value;
var ustoCountry=document.form1.modDestCountry.value;

adtoCity=adtoCity.toUpperCase();
adtoCountry=adtoCountry.toUpperCase();
ustoCity=ustoCity.toUpperCase();
ustoCountry=ustoCountry.toUpperCase();

var tonickSelected;

if(document.form1.toAddressBook!=null){
	var origIndex=document.form1.toAddressBook.selectedIndex;
	if(origIndex!=null){
    tonickSelected=document.form1.toAddressBook.options[origIndex].value;
   }
  }


 if(tonickSelected!=null && tonickSelected!="00"){
  if(adtoCity!=ustoCity || adtoZip!=ustoZip || adtoCountry!=ustoCountry){
  toAddressUpdate="true";
  }
  }
  
	if(toAddressUpdate=="true"){
	document.form1.toAddressBook.value="00";
	document.form1.destCity.value=ustoCity;
	document.form1.destPostal.value=ustoZip;
	document.form1.destCountry.value=ustoCountry;
	}


if(qtype=="estimateTimeCost.x"){
if(document.form1.modSameValue.value!=null){
	   var yn=document.form1.modSameValue.value;

	   if(yn=="NO"){
	   
	   for(var k =0;k<document.form1.sameValues.options.length;k++)
		{
		if(document.form1.sameValues.options[k].value == yn)
		{
		document.form1.sameValues.options[k].selected="SELECTED";
		}
    	}
    	var pkgType;
		if(document.form1.shipmentType!=null){
		pkgType=document.form1.shipmentType[0].checked;
		}
		document.getElementById("weightValue1").style.display = "none";
		document.getElementById("weightLabel1").style.display = "none";
		document.getElementById("packDimensions").style.display = "none";
		document.getElementById("enter_dimensions").style.display = "none";
		document.getElementById("valueAdded1").style.display = "none";
		document.getElementById("valueAdded").style.display = "none";
		document.form1.width1.value="";
		document.form1.height1.value="";
		document.form1.length1.value="";
		document.form1.weight1.value="";
		document.form1.currency1.value="";
		document.form1.valueAdded.checked=false;
		if(pkgType==false){
			document.getElementById("detailed_time_cost_step3").style.display = "none";
		}
		
	   }
	}
	}

}


if(imsStatus=="true" && document.form1.isModifyClicked.value != 'true' && (qtype=="none" ||qtype=="estimateTimeCost.x"))
{

var howWillGive=null;
var ratingDailypick=null;
var ratingPackType=null;
var ratingResCom=null;
var accountDailypick=null;
var gbPalletEligible=document.form1.palletEligable.value;

if(document.form1.ratingHowWillRetail.value!=null && document.form1.ratingHowWillRetail.value=="CHECKED"){
howWillGive="retail";
}

if(document.form1.ratingHowWillDriver.value!=null && document.form1.ratingHowWillDriver.value=="CHECKED"){
howWillGive="driver";
}

if(document.form1.ratingHowWillDotCom.value!=null && document.form1.ratingHowWillDotCom.value=="SELECTED"){
howWillGive="dotcom";
}

if(document.form1.ratingHowWillOneEight.value!=null && document.form1.ratingHowWillOneEight.value=="SELECTED"){
howWillGive="oneEight";
}
if(document.form1.ratingDailyPick.value!=null){
ratingDailypick=document.form1.ratingDailyPick.value;
}


if(document.form1.ratingDestTypeRes.value!=null && document.form1.ratingDestTypeRes.value=="CHECKED"){
ratingResCom="residential";
}

if(document.form1.ratingDestTypeComm.value!=null&& document.form1.ratingDestTypeComm.value=="CHECKED"){
ratingResCom="commercial";
}

//res_com logic
if(ratingResCom=="residential"){
document.getElementById("rRadio").checked=true;
}else if(ratingResCom=="commercial"){
document.getElementById("cRadio").checked=true;
}


if(document.form1.ratingQuoteTypeTime.value!=null && document.form1.ratingQuoteTypeTime.value=="CHECKED"){
timeOnly();
document.getElementById("timeRadio").checked=true;
}

if(document.form1.ratingQuoteTypeDetail.value!=null && document.form1.ratingQuoteTypeDetail.value=="CHECKED"){
document.getElementById("costRadio").checked=true;
timeCostOnly();




if(ratingDailypick!=null && ratingDailypick=="YES"){
document.getElementById("dailyyes").checked=true;
}else if(ratingDailypick!=null && ratingDailypick=="NO"){
document.getElementById("dailyno").checked=true;
}

if(howWillGive!=null && howWillGive=="retail"){
	document.getElementById("i_will_pay").checked=true;
	
	 var retailText = document.getElementById("negotiatedLabel");
       var abrStatus=document.form1.isAccountSelected.value;
       if(abrStatus=="yes")
       {
                if(retailText!=null)
                {
            retailText.style.display = "";
                }
       }       
	
}else if (howWillGive!=null && howWillGive=="driver")
{
	document.getElementById("i_will_drop_off").checked=true;
}else if (howWillGive!=null && howWillGive=="dotcom")
{
	document.getElementById("i_will_schedule").checked=true;
	document.form1.pickupMethod.value="1";

}else if (howWillGive!=null && howWillGive=="oneEight")
{
	document.getElementById("i_will_schedule").checked=true;
    document.form1.pickupMethod.value="2";
	
}
//}
}

if(document.form1.ratingQuoteTypePackage.value!=null && document.form1.ratingQuoteTypePackage.value=="CHECKED"){
quicktimeOnlyPackage();
document.getElementById("packageRadio").checked=true;
//res_com logic
if(ratingResCom=="residential"){
document.getElementById("rRadio").checked=true;
}else if(ratingResCom=="commercial"){
document.getElementById("cRadio").checked=true;
}
}

if(document.form1.ratingQuoteTypeLetter.value!=null && document.form1.ratingQuoteTypeLetter.value=="CHECKED"){
quicktimeOnlyLetter();
document.getElementById("letterRadio").checked=true;
//res_com logic
if(ratingResCom=="residential"){
document.getElementById("rRadio").checked=true;
}else if(ratingResCom=="commercial"){
document.getElementById("cRadio").checked=true;
}
}

if(document.form1.isResidential.value!=null){
if(document.form1.isResidential.value=="01"){
document.getElementById("rRadio").checked=true;
}else if(document.form1.isResidential.value=="02"){
document.getElementById("cRadio").checked=true;
}
}


if(howWillGive==null || howWillGive!="retail"){
if(document.form1.accountPrefpickup.value!=null &&document.form1.accountPrefpickup.value=="hide"){
//dont forget give to drive
 document.getElementById("dailyPickupHideShow").style.display = 'none';
 document.getElementById("i_will_drop_off").checked=true;
}
}



}
//End of For Logged in scenerios////////////////////////////////////////////////////////////////
}

function getDimenstion(form){
var index=document.form1.container.options[document.form1.container.selectedIndex].value

$.ajax({type: 'POST',
		url: '/ctc/CTCAjaxServlet',
	dataType: 'html',
data:"requestType=dimensions&container="+index,
success: function(data){

               }
});

}

function removeSelection(){

if(document.form1.dropOffChoice1!=null){
for(var t=0;t<document.form1.dropOffChoice1.length;t++)
{
document.form1.dropOffChoice1[t].value="null";
}
}

if(document.form1.dailyPickup!=null){
for(var t=0;t<document.form1.dailyPickup.length;t++)
{
document.form1.dailyPickup[t].value="null";
}
}


}

function removeQuoteSelection(){
if(document.form1.quoteselected.value!=null && document.form1.quoteselected.value=="quickTimeCost")
{
if(getOrigin()!="US" || getDestination()!="US")
{
document.form1.nextclicked.value="next";
document.form1.quoteType.value="null";
document.form1.quoteselected.value="none";
for(var t=0;t<document.form1.quoteType.length;t++)
{
document.form1.quoteType[t].value="null";
}
}
}
}


	var namespace = window.ctcJavaScript = function() {	};
	namespace.timeOnly=timeOnly;
        namespace.quicktimeOnlyPackage=quicktimeOnlyPackage;
        namespace.quicktimeOnlyLetter=quicktimeOnlyLetter;
        namespace.timeCostOnly=timeCostOnly;
        namespace.isTimeOnly=isTimeOnly;
        namespace.updateWeightAndDimensions=updateWeightAndDimensions;
        namespace.updateDeclaredValue=updateDeclaredValue;
        namespace.createPackageList=createPackageList;
        namespace.submitAccountNumber=submitAccountNumber;
        namespace.fillHidden=fillHidden;
        namespace.submitToAddress=submitToAddress;
        namespace.submitFromAddress=submitFromAddress;
        namespace.popZipFinderOrig=popZipFinderOrig;
        namespace.popZipFinderDest=popZipFinderDest;
        namespace.hideShowFields=hideShowFields;
        namespace.submitPkgNumber=submitPkgNumber;
        namespace.commonF=commonF;
        namespace.hideQuoteTypeSmallPKG=hideQuoteTypeSmallPKG;
  	    namespace.hideQuoteTypeSmallPKG_ErrorPg=hideQuoteTypeSmallPKG_ErrorPg;
		namespace.hideShowFields_ErrorPg=hideShowFields_ErrorPg;
        namespace.hideQuoteTypePallet=hideQuoteTypePallet;
		namespace.hideQuoteTypePallet_ErrorPg=hideQuoteTypePallet_ErrorPg;
        namespace.getOrigin=getOrigin;
        namespace.getDestination=getDestination;
        namespace.handleCustomsAndDocsNoComVal=handleCustomsAndDocsNoComVal;
        namespace.myFromCountryChangeFunction=myFromCountryChangeFunction;
        namespace.myToCountryChangeFunction=myToCountryChangeFunction;
        namespace.ctcAjaxCallFunction=ctcAjaxCallFunction;
		namespace.submitFreight=submitFreight;
		namespace.submitErrorPg=submitErrorPg;
		namespace.retailShow=retailShow;
		namespace.retailHide=retailHide;
		namespace.hideFields=hideFields;
		namespace.dismissSetPrefLink=dismissSetPrefLink;
		namespace.onInputPageLoadFunction=onInputPageLoadFunction;
		namespace.getPackageDimension=getPackageDimension;


})();


