﻿// JScript File


// Add to Cart Function

function GoToCheckOut()
{
    alert("The item has been added to your shopping cart.");
}

function CheckShippingMethod(shipmethod)
{
    if(shipmethod == 99)
    {
        alert('Please include Your Preferred Carrier, Account #, and Speed in the Special instructions.');
    }
}

function NoInsuranceWarning(checker) {
    if (checker == false) {
        alert("By declining insurance on your package for the full amount, you will only be eligible for $100 of protection if your package is lost, stolen, or damaged while in transit.");
    }
}

function NoInsuranceWarningUSPS(checker) {
    if (checker == false) {
        alert("By declining insurance on your package, you will not be reimbursed for the cost of your product and shipping if your package is lost, stolen, or damaged while in transit.");
    }
}

function NoInsuranceWarningCustom(checker) {
    if (checker == false) {
        alert("By declining insurance on your package, you will only be covered for the minimum amount your preferred carrier provides if your package is lost, stolen, or damaged while in transit.");
    }
}

function FreightShipmentEstimateWarning()
{
    alert("Shipping Costs can not be estimated because one or more of your items in your cart is a Truck Shipment Only. After placing your order, we will calculate your exact freight cost and contact you with the specific freight amount.");
}

function FreightShipmentCheckoutWarning()
{
    alert("Shipping Costs can not be calculated because one or more of your items in your cart is a Truck Shipment Only. After placing your order, we will calculate your exact freight cost and contact you with the specific freight amount.");
}

function ToggleCVV2()
{
    var cvv2frame = document.getElementById("iframe_cvv2");
    if(cvv2frame.style.display != "block")
    {
        cvv2frame.style.display="block";
        cvv2frame.style.left = (cX) + "px";
        cvv2frame.style.top = (cY) + "px";
        cvv2frame.style.border = "solid 1px";
        cvv2frame.style.width = "450px";
        cvv2frame.style.height = "250px";
    }
    else
    {
        cvv2frame.style.display="none";
    }
}


function CleanSearchBox(searchid) {
    var cleaned = document.getElementById(searchid).value
    cleaned = cleaned.replace(/(<([^>]+)>)/ig, "");
    document.getElementById(searchid).value = cleaned;
}

function CleanInputBox(searchid) {
    var cleaned = document.getElementById(searchid).value
    cleaned = cleaned.replace(/(<([^>]+)>)/ig, "");
    document.getElementById(searchid).value = cleaned;
}

function fnTrapKD(btn, event){
 if (document.all){
     if (event.keyCode == 13) {
       event.returnValue=false;
       event.cancel = true;
       btn.click();
    }
 }
 else if (document.getElementById){
  if (event.which == 13){
   event.returnValue=false;
   event.cancel = true;
   btn.click();
  }
 }
 else if(document.layers){
  if(event.which == 13){
   event.returnValue=false;
   event.cancel = true;
   btn.click();
  }
 }
}
