var checkItemLevel = 0;
var catEntryId_1 = 0;
var isSoftlineOutStockEmail = 0;
var isProductPage = false;
function checkItemLevelCatEntry(a) {
    checkItemLevel = a
}
function checkSoftlinePage(a) {
    isSoftlineOutStockEmail = a
}
function deCodePName(a) {
    var c = replaceCharacters(a, "##12", "'");
    var b = replaceCharacters(c, "##13", "''");
    return b
}
function replaceCharacters(a, d, c) {
    var b = a.split(d);
    b = b.join(c);
    return b
}

function rtrim(a) {
    return a.replace(/\s*$/, "")
}
function ltrim(a) {
    return a.replace(/^\s*/, "")
}

function replaceAll(strChk, strFind, strReplace) {
    var strOut = strChk;
    while (strOut.indexOf(strFind) > -1) {
        strOut = strOut.replace(strFind, strReplace);
    }
    return strOut;
}

var Sears = {
    topNav: function() {
        var global = this;
        var depts = $('#deptNav')
        var shopAll = $('#MNshopAll');
        var timer = 0;
        var timer2 = 0;
        var timer3 = 0;
        var timer4 = 0;
        var timer5 = 0;
        var idx = 0;
        var buffer = 0;
        if ($('body').is('#home')) {
            depts.show();
        } else {
            depts.appendTo('#wrap').css({
                top: '94px',
                left: '0'
            });
        }
        function loadFly() {
            $('#tempNav').remove();
            depts.find('li.active').removeClass('active');
            depts.find('li#' + idx).addClass('active');
            var div = $('<div/>').attr({
                id: 'tempNav'
            }).css({
                position: 'absolute',
                display: 'none',
                float: 'left',
                top: (depts.offset().top - 22),
                left: (depts.offset().left + depts.width()) - buffer,
                zIndex: 1000
            }).appendTo('body').hover(function() {
                clearTimeout(timer2);
                clearTimeout(timer4);
                clearTimeout(timer5);
            },
            function() {
                timer2 = setTimeout(function() {
                    $('#tempNav').fadeOut(300,
                    function() {
                        $(this).remove()
                    });
                    if ($('body').is(':not(#home)')) {
                        depts.fadeOut(300).find('li.active').removeClass('active');
                    } else {
                        depts.find('li.active').removeClass('active');
                    }
                },
                800);
            });
            div.append($('#' + idx.split('_n')[0] + '_fly').clone()).show(10,
            function() {
                //alert($('#tempNav').attr('id'));
                var _this = $('#tempNav');
                _this.bgIframe();
                var tallest = _this.find('.col:eq(0)').height();
                _this.find('.col').each(function(i) {
                    if ($(this).height() > tallest) {
                        tallest = $(this).height();
                    }
                });
                _this.find('.col').height(tallest);
            });
        }
        shopAll.hover(function() {
            timer3 = setTimeout(function() {
                depts.fadeIn(300);
            },
            500)
        },
        function() {
            clearTimeout(timer3);
            timer4 = setTimeout(function() {
                if ($('body').is('#home')) {
                    $('#tempNav').fadeOut(300).find('li.active').removeClass('active');
                } else {
                    depts.add('#tempNav').fadeOut(300).find('li.active').removeClass('active');
                }
            },
            500);
        }).click(function() {
            return false;
        });
        depts.children().hover(function() {
            clearTimeout(timer4)
            idx = $(this).attr('id');
            $(this).addClass('hover');
            var tempNav = $('#tempNav');
            timer = setTimeout(loadFly, 400);
        },
        function() {
            $(this).removeClass('hover');
            clearTimeout(timer);
        });
        depts.hover(function() {
            clearTimeout(timer2);
        },
        function() {
            $('#tempNav').mouseout();
            timer5 = setTimeout(function() {
                $('#tempNav').fadeOut(300,
                function() {
                    $(this).remove()
                });
                if ($('body').is(':not(#home)')) {
                    depts.fadeOut(300).find('li.active').removeClass('active');
                } else {
                    depts.find('li.active').removeClass('active');
                }
            },
            500);
        });
        function qsval(name) {
            name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
            var results = new RegExp("[\\?&]" + name + "=([^&#]*)").exec(window.location.href);
            return results === null ? '': results[1].replace(/[+]/g, " ");
        }
        $('#keyword').css({
            color: '#666666'
        }).val('').focus(function() {
            $(this).css({
                color: '#000000'
            });
            if (this.value == '') {
                this.value = '';
            } else {
                $(this).select();

            }
        }).blur(function() {
            if (this.value == '') {
                $(this).css({
                    color: '#666666'
                }).val('');
            } else {}
        });

    },
    getWindowSize: function() {
        var xScroll, yScroll, windowWidth, windowHeight;
        if (window.innerHeight && window.scrollMaxY) {
            xScroll = document.body.scrollWidth + window.scrollMaxX;
            yScroll = window.innerHeight + window.scrollMaxY;
        } else if (document.body.scrollHeight > document.body.offsetHeight) {
            xScroll = document.body.scrollWidth;
            yScroll = document.body.scrollHeight;
        } else {
            xScroll = document.body.offsetWidth;
            yScroll = document.body.offsetHeight;
        }
        if (self.innerHeight) {
            windowWidth = self.innerWidth;
            windowHeight = self.innerHeight;
        } else if (document.documentElement && document.documentElement.clientHeight) {
            windowWidth = document.documentElement.clientWidth;
            windowHeight = document.documentElement.clientHeight;
        } else if (document.body) {
            windowWidth = document.body.clientWidth;
            windowHeight = document.body.clientHeight;
        }
        if (yScroll < windowHeight) {
            pageHeight = windowHeight;
        } else {
            pageHeight = yScroll;
        }
        if (xScroll < windowWidth) {
            pageWidth = windowWidth;
        } else {
            pageWidth = xScroll;
        }
        return {
            'pageWidth': pageWidth,
            'pageHeight': pageHeight,
            'windowWidth': windowWidth,
            'windowHeight': windowHeight
        };
    },
    /**
	 * 
	 */
    showHideRecentlyView: function(e) {
        if (e) {
            $("#recentlyView").fadeIn("slow");
            $("#linkToContinue").css("visibility", "hidden");
        }
        else {
            $("#recentlyView").fadeOut("slow");
            $("#linkToContinue").css("visibility", "visible");
        }
    },
    preloadImages: function() {
        if (document.images) {
            document.myImages = new Array();
            for (var i = 0; i < preloadImages.arguments.length; i++) {
                document.myImages[i] = new Image;
                document.myImages[i].src = preloadImages.arguments[i];
            }
        }
    }
};
function sr_create_script(a) {
    var b = document.createElement('script');
    b.type = 'text/javascript';
    b.src = a;
    document.getElementsByTagName('head')[0].appendChild(b);
}
function showHideContainer(element) {
    if (document.all) {
        if (element.style.display == "none") $("#" + element.id).fadeIn("slow");
        else $("#" + element.id).fadeOut("slow");
    }
}


// Set up page to do multiple loads //
function addLoadEvent(func) {

    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    }
    else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }

}

//This section is added in this js apart from global.js
//Gets a cookie from the session based on the cookiename. if there is no cookie present an empty string is returned
function getCookie(cookieName) {
    var cookieArray = document.cookie.split("; ");
    var searchString = cookieName + "=";
    var returnValue = '';

    for (var index = 0; index < cookieArray.length; index++) {
        var cookie = cookieArray[index];
        var position = cookie.indexOf(searchString);

        if (position == 0) {
            var name_value = cookie.split("=");

            if (name_value[1] != '') {
                returnValue = name_value[1];
            }
            else {
                returnValue = '';
            }

        }
    }
    return returnValue;
}

//Sets a cookie in the session based on the cookiename and cookievalue
function setCookie(cookieName, cookieValue) {
    document.cookie = cookieName + "=" + cookieValue + ";";
}

function checkIt(a) {
    place = detect.indexOf(a) + 1;
    thestring = a;
    return place
}

function gup(b) {
    b = b.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var a = "[\\?&]" + b + "=([^&#]*)";
    var d = new RegExp(a);
    var c = d.exec(window.location.href);
    if (c == null) {
        return ""
    } else {
        return c[1]
    }
}
function remove(b) {
    var a = b.parentNode;
    a.removeChild(b)
}
function removeID(b) {
    var a = document.getElementById(b);
    document.body.removeChild(a)
}

function removeSpaces(b) {
    var a = "";
    b = "" + b;
    splitstring = b.split(" ");
    for (i = 0; i < splitstring.length; i++) {
        a += splitstring[i]
    }
    return a
}

function hideTabs(c) {
    var f = document.getElementById("tabList");
    var b = f.getElementsByTagName("dt").length;
    for (var e = 1; e < b + 1; e++) {
        if (document.getElementById("tab_" + e).className == "selected") {
            tabHide = document.getElementById("tab_" + e);
            tabHide.className = "unselected"
        }
        document.getElementById("tab" + e).style.display = "none"
    }
    tabHide = document.getElementById("tab_" + c);
    tabHide.className = "selected";
    document.getElementById("tab" + c).style.display = ""
}
function showBox(a) {
    if (document.getElementById && null != document.getElementById(a)) {
        document.getElementById(a).style.display = ""
    }
    return true
}
function hideBox(a) {
    if (document.getElementById && null != document.getElementById(a)) {
        document.getElementById(a).style.display = "none"
    }
    return true
}
function showhideBox(b) {
    var a = document.getElementById(b);
    if (document.getElementById) {
        if (a.style.display !== "none") {
            a.style.display = "none"
        } else {
            a.style.display = ""
        }
    }
    a.style.top = "15px";
    a.style.left = "-5px"
}

function collapse(d, c) {
    if (document.getElementById(d).className == "hideAtt") {
        hideCell(c);
        tableHide = document.getElementById(d);
        tableHide.className = "showAtt";
        tableHide.innerHTML = '<a href="javascript:;" onClick="collapse(\'' + d + "','" + c + "');\">See Details</a>";
        d = d + "_on"
    } else {
        if (d + "_on") {
            showCell(c);
            tableHide = document.getElementById(d);
            tableHide.className = "hideAtt";
            tableHide.innerHTML = '<a href="javascript:;" onClick="collapse(\'' + d + "','" + c + "');\">Hide Details</a>";
            d = d + "_off"
        }
    }
}
initialvalue = 6;
function selectedsize_fn(c, b, a) {
    chosensize = a;
    document.getElementById("size").innerHTML = a;
    document.getElementById("size").innerText = a;
    identity1 = document.getElementById("size_1");
    identity1.className = "unselectedsize";
    identity2 = document.getElementById("size_2");
    identity2.className = "unselectedsize";
    identity3 = document.getElementById("size_3");
    identity3.className = "unselectedsize";
    identity = document.getElementById(c);
    identity.className = b;
    initialvalue = ""
}
function showTab(c, e) {
    var k = document.getElementById("tabList");
    var b = k.getElementsByTagName("dd").length;
    for (var f = 1; f < b + 1; f++) {
        if (document.getElementById("tab_" + f).className == "selected") {
            tabHide = document.getElementById("tab_" + f);
            tabHide.className = "unselected"
        }
        if (document.getElementById("tab" + f)) {
            document.getElementById("tab" + f).style.display = "none"
        }
    }
    tabHide = document.getElementById("tab_" + c);
    tabHide.className = "selected";
    document.getElementById("tab" + c).style.display = "";
    var l = tabHide.childNodes;
    for (var f = 0; f < l.length; f++) {
        var g = l[f];
        if (g.tagName == "A") {
            var j = g.innerHTML;
            if (j != null && j != "Overview") {
                if (j.indexOf("Review") != -1) {
                    j = "Reviews"
                }
                j += " Tab";
                if (typeof omPrefix != "undefined") {
                    omPrefix = "Product Summary > " + j
                }
                if (typeof s != "undefined") {
                    s.t()
                }
            }
            break
        }
    }
    selectOverview(c - 1);
    if (c == 2) {
        ajaxCall(e, "displayTabContent", null, "tab2")
    }
    if (c == 3 && e != null) {
        ajaxCall(e, "displayTabContent", null, "tab3")
    }
}
function showSearchTab(c) {
    var f = document.getElementById("tabList");
    var b = f.getElementsByTagName("dd").length;
    for (var e = 1; e < b + 1; e++) {
        if (document.getElementById("tab_" + e).className == "selected") {
            tabHide = document.getElementById("tab_" + e);
            tabHide.className = "unselected"
        }
        document.getElementById("tab" + e).style.display = "none"
    }
    tabHide = document.getElementById("tab_" + c);
    tabHide.className = "selected";
    document.getElementById("tab" + c).style.display = "";
    selectOverview(c - 1)
}
function selectOverview(b) {
    if (document.getElementById("overviewBox")) {
        var e = document.getElementById("overviewBox");
        var a = e.getElementsByTagName("li");
        for (var c = 0; c < a.length; c++) {
            if (a[c].className == "selected") {
                a[c].className = ""
            }
        }
        a[b].className = "selected"
    }
}
function showHideLite(a) {
    var a = document.getElementById(a);
    a.style.display = (a.style.display == "none") ? "": "none"
}
function showHide(c) {
    var b = document.getElementById(c);
    var a = document.getElementById(c + "_edit");
    b.className = (b.className == "open") ? "close": "open";
    a.style.display = (a.style.display == "none") ? "": "none"
}
function showHideSelect(k, g) {
    if (!document.getElementsByTagName) {
        return false
    }
    if (!document.getElementById) {
        return false
    }
    var b = document.getElementById(k);
    var f = b.getElementsByTagName("option");
    for (var c = 0; c < f.length; c++) {
        var d = f[c].value;
        var a = document.getElementById(d);
        if (a) {
            a.style.display = "none"
        }
    }
    var e = document.getElementById(g);
    if (e) {
        e.style.display = ""
    }
}
function checkAll(b, c) {
    var a = document.getElementsByTagName("input");
    for (z = 0; z < a.length; z++) {
        if (a[z].type == "checkbox" && a[z].name == c) {
            a[z].checked = b.checked
        }
    }
}
var h = "";
function timeOutNav(b) {
    var a = "hideBox('d" + b + "')";
    h = setTimeout(a, 500)
}
function dropNav(d, c) {
    var b = c;
    for (var e = 1; e < b + 1; e++) {
        document.getElementById("d" + e).style.display = "none";
        document.getElementById("c" + e).style.position = "static"
    }
    document.getElementById("d" + d).style.display = "block";
    document.getElementById("c" + d).style.position = "relative";
    document.getElementById("content").style.zIndex = 10
}

function findPos(a) {
    xPos = yPos = 0;
    if (a.offsetParent) {
        xPos = a.offsetLeft;
        yPos = a.offsetTop;
        while (a = a.offsetParent) {
            xPos += a.offsetLeft;
            yPos += a.offsetTop
        }
    }
    xPos += 20;
    yPos += 20;
    return [xPos, yPos]
}
function findPosX(a) {
    var b = 0;
    if (a.offsetParent) {
        while (a.offsetParent) {
            b += a.offsetLeft;
            a = a.offsetParent
        }
    } else {
        if (a.x) {
            b += a.x
        }
    }
    return b
}
function findPosY(b) {
    var a = 0;
    if (b.offsetParent) {
        while (b.offsetParent) {
            a += b.offsetTop;
            b = b.offsetParent
        }
    } else {
        if (b.y) {
            a += b.y
        }
    }
    return a
}
function hideSelect(a) {
    if (document.all) {
        document.getElementById(a).style.display = "hidden"
    }
}
function unhideSelect(a) {
    if (document.all) {
        document.getElementById(a).style.visibility = "visible"
    }
}
function prepareLinks(d, b, c) {
    if (document.getElementById || document.all) {
        var a = document.getElementById(d).getElementsByTagName(b);
        for (i = 0; i < a.length; i++) {
            if (a[i].className == c && c == "print") {
                a[i].onclick = function() {
                    print()
                }
            }
            if (a[i].className == c && c == "shippingCal") {
                a[i].onclick = function() {
                    shippingCalculator(d)
                }
            }
        }
        flyOut()
    }
}


function rObj(a) {
    var b = document.getElementById(a);
    return b
}
function disObjBlk(b, a) {
    if (b != null && typeof b == "object") {
        if (a) {
            b.style.display = "block"
        } else {
            b.style.display = "none"
        }
    }
}
function searsAjax(a, b) {
    var d = null;
    var f = b.onSuccess;
    var c = b.onFailure;
    if (window.XMLHttpRequest) {
        d = new XMLHttpRequest();
        if (d) {
            d.onreadystatechange = e;
            d.open(b.method, a, b.asynchronous);
            d.send(null)
        }
    } else {
        if (window.ActiveXObject) {
            d = new ActiveXObject("Microsoft.XMLHTTP");
            if (d) {
                d.onreadystatechange = e;
                d.open(b.method, a, b.asynchronous);
                d.send()
            }
        }
    }
    if (!d) {
        return
    }
    function e() {
        if (d.readyState == 4) {
            if (d.status == 200) {
                f(d)
            } else {
                c(d)
            }
        }
    }
}
function checkEmailChar(b) {
    var a = b.length;
    for (iLoop = 0; iLoop < a; iLoop++) {
        if ((b.charCodeAt(iLoop) >= 33 && b.charCodeAt(iLoop) <= 41) || (b.charCodeAt(iLoop) >= 58 && b.charCodeAt(iLoop) <= 63)) {
            return false
        }
    }
    return true
}
function BVcheckLoadStateRdNew() {
    if (!BVisLoaded) {
        rObj("BVFrame").src = "";
        var a = rObj("BVFrame").src;
        rObj("BVFrame").src = rvInfo;
        rObj("BVReviewsContainer").innerHTML = "Product Reviews Currently Unavailable"
    }
}
var zipCode = "";
function doAjax(b, g) {
    zipCode = b;
    var f = "CalculateRegionalSaveStoryCmd";
    var j = window.location.protocol;
    if (j == "http:" || j == "") {
        f = "CalculateRegionalSaveStoryCmdhttp"
    }
    var c = "";
    var k = "";
    setCookie("zipCode", zipCode);
    var a = "";
    if (typeof allRegiSS != "undefined") {
        for (var d = 0; d < allRegiSS.length; d++) {
            if (allRegiSS[d].regiSSInd) {
                var e = allRegiSS[d].pn;
                if (!allRegiSS[d].regiIBType) {
                    e = allRegiSS[d].pn.substring(0, 11)
                }
                if (c.search(e) == -1) {
                    c += e + "|";
                    k += allRegiSS[d].ss + "|"
                }
            }
        }
    }
    var a = f + "?storeId=" + g + "&zipCode=" + zipCode + "&partNumberList=" + c;
    request = $.post(a, showResponse)
}
function showResponse(respHTML) {
    var zipCode = $.cookie("zipCode");
    var _Rp = eval("(" + respHTML + ")");
    var fpr = "";
    if (typeof allRegiSS != "undefined") {
        if (_Rp.errorCode == "STORE_FOUND") {
            for (var i = 0; i < allRegiSS.length; i++) {
                if (allRegiSS[i].regiSSInd) {
                    var partNum = allRegiSS[i].pn;
                    for (var k = 0; k < _Rp.prodCount; k++) {
                        if (_Rp.price[k].pId == allRegiSS[i].pn || _Rp.price[k].pId == allRegiSS[i].pn.substring(0, 11)) {
                            if (_Rp.price[k].isException) {
                                populatePrice(_Rp.price[k].saveStory, allRegiSS[i].pn, "Price May Vary", allRegiSS[i].regiIBType)
                            } else {
                                populatePrice(_Rp.price[k].saveStory, allRegiSS[i].pn, "Price in " + zipCode, allRegiSS[i].regiIBType)
                            }
                            break
                        }
                    }
                } else {
                    populatePrice(allRegiSS[i].ss, allRegiSS[i].pn, "Price in " + zipCode, allRegiSS[i].regiIBType)
                }
            }
        } else {
            for (var kk = 0; kk < allRegiSS.length; kk++) {
                if (allRegiSS[kk].regiSSInd) {
                    populatePrice(allRegiSS[kk].ss, allRegiSS[kk].pn, "Price May Vary", allRegiSS[kk].regiIBType)
                } else {
                    populatePrice(allRegiSS[kk].ss, allRegiSS[kk].pn, "Price in " + zipCode, allRegiSS[kk].regiIBType)
                }
            }
        }
    }
    populateStoreInfo(_Rp);
    if (window.afterRegiSS) {
        afterRegiSS()
    }
    if ($("body").attr("id") == "product") {
        fixInfoHeight()
    }
}
var regionalDiv = "";
var currentPartNo = "";
var dbFlagVal = "";
var catentryVal = "";
var pageFlag = "";
var qvDiv = "";
var repaintedZipCode = "";
var atcZipCode = "";
var CAPopUpFlag = true;
function checkRegionalZip() {
    regionalZip = $("#availPopup div:visible #zipCode").val();
    var a = /^\d{5}$|^\d{5}\-?\d{4}$/;
    var b = a.test(regionalZip);
    if (!b) {
        showErrorMsg();
        return false
    } else {
        return true
    }
}
function showErrorMsg() {
    var a = "<div id='validatePopup' class='validatePopup'>" + "<h3>Enter Zip Code</h3>\n" + "<h2>Please enter a valid 5-digit ZIP code (example: 60515).</h2>" + "\n\n<input type='submit' name='ok' value='OK' onclick='remove(this.parentNode);' style='margin-bottom:10px'>\n";
    $("body").append(a);
    $("#validatePopup").centerOnScreen()
}
var zipOnLoad = "";
function regionalAvlMain(e, c, b) {
    $(".standardDiv input#checkZip").css({
        display: "none"
    });
    $(".errorDiv input#checkZip").css({
        display: "none"
    });
    $(".standardDiv #loadGif").css({
        display: "inline"
    });
    $(".errorDiv #loadGif").css({
        display: "inline"
    });
    var d = false;
    if ($("input#qvPickUpFlag")) {
        var a = $("input#qvPickUpFlag").attr("value");
        if (a == "1") {
            d = true
        }
    }
    if (e == "PRD") {
        if (regionalDiv.indexOf("storepu") > -1 || regionalDiv.indexOf("pickup") > -1) {
            storeLocator()
        } else {
            if (zipOnLoad == "") {
                if (atcDelFlag) {
                    makeRegionalDeliveryCall(e, c, b, "")
                } else {
                    makeRegionalDeliveryCall(e, c, b, "");
                    if (pickUpVar == "1") {
                        makeRegionalRTICall()
                    }
                }
            } else {
                makeRegionalDeliveryCall(e, c, b, "")
            }
        }
    } else {
        if ((qvDiv == "checkAvailSpu" || d) && qvDiv != "checkAvailDel") {
            $("#availPopup").remove();
            if (qvDiv == "checkAvailSpu") {
                fnRegionalStorePickUpQV(currentPartNo)
            } else {
                if (d) {
                    storeLocator()
                }
            }
        } else {
            if (regionalDiv.indexOf("storepu") > -1) {
                $("#availPopup").remove();
                fnRegionalStorePickUp(currentPartNo)
            } else {
                fnRegDeliveryAvlAjax(e, c, b)
            }
        }
    }
}

function fnSpuZip() {
    var a = "";
    if ((pageFlag == "CAT" || pageFlag == "COM") && fnChkZipCode()) {
        if ((regionalDiv == "storepu") || (qvDiv == "checkAvailSpu")) {
            a = getRegPickZip()
        } else {
            a = getRegDelZip()
        }
    } else {
        if (pageFlag == "PRD") {
            if ((regionalDiv.indexOf("storepu") > -1 || regionalDiv.indexOf("pickup") > -1) && fnChkZipCode()) {
                a = getRegPickZip()
            } else {
                if (fnChkZipCode()) {
                    a = getRegDelZip()
                }
            }
        }
    }
    return a
}
var atcDelFlag = false;
var showCAPopUp = function() {
    $("#availPopup").remove();
    fnPopUp()
};
function fnPopUp() {
    zipType = "";
    if ((pageFlag == "PRD" || pageFlag == "CAT" || pageFlag == "COM") && (regionalDiv.indexOf("storepu") > -1 || regionalDiv.indexOf("pickup") > -1)) {
        zipOnLoad = getCookie("zipCode" + getStoreId());
        zipType = "storepu"
    } else {
        zipOnLoad = getCookie("zipCode");
        zipType = "delivery"
    }
    CAPopUpFlag = false;
    var a = "<div id='availPopup' class='availPopup' style='display: none;'><div style='display: none;' class='standardDiv'><h2>Check Availability</h2><a href='javascript:;' class='closeAvail'>Close</a>" + "<p><span>See What's in Stock</span>We need a little more info to check this item's local availability.<br/>" + "Enter your zip.</p><p><label for='zipCode'>Enter ZIP Code: </label><input type='text' id='zipCode' value='" + fnSpuZip() + "' maxlength='5' size='5'/>" + "<input type='image' value='Check Availability' id='checkZip' src='" + imagePath + "img/btn_check_availability.gif' onClick='if(checkRegionalZip()){setRegZip(regionalZip,zipType);regionalAvlMain(pageFlag,dbFlagVal,catentryVal);}'/>" + "<img height='16' width='16' alt='loading...' src='" + imagePath + "img/loadingSmall.gif' id='loadGif' style='display: none;'/></p>" + "</div>" + "<div style='display: none;' class='errorDiv'><h2>Check Availability</h2><a href='javascript:;' class='closeAvail' id='closeAvail'>Close</a>" + "<p class='error'>This product doesn't seem to be available for Delivery in the ZIP Code you've entered.</p><p>Some product availability is based on region, so this product may not be available in your area.</p>" + "<p><label for='zipCode'>Check another ZIP Code for Delivery: </label><input type='text' id='zipCode' maxlength='5' size='5'/>" + "<input type='image' value='Check Availability' id='checkZip' src='" + imagePath + "img/btn_check_availability.gif' onClick='if(checkRegionalZip()){setRegZip(regionalZip,zipType);regionalAvlMain(pageFlag,dbFlagVal,catentryVal);}'/>" + "<img height='16' width='16' alt='loading...' src='" + imagePath + "img/loadingSmall.gif' id='loadGif' style='display: none;'/>" + "</p><p class='or'><span>------------------------------------</span>Or<span>------------------------------------</span></p>" + "<p>Save Delivery costs and <a id='popupPickup' style='cursor:pointer'>Pick Up your item at the store</a></p>" + "</div>" + "</div>";
    $("body").append(a);
    if ((pageFlag == "CAT") || (pageFlag == "COM")) {
        $("#availPopup #closeAvail").click(function() {
            ATCFailureFlg = false;
            if (atcZipCode != repaintedZipCode) {
                fnRegDeliveryAvlAjax(pageFlag, "Y", catentryVal)
            }
            $("#availPopup").remove()
        })
    }
    $("#availPopup .closeAvail").click(function() {
        if (pageFlag == "PRD") {
            atcDelFlag = false
        }
        $("#availPopup").remove()
    });
    $("a#popupPickup").click(function(b) {
        $.cookie("zipCode" + getStoreId(), getRegDelZip());
        if (pageFlag == "PRD") {
            storeLocator()
        } else {
            if (pageFlag == "CAT" && qvDiv == "checkAvailSpu") {
                fnRegionalStorePickUpQV(currentPartNo)
            } else {
                fnRegionalStorePickUp(currentPartNo)
            }
        }
    })
}
var ddcAvlCheck = "NA";
function fnRegDeliveryAvlAjax(g, d, a) {
    var b = getRegDelZip();
    var f = a;
    var n = getStoreId();
    if (DDItemList != null && DDItemList != "") {
        if (d == "Y") {
            var m = DDItemList;
            if (ATCFailureFlg) {
                m = currentPartNo
            }
            var j = {
                success: fnDeliveryAvailResponse,
                url: "RegionalAvailCmd?pageInd=" + g + "&dbFlag=" + d + "&catEntryId=" + a + "&zipCode=" + b + "&storeId=" + n,
                type: "POST",
                data: {
                    DDItemList: m
                },
                dataType: "json",
                error: errorFnDeliveryAvailResponse
            };
            request = $.ajax(j)
        } else {
            if (d == "N") {
                var k = "1";
                var l = "09300";
                var e = "1";
                var o = "09300";
                var c = {
                    success: fnDeliveryAddToCartResponse,
                    url: "RegionalAvailCmd?pageInd=" + g + "&dbFlag=" + d + "&storeId=" + n + "&ndd=" + k + "&zipCode=" + b + "&catEntryId=" + f + "&scimStoreId=" + l + "&deliveryStore=" + o + "&quantity=" + e,
                    type: "POST",
                    data: {
                        DDItemList: currentPartNo
                    },
                    error: errorFnDeliveryAvailResponse
                };
                request = $.ajax(c)
            }
        }
    }
}
function errorFnDeliveryAvailResponse() {
    $("div#availPopup").remove();
    ddcAvlCheck = "NA"
}
function fnDeliveryAvailResponse(b) {
    var g = b.jsonRegionalAvail;
    var f = g.pco;
    var j = g.ddcInstk;
    var m = g.ddcOutstk;
    var d = new Array();
    var k = "";
    if (fnChkZipCode() && typeof g != "undefined") {
        for (var e = 0; e < f; e++) {
            var l = g.regAvailList[e].pn;
            var c = g.regAvailList[e].msg;
            if (c == "InStock") {
                k = j
            } else {
                if (c == "") {
                    k = j;
                    if (ATCFailureFlg) {
                        c = "InStock"
                    }
                } else {
                    k = m
                }
            }
            availValues.Set(l, k);
            d[d.length] = l;
            if (currentPartNo == l) {
                if (c == "InStock") {
                    $("div#availPopup").remove();
                    if (ATCFailureFlg) {
                        if (pageFlag == "CAT") {
                            addItemPartNo(DDCPartNoVal, DDCSiVal, DDCSpiVal, DDCSriVAl, DDCDffVal, DDCVendorVal, DDCStDateVal)
                        } else {
                            if (pageFlag == "COM") {
                                var a;
                                $("div.col_1").find("a#DDCAtcCom_" + currentPartNo).each(function(o) {
                                    var p = $(this).attr("info");
                                    var n = p.split("^");
                                    a = n[4]
                                });
                                submitCart(a)
                            }
                        }
                    }
                } else {
                    if (c == "") {
                        $("div#availPopup").remove()
                    } else {
                        $("#availPopup").css({
                            display: "block"
                        });
                        $("#availPopup .standardDiv").css({
                            display: "none"
                        });
                        $("#availPopup .errorDiv").css({
                            display: "block"
                        });
                        $(".errorDiv input#checkZip").css({
                            display: "inline"
                        });
                        $(".standardDiv #loadGif").css({
                            display: "none"
                        });
                        $(".errorDiv #loadGif").css({
                            display: "none"
                        });
                        if (ATCFailureFlg) {
                            if ((pageFlag == "CAT") || (pageFlag == "COM")) {
                                atcZipCode = getRegDelZip()
                            }
                            return false
                        }
                    }
                }
            }
        }
        if (flagQV == "Y") {
            c = availValues.Get(qvPartnumber);
            if (c == g.ddcInstk) {
                $("div#availPopup").remove()
            } else {
                $("#availPopup").css({
                    display: "block"
                });
                $("#availPopup .standardDiv").css({
                    display: "none"
                });
                $("#availPopup .errorDiv").css({
                    display: "block"
                })
            }
            $("div#availability").find("span.delivery").html(c + " " + getRegDelZip() + '<a id="checkAvailDel" class="checkAvail" href="javascript:;" rel="regionalAvailability" info=' + partnumber + "^Y^" + pageFlag + "^" + itemCatentryVal + ">Change ZIP Code</a>")
        }
    }
    $("#availPopup .standardDiv").css({
        display: "none"
    });
    repaintedZipCode = getRegDelZip();
    repaintRegAvial(availValues, d)
}
function fnDeliveryAddToCartResponse(b) {
    ATCFailureFlg = false;
    if (typeof b != "undefined") {
        if (flagCartQV == "true") {
            fnSearsAddToCart(b)
        } else {
            if (b == "OutOfStock") {
                ddcAvlCheck = "CPOUT";
                atcZipCode = getRegDelZip();
                $("#availPopup").css({
                    display: "block"
                });
                $("#availPopup .standardDiv").css({
                    display: "none"
                });
                $("#availPopup .errorDiv").css({
                    display: "block"
                });
                $(".errorDiv input#checkZip").css({
                    display: "inline"
                });
                $(".standardDiv #loadGif").css({
                    display: "none"
                });
                $(".errorDiv #loadGif").css({
                    display: "none"
                });
                ddcAvlCheck = "NA"
            } else {
                if (b == "Failure") {
                    ddcAvlCheck = "NA";
                    ATCFailureFlg = true;
                    fnRegDeliveryAvlAjax(pageFlag, "Y", catentryVal)
                } else {
                    ddcAvlCheck = "CPIN";
                    $("#availPopup").remove();
                    if (pageFlag != "COM") {
                        addItemPartNo(DDCPartNoVal, DDCSiVal, DDCSpiVal, DDCSriVAl, DDCDffVal, DDCVendorVal, DDCStDateVal)
                    } else {
                        var a;
                        $("div.col_1").find("a#DDCAtcCom_" + currentPartNo).each(function(d) {
                            var e = $(this).attr("info");
                            var c = e.split("^");
                            a = c[4];
                            a = a + "&IndicatorA=delivery"
                        });
                        submitCart(a)
                    }
                    ddcAvlCheck = "NA"
                }
            }
        }
    }
}
function fnOnLoadRARepaint(a) {
    var f = a;
    var e = f.pco;
    var g = f.ddcInstk;
    var l = f.ddcOutstk;
    var c = new Array();
    var j = "";
    if (fnChkZipCode() && typeof f != "undefined") {
        for (var d = 0; d < e; d++) {
            var k = f.regAvailList[d].pn;
            var b = f.regAvailList[d].msg;
            if (b == "InStock") {
                j = g
            } else {
                if (b == "") {
                    j = g
                } else {
                    j = l
                }
            }
            availValues.Set(k, j);
            c[c.length] = k
        }
    }
    repaintedZipCode = getRegDelZip();
    repaintRegAvial(availValues, c)
}
function populateStoreInfo(a) {
    if (a.errorCode == "STORE_FOUND") {
        var c = a.storePhone;
        if (c != "") {
            c = "(" + a.storePhone.substring(0, 3) + ") " + a.storePhone.substring(3, 6) + "-" + a.storePhone.substring(6, 10)
        }
        var b = "<strong>Nearest Sears Auto Center</strong><br/>" + a.storeName + "<br/>" + c;
        $("p[@class=centerInfo]").html(b)
    }
}
function populatePrice(c, b, e, a) {
    var d = c.split("^");
    $("div[@id=ss_" + b + "]").find("a").text(e);
    $("div[@id=ss_" + b + "]").find("div.saveStoryText").html(d[0])
}
$(document).ready(function(a) {
    a("a.greatPrice").click(function() {
        var b = a(this).offset();
        if (document.getElementById("greatPrice")) {
            document.body.removeChild(document.getElementById("greatPrice"))
        }
        var c = document.createElement("div");
        document.body.appendChild(c);
        c.id = "greatPrice";
        c.className = "floatWindow";
        c.innerHTML = "<p onclick='remove(this.parentNode);'><a href='javascript:;' class='closeWindow'>Close</a></p><br clear='all'>" + "<p>" + this.getAttribute("info") + "</p>";
        c.style.top = b.top - c.offsetHeight - 25 + "px";
        c.style.left = b.left - c.offsetWidth + 200 + "px"
    })
});
function ajaxCallForShopCart(e, d, c) {
    var g = document.ShopCartForm.catalogId.value;
    var a = document.ShopCartForm.ajaxStoreId.value;
    var f = {
        method: "GET",
        asynchronous: true,
        postBody: "",
        onSuccess: function(o) {
            var l = o.responseXML.documentElement;
            var q = l.getElementsByTagName("PAPrices");
            for (var n = 0; n < q.length; n++) {
                var m = q[n].getElementsByTagName("PACatEntryId")[0].childNodes[0].nodeValue;
                var k = q[n].getElementsByTagName("Price")[0].firstChild.data;
                var j = "pa_price_" + m + "_" + d;
                var p = document.getElementById(j);
                p.innerHTML = "$" + formatCurrency(k)
            }
        },
        onFailure: function(k) {
            showBox("errorBox");
            var j = document.getElementById("error1");
            j.innerHTML = "Error processing your request, please try again later."
        }
    };
    var b = "GetProductOptionPrices?storeId=" + a + "&catalogId=" + g + "&zipCode=" + c + "&parentCatId=" + e;
    new searsAjax(b, f)
}
function updateMiniCartDisplay(b, a) {
    a = formatCurrencyCheck(a);
    document.getElementById("items").innerHTML = b;
    document.getElementById("miniCartTotal").innerHTML = "$" + a
}
function updateMiniCartDisplayLink(b, a) {
    updateMiniCartDisplay(b, a);
    document.getElementById("miniCartLink").href = document.getElementById("miniCartURL").value;
    if (isI18NConvReq()) {
        fnConvertMiniCart()
    }
}
function specialOffers(b, k, e, a) {
    var c = document.createElement("div");
    document.body.appendChild(c);
    omnDeals(b);
    c.id = "rebateSpecialOffers";
    curtainOverlay({
        trans: "0.0",
        ajaxmodal: true,
        fade: false,
        closeonclick: true,
        ajaxclass: "rebateSpecialOffers",
        persistmodal: true
    });
    var c = $(".rebateSpecialOffers");
    var f = '<link rel="stylesheet" type="text/css" media="all" href="' + imagePath + 'css/rebateMessage.css">';
    var d = '<link rel="stylesheet" type="text/css" media="print" href="' + imagePath + 'css/rebates_print.css">';
    $(f).appendTo("head");
    $(d).appendTo("head");
    var g;
    if (null != document.getElementById("saveForLater")) {
        g = document.getElementById("saveForLater").value
    }
    var j;
    if ($("body").attr("id") == "checkout" || ((null != g) && (g == "YES"))) {
        j = "BrowseSpecialOfferViewHttps"
    } else {
        j = "BrowseSpecialOfferView"
    }
    $.ajax({
        url: "" + j + "?storeId=" + k + "&activeTab=" + b + "&catalogId=" + e + "&catentryId=" + a,
        success: function(l) {
            $(c).html(l);
            $("#ajaxmodal").bgiframe().centerOnScreen();
            $(c).show();
            $("#curtain").add("#closeWinDeals").unbind().click(function() {
                $('head link[@href *= "rebates_print.css"]').remove();
                curtainOverlay({
                    closing: true
                });
                $("div#rebateSpecialOffers").remove()
            });
            rebates_tabs();
            rebateTabDisp();
            splFinTabDisp();
            scrollSize();
            detailView();
            expandOffers();
            if (isI18NConvReq()) {
                fnConvertPriceSpecialOffer()
            }
        }
    })
}
function omnDeals(a) {
    if (a == "splOffr") {
        omPrefix = "Special Offer > Deals Popup"
    }
    if (a == "splFin") {
        omPrefix = "Special Financing > Deals Popup"
    }
    if (a == "rebateDet") {
        omPrefix = "Rebate > Deals Popup"
    }
    if (a == "siteWide") {
        omPrefix = "Site Wide > Deals Popup"
    }
    s.tl()
}
function rebateTabDisp() {
    var a = $("#intTab3_content").attr("class");
    if (a == "visible") {
        mailInRebateAjax()
    }
}
function splFinTabDisp() {
    var a = $("div#intTab2_content").attr("class");
    if (a == "visible") {
        splFinanceAjax("splFinanceTab")
    }
}
function mailInRebateAjax() {
    if ($("input#mailInRebPres").attr("value") == "mailInRebatePresent") {
        var c = $("input#rebateContent").attr("value");
        var d = "frmDealsPopUp";
        var b;
        var a;
        if (null != document.getElementById("saveForLater")) {
            b = document.getElementById("saveForLater").value
        }
        if ($("body").attr("id") == "checkout" || ((null != b) && (b == "YES"))) {
            a = "RebateDetailsCmdSecure"
        } else {
            a = "RebateDetailsCmd"
        }
        $.ajax({
            url: "" + a + "?storeId=" + storeId + "&RebateId=" + c + "&dealsPopUp=" + d,
            type: "GET",
            success: function(e) {
                $("#pForm").html(e);
                $("#pForm").show()
            }
        })
    }
}
function splFinanceAjax(a) {
    if ($("input#splFinPres").attr("value") == "splFinPresent") {
        $("input#splFinPres").attr("value", "splFinLoaded");
        var f = $("input#splFinStoreId").attr("value");
        var e = $("input#splFinCatalogId").attr("value");
        var k = $("input#splFinLangId").attr("value");
        var c = $("input#splFinCatalogInd").attr("value");
        var j = $("input#splFinVName").attr("value");
        var b = $("input#dzName").attr("value");
        var d;
        var g;
        if (null != document.getElementById("saveForLater")) {
            d = document.getElementById("saveForLater").value
        }
        if ($("body").attr("id") == "checkout" || ((null != d) && (d == "YES"))) {
            g = "BrowseStaticPageCmdSecure"
        } else {
            g = "BrowseStaticPageCmd"
        }
        $.ajax({
            url: "" + g + "?storeId=" + f + "&catalogId=" + e + "&langId=" + k + "&catalogInd=" + c + "&vName=" + j + "&dzName=" + b,
            type: "GET",
            success: function(l) {
                $("#splFinDet").html(l);
                $("#splFinDetails").append(l);
                $("#splFinDetails").show();
                if (a == "splOfferTab") {
                    $("#splFinDet").show()
                }
                $("#splFinDetails").css({
                    height: 307
                })
            }
        })
    }
}
function rebates_tabs() {
    var a = $("#dTabs li a");
    $(a).unbind().click(function() {
        var d = $(this).parent().attr("id");
        var c = "#" + d;
        var f = $(c).siblings();
        var b = c + "_content";
        var e = $(b).siblings();
        $(f).removeClass("active");
        $(c).addClass("active");
        if ($(c)) {
            $(e).removeClass("visible").addClass("notVisible");
            $(b).removeClass("notVisible").addClass("visible")
        }
    })
}
function scrollSize() {
    if ($("#intTab1_content img.adImg").length == 0) {
        $("#intTab1_content div.offerScroll").css({
            height: 307
        })
    }
}
function detailView() {
    $(".detailHd").addClass("closed");
    $("a.showDetails").click(function() {
        if ($(this).parent().hasClass("closed")) {
            $(this).parent(".detailHd").removeClass("closed").addClass("open");
            $(this).text("Hide Details");
            $(this).parent().next(".details").fadeIn("fast")
        } else {
            $(this).parent(".detailHd").removeClass("open").addClass("closed");
            $(this).text("See Details");
            $(this).parent().next(".details").fadeOut("fast")
        }
    })
}
function rebateDisp() {
    mailInRebateAjax();
    $("#intTab1_content").removeClass("visible").addClass("notVisible");
    $("#intTab1").removeClass("active");
    $("#intTab3_content").removeClass("notVisible").addClass("visible");
    $("#intTab3").addClass("active")
}

$(function() {
    try {
        document.execCommand("BackgroundImageCache", false, true)
    } catch(a) {}
});
function LTrim(b) {
    var a = /\s*((\S+\s*)*)/;
    return b.replace(a, "$1")
}
function RTrim(b) {
    var a = /((\s*\S+)*)\s*/;
    return b.replace(a, "$1")
}
function trimStr(a) {
    return LTrim(RTrim(a))
}
if (typeof Sears == "undefined") {
    var Sears = {
        showHideRecentlyView: function(a) {
            if (a) {
                $("#recentlyView").fadeIn("slow")
            } else {
                $("#recentlyView").fadeOut("slow")
            }
        }
    }
}
function bindEventsForRR() {
    $("a.mapLink").click(function() {
        mapClick(this)
    });
    $("a.greatPrice").click(function() {
        var a = $(this).offset();
        if (document.getElementById("greatPrice")) {
            document.body.removeChild(document.getElementById("greatPrice"))
        }
        var b = document.createElement("div");
        document.body.appendChild(b);
        b.id = "greatPrice";
        b.className = "floatWindow";
        b.innerHTML = "<p onclick='remove(this.parentNode);'><a href='javascript:;' class='closeWindow'>Close</a></p><br clear='all'>" + "<p>" + this.getAttribute("info") + "</p>";
        b.style.top = a.top - b.offsetHeight - 25 + "px";
        b.style.left = a.left - b.offsetWidth + 200 + "px"
    })
}
function sr_create_script(d) {
    var c = document.createElement("script");
    c.type = "text/javascript";
    c.src = d;
    document.getElementsByTagName("head")[0].appendChild(c)
}
jQuery(document).ready(function(d) {
    var c = "";
    var b = "";
    var a = "";
    var f = "";
    var c = unescape(gup("keyword"));
    if (window.jsonProperties && jsonProperties != null && jsonProperties != "") {
        b = jsonProperties.vName;
        a = jsonProperties.cName;
        f = jsonProperties.sName
    }
    actualWord = c.replace(/\+/g, " ");
    if (actualWord != "" && null != actualWord && b == "" && a == "" && f == "") {
        var e = retrieveRelatedWords(actualWord)
    }
});
function fnGenNetDownMsg(curSalePrice, minPrice, rebateInd, mapInd) {
    var netDownMsg = "";
    if (minPrice.indexOf("#") > -1) {
        netDownMsg = fnGenDealMsg(curSalePrice, minPrice, rebateInd, mapInd);
        return netDownMsg
    }
    curSalePrice = removeCurrencyFormat(curSalePrice);
    minPrice = removeCurrencyFormat(minPrice);
    var dealPrice = addCurrencyFormat(curSalePrice - minPrice);
    if (eval(curSalePrice) > eval(minPrice) && removeCurrencyFormat(minPrice) != 0) {
        if (!mapInd) {
            if (!rebateInd) {
                netDownMsg = '<div class="addl savings" style="position:relative;padding-left:10px;padding-right:10px;padding-bottom:20px;">' + '<span class="text" style="font-weight:bold;color:#FA7238;float:left;font-size:11px;height:1.3em;width:170px;position:absolute;">' + "Additional Savings: " + dealPrice + "</span><br/>" + '<span class="dealPrice" style="position:relative;float:left;right:0;color:#8DA351;font-size:12px;font-weight:bold;height: 29px; width: 135px; ">' + " You Pay: " + addCurrencyFormat(minPrice) + "</span>" + "</div>"
            } else {
                netDownMsg = '<div class="addl savings" style="position:relative;padding-left:10px;padding-right:10px;padding-bottom:20px;">' + '<span class="text" style="font-weight:bold;color:#FA7238;float:left;font-size:11px;height:1.3em;position:absolute;">' + "Plus, save an additional " + dealPrice + " when you add to cart</span>" + "</div>"
            }
        } else {
            netDownMsg = '<div class="addl savings" style="position:relative;padding-left:10px;padding-right:10px;padding-bottom:20px;">' + '<span class="text" style="font-weight:bold;color:#FA7238;float:left;font-size:11px;height:1.3em;position:absolute;">' + "additional savings may apply in cart</span>" + "</div>"
        }
    } else {
        netDownMsg = ""
    }
    return netDownMsg
}
function fnGenDealMsg(d, l, k, b) {
    var m = "";
    var f = "";
    var j = l.split("#")[0];
    var c = l.split("#")[1];
    var a = c;
    var e = "";
    if (k || !b) {
        e = addCurrencyFormat(d - a)
    }
    var g = l.split("#")[2];
    if (j == "YES" || g != "") {
        f = "YES"
    }
    if (c != null && c != "" && f != "YES") {
        if (c == "-1.00") {
            m = '<span style="color: red;font-size:15px;font-weight:bold !important;"></span>'
        } else {
            if (!b) {
                if (!k) {
                    m = '<span style="color: red;font-size:15px;font-weight:bold !important;">$' + c + "</span> after deducting applicable additional savings "
                } else {
                    m = '<div class="addl savings" style="position:relative;padding-left:10px;padding-right:10px;padding-bottom:20px;">' + '<span class="text" style="font-weight:bold;color:#FA7238;float:left;font-size:11px;height:1.3em;position:absolute;">' + "Plus, save an additional " + e + " when you add to cart</span>" + "</div>"
                }
            } else {
                m = '<div class="addl savings" style="position:relative;padding-left:10px;padding-right:10px;padding-bottom:20px;">' + '<span class="text" style="font-weight:bold;color:#FA7238;float:left;font-size:11px;height:1.3em;position:absolute;">' + "additional savings may apply in cart</span>" + "</div>"
            }
        }
    }
    return m
}
function removeCurrencyFormat(a) {
    a = a.toString().replace(/\$|\,/g, "");
    if (isNaN(a)) {
        a = "0"
    }
    return a
}
function addCurrencyFormat(a) {
    a = a.toString().replace(/\$|\,/g, "");
    if (isNaN(a)) {
        a = "0"
    }
    sign = (a == (a = Math.abs(a)));
    a = Math.floor(a * 100 + 0.50000000001);
    cents = a % 100;
    a = Math.floor(a / 100).toString();
    if (cents < 10) {
        cents = "0" + cents
    }
    for (var b = 0; b < Math.floor((a.length - (1 + b)) / 3); b++) {
        a = a.substring(0, a.length - (4 * b + 3)) + "," + a.substring(a.length - (4 * b + 3))
    }
    return "$" + (a + "." + cents)
}
var intShipFlgSwitch = "FALSE";
var intShipJspChk = "false";
var i18nCookieData = null;
function isI18NConvReq() {
    var a = false;
    var c = false;
    if (intShipFlgSwitch == "TRUE") {
        var b = fnParseCountryCookie();
        if (b != null && b.countryCode != "US") {
            a = true
        }
    }
    return a
}
function fnCreateCountryCookie(b, a, c, d) {
    $.cookie("IntnlShip", b + "|" + a + "|" + c + "|" + d, {
        path: "/",
        domain: ".sears.com"
    })
}
function fnDeleteCountryCookie() {
    $.cookie("IntnlShip", null)
}
function fnParseCountryCookie() {
    var b = null;
    if (i18nCookieData != null) {
        b = i18nCookieData
    } else {
        var a = $.cookie("IntnlShip");
        if (a != null && typeof a != "undefined") {
            var c = a.split("|");
            var d = c.length;
            b = new Object();
            if (d > 1) {
                b.countryCode = c[0];
                b.currencyCode = c[1];
                if (d > 2) {
                    b.exgRate = c[2]
                }
                if (d > 3) {
                    b.quoteId = c[3]
                }
                i18nCookieData = b
            }
        }
    }
    return b
}
function expandOffers() {
    var a = $("body").attr("id");
    var b = $("input#expOffers").attr("value");
    if (a == "product") {
        if (typeof b != "undefined" && b == "true") {
            $("div#intTab1_content .offerScroll .details").each(function(c) {
                $(this).show()
            });
            $("div#intTab1_content .offerScroll .detailHd").each(function(d) {
                var c = $(this).find("a").attr("href");
                if (c == "javascript:;") {
                    $(this).attr("class", "detailHd open");
                    $(this).find("a").text("Hide Details")
                }
            })
        }
        $("input#expOffers").attr("value", "false")
    }
}
function fnHideI18NCompare() {
    var nam = "";
    var sQuote = "'";
    var dot = ".";
    var bracketfnt = "$(";
    var bracketbck = ").hide()";
    var anch = "'a.";
    var saveLater = "'input.saveLater_";
    var rev = "'div.info a.p_10153_12605_";
    var cart = "div.info a.cart_";
    var cartSoft = ".cart_";
    var part = "'div.info a.part_";
    var spucom = "'div.info a.spuCom_";
    var DDCAtcCom = "'div.info a.DDCAtcCom_";
    var msgElg = "li.intShip";
    var msgInElg = "li.unvIntShip";
    var iShpaddToCartButtonArr = iShpaddToCartButton.split("|");
    var intnlShippingValue = "";
    var cokkieVal = $.cookie("IntnlShip");
    if (cokkieVal != "undefined" && cokkieVal != null) {
        intnlShippingValue = cokkieVal.split("|");
        countryCode = intnlShippingValue[0]
    }
    if (intShipJspChk == "false" && countryCode == "US") {
        if (pnolist != "undefined" || pnolist != "") {
            var pnolistArr = pnolist.split("|");
            var intShipSoftArr = intShipSfVal.split("|");
            for (var i = 0; i <= pnolistArr.length; i++) {
                if (pnolistArr[i] != "" && intShipSoftArr[i] != "") {
                    if (intShipSoftArr[i] == "NO") {
                        eval("$('" + msgElg + pnolistArr[i] + "').hide()");
                        eval("$('" + msgInElg + pnolistArr[i] + "').hide()")
                    } else {
                        if (intShipSoftArr[i] == "YES") {
                            eval("$('" + msgElg + pnolistArr[i] + "').show()");
                            eval("$('" + msgInElg + pnolistArr[i] + "').hide()")
                        }
                    }
                }
            }
        }
        var intbutlp = intShipbut.split("|");
        var intShipval = intShipVal.split("|");
        for (var i = 0; i < intbutlp.length; i++) {
            if (intbutlp[i] != "") {
                if (intShipval[i] == "NO") {
                    eval("$('" + msgElg + intbutlp[i] + "').hide()");
                    eval("$('" + msgInElg + intbutlp[i] + "').hide()")
                }
                if (intShipval[i] == "YES") {
                    eval("$('" + msgElg + intbutlp[i] + "').show()");
                    eval("$('" + msgInElg + intbutlp[i] + "').hide()")
                }
            }
        }
    }
    if (intShipJspChk == "true") {
        fnHideForIntShipCompare(pnolist, intShipSfVal, intShipbut, iShpSaveCart, iShpSaveCartSoft, intShipVal)
    }
}


function trim(b) {
    var a = /\s*((\S+\s*)*)/;
    return b.replace(a, "$1")
}
function RecentlyViewed(b) {
    var a = document.getElementById("recentView");
    a.style.display = "block";
    a.innerHTML = b;
    divFloat("recentView", true)
}
function RecentlyViewedWide(b) {
    var a = document.getElementById("recentlyView");
    a.style.display = "block";
    a.innerHTML = b;
    Sears.showHideRecentlyView(true)
}
function relogon() {
    var d = "-1";
    var a = "10153";
    var c = "12605";
    var b = "/shc/s/TopCategoriesDisplayView?storeId=" + a + "&catalogId=" + c + "&langId=" + d;
    ajaxCall(b, "reLogon", "", "");
    setTimeout("callRecentlyViewed()", 3000)
}
function callRecentlyViewed() {
    var d = "-1";
    var a = "10153";
    var c = "12605";
    var b = "/shc/s/RecentlyViewedCmd?storeId=" + a + "&catalogId=" + c + "&langId=" + d;
    ajaxCall(b, "RecentlyViewedWide")
};
/*   C:/SVNStreams/MCP_REL_9-Dec-2009/wcs-static/StaticWeb/WebContent/StaticContent/Sears/js/bingCashBack.js:110273   */
var bing = {
    showWindow: function() {
        var a = document.getElementById("availPopup");
        a.style.display = "block"
    },
    hideWindow: function() {
        var a = document.getElementById("availPopup");
        a.style.display = "none"
    },
    ajaxPop: function(a) {
        $.ajax({
            url: "/shc/s/BrowseStaticPageCmd?storeId=" + storeId + "&catalogId=" + catalogId + "&catalogInd=DZD&dzName=W4&vName=bingTC",
            success: function(b) {
                $("#availPopup").remove();
                $(b).appendTo("body");
                bing.showWindow();
                $("#availPopup").css({
                    top: a.pageY - 50,
                    left: a.pageX * 4 / 6.5
                });
                $("#availPopup a.closeAvail").unbind().click(bing.hideWindow)
            }
        })
    }
};
window.onload = function() {
    displayBingCashBackHeader();
    if ($("#bingimg").length > 0) {
        $("#bingimg").unbind().click(function(a) {
            bing.ajaxPop(a)
        })
    }
    if ($("#bingimg1").length > 0) {
        $("#bingimg1").unbind().click(function(a) {
            bing.ajaxPop(a)
        })
    }
    $(".bingProd").unbind().click(function(a) {
        bing.ajaxPop(a)
    })
};
function displayBingCashBackHeader() {
    $("div#bingHeader").hide();
    var a = getCookie("BINGCSHBCK");
    if (a != null && a != "" && a == "ISx20070515x00001d") {
        $("div#bingHeader").show()
    }
};

var overflow;

//inline
	var recentKwd = "";
	var recentKwdRdt = "";
	var recentlyViewedURL = '';

//inline
	function noenter() {
		if(window.event.keyCode == 13){
			var keyword = trim(document.searchForm.keyword.value);
			if(keyword != ""){
				fnSearchSubmit();
			} else {
				return false;
			}
		} else {
  			return true;
  		}
  	}


/* header.js */

$(function () {
    $('#keyword').focus();
    var t = null;
    var t1 = null;
    var t2 = null;
    var t3 = null;
    if ($.browser.msie && $.browser.version < 7) {
        var rightVal = '9'
    } else {
        var rightVal = '10'
    }
    Sears.topNav();
    $('#vertSearch').fakeDropDown({
        mouseoutDelay: 500,
        selectedCharLimit: 15
    });

   
    //Ready See It All Drop Downs
	
	$('.seeItAllDD').appendTo('body');
	
	$('#seeItAll li a').unbind('mouseenter').bind('mouseenter', function(){
		closeDDs();
		clearTimeout(t);
		var pos = $(this).offset();
		var menu = $('#' + $(this).parent().attr('class') + 'DD');
		$(this).addClass('active');
		menu.find('.topBorder').css('width', menu.width()+14-($(this).width()+parseFloat($(this).css('padding-left'))+parseFloat($(this).css('padding-right'))));
		menu.fadeIn('fast').css({left: pos.left, top: pos.top+20}).unbind('mouseleave').bind('mouseleave', function(){
			t = setTimeout(function(){ $('#seeItAll li a.active').removeClass('active'); menu.hide(); }, 100);
		}).bind('mouseenter', function(){
			clearTimeout(t);
		});
		$(this).unbind('mouseleave').bind('mouseleave', function(){
			t = setTimeout(function(){ $('#seeItAll li a.active').removeClass('active'); menu.hide(); }, 50);
		})
	});
	
	
	$('#seeItAll li a').click(function(){ /*return false; */});
	
	
	//Sub Nav Drop Downs
    
    $('#topNav #subNav li a').unbind('click').click(function () {
      /*  if ($(this).html() == 'Weekly Ad') {
            return true
        } else {
            return false
        }*/
    }); 
    $('.subnavDD, .seeItAllDD').bgiframe();
   
    $('#topNav #subNav li.deals a').unbind('mouseenter').bind('mouseenter', function () {
        closeDDs();
        clearTimeout(t1);
        var pos = $(this).offset();
        var menu = $('#subnavDD_deals');
        $(this).addClass('active');
        menu.fadeIn('fast').css({
            //left: pos.left,
            //top: pos.top + 27
        }).unbind('mouseleave').bind('mouseleave', function () {
            t1 = setTimeout(function () {
                $('#topNav #subNav li.deals a.active').removeClass('active');
                menu.hide()
            },
            100)
        }).bind('mouseenter', function () {
            clearTimeout(t1)
        });
        $(this).unbind('mouseleave').bind('mouseleave', function () {
            t1 = setTimeout(function () {
                $('#topNav #subNav li.deals a.active').removeClass('active');
                menu.hide()
            },
            50)
        })
    });
	

//dropdownpanel 
   $('a#login').unbind('mouseenter').bind('mouseenter', function () {
        closeDDs();
        clearTimeout(t1);
        var menu = $('#subnavDD_login');

        menu.slideDown('fast').unbind('mouseleave').bind('mouseleave', function () {
            t1 = setTimeout(function () {
                menu.slideUp('fast').show();
            },100)
        }).bind('mouseenter', function () {
            clearTimeout(t1)
        });
        $(this).unbind('mouseleave').bind('mouseleave', function () {
            t1 = setTimeout(function () {
                menu.slideUp('fast').show();
            },50)
        })
    });

		
	
	
	
    $('#topNav #subNav li.inspiration a, #topNav #subNav li.gifts a, #topNav #subNav li.services a').unbind('mouseenter').bind('mouseenter', function () {
        var link = $(this).parent().attr('class');
        if($('#mmlToolboxWrap').hasClass('open') && $('html').css('overflow-x') == 'auto'){
        	var leaf = 161;
        }else{
        	var leaf = 0;
        }
        closeDDs();
        clearTimeout(t2);
        var pos = $(this).offset();
        var menu = $('#subnavDD_'+link);
        $(this).addClass('active');
        menu.slideDown('fast').css({
            right: rightVal-leaf,
            top: pos.top + 27
        }).unbind('mouseleave').bind('mouseleave', function () {
            t2 = setTimeout(function () {
                $('#topNav #subNav li.'+link+' a.active').removeClass('active');
                menu.slideUp('fast').show();
            },
            100)
        }).bind('mouseenter', function () {
            clearTimeout(t2)
        });
        $(this).unbind('mouseleave').bind('mouseleave', function () {
            t2 = setTimeout(function () {
                $('#topNav #subNav li.'+link+' a.active').removeClass('active');
                menu.slideUp('fast').show();
            },
            50)
        })
    });
    
	
    $('#custService').unbind('mouseenter').bind('mouseenter', function () {
        closeDDs();
        clearTimeout(t3);
        var pos = $(this).offset();
        var menu = $('#custServiceDD');
        $(this).addClass('active');
       // var menuWidth = menu.width() - ($(this).width() + parseFloat($(this).css('padding-left')) + parseFloat($(this).css('padding-right')));
        //menu.find('.topBorder').css('width', menuWidth);
        menu.fadeIn('fast').css({
          //  left: pos.left - menuWidth,
            top: pos.top + 22
        }).unbind('mouseleave').bind('mouseleave', function () {
            t3 = setTimeout(function () {
                $('#custService').removeClass('active');
                menu.hide()
            },
            100)
        }).bind('mouseenter', function () {
            clearTimeout(t3)
        });
        $(this).unbind('mouseleave').bind('mouseleave', function () {
            t3 = setTimeout(function () {
                $('#custService').removeClass('active');
                menu.hide()
            },
            50)
        })
    });
   
 /*   //MML Header Omniture Tracking
    
   $('#subnavDD_deals ul li a').click(function(){
   		var obj = $(this);
   		if(obj.attr('target') == '_blank'){
   			var type = 'e';
   		}else{
   			var type = "o";
   		}
   		var linkName = 'Global Nav>Deals Menu>'+obj.text();
   		trackToolbarClicks(obj, type, linkName);
   });

   $('.subNavDD p a').click(function(){
   		var obj = $(this);
   		if(obj.attr('target') == '_blank'){
   			var type = 'e';
   		}else{
   			var type = "o";
   		}
   		var linkName = 'Global Nav>'+obj.text();
   		trackToolbarClicks(obj, type, linkName);
   });
   
   $('#shopDD ul li ul li a').click(function(){
   		var obj = $(this);
   		if(obj.attr('target') == '_blank'){
   			var type = 'e';
   		}else{
   			var type = "o";
   		}
   		var linkName = 'Global Nav>Shop>'+obj.text();
   		if(obj.hasClass('promo')){
   			linkName = 'promo_'+linkName;
   		}
   		trackToolbarClicks(obj, type, linkName);
   });
   $('#exploreDD ul li ul li a').click(function(){
   		var obj = $(this);
   		if(obj.attr('target') == '_blank'){
   			var type = 'e';
   		}else{
   			var type = "o";
   		}
   		var linkName = 'Global Nav>Explore>'+obj.text();
   		if(obj.hasClass('promo')){
   			linkName = 'promo_'+linkName;
   		}
   		trackToolbarClicks(obj, type, linkName);
   });
   $('#createDD ul li ul li a').click(function(){
   		var obj = $(this);
   		if(obj.attr('target') == '_blank'){
   			var type = 'e';
   		}else{
   			var type = "o";
   		}
   		var linkName = 'Global Nav>Create>'+obj.text();
   		if(obj.hasClass('promo')){
   			linkName = 'promo_'+linkName;
   		}
   		trackToolbarClicks(obj, type, linkName);
   });
   $('#manageDD ul li ul li a').click(function(){
   		var obj = $(this);
   		if(obj.attr('target') == '_blank'){
   			var type = 'e';
   		}else{
   			var type = "o";
   		}
   		var linkName = 'Global Nav>Manage>'+obj.text();
   		if(obj.hasClass('promo')){
   			linkName = 'promo_'+linkName;
   		}
   		trackToolbarClicks(obj, type, linkName);
   });*/
   
	// I think we can just do this for everything.
	// Seems fairly inexpensive.
   //readjustColHeight();
    
});

var closeDDs = function(){
	$('#topNav #subNav li a, #custService, #seeItAll li a').removeClass('active');
	$('.subNavDD, .seeItAllDD').hide();
}

function readjustColHeight() {
    var col1 = $('#content div.col_1');
    if (col1.css('position') == 'absolute') {
        var content = $('.col_2'),
            col1H = col1.height(),
            h = content.height();
        if (col1H > h) {
            content.css('height', col1H);
        }
    }
}


/* fakedropdown.js */
(function($){
	$.fn.fakeDropDown = function(options) {
		//declare timers
		var t;
		//default parameters
		var defaults = {
			mouseoutDelay: 500, //time delay before fake dd hides on mouse off
			selectedCharLimit: null //limit the amount of characters to show in selected option
		};
		var options = $.extend(defaults, options);
		
		return this.each(function() {
			obj = $(this);
			//convert existing select into fake dd format
			var selectId = obj.attr('id');
			var defaultSelected = obj.find('option').eq(0).text();
			var defaultSelectedVal = obj.find('option').eq(0).attr('value');
			obj.after('<a id="'+selectId+'" href="'+defaultSelectedVal+'">'+defaultSelected+'</a>');
			var trigger = obj.next();
			$('body').append('<ul id="'+selectId+'DD"></ul>');
			var dd = $('#'+selectId+'DD');
			obj.find('option').each(function(){
				var val = $(this).attr('value');
				var txt = $(this).text();
				dd.append('<li><a href="#" class="'+val+'">'+txt+'</a></li>');
			});
			//remove original select
			obj.hide();
			//new fake dd functionality
			trigger.unbind('click').click(function(){
				var pos = trigger.offset();
				dd.fadeIn('fast').css({left: pos.left, top: pos.top+trigger.height()+parseFloat(trigger.css('border-top-width'))+parseFloat(trigger.css('border-bottom-width'))+parseFloat(trigger.css('padding-top'))+parseFloat(trigger.css('padding-bottom'))});
				return false;
			});
			dd.find('a').unbind('click').click(function(){
				if($(this).text() == 'Music' || $(this).text() == 'Movies & TV Shows' || $(this).text() == 'Books'){
					$(this).attr('href', $(this).attr('class') + $('#keyword').val());
					return true;
				}else{
					if(options.selectedCharLimit){
						var newTxt = $(this).text().substring(0,options.selectedCharLimit);
					}else{
						var newTxt = $(this).text();
					}
					var vName = $(this).attr('class');
					trigger.text(newTxt).attr('href', vName);
					$('#vName').val(vName);
					if($(this).text() == 'Office Products'){
						$('#cName').val('Office+Products');
					}
					dd.fadeOut('fast');
					return false;
				}
			});
			dd.add(trigger).mouseout(function(){
				t = setTimeout(function(){ dd.fadeOut('fast'); }, options.mouseoutDelay);
			}).mouseover(function(){
				clearTimeout(t);
			});
		});
	};
})(jQuery);


/* toolbox.js */
(function($) {

$.jScrollPane = {
	active : []
};
$.fn.jScrollPane = function(settings)
{
	settings = $.extend({}, $.fn.jScrollPane.defaults, settings);

	var rf = function() { return false; };
	
	return this.each(
		function()
		{
			var $this = $(this);
			// Switch the element's overflow to hidden to ensure we get the size of the element without the scrollbars [http://plugins.jquery.com/node/1208]
			$this.css('overflow', 'hidden');
			var paneEle = this;
			
			if ($(this).parent().is('.jScrollPaneContainer')) {
				var currentScrollPosition = settings.maintainPosition ? $this.position().top : 0;
				var $c = $(this).parent();
				var paneWidth = $c.innerWidth() + 5;
				var paneHeight = $c.outerHeight();
				var trackHeight = paneHeight;
				$('>.jScrollPaneTrack, >.jScrollArrowUp, >.jScrollArrowDown', $c).remove();
				$this.css({'top':0});
			} else {
				var currentScrollPosition = 0;
				this.originalPadding = $this.css('paddingTop') + ' ' + $this.css('paddingRight') + ' ' + $this.css('paddingBottom') + ' ' + $this.css('paddingLeft');
				this.originalSidePaddingTotal = (parseInt($this.css('paddingLeft')) || 0) + (parseInt($this.css('paddingRight')) || 0);
				var paneWidth = $this.innerWidth() + 5;
				var paneHeight = $this.innerHeight();
				var trackHeight = paneHeight;
				$this.wrap(
					$('<div></div>').attr(
						{'className':'jScrollPaneContainer'}
					).css(
						{
							'height':paneHeight+'px', 
							'width':paneWidth+'px'
						}
					)
				);
				// deal with text size changes (if the jquery.em plugin is included)
				// and re-initialise the scrollPane so the track maintains the
				// correct size
				$(document).bind(
					'emchange', 
					function(e, cur, prev)
					{
						$this.jScrollPane(settings);
					}
				);
				
			}
			
			if (settings.reinitialiseOnImageLoad) {
				// code inspired by jquery.onImagesLoad: http://plugins.jquery.com/project/onImagesLoad
				// except we re-initialise the scroll pane when each image loads so that the scroll pane is always up to size...
				// TODO: Do I even need to store it in $.data? Is a local variable here the same since I don't pass the reinitialiseOnImageLoad when I re-initialise?
				var $imagesToLoad = $.data(paneEle, 'jScrollPaneImagesToLoad') || $('img', $this);
				var loadedImages = [];
				
				if ($imagesToLoad.length) {
					$imagesToLoad.each(function(i, val)	{
						$(this).bind('load', function() {
							if($.inArray(i, loadedImages) == -1){ //don't double count images
								loadedImages.push(val); //keep a record of images we've seen
								$imagesToLoad = $.grep($imagesToLoad, function(n, i) {
									return n != val;
								});
								$.data(paneEle, 'jScrollPaneImagesToLoad', $imagesToLoad);
								settings.reinitialiseOnImageLoad = false;
								$this.jScrollPane(settings); // re-initialise
							}
						}).each(function(i, val) {
							if(this.complete || this.complete===undefined) { 
								//needed for potential cached images
								this.src = this.src; 
							} 
						});
					});
				};
			}

			var p = this.originalSidePaddingTotal;
			
			var cssToApply = {
				'height':'auto',
				'width':paneWidth - settings.scrollbarWidth - settings.scrollbarMargin - p + 3 + 'px'
			}

			if(settings.scrollbarOnLeft) {
				cssToApply.paddingLeft = settings.scrollbarMargin + settings.scrollbarWidth + 'px';
			} else {
				cssToApply.paddingRight = settings.scrollbarMargin + 'px';
			}

			$this.css(cssToApply);

			var contentHeight = $this.outerHeight();
			var percentInView = paneHeight / contentHeight;

			if (percentInView < .99) {
				var $container = $this.parent();
				$container.append(
					$('<div></div>').attr({'className':'jScrollPaneTrack'}).css({'width':settings.scrollbarWidth+'px'}).append(
						$('<div></div>').attr({'className':'jScrollPaneDrag'}).css({'width':settings.scrollbarWidth+'px'}).append(
							$('<div></div>').attr({'className':'jScrollPaneDragTop'}).css({'width':settings.scrollbarWidth+'px'}),
							$('<div></div>').attr({'className':'jScrollPaneDragBottom'}).css({'width':settings.scrollbarWidth+'px'})
						)
					)
				);
				
				var $track = $('>.jScrollPaneTrack', $container);
				var $drag = $('>.jScrollPaneTrack .jScrollPaneDrag', $container);
				
				if (settings.showArrows) {
					
					var currentArrowButton;
					var currentArrowDirection;
					var currentArrowInterval;
					var currentArrowInc;
					var whileArrowButtonDown = function()
					{
						if (currentArrowInc > 4 || currentArrowInc%4==0) {
							positionDrag(dragPosition + currentArrowDirection * mouseWheelMultiplier);
						}
						currentArrowInc ++;
					};
					var onArrowMouseUp = function(event)
					{
						$('html').unbind('mouseup', onArrowMouseUp);
						currentArrowButton.removeClass('jScrollActiveArrowButton');
						clearInterval(currentArrowInterval);
					};
					var onArrowMouseDown = function() {
						$('html').bind('mouseup', onArrowMouseUp);
						currentArrowButton.addClass('jScrollActiveArrowButton');
						currentArrowInc = 0;
						whileArrowButtonDown();
						currentArrowInterval = setInterval(whileArrowButtonDown, 100);
					};
					$container
						.append(
							$('<a></a>')
								.attr({'href':'javascript:;', 'className':'jScrollArrowUp'})
								.css({'width':settings.scrollbarWidth+'px'})
								.html('Scroll up')
								.bind('mousedown', function()
								{
									currentArrowButton = $(this);
									currentArrowDirection = -1;
									onArrowMouseDown();
									this.blur();
									return false;
								})
								.bind('click', rf),
							$('<a></a>')
								.attr({'href':'javascript:;', 'className':'jScrollArrowDown'})
								.css({'width':settings.scrollbarWidth+'px'})
								.html('Scroll down')
								.bind('mousedown', function()
								{
									currentArrowButton = $(this);
									currentArrowDirection = 1;
									onArrowMouseDown();
									this.blur();
									return false;
								})
								.bind('click', rf)
						);
					var $upArrow = $('>.jScrollArrowUp', $container);
					var $downArrow = $('>.jScrollArrowDown', $container);
					if (settings.arrowSize) {
						trackHeight = paneHeight - settings.arrowSize - settings.arrowSize;
						$track
							.css({'height': trackHeight+'px', top:settings.arrowSize+'px'})
					} else {
						var topArrowHeight = $upArrow.height();
						settings.arrowSize = topArrowHeight;
						trackHeight = paneHeight - topArrowHeight - $downArrow.height();
						$track
							.css({'height': trackHeight+'px', top:topArrowHeight+'px'})
					}
				}
				
				var $pane = $(this).css({'position':'absolute', 'overflow':'visible'});
				
				var currentOffset;
				var maxY;
				var mouseWheelMultiplier;
				// store this in a seperate variable so we can keep track more accurately than just updating the css property..
				var dragPosition = 0;
				var dragMiddle = percentInView*paneHeight/2;
				
				// pos function borrowed from tooltip plugin and adapted...
				var getPos = function (event, c) {
					var p = c == 'X' ? 'Left' : 'Top';
					return event['page' + c] || (event['client' + c] + (document.documentElement['scroll' + p] || document.body['scroll' + p])) || 0;
				};
				
				var ignoreNativeDrag = function() {	return false; };
				
				var initDrag = function()
				{
					ceaseAnimation();
					currentOffset = $drag.offset(false);
					currentOffset.top -= dragPosition;
					maxY = trackHeight - $drag[0].offsetHeight;
					mouseWheelMultiplier = 2 * settings.wheelSpeed * maxY / contentHeight;
				};
				
				var onStartDrag = function(event)
				{
					initDrag();
					dragMiddle = getPos(event, 'Y') - dragPosition - currentOffset.top;
					$('html').bind('mouseup', onStopDrag).bind('mousemove', updateScroll);
					if ($.browser.msie) {
						$('html').bind('dragstart', ignoreNativeDrag).bind('selectstart', ignoreNativeDrag);
					}
					return false;
				};
				var onStopDrag = function()
				{
					$('html').unbind('mouseup', onStopDrag).unbind('mousemove', updateScroll);
					dragMiddle = percentInView*paneHeight/2;
					if ($.browser.msie) {
						$('html').unbind('dragstart', ignoreNativeDrag).unbind('selectstart', ignoreNativeDrag);
					}
				};
				var positionDrag = function(destY)
				{
					destY = destY < 0 ? 0 : (destY > maxY ? maxY : destY);
					dragPosition = destY;
					$drag.css({'top':destY+'px'});
					var p = destY / maxY;
					$this.data('jScrollPanePosition', (paneHeight-contentHeight)*-p);
					$pane.css({'top':((paneHeight-contentHeight)*p) + 'px'});
					$this.trigger('scroll');
					if (settings.showArrows) {
						$upArrow[destY == 0 ? 'addClass' : 'removeClass']('disabled');
						$downArrow[destY == maxY ? 'addClass' : 'removeClass']('disabled');
					}
				};
				var updateScroll = function(e)
				{
					positionDrag(getPos(e, 'Y') - currentOffset.top - dragMiddle);
				};
				
				var dragH = Math.max(Math.min(percentInView*(paneHeight-settings.arrowSize*2), settings.dragMaxHeight), settings.dragMinHeight);
				
				$drag.css(
					{'height':dragH+'px'}
				).bind('mousedown', onStartDrag);
				
				var trackScrollInterval;
				var trackScrollInc;
				var trackScrollMousePos;
				var doTrackScroll = function()
				{
					if (trackScrollInc > 8 || trackScrollInc%4==0) {
						positionDrag((dragPosition - ((dragPosition - trackScrollMousePos) / 2)));
					}
					trackScrollInc ++;
				};
				var onStopTrackClick = function()
				{
					clearInterval(trackScrollInterval);
					$('html').unbind('mouseup', onStopTrackClick).unbind('mousemove', onTrackMouseMove);
				};
				var onTrackMouseMove = function(event)
				{
					trackScrollMousePos = getPos(event, 'Y') - currentOffset.top - dragMiddle;
				};
				var onTrackClick = function(event)
				{
					initDrag();
					onTrackMouseMove(event);
					trackScrollInc = 0;
					$('html').bind('mouseup', onStopTrackClick).bind('mousemove', onTrackMouseMove);
					trackScrollInterval = setInterval(doTrackScroll, 100);
					doTrackScroll();
				};
				
				$track.bind('mousedown', onTrackClick);
				
				$container.bind(
					'mousewheel',
					function (event, delta) {
						initDrag();
						ceaseAnimation();
						var d = dragPosition;
						positionDrag(dragPosition - delta * mouseWheelMultiplier);
						var dragOccured = d != dragPosition;
						return !dragOccured;
					}
				);

				var _animateToPosition;
				var _animateToInterval;
				function animateToPosition()
				{
					var diff = (_animateToPosition - dragPosition) / settings.animateStep;
					if (diff > 1 || diff < -1) {
						positionDrag(dragPosition + diff);
					} else {
						positionDrag(_animateToPosition);
						ceaseAnimation();
					}
				}
				var ceaseAnimation = function()
				{
					if (_animateToInterval) {
						clearInterval(_animateToInterval);
						delete _animateToPosition;
					}
				};
				var scrollTo = function(pos, preventAni)
				{
					if (typeof pos == "string") {
						$e = $(pos, $this);
						if (!$e.length) return;
						pos = $e.offset().top - $this.offset().top;
					}
					$container.scrollTop(0);
					ceaseAnimation();
					var maxScroll = contentHeight - paneHeight;
					pos = pos > maxScroll ? maxScroll : pos;
					$this.data('jScrollPaneMaxScroll', maxScroll);
					var destDragPosition = pos/maxScroll * maxY;
					if (preventAni || !settings.animateTo) {
						positionDrag(destDragPosition);
					} else {
						_animateToPosition = destDragPosition;
						_animateToInterval = setInterval(animateToPosition, settings.animateInterval);
					}
				};
				$this[0].scrollTo = scrollTo;
				
				$this[0].scrollBy = function(delta)
				{
					var currentPos = -parseInt($pane.css('top')) || 0;
					scrollTo(currentPos + delta);
				};
				
				initDrag();
				
				scrollTo(-currentScrollPosition, true);
			
				// Deal with it when the user tabs to a link or form element within this scrollpane
				$('*', this).bind(
					'focus',
					function(event)
					{
						var $e = $(this);
						
						// loop through parents adding the offset top of any elements that are relatively positioned between
						// the focused element and the jScrollPaneContainer so we can get the true distance from the top
						// of the focused element to the top of the scrollpane...
						var eleTop = 0;
						
						while ($e[0] != $this[0]) {
							eleTop += $e.position().top;
							$e = $e.offsetParent();
						}
						
						var viewportTop = -parseInt($pane.css('top')) || 0;
						var maxVisibleEleTop = viewportTop + paneHeight;
						var eleInView = eleTop > viewportTop && eleTop < maxVisibleEleTop;
						if (!eleInView) {
							var destPos = eleTop - settings.scrollbarMargin;
							if (eleTop > viewportTop) { // element is below viewport - scroll so it is at bottom.
								destPos += $(this).height() + 15 + settings.scrollbarMargin - paneHeight;
							}
							scrollTo(destPos);
						}
					}
				)
				
				
				if (location.hash) {
					scrollTo(location.hash);
				}
				
				// use event delegation to listen for all clicks on links and hijack them if they are links to
				// anchors within our content...
				$(document).bind(
					'click',
					function(e)
					{
						$target = $(e.target);
						if ($target.is('a')) {
							var h = $target.attr('href');
							if (h.substr(0, 1) == '#') {
								scrollTo(h);
							}
						}
					}
				);
				
				$.jScrollPane.active.push($this[0]);
				
			} else {
				$this.css(
					{
						'height':paneHeight+'px',
						'width':paneWidth-this.originalSidePaddingTotal+'px',
						'padding':this.originalPadding
					}
				);
				// remove from active list?
				$this.parent().unbind('mousewheel');
			}
			
		}
	)
};

$.fn.jScrollPaneRemove = function()
{
	$(this).each(function()
	{
		$this = $(this);
		var $c = $this.parent();
		if ($c.is('.jScrollPaneContainer')) {
			$this.css(
				{
					'top':'',
					'height':'',
					'width':'',
					'padding':'',
					'overflow':'',
					'position':''
				}
			);
			$c.after($this).remove();
		}
	});
}

$.fn.jScrollPane.defaults = {
	scrollbarWidth : 10,
	scrollbarMargin : 5,
	wheelSpeed : 18,
	showArrows : false,
	arrowSize : 0,
	animateTo : false,
	dragMinHeight : 1,
	dragMaxHeight : 99999,
	animateInterval : 100,
	animateStep: 3,
	maintainPosition: true,
	scrollbarOnLeft: false,
	reinitialiseOnImageLoad: false
};

// clean up the scrollTo expandos
$(window)
	.bind('unload', function() {
		var els = $.jScrollPane.active; 
		for (var i=0; i<els.length; i++) {
			els[i].scrollTo = els[i].scrollBy = null;
		}
	}
);

})(jQuery);

(function($){
$.fn.bgIframe = $.fn.bgiframe = function(s) {
	// This is only for IE6
	if ( $.browser.msie && /6.0/.test(navigator.userAgent) ) {
		s = $.extend({
			top     : 'auto', // auto == .currentStyle.borderTopWidth
			left    : 'auto', // auto == .currentStyle.borderLeftWidth
			width   : 'auto', // auto == offsetWidth
			height  : 'auto', // auto == offsetHeight
			opacity : true,
			src     : 'javascript:false;'
		}, s || {});
		var prop = function(n){return n&&n.constructor==Number?n+'px':n;},
		    html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+
		               'style="display:block;position:absolute;z-index:-1;'+
			               (s.opacity !== false?'filter:Alpha(Opacity=\'0\');':'')+
					       'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+
					       'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+
					       'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+
					       'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+
					'"/>';
		return this.each(function() {
			if ( $('> iframe.bgiframe', this).length == 0 )
				this.insertBefore( document.createElement(html), this.firstChild );
		});
	}
	return this;
};

})(jQuery);

/* Copyright (c) 2006 Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 *
 * $LastChangedDate: 2007-12-20 09:02:08 -0600 (Thu, 20 Dec 2007) $
 * $Rev: 4265 $
 *
 * Version: 3.0
 * 
 * Requires: $ 1.2.2+
 */

(function($) {

$.event.special.mousewheel = {
	setup: function() {
		var handler = $.event.special.mousewheel.handler;
		
		// Fix pageX, pageY, clientX and clientY for mozilla
		if ( $.browser.mozilla )
			$(this).bind('mousemove.mousewheel', function(event) {
				$.data(this, 'mwcursorposdata', {
					pageX: event.pageX,
					pageY: event.pageY,
					clientX: event.clientX,
					clientY: event.clientY
				});
			});
	
		if ( this.addEventListener )
			this.addEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false);
		else
			this.onmousewheel = handler;
	},
	
	teardown: function() {
		var handler = $.event.special.mousewheel.handler;
		
		$(this).unbind('mousemove.mousewheel');
		
		if ( this.removeEventListener )
			this.removeEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false);
		else
			this.onmousewheel = function(){};
		
		$.removeData(this, 'mwcursorposdata');
	},
	
	handler: function(event) {
		var args = Array.prototype.slice.call( arguments, 1 );
		
		event = $.event.fix(event || window.event);
		// Get correct pageX, pageY, clientX and clientY for mozilla
		$.extend( event, $.data(this, 'mwcursorposdata') || {} );
		var delta = 0, returnValue = true;
		
		if ( event.wheelDelta ) delta = event.wheelDelta/120;
		if ( event.detail     ) delta = -event.detail/3;
//		if ( $.browser.opera  ) delta = -event.wheelDelta;
		
		event.data  = event.data || {};
		event.type  = "mousewheel";
		
		// Add delta to the front of the arguments
		args.unshift(delta);
		// Add event to the front of the arguments
		args.unshift(event);

		return $.event.handle.apply(this, args);
	}
};

$.fn.extend({
	mousewheel: function(fn) {
		return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
	},
	
	unmousewheel: function(fn) {
		return this.unbind("mousewheel", fn);
	}
});

})(jQuery);

var hover = 1;

var wrap = $('#wrap');

if($.browser.msie && $.browser.version < 7){
	var sillyIE6 = true;			
}else{
	var sillyIE6 = false;
}

//Function for including the JS files dynamically
function jsInclude(jsFile) {
	document.write('<' + 'script');
	document.write(' language="JavaScript"');
	document.write(' type="text/javascript"');
	document.write(' src="' + jsFile + '">');
	document.write('</' + 'script' + '>');
}

/* trackToolbarClicks() is moved to global_wide.js */

/*Code for Save for later starts*/
var popupheight;
var popupwidth;

	
	function findPosXForMML(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
	{
		curleft += obj.x;
	}
	return curleft;
}

function findPosYForMML(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
	{
		curtop += obj.y;
	}
	return curtop;
}
var mmlSaveFlag = 0;
/*function showLogonPageForMML(url,catentryId) {
		var catEntryIds = enCodeUrlForMML(getCatEntryIdURLForMML(catentryId));
		if(catEntryIds.length > 0) {
			mmlSaveFlag = 1;
			window.location = url + catEntryIds;
		}
	}	

function enCodeUrlForMML(url){		
		var strValue = "";		
		for(i=0;i<url.length;i++){			
			var char = url.charAt(i);
			if(char == '=')

			{
				strValue = strValue + "%3d";
			}
			else if(char == '&')
			{
				strValue = strValue + "%26";
			}else{
				
				strValue =  strValue + char;
			}
		}
		return strValue;
	}

*/
function ajaxCallForMML(url,callbackFunction,returnData,linkId) 
{ 
    var httpRequest = false; 	
    // Exit if this function is not supported
    if (!httpRequestSupported) {
        return;  
    }  
    
    // check if supported
    httpRequest = isHttpRequestSupported();   
    if (!httpRequest) { 
        httpRequestSupported = false;
        return false; 
    } 

    // Map the response to the callback function
    httpRequest.onreadystatechange = function() { 

        if (httpRequest.readyState == 4) {  
            if (httpRequest.status == 200) {
                if (returnData) { 
                    eval(callbackFunction + '(httpRequest.responseXML,linkId)'); 
                } else { 
                    eval(callbackFunction + '(httpRequest.responseText,linkId)'); 
                }  
            } else { 
                // TODO:  Keep this line commented in production.  The user will have no idea what this means.
                //('The AJAX request was made to our backend server and the following error occurred: ' + httpRequest.status); 
                eval(callbackFunction + '("")'); 
            } 
        }
        else{
            if(callbackFunction == 'displayTabContent'){
                
                htmlValue = "<img src= '"+ imagePath + "img/backgrounds/loading.gif' />";
                document.getElementById(linkId).innerHTML = htmlValue;
            }
            if(callbackFunction == 'browseSpecialOffer'){   
                htmlValue = "<img src= '"+ imagePath + "img/backgrounds/loading.gif' />";
                linkId.innerHTML = htmlValue;           
            }
            if(callbackFunction == 'loadingProductOptions'){   
				htmlValue = "<h4>Options and Services</h4>"
					+ "<img src= '"+ imagePath + "img/backgrounds/loading.gif' />";
                document.getElementById(linkId).innerHTML = htmlValue;
            }
        } 
    } 
    
    httpRequest.open('GET', url, true); 
    httpRequest.send(null); 
}
	
/* main.js */
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=2,location=0,statusbar=1,menubar=0,resizable=0,width=750,height=525,left = 100,top = 134');");
}
function popUpSmall(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=2,location=0,statusbar=1,menubar=0,resizable=0,width=200,height=150,left = 100,top = 134');");
}
// load htmlarea
	_editor_url = "";                     // URL to htmlarea files
	var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
	if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
	if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
	if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
	if (win_ie_ver >= 5.5) {
		 document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
		 document.write(' language="Javascript1.2"></scr' + 'ipt>');
	} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }


browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);

ns3up = (browserName == "Netscape" && browserVer >= 3);
ie4up = (browserName.indexOf("Microsoft") >= 0 && browserVer >= 4);


//finished05
function doPic(imgName) {
if (ns3up || ie4up) {
	imgOn = ("" + imgName);
	document.main_ad_image.src = imgOn;
	lnk = imgOn.between('../../','"');
	//alert(lnk);
	//$("a.RbZoom").attr("href", '#');	
}
}

/**
 * Usage  var you = 'hello you guys'.between('hello ',' guys');
 * you = 'you';
 */
String.prototype.between = function(prefix, suffix) {
  s = this;
  var i = s.indexOf(prefix);
  if (i >= 0) {
    s = s.substring(i + prefix.length);
  }
  else {
    return '';
  }
  if (suffix) {
    i = s.indexOf(suffix);
    if (i >= 0) {
      s = s.substring(0, i);
    }
    else {
      return '';
    }
  }
  return s;
}

function doMedia(mediaName) {
if (ns3up || ie4up) {
mediaOn = ("" + mediaName);
document.main_ad_media.src = mediaOn;
}
}



/* countdown.js */
// Configure according to meta elements
function CD_M(strTagId) {
	var objMeta = document.getElementsByTagName("meta");
	if (objMeta && objMeta.length) {
		// Loop over all meta tags
		for (var i=0; i<objMeta.length; ++i) {
			// Look for one that matches the counterId
			if (objMeta.item(i).scheme == strTagId) {
				// Match found, add meta data to collection
				var name	= objMeta.item(i).name;
				var content	= objMeta.item(i).content;
				if (name.indexOf("mindigits") > 0 || name.indexOf("hidezero") > 0) {
					// Content is an integer
					window[strTagId][name] = parseInt(content, 10);
				}
				else {
					// Content is a string
					window[strTagId][name]  = content;
				}
			}
		}
	}
}

// Update display
function CD_UD(strContent, objW) {
	objW.node.innerHTML = strContent;
}

// Tick loop
function CD_T(strTagId) {
	var objNow			= new Date();
	var objW			= window[strTagId];
	if (objW.msoffset) {
		// Correct for client's slow/fast clock
		objNow.setMilliseconds(objNow.getMilliseconds() + objW.msoffset);
	}
	CD_C(objNow, objW);

	
	
	// reached zero
	if (objW.intEvntDte <= objNow.valueOf() && (objW.event_msg || objW.event_redirecturl)) {
		var msg			= "<span id=\"" + strTagId + "_complete\">" + objW.event_msg + "</span>";
		var audioSrc	= objW.event_audio_src;
		var redirectUrl	= objW.event_redirecturl;

		if (redirectUrl) {
			// Redirect to a URI
			location.href = redirectUrl;
		}
		else if (audioSrc) {
			// Show message and play tune, then stop.
			var strMimeType	= objW.event_audio_mimetype;
			var audioObject = "<object style=\"visibility: hidden;\" id=\"MediaPlayer\" width=\"2\" height=\"2\" data=\"" + audioSrc + "\" type=\"" + strMimeType + "\"></object>";
			CD_UD(msg + audioObject, objW);
		}
		else {
			// Just show message and stop.
			CD_UD(msg, objW);
		}
	}
	else {
		// Keep ticking
		
		setTimeout("CD_T(\"" + strTagId + "\")", 1100-objNow.getMilliseconds()); // We offset from 1100 so that our clock ticks every second (the millisecond correction each loop sees to that), but updates 0.1s after every whole second so that we don't accidentally read the same Date() twice in the same second
	}
}

// Calculate new display value and call drawing routine
function CD_C(objNow, objW) {
	var intMS = objW.intEvntDte - objNow.valueOf();
	if (intMS <= 0) {
		intMS *= -1;
	}
	var intD = Math.floor(intMS/864E5);
	intMS = intMS - (intD*864E5);
	var intH = Math.floor(intMS/36E5);
	intMS = intMS - (intH*36E5);
	var intM = Math.floor(intMS/6E4);
	intMS = intMS - (intM*6E4);
	var intS = Math.floor(intMS/1E3);
	var strTmp = CD_F(intD, "d", objW) + CD_F(intH, "h", objW) + CD_F(intM, "m", objW) + CD_F(intS, "s", objW);
	CD_UD(strTmp, objW);
}

// Format date/time
function CD_F(intData, strPrefix, objW) {
	
	// Has counter reached 5mins
	
	var objNow			= new Date(); 
	var intMS = objW.intEvntDte - objNow.valueOf();
	if (intMS <= 0) {
		intMS *= -1;
	}
	var intD = Math.floor(intMS/864E5);
	intMS = intMS - (intD*864E5);
	var intH = Math.floor(intMS/36E5);
	intMS = intMS - (intH*36E5);
	var intM = Math.floor(intMS/6E4);
	intMS = intMS - (intM*6E4);
	var intS = Math.floor(intMS/1E3);

if (intData == 0 && objW[strPrefix + "_hidezero"]) {
		return "";
	}
	var strResult = intData;
	var intMinDigits = objW[strPrefix + "_mindigits"];
	if (intData.toString().length < intMinDigits) {
		strResult = "0000000000" + strResult;
		strResult = strResult.substring(strResult.length, strResult.length - intMinDigits);
	}
	if (intData != 1) {
		strResult += objW[strPrefix + "_units"];
	}
	else {
		strResult += objW[strPrefix + "_unit"];
	}
	return objW[strPrefix + "_before"] + strResult + objW[strPrefix + "_after"];
}

// Get Date() object from 2006-01-01 00:00:00 GMT+00:00 date format
function CD_Parse(strDate) {
	// Pattern match to a countdown date
	var objReDte = /(\d{4})\-(\d{1,2})\-(\d{1,2})\s+(\d{1,2}):(\d{1,2}):(\d{0,2})\s+GMT([+\-])(\d{1,2}):?(\d{1,2})?/;

	if (strDate.match(objReDte)) {
		
		// Start with a default date and build it up into the countdown date through Date setter methods
		var d = new Date(0);

		d.setUTCFullYear(+RegExp.$1,+RegExp.$2-1,+RegExp.$3); // Set YYYY-MM-DD directly as UTC
		d.setUTCHours(+RegExp.$4,+RegExp.$5,+RegExp.$6); // Set HH:MM:SS directly as UTC

		// If there is a timezone offset specified then we need to compensate for the offset from UTC
		var tzs	= (RegExp.$7 == "-" ? -1 : 1); // Timezone sign
		var tzh = +RegExp.$8; // Get requested timezone offset HH (offset ahead of UTC)
		var tzm = +RegExp.$9; // Get requested timezone offset MM (offset ahead of UTC)
		if (tzh) {
			d.setUTCHours(d.getUTCHours() - tzh*tzs); // Compensate for timezone HH offset from UTC
		}
		if (tzm) {
			d.setUTCMinutes(d.getUTCMinutes() - tzm*tzs); // Compensate for timezone MM offset, depending on whether the requested MM offset is ahead or behind of UTC
		}
		
		return d; // Date now correctly parsed into a Date object correctly offset from UTC internally regardless of users current timezone.
	}
	else {
		return NaN; // Didn't match required date format
	};
}

// Entry point onload
function CD_Init(strTagPrefix) {
	
	//var strTagPrefix	= "countdown";
	var objElem			= true; // temp value
	if (document.getElementById) {
		for (var i=1; objElem; ++i) {
			var strTagId = strTagPrefix + i;
			objElem = document.getElementById(strTagId);

			if (objElem && (typeof objElem.innerHTML) != 'undefined') {
				// OK, found a counter, start it ticking
				var strDate	= objElem.innerHTML;
				var objDate	= CD_Parse(strDate);
			
				if (!isNaN(objDate)) {
					var objW = window[strTagId] = new Object();
					objW.intEvntDte		= objDate.valueOf();
					objW.node			= objElem; // Handle to DOM element

					// Default formatting data
					objW.servertime		= "";
					objW.d_mindigits	= 1;
					objW.d_unit			= "d";
					objW.d_units		= "d";
					objW.d_before		= "";
					objW.d_after		= " ";
					objW.d_hidezero		= 0;
					objW.h_mindigits	= 2;
					objW.h_unit			= "h";
					objW.h_units		= "h";
					objW.h_before		= "";
					objW.h_after		= " ";
					objW.h_hidezero		= 0;
					objW.m_mindigits	= 2;
					objW.m_unit			= "m";
					objW.m_units		= "m";
					objW.m_before		= "";
					objW.m_after		= " ";
					objW.m_hidezero		= 0;
					objW.s_mindigits	= 2;
					objW.s_unit			= "s";
					objW.s_units		= "s";
					objW.s_before		= "";
					objW.s_after		= " ";
					objW.s_hidezero		= 0;
					objW.event_msg		= "";
					objW.event_audio_src		= "";
					objW.event_audio_mimetype	= "";
					objW.event_redirecturl		= "";

					// User-defined formatting data, overrides data in global-scope object objW
					CD_M(strTagId);

					// Calculate client-server time offset (ms)
					if (objW.servertime) {
						var objSrvrTm = CD_Parse(objW.servertime);
						if (isNaN(objSrvrTm)) {
							// Bad severtime date format, show subtle error
							objElem.innerHTML = strDate + "**";
							
							continue;
						}
						else {
							
							objW.msoffset = parseInt((objSrvrTm.valueOf() - (new Date()).valueOf())/1000, 10) * 1000; // MS truncated as causes non-integer second display update issue
						}
					}
					else {
						objW.msoffset = 0;
					}

					// Start ticking
					CD_T(strTagId);

					// Make visible (if hidden)
					if (objElem.style) {
						objElem.style.visibility = "visible";
						
					}
				}
				else {
					// Bad date format, show subtle error
					objElem.innerHTML = strDate + "CountdownPro Error: Invalid date format used, check documentation";
				}
			}
		}
	}
}

$(document).ready(function() { 
	if($('#countdown1')) CD_Init("countdown"); 
	if($('#countend1')) CD_Init("countend"); 
	if($('#recentend1')) CD_Init("recentend"); 
	if($('#carousel1')) CD_Init("carousel");	
});


//profile
$(document).ready(function() {

    /*expands the left nav*/
    $("div.menu_universal_profile div > h3 .openclose").click(function() {
        var selectedNum = 0;
        //$(this).toggleClass("open");
        $(this.parentNode).toggleClass("open");
        $(this.parentNode.parentNode).children("ul:eq(0)").slideToggle("fast");
        $(this.parentNode.parentNode).children("span.displayAll").toggle();
        if ($(this.parentNode.parentNode).children("ul:eq(0)").children().length <= 10) {
            $(this.parentNode.parentNode).children("span.displayAll").hide()
        }
        return false;
    });

    // Find all toggling links
    $('.pod_header > span.pod_toggle').each(function() {
        // Attach the click event
        $(this).click(function() {
            // Show/Hide the .pod_content DIV
            var pod_content = $(this).parent().parent().children('.pod_content');
            pod_content.slideToggle("fast");
            $(this).toggleClass("pod_toggle_off");
        });
    });



});


var myPopup = '';
function openPopup(url) {
	myPopup = window.open(url,'popupWindow','width=640,height=150,status=yes');
   if (!myPopup.opener) myPopup.opener = self;
}
function converter_open(url) {
	output = window.open(url,"popDialog","height=220,width=700,toolbar=no,resizable=yes,scrollbars=yes,left=10,top=10");
}

function openTab(idOpen,idClass,tabID,obj){
   $('#'+idClass+' > div.tabc').each(function() {
        $(this).css("display","none");
    });
   
   $('#'+tabID+' > ul li a').each(function() {
        $(this).removeClass("t_active");
    });
	$('#'+obj).addClass("t_active");
	$('#'+idOpen).css("display","block");
}

var countCompare = 0;

function setCheck(b){if(countCompare==3&&b.checked==true){alert('Error: Maximum three products you can compare!');b.checked=false;return;} if(b.checked==true){document.getElementById('l_'+b.id).style.display='none';document.getElementById('a_'+b.id).style.display='block';countCompare++;}else{document.getElementById('l_'+b.id).style.display='inline';document.getElementById('a_'+b.id).style.display='none';countCompare--;}}

function checkCompare(){
alert(countCompare); return false;
if(countCompare>1) return true;
alert('Error: Minimum 2 products you have compare!');
return false;
}

/* tabs */
var currentTab = 0; // Set to a different number to start on a different tab.

function openTab(clickedTab) {
	var thisTab = $(".tabbed-box .tabs a").index(clickedTab);
	$(".tabbed-box .tabs li a").removeClass("active");
	$(".tabbed-box .tabs li a:eq("+thisTab+")").addClass("active");
	$(".tabbed-box .tabbed-content").hide();
	$(".tabbed-box .tabbed-content:eq("+thisTab+")").show();
	currentTab = thisTab;
}

$(document).ready(function() {
						 // alert($(".user_reputation"));
 // if(!$(".user_reputation")){						   
	  $(".tabs li:eq(0) a").css("border-left", "none");
	  $(".tabbed-box .tabs li a").click(function() { 
		  openTab($(this)); return false; 
	  });
	  $(".tabbed-box .tabs li a:eq("+currentTab+")").click();
 // }
 
/* 	$('div.f-row').mouseenter(function(){
		$(span.freq
		//alert('sdfd');
	});*/
});

//add by me
$(document).ready(function() {
	$('#ask_poster').click(function() {
		$('#post-form').css('display','block');
		$('#ask_poster').css('display','none');
	});
});

function changeList(type){
	current = getCookie('auctions_browse');
	if(current != type){
		setCookie('auctions_browse', type);
		window.location.reload(); 
	}
}

function toggle_visible(divId, fieldId) {
    var d = getObject(divId);
    var fld = getObject(fieldId);

    if (d.style.visibility == '' || d.style.visibility == 'visible') {
        d.style.visibility = 'hidden';
		fld.value = '';
    } else {
        d.style.visibility = 'visible';
    }
}


/* scroll */
var scrolltotop={
	setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
	controlHTML: '<img src="/i/up.png" style="width:48px; height:48px" />', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
	controlattrs: {offsetx:5, offsety:35}, //offset of control relative to right/ bottom of window corner
	anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links

	state: {isvisible:false, shouldvisible:false},

	scrollup:function(){
		if (!this.cssfixedsupport) //if control is positioned using JavaScript
			this.$control.css({opacity:0}) //hide control immediately after clicking it
		var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
		if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists
			dest=jQuery('#'+dest).offset().top
		else
			dest=0
		this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
	},

	keepfixed:function(){
		var $window=jQuery(window)
		var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
		var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
		this.$control.css({left:controlx+'px', top:controly+'px'})
	},

	togglecontrol:function(){
		var scrolltop=jQuery(window).scrollTop()
		if (!this.cssfixedsupport)
			this.keepfixed()
		this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
		if (this.state.shouldvisible && !this.state.isvisible){
			this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
			this.state.isvisible=true
		}
		else if (this.state.shouldvisible==false && this.state.isvisible){
			this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
			this.state.isvisible=false
		}
	},
	
	init:function(){
		jQuery(document).ready(function($){
			var mainobj=scrolltotop
			var iebrws=document.all
			mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
			mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
			mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
				.css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
				.attr({title:'Scroll Back to Top'})
				.click(function(){mainobj.scrollup(); return false})
				.appendTo('body')
			if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text
				mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text
			mainobj.togglecontrol()
			$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
				mainobj.scrollup()
				return false
			})
			$(window).bind('scroll resize', function(e){
				mainobj.togglecontrol()
			})
		})
	}
}

scrolltotop.init();


/* loading */
$(function(){
	$('#loading').css('display','none');
  	$('a').live('click', function() {
		if( this.href!='#' && this.href != '' && this.href!='javascript:void(0)' && this.href!='javascript:void()')
			$('#loading').css('display','block');
	});

});

