<!-- BEGIN
var ShipName = "";
var ShipEmail = "";
var ShipEmail2 = "";
var ShipCompany = "";
var ShipAddress1 = "";
var ShipAddress2 = "";
var ShipCity = "";
var ShipContinentTxt = "";
var ShipContinentVal = "";
var ShipContinentIdx = 0;
var ShipCountryTxt = "";
var ShipCountryVal = "";
var ShipCountryIdx = 0;
var ShipStateTxt = "";
var ShipStateVal = "";
var ShipStateIdx = 0;
var ShipZip = "";
var ShipPhone = "";

function InitSaveVariables(form) {
ShipName = form.ShipName.value;
ShipEmail = form.ShipEmail.value;
ShipEmail2 = form.ShipEmail2.value;
ShipCompany = form.ShipCompany.value;
ShipAddress1 = form.ShipAddress1.value;
ShipAddress2 = form.ShipAddress2.value;
ShipCity = form.ShipCity.value;
ShipZip = form.ShipZip.value;
ShipPhone = form.ShipPhone.value;
ShipContinentIdx = form.ShipContinent.selectedIndex;
ShipContinentVal = form.ShipContinent[ShipContinentIdx].value;
ShipContinentTxt = form.ShipContinent[ShipContinentIdx].text;
ShipCountryIdx = form.ShipCountry.selectedIndex;
ShipCountryVal = form.ShipCountry[ShipCountryIdx].value;
ShipCountryTxt = form.ShipCountry[ShipCountryIdx].text;
ShipStateIdx = form.ShipState.selectedIndex;
ShipStateTxt = form.ShipState[ShipStateIdx].text;
ShipStateVal = form.ShipState[ShipStateIdx].value;
//ShipCountryVal = form.ShipCountry.value;
//ShipStateVal = form.ShipState.value;
//ShipCountryTxt = form.ShipCountry.text;
//ShipStateTxt = form.ShipState.text;
//alert ("ShipName = " + ShipName + " ShipEmail = " + ShipEmail + " ShipAddress1 = " + ShipAddress1 + " ShipCity = " + ShipCity);
//alert ("ShipContinentTxt = " + ShipContinentTxt + " ShipContinentVal = " + ShipContinentVal + " ShipCountryTxt = " + ShipCountryTxt + " ShipCountryVal = " + ShipCountryVal + " ShipStateTxt = " + ShipStateTxt + " ShipStateVal = " + ShipStateVal);
}

function ShipToBillPerson(form) {
var ctryIdx = form.BillCountry.selectedIndex;
var stIdx = form.BillState.selectedIndex;
var cntntIdx = form.BillContinent.selectedIndex;
//alert("ctryIdx = " + ctryIdx + " stIdx = " + stIdx + " cntntIdx = " + cntntIdx);
if (form.copyInfo.checked) {
InitSaveVariables(form);
form.ShipName.value = form.BillName.value;
form.ShipEmail.value = form.BillEmail.value;
form.ShipEmail2.value = form.BillEmail2.value;
form.ShipCompany.value = form.BillCompany.value;
form.ShipAddress1.value = form.BillAddress1.value;
form.ShipAddress2.value = form.BillAddress2.value;
form.ShipCity.value = form.BillCity.value;
form.ShipZip.value = form.BillZip.value;
form.ShipPhone.value = form.BillPhone.value;
//alert("here 1");
form.ShipContinent.selectedIndex = cntntIdx;
form.ShipContinent[cntntIdx].value = form.BillContinent[cntntIdx].value;
form.ShipContinent[cntntIdx].text = form.BillContinent[cntntIdx].text;
form.ShipCountry.selectedIndex = ctryIdx;
form.ShipCountry[ctryIdx].value = form.BillCountry[ctryIdx].value;
form.ShipCountry[ctryIdx].text = form.BillCountry[ctryIdx].text;
//form.ShipCountry.text = form.BillCountry[ctryIdx].text;
//form.ShipCountry.value = form.BillCountry[ctryIdx].value;
form.ShipState.selectedIndex = stIdx;
form.ShipState[stIdx].text = form.BillState[stIdx].text;
form.ShipState[stIdx].value = form.BillState[stIdx].value;
//form.ShipState.value = form.BillState[stIdx].value;
//form.ShipState.text = form.BillState[stIdx].text;
//alert("1 form.ShipCountry = " + form.ShipCountry.text + " " + form.ShipCountry.value);
//alert("1 form.ShipState = " + form.ShipState.text + " " + form.ShipState.value);
}
else {
form.ShipName.value = ShipName;
form.ShipEmail.value = ShipEmail;
form.ShipEmail2.value = ShipEmail2;
form.ShipCompany.value = ShipCompany;
form.ShipAddress1.value = ShipAddress1;
form.ShipAddress2.value = ShipAddress2;
form.ShipCity.value = ShipCity;
form.ShipZip.value = ShipZip;
form.ShipPhone.value = ShipPhone; 
//form.ShipCountry.value = ShipCountryVal; 
//form.ShipCountry.text = ShipCountryTxt;
//form.ShipState.value = ShipStateVal;
//form.ShipState.text = ShipStateTxt; 
//alert("2 form.ShipCountry = " + form.ShipCountry.text + " " + form.ShipCountry.value);
//alert("2 form.ShipState = " + form.ShipState.text + " " + form.ShipState.value);
form.ShipState.selectedIndex = ShipStateIdx;
//form.ShipState[ShipStateIdx].value = ShipStateVal;
//form.ShipState[ShipStateIdx].text = ShipStateTxt;
form.ShipCountry.selectedIndex = ShipCountryIdx;      
//form.ShipCountry[ShipCountryIdx].value = ShipCountryVal;
//form.ShipState[ShipCountryIdx].text = ShipCountryTxt;
form.ShipContinent.selectedIndex = ShipContinentIdx;      
//form.ShipState[ShipContinentIdx].value = ShipContinentVal;
//form.ShipState[ShipContinentIdx].text = ShipContinentTxt;
   }
}

  // This function initialzes all the form elements to default values.
  function InitForm() {
    // Reset values on form.
    document.backissForm.totalCost.value=0;
    document.backissForm.totalIssues.value=0;
    document.backissForm.comptotalCost.value=0;
    document.backissForm.comptotalIssues.value=0;

    // Set all checkboxes and radio buttons on form to unchecked.
    for (i=0; i < document.backissForm.elements.length; i++) {
      if (document.backissForm.elements[i].type == 'checkbox' | document.backissForm.elements[i].type == 'radio') {
        document.backissForm.elements[i].checked = false;
      }
    }
  }

// Calculate the total cost for items in the form which are selected.
function calcTotalCost(inputItem) {
  with (inputItem.form) {
    // Process each of the different input types in the form.
    if (inputItem.type == "radio") {   // Process radio buttons.
      // Subtract the previously selected radio button value from the total.
      comptotalCost.value = eval(comptotalCost.value) - eval(previouslySelectedRadioButton.value);
      // Save the current radio selection value.
      previouslySelectedRadioButton.value = eval(inputItem.value);
      // Add the current radio button selection value to the total.
      comptotalCost.value = eval(comptotalCost.value) + eval(inputItem.value);
    } else {   // Process check boxes.
      if (inputItem.checked == false) {   // Item was uncheck. Subtract item value from total.
          comptotalCost.value = eval(comptotalCost.value) - eval(inputItem.value);
      } else {   // Item was checked. Add the item value to the total.
          comptotalCost.value = eval(comptotalCost.value) + eval(inputItem.value);
      }
    }

    // Total value should never be less than 0.
    if (comptotalCost.value < 0) {
      InitForm();
    }

    // Return total value.
    return(formatCurrency(comptotalCost.value));
  }
}

function calcTotalIss(inputItem) {
  with (inputItem.form) {
    // Process each of the different input types in the form.
    if (inputItem.type == "radio") {   // Process radio buttons.
      // Subtract the previously selected radio button value from the total.
      comptotalIssues.value = eval(comptotalIssues.value) - eval(previouslySelectedRadioButton.value);
      // Save the current radio selection value.
      previouslySelectedRadioButton.value = eval(inputItem.value);
      // Add the current radio button selection value to the total.
      comptotalIssues.value = eval(comptotalIssues.value) + 1;
    } else {   // Process check boxes.
      if (inputItem.checked == false) {   // Item was uncheck. Subtract item value from total.
          comptotalIssues.value = eval(comptotalIssues.value) - 1;
      } else {   // Item was checked. Add the item value to the total.
          comptotalIssues.value = eval(comptotalIssues.value) + 1;
      }
    }

    // Total value should never be less than 0.
    if (comptotalIssues.value < 0) {
      InitForm();
    }

    // Return total value.
    return(comptotalIssues.value);
  }
}


// Format a value as currency.
function formatCurrency(num) {
  num = num.toString().replace(/\$|\,/g,'');
  if(isNaN(num))
     num = "0";
  sign = (num == (num = Math.abs(num)));
  num = Math.floor(num*100+0.50000000001);
  cents = num%100;
  num = Math.floor(num/100).toString();
  if(cents<10)
      cents = "0" + cents;
  for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
      num = num.substring(0,num.length-(4*i+3)) + ',' + num.substring(num.length-(4*i+3));
  return (((sign)?'':'-') + '$' + num + '.' + cents);
}


// END -->
