/*var isNS4 = navigator.appName.toLowerCase() == "netscape" && parseInt(navigator.appVersion) <= 4 ? true : false;
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if (plugin) {
    var words = navigator.plugins["Shockwave Flash"].description.split(" ");
    for (var i = 0; i < words.length; ++i) {
        if (isNaN(parseInt(words[i]))) continue;
        var MM_PluginVersion = words[i]
    }
    var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion
} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE") >= 0 && (navigator.appVersion.indexOf("Win") != -1)) {
   // document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
   // document.write('on error resume next \n');
   // document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
   // document.write('</SCR' + 'IPT\> \n')
}*/
function cookiesEnabled() {
    if (readCookie("cookieTest") != null) {
        return true
    } else {
        createCookie("cookieTest", "test", 1);
        if (readCookie("cookieTest") == null) {
            alert("This site uses cookies to store information about your cart.\n\nYou must have cookies enabled to make online orders.\n\nTo place an order by phone, please call us toll-free at 1.800.860.9583.");
            return false
        } else {
            return true
        }
    }
}
function createCookie(strCookieName, strCookieValue, iDaysToExpire) {
    iDaysToExpire = iDaysToExpire == null ? 30 : iDaysToExpire;
    var expires = "";
    var oDate = new Date();
    oDate.setTime(oDate.getTime() + (iDaysToExpire * 24 * 60 * 60 * 1000));
    expires = "; expires=" + oDate.toGMTString();
    document.cookie = strCookieName + "=" + strCookieValue + expires + "; path=/"
}
function readCookie(strCookieName) {
    var nameEQ = strCookieName + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') {
            c = c.substring(1, c.length)
        }
        if (c.indexOf(nameEQ) == 0) {
            return unescape(c.substring(nameEQ.length, c.length))
        }
    }
    return null
}
var descPop;
var discountPop;
var adminPop;
var autoshipPop;
var charityPop;
var passwordPop;
var saveCartPop;
var noAccount;
var couponPop;

function popup(url, varName) {
    if (varName == "descPop") {
        descPop = open(url, 'desc', 'width=420,height=505,scrollbars=1');
        if (typeof (descPop) == "object" && !descPop.closed) descPop.focus()
    } else if (varName == "discountPop") {
        discountPop = open(url, 'discount', 'width=420,height=505,scrollbars=1');
        if (typeof (discountPop) == "object" && !discountPop.closed) discountPop.focus()
    } else if (varName == "adminPop") {
        adminPop = open(url, 'admin', 'width=420,height=505,scrollbars=1');
        if (typeof (adminPop) == "object" && !adminPop.closed) adminPop.focus()
    } else if (varName == "autoshipPop") {
        autoshipPop = open(url, 'autoship', 'width=420,height=505,scrollbars=1');
        if (typeof (autoshipPop) == "object" && !autoshipPop.closed) autoshipPop.focus()
    } else if (varName == "charityPop") {
        charityPop = open(url, 'charity', 'width=420,height=505,scrollbars=1');
        if (typeof (charityPop) == "object" && !charityPop.closed) charityPop.focus()
    } else if (varName == "passwordPop") {
        passwordPop = open(url, 'password', 'width=420,height=505,scrollbars=1');
        if (typeof (passwordPop) == "object" && !passwordPop.closed) passwordPop.focus()
    } else if (varName == "saveCartPop") {
        saveCartPop = open("https://www.pureprescriptions.com" + url, 'saveCart', 'width=420,height=505,scrollbars=1');
        if (typeof (saveCartPop) == "object" && !saveCartPop.closed) saveCartPop.focus()
    } else if (varName == "noAccount") {
        autoshipPop = open(url, 'noaccount', 'width=420,height=350,scrollbars=1');
        if (typeof (autoshipPop) == "object" && !autoshipPop.closed) autoshipPop.focus()
    } else if (varName == "couponPop") {
        couponPop = open(url, 'coupon', 'width=485,height=505,scrollbars=1');
        if (typeof (couponPop) == "object" && !couponPop.closed) couponPop.focus()
    }
}
function trim(val) {
    val = val.replace(/^\s+|\s+$/g, "");
    return val
}
function gotoPage(frameName, url) {
    top.frames["orders_" + frameName].location = url
}
function swapImage(imgName, imgSource) {
    $("img[name=" + imgName + "]").attr("src", imgSource)
}
function swapSrc(imgName, imgSource) {
    $("img[name=" + imgName + "]").attr("src", imgSource)
}
function cSrc(e, sSrc) {
    $(e).attr("src", sSrc)
}
function writeToLayer(strName, val) {
    if (document.all) {
        document.all[strName].innerHTML = val
    } else if (document.layers) {} else if (document.getElementById) {
        document.getElementById(strName).innerHTML = val
    }
}
function getNumber(oField) {
    var qty = Number(oField.value);
    if (isNaN(qty) || qty < 0 || qty > 999 || qty == "") {
        alert("You must enter in a valid quantity.");
        oField.value = 1
    } else {
        if (qty.toString().indexOf(".") != -1) oField.value = Math.floor(qty)
    }
}
function getCurrency(val) {
    var cents;
    val = val.toString();
    if (val != "" && !isNaN(val)) {
        if (val.indexOf(".") == -1) {
            val += ".00"
        } else {
            cents = val.substring(val.indexOf(".") + 1, val.length);
            if (cents.length == 1) val += "0"
        }
        return "$" + val
    } else {
        return ""
    }
}
function getIndex(field, value) {
    for (var i = 0; i < field.options.length; i++) {
        if (field.options[i].value == value || field.options[i].text == value) {
            return i;
            break
        }
    }
    return 0
}
function checkPhone(strValue) {
    var pattern = /[^[0-9]]*/g;
    var sTempVal = strValue;
    sTempVal = (strValue.replace(pattern, ''));
    if (sTempVal.length < 7) {
        return false
    } else {
        return true
    }
}
function checkEmail(strValue) {
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(strValue)) {
        return true
    }
    return false
}
function isValidCreditCard(type, ccnum) {
    if (type == "Visa" && ccnum == "999966661111") return true;
    if (type == "Visa") {
        var re = /^4\d{3}-?\d{4}-?\d{4}-?\d{4}$/
    } else if (type == "MC") {
        var re = /^5[1-5]\d{2}-?\d{4}-?\d{4}-?\d{4}$/
    } else if (type == "Disc") {
        var re = /^6011-?\d{4}-?\d{4}-?\d{4}$/
    } else if (type == "AmEx") {
        var re = /^3[4,7]\d{13}$/
    } else if (type == "Diners") {
        var re = /^3[0,6,8]\d{12}$/
    }
    if (!re.test(ccnum)) return false;
    var checksum = 0;
    for (var i = (2 - (ccnum.length % 2)); i <= ccnum.length; i += 2) {
        checksum += parseInt(ccnum.charAt(i - 1))
    }
    for (var i = (ccnum.length % 2) + 1; i < ccnum.length; i += 2) {
        var digit = parseInt(ccnum.charAt(i - 1)) * 2;
        if (digit < 10) checksum += digit;
        else checksum += (digit - 9)
    }
    if ((checksum % 10) == 0) return true;
    else return false
}
function pageResults(iPage, iPageCount, iTotalRecords, strQueryString) {
    var iCounter = 0;
    var iStart = 0;
    var iEnd = 0;
    var iTotalPages = Math.round((iTotalRecords / iPageCount) + 0.49999999999999);
    var strText = "";
    var url = self.location.toString().substring(0, self.location.toString().indexOf("?"));
    strQueryString = strQueryString == "" ? "" : strQueryString + "&";
    iPage = iPage <= 0 ? 1 : iPage;
    iCounter = Math.round((iPage / iTotalPages * (iTotalPages / iPageCount)) + 0.49999999999999);
    iCounter = iCounter - 1;
    iStart = iPageCount * iCounter;
    iEnd = iStart + iPageCount > iTotalPages ? iTotalPages : iStart + iPageCount;
    strText = "<span class='blu11'>|</span>";
    for (var i = iStart + 1; i <= iEnd; i++) {
        if (i == iPage) strText += "<b style='padding:5px'>" + i + "</b><span class='blu11'>|</span>";
        else strText += "<a href='" + url + "?" + strQueryString + "Page=" + i + "' style='padding:5px'>" + i + "</a><span class='blu11'>|</span>"
    }
    strText = iCounter == 0 ? strText : "<a href='" + url + "?" + strQueryString + "Page=" + iStart + "' class='bodyLink'><<</a> " + strText;
    strText = Math.abs(iStart - iEnd) < iPageCount || iEnd == iTotalPages ? strText : strText + " <a href='" + url + "?" + strQueryString + "Page=" + (iEnd + 1) + "' class='bodyLink'>>></a>";
    document.write(strText)
}
function atYourService(blnShowTopDivider, strOptions, blnShowBottomDivider) {}
function popUpverisign(URL) {
    eval("win3 = window.open(URL, 'win3', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=450,left = 1,top = 1');");
    win3.focus()
};

function popUpprivacy(URL) {
    eval("win4 = window.open(URL, 'win4', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=450,left = 1,top = 1');");
    win4.focus()
};

function popUpfreeship(URL) {
    eval("win5 = window.open(URL, 'win5', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=425,height=282,left = 1,top = 1');");
    win5.focus()
};
if (typeof jQuery == 'undefined') {
    document.write('<script src="/js/jquery-1.3.2.min.js" type="text/javascript"></script>')
}
