﻿function MM_preloadImages() { //v3.0
    var d = document; if (d.images) {
        if (!d.MM_p) d.MM_p = new Array();
        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; }
    }
}
function MM_swapImgRestore() { //v3.0
    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}
function MM_findObj(n, d) { //v4.01
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
}
function chkform() {
    var MyInput;
    for (var i = 0; i < document.cartform.elements.length; i++) {
        if (document.cartform.elements[i].name == 'jobloss') {
            //alert(document.cartform.elements[i].name)
            MyInput = document.cartform.elements[i];
            if (isNaN(MyInput.value)) {
                alert("Please Use Numbers");
                MyInput.focus();
                MyInput.select();
                return false;
            }
        }
        if (document.cartform.elements[i].name == 'smoking') {
            //alert(document.cartform.elements[i].name)
            MyInput = document.cartform.elements[i];
            if (isNaN(MyInput.value)) {
                alert("Please Use Numbers");
                MyInput.focus();
                MyInput.select();
                return false;
            }
        }
        if (document.cartform.elements[i].name == 'weight') {
            //alert(document.cartform.elements[i].name)
            MyInput = document.cartform.elements[i];
            if (isNaN(MyInput.value)) {
                alert("Please Use Numbers");
                MyInput.focus();
                MyInput.select();
                return false;
            }
        }
        if (document.cartform.elements[i].name == 'stress') {
            //alert(document.cartform.elements[i].name)
            MyInput = document.cartform.elements[i];
            if (isNaN(MyInput.value)) {
                alert("Please Use Numbers");
                MyInput.focus();
                MyInput.select();
                return false;
            }
        }
        if (document.cartform.elements[i].name == 'sleep') {
            //alert(document.cartform.elements[i].name)
            MyInput = document.cartform.elements[i];
            if (isNaN(MyInput.value)) {
                alert("Please Use Numbers");
                MyInput.focus();
                MyInput.select();
                return false;
            }
        }
        if (document.cartform.elements[i].name == 'intimate') {
            //alert(document.cartform.elements[i].name)
            MyInput = document.cartform.elements[i];
            if (isNaN(MyInput.value)) {
                alert("Please Use Numbers");
                MyInput.focus();
                MyInput.select();
                return false;
            }
        }
    }
    return true;
}
function chkShipForm() {
    if (document.cartform("firstname").value == "") {
        alert("User First Name Cannot be Empty!");
        document.cartform("firstname").focus();
        return false;
    }
    if (document.cartform("lastname").value == "") {
        alert("User Last Name Cannot be Empty!");
        document.cartform("lastname").focus();
        return false;
    }
    if (document.cartform("streetaddress").value == "") {
        alert("Street Address Cannot be Empty!");
        document.cartform("streetaddress").focus();
        return false;
    }
    if (document.cartform("city").value == "") {
        alert("City Cannot be Empty!");
        document.cartform("city").focus();
        return false;
    }
    if (document.cartform("state").value == "") {
        alert("State Cannot be Empty!");
        document.cartform("state").focus();
        return false;
    }
    if (document.cartform("zip").value == "") {
        alert("Postal Code Cannot be Empty!");
        document.cartform("zip").focus();
        return false;
    }
    if (document.cartform("phone1").value == "") {
        alert("Phone Cannot be Empty!");
        document.cartform("phone1").focus();
        return false;
    }
    if (isNaN(document.cartform("phone1").value)) {
        alert('Digits only here!');
        document.cartform("phone1").focus();
        return false;
    }
    if (document.cartform("phone1").value.length != 3) {
        alert('Three digits here!');
        //alert(document.cartform("phone1").length)
        document.cartform("phone1").focus();
        return false;
    }
    if (document.cartform("phone2").value == "") {
        alert("Phone Cannot be Empty!");
        document.cartform("phone2").focus();
        return false;
    }
    if (isNaN(document.cartform("phone2").value)) {
        alert('Digits only here!');
        document.cartform("phone2").focus();
        return false;
    }
    if (document.cartform("phone2").value.length != 3) {
        alert('Three digits here!');
        document.cartform("phone2").focus();
        return false;
    }
    if (document.cartform("phone3").value == "") {
        alert("Phone Cannot be Empty!");
        document.cartform("phone3").focus();
        return false;
    }
    if (isNaN(document.cartform("phone3").value)) {
        alert('Digits only here!');
        document.cartform("phone3").focus();
        return false;
    }
    if (document.cartform("phone3").value.length != 4) {
        alert('Four digits here!');
        document.cartform("phone3").focus();
        return false;
    }
    if (document.cartform("email").value == "") {
        alert("Email Cannot be Empty!");
        document.cartform("email").focus();
        return false;
    }
    return true;
}
function chkPaymentform() {
    if (document.cartform("paymenttype").value == "") {
        alert("Payment Type is blank!");
        document.cartform("paymenttype").focus();
        return false;
    }
    if (document.cartform("CCNum").value == "") {
        alert("Credit Card Number is blank!");
        document.cartform("CCNum").focus();
        return false;
    }
    if (isNaN(document.cartform("CCNum").value)) {
        alert('Digits only here!');
        document.cartform("CCNum").focus();
        return false;
    }
    if (document.cartform("expdate").value == "") {
        alert("Expiration date Cannot be Empty!");
        document.cartform("expdate").focus();
        return false;
    }
    if (isNaN(document.cartform("expdate").value)) {
        alert('Digits only here!');
        document.cartform("expdate").focus();
        return false;
    }
    if (document.cartform("expdate").value.length != 4) {
        alert('Four digits here!');
        document.cartform("expdate").focus();
        return false;
    }
    //alert(document.cartform("PaymentType").value)
    //if (document.cartform("PaymentType").value=="VS")||(document.cartform("PaymentType").value=="MC")
    //{
    //}
    if (document.cartform("billtofirstname").value == "") {
        alert("User First Name Cannot be Empty!");
        document.cartform("billtofirstname").focus();
        return false;
    }
    if (document.cartform("billtolastname").value == "") {
        alert("User Last Name Cannot be Empty!");
        document.cartform("billtolastname").focus();
        return false;
    }
    if (document.cartform("billtostreetaddress").value == "") {
        alert("Street Address Cannot be Empty!");
        document.cartform("billtostreetaddress").focus();
        return false;
    }
    if (document.cartform("billtocity").value == "") {
        alert("City Cannot be Empty!");
        document.cartform("billtocity").focus();
        return false;
    }
    if (document.cartform("billtostate").value == "") {
        alert("State Cannot be Empty!");
        document.cartform("billtostate").focus();
        return false;
    }
    if (document.cartform("billtozip").value == "") {
        alert("Postal Code Cannot be Empty!");
        document.cartform("billtozip").focus();
        return false;
    }
    if (document.cartform("phone1").value == "") {
        alert("Phone Cannot be Empty!");
        document.cartform("phone1").focus();
        return false;
    }
    if (isNaN(document.cartform("phone1").value)) {
        alert('Digits only here!');
        document.cartform("phone1").focus();
        return false;
    }
    if (document.cartform("phone1").value.length != 3) {
        alert('Three digits here!');
        //alert(document.cartform("billtophone1").length)
        document.cartform("phone1").focus();
        return false;
    }
    if (document.cartform("phone2").value == "") {
        alert("Phone Cannot be Empty!");
        document.cartform("phone2").focus();
        return false;
    }
    if (isNaN(document.cartform("phone2").value)) {
        alert('Digits only here!');
        document.cartform("phone2").focus();
        return false;
    }
    if (document.cartform("phone2").value.length != 3) {
        alert('Three digits here!');
        document.cartform("phone2").focus();
        return false;
    }
    if (document.cartform("phone3").value == "") {
        alert("Phone Cannot be Empty!");
        document.cartform("phone3").focus();
        return false;
    }
    if (isNaN(document.cartform("phone3").value)) {
        alert('Digits only here!');
        document.cartform("phone3").focus();
        return false;
    }
    if (document.cartform("phone3").value.length != 4) {
        alert('Four digits here!');
        document.cartform("phone3").focus();
        return false;
    }
    return true;
}
