// JavaScript Document
// for Returns and Exchange Form

<!-- hide
 function verifyInfo(form){
  var fName = form.fName.value;
  var lName = form.lName.value;
  var custMailTo = form.custMailTo.value;
  var customerNo = form.customerNo.value;
  var orderNo = form.orderNo.value;
  var itemNo = form.itemNo1.value;
  var qty = form.qty1.value;
  var description = form.description1.value;
  var price = form.price1.value;
  var total = form.total1.value;

  var inputArray = new Array(0);
  inputArray[0] = fName;
  inputArray[1] = lName;
  inputArray[2] = custMailTo;
  inputArray[3] = customerNo;
  inputArray[4] = orderNo;
  inputArray[5] = itemNo;
  inputArray[6] = qty;
  inputArray[7] = description;
  inputArray[8] = price;
  inputArray[9] = total;

  var inputNamesArray = new Array(0);
  inputNamesArray[0] = "First Name";
  inputNamesArray[1] = "Last Name";
  inputNamesArray[2] = "Email Address";
  inputNamesArray[3] = "Customer Number";
  inputNamesArray[4] = "Order Number";
  inputNamesArray[5] = "first return Item Number";
  inputNamesArray[6] = "first return Quantity";
  inputNamesArray[7] = "first return Description";
  inputNamesArray[8] = "first return Price";
  inputNamesArray[9] = "first return Total";

  var noErrorFlag = true;
  var emptyFiedldMessage;

  for(var i = 0; i < inputArray.length; i++){
   var tempErFg = chkEmpty(inputArray[i]);
   if (tempErFg == false){
    noErrorFlag = tempErFg;
    emptyFieldMessage = inputNamesArray[i];
    break;
   }
  }

  if (noErrorFlag == false){
   alert("The "+emptyFieldMessage+" field is empty and it is a required field.");
   noErrorFlag = true;
   return false;
  }
  else {
   if ((custMailTo.indexOf('@') == -1) || (custMailTo.indexOf('.') == -1)) {
    alert("Your email address is incorrect. Please try again.\nExample: InternetCS@northerntool.com");
    return false;
   }
  }

  if (form.code1.selectedIndex == 0) {
   alert('You must select a Return Code for each item.');
   return false;
  }

  if (!(form.refRep[0].checked) && !(form.refRep[1].checked)) {
   alert('Would you like us to refund credit or replace/exchange the items?\nPlease select either "Refund Credit" or "Replace/Exchange".');
   return false;
  }
  if (form.refRep[1].checked) {
   var exitemNo = form.exitemNo1.value;
   var exqty = form.exqty1.value;
   var exdescription = form.exdescription1.value;
   var exprice = form.exprice1.value;
   var extotal = form.extotal1.value;

   var inputArray = new Array(0);
   inputArray[0] = exitemNo;
   inputArray[1] = exqty;
   inputArray[2] = exdescription;
   inputArray[3] = exprice;
   inputArray[4] = extotal;

   var inputNamesArray = new Array(0);
   inputNamesArray[0] = "first exchange Item Number";
   inputNamesArray[1] = "first exchange Quantity";
   inputNamesArray[2] = "first exchange Description";
   inputNamesArray[3] = "first exchange Price";
   inputNamesArray[4] = "first exchange Total";

   var noErrorFlag = true;
   var emptyFiedldMessage;

   for(var i = 0; i < inputArray.length; i++){
    var tempErFg = chkEmpty(inputArray[i]);
    if (tempErFg == false){
     noErrorFlag = tempErFg;
     emptyFieldMessage = inputNamesArray[i];
     break;
    }
   }

   if (noErrorFlag == false){
    alert("You chose to Replace/Exchange the item(s), so the "+emptyFieldMessage+" field cannot be empty.");
    noErrorFlag = true;
    return false;
   }
  }
  return true;
 }

 function isChecked(object) {
  if (object.checked) return true;
  else return false;
 }

 function chkEmpty(inputStr){
  if (inputStr == "" || inputStr == null) return false;
  else return true;
 }
// end -->