// JavaScript Document
function jemail(user, domain, suffix, txtDisplay){
document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '">' + txtDisplay + '</a>');

}

function SubmitForm_customer_login() { 
  if (CheckFormFields_customer_login() == true) 
      {document.frmCheckLogin.submit();}   
}
function CheckFormFields_customer_login() { 
  if (document.frmCheckLogin.LoginName.value == "") 
     {alert('Please provide your Login Name.');
     document.frmCheckLogin.LoginName.focus();
     return (false);}
  if (document.frmCheckLogin.Password.value == "") 
     {alert('Please provide your Password.');
     document.frmCheckLogin.Password.focus();
     return (false);}
  return (true);
}

function LogOffNow() { 
  document.frmLogOff.submit(); 
}


function CheckForm_customer_register() { 
  if (CheckFormFields_customer_register() == true) 
      {document.frmAddUser.submit();}   
}
function CheckFormFields_customer_register() { 
  if (document.frmAddUser.LoginName.value == "") 
     {alert('Please select your Login Name.');
      document.frmAddUser.LoginName.focus();
      return (false);}
  if (document.frmAddUser.LoginName.value.length < 8)
     {alert('Please enter minimum of 8 characters in the Login Name field.');
      document.frmAddUser.LoginName.focus();
      return (false);}
  var checkOK = " ";
  var checkStr = document.frmAddUser.LoginName.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++) {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++) {
       if (ch != checkOK.charAt(j))
        { break; }
     }
    if (j == checkOK.length) {
       allValid = false;
       break;
     }
  }
  if (!allValid) {
    alert("The Login Name should not contain a space between characters.");
    document.frmAddUser.LoginName.focus();
    return (false);
  }
  if (document.frmAddUser.New_Password) {
       if (document.frmAddUser.New_Password.value != "") {
          if ((document.frmAddUser.New_Password.value.length < 8)||(document.frmAddUser.New_Password.value.length > 25)) {
            alert("Please enter minimum of 8 and maximum of 25 characters in the New Password field.");
            document.frmAddUser.New_Password.focus();
            return (false);
           }
          var checkOK = " ";
          var checkStr = document.frmAddUser.New_Password.value;
          var allValid = true;
          for (i = 0;  i < checkStr.length;  i++) {
            ch = checkStr.charAt(i);
            for (j = 0;  j < checkOK.length;  j++) {
               if (ch != checkOK.charAt(j))
                { break; }
             }
            if (j == checkOK.length) {
               allValid = false;
               break;
             }
          }
          if (!allValid) {
            alert("The New Password field should not contain a space between characters.");
            document.frmAddUser.New_Password.focus();
            return (false);
          }
         }
     }
  if (document.frmAddUser.FirstName.value == "") 
     {alert('Please provide your First Name.');
     document.frmAddUser.FirstName.focus();
     return (false);}
  if (document.frmAddUser.LastName.value == "") 
     {alert('Please provide your Last Name.');
     document.frmAddUser.LastName.focus();
     return (false);}
  if (document.frmAddUser.Street.value == "") 
     {alert('Please provide your Street address.');
     document.frmAddUser.Street.focus();
     return (false);}
  if (document.frmAddUser.City.value == "") 
     {alert('Please provide the name of your City.');
     document.frmAddUser.City.focus();
     return (false);}
  if (document.frmAddUser.State[0].selected == true) 
     {alert('Please provide the name of your State.');
     document.frmAddUser.State.focus();
     return (false);}
  if (document.frmAddUser.ZipCode.value == "") 
     {alert('Please provide your Zip Code.');
     document.frmAddUser.ZipCode.focus();
     return (false);}
  var checkOK = "0123456789";
  var checkStr = document.frmAddUser.ZipCode.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++) {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++) {
       if (ch == checkOK.charAt(j))
        { break; }
     }
    if (j == checkOK.length) {
       allValid = false;
       break;
     }
  }
  if (!allValid) {
    alert("Please enter only digit characters in the Zip Code field.");
    document.frmAddUser.ZipCode.focus();
    return (false);
  }
  if (document.frmAddUser.ZipCode.value.length < 5) {
    alert("Please enter five digit characters in the Zip Code field.");
    document.frmAddUser.ZipCode.focus();
    return (false);
  }
  if (document.frmAddUser.PhoneArea.value != "") {
    var checkOK = "0123456789";
    var checkStr = document.frmAddUser.PhoneArea.value;
    var allValid = true;
    for (i = 0;  i < checkStr.length;  i++) {
      ch = checkStr.charAt(i);
      for (j = 0;  j < checkOK.length;  j++) {
         if (ch == checkOK.charAt(j))
          { break; }
       }
      if (j == checkOK.length) {
         allValid = false;
         break;
       }      
    }
    if (!allValid) {
      alert("Please enter only digit characters in the Phone Area Code field.");
      document.frmAddUser.PhoneArea.focus();
      return (false);
    }
  }
  if (document.frmAddUser.PhoneNumber.value != "") {
    var checkOK = "0123456789";
    var checkStr = document.frmAddUser.PhoneNumber.value;
    var allValid = true;
    for (i = 0;  i < checkStr.length;  i++) {
      ch = checkStr.charAt(i);
      for (j = 0;  j < checkOK.length;  j++) {
         if (ch == checkOK.charAt(j))
          { break; }
       }
      if (j == checkOK.length) {
         allValid = false;
         break;
       }
    }
    if (!allValid) {
      alert("Please enter only digit characters in the Phone Number field.");
      document.frmAddUser.PhoneNumber.focus();
      return (false);
    }
  }
  if (document.frmAddUser.PhoneExt.value != "") {
    var checkOK = "0123456789";
    var checkStr = document.frmAddUser.PhoneExt.value;
    var allValid = true;
    for (i = 0;  i < checkStr.length;  i++) {
      ch = checkStr.charAt(i);
      for (j = 0;  j < checkOK.length;  j++) {
         if (ch == checkOK.charAt(j))
          { break; }
       }
      if (j == checkOK.length) {
         allValid = false;
         break;
       }
    }
    if (!allValid) {
      alert("Please enter only digit characters in the Phone Extension field.");
      document.frmAddUser.PhoneExt.focus();
      return (false);
    }
  }
  if (document.frmAddUser.Password.value == "") 
     {alert('Please select your Password.');
     document.frmAddUser.Password.focus();
     return (false);}
  if ((document.frmAddUser.Password.value.length < 8)||(document.frmAddUser.Password.value.length > 25)) {
     alert("Please enter minimum of 8 and maximum of 25 characters in the Password field.");
     document.frmAddUser.Password.focus();
     return (false);
     }
  var checkOK = " ";
  var checkStr = document.frmAddUser.Password.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++) {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++) {
       if (ch != checkOK.charAt(j))
        { break; }
     }
    if (j == checkOK.length) {
       allValid = false;
       break;
     }
  }
  if (!allValid) {
    alert("The Password should not contain a space between characters.");
    document.frmAddUser.Password.focus();
    return (false);
  }
  return (true);
}




function SendRequest_passwordrequest() { 
  if (CheckFormFields_passwordrequest() == true) 
      {document.frmPasswordRequest.submit();}   
}
function CheckFormFields_passwordrequest() { 
  if (document.frmPasswordRequest.Email.value == "") 
     {alert('Please provide your Email Address.');
     document.frmPasswordRequest.Email.focus();
     return (false);}
  return (true);
}


function gotoPage_AOV(myPage) { 
 document.frmPrintInvoice.action = myPage;
 document.frmPrintInvoice.submit();
}




function SubmitForm_AOL() { 
  if (CheckFormFields_AOL() == true) 
      {document.frmCheckLogin.submit();}   
}
function CheckFormFields_AOL() { 
  if (document.frmCheckLogin.LoginName.value == "") 
     {alert('Please provide your Login Name.');
     document.frmCheckLogin.LoginName.focus();
     return (false);}
  if (document.frmCheckLogin.Password.value == "") 
     {alert('Please provide your Password.');
     document.frmCheckLogin.Password.focus();
     return (false);}
  return (true);
}



function SubmitForm_AOO() { 
  if (CheckFormFields() == true) {
  	document.frmCheckLogin.submit();
  }
}
function CheckFormFields() { 
  if (document.frmCheckLogin.LoginName.value == "") {
     alert('Please provide your Login Name.');
     document.frmCheckLogin.LoginName.focus();
     return (false); }
  if (document.frmCheckLogin.Password.value == "") {
     alert('Please provide your Password.');
     document.frmCheckLogin.Password.focus();
     return (false); }
  if (document.frmCheckLogin.CartID.value == "") {
     alert('Please provide your Order Confirmation Number.');
     document.frmCheckLogin.CartID.focus();
     return (false); }
  return (true);
}




function ViewOrder_AOLV(CartID) { 
  document.frmViewOrder.CartID.value=CartID;
  document.frmViewOrder.submit();  
}



function CheckQuantity(PurchaseOK, ItemID) { 
  if (PurchaseOK != "Yes")
  {alert("This product is currently not available. Please check with us later.");}
  else
  {document.frmNewOrder.ItemID.value = ItemID;
   document.frmNewOrder.submit();
  }
}
function sortform(Sort) { 
  document.frmSortForm.Sort.value = Sort;
  document.frmSortForm.submit();  
}
function browseform(AbsolutePage) { 
  document.frmSortForm.AbsolutePage.value = AbsolutePage;
  document.frmSortForm.submit();
}



function view_image(LargeImage) { 
 var gotoURL = "Merchandise_images/"  + LargeImage;
 window.open(gotoURL,'','toolbar=no,menubar=no,location=no,height=350,width=350');
}
function CheckQuantity_IP() { 
 if (document.frmNewOrder.PurchaseOK.value != "Yes")
  {alert("This product is currently not available. Please check with us later.");}
 else
  {document.frmNewOrder.submit();}
}




function UpdateCart() {
  document.ViewCart.submit();
}



