//jQuery jqzoom
(function($) { $.fn.jqzoom = function(options) { var settings = { zoomHeight: 366, zoomWidth: 381, xOffset: 12, yOffset: 0, alwaysOn: false, preloadText: 'Loading zoom' }; options = options || {}; $.extend(settings, options); return this.each(function() { var a = $(this); $(a).css('outline-style', 'none'); var img = $("img", this); var smallimage = new Smallimage(img); var smallimagedata = {}; var btop = 0; var bleft = 0; var loader = null; loader = new Loader(); var largeimage = new Largeimage(a[0].href); var lens = new Lens(); var lensdata = {}; var largeimageloaded = false; var scale = {}; var stage = null; var running = false; var mousepos = {}; var firstime = 0; var preloadshow = false; var isMouseDown = false; var dragstatus = false; smallimage.loadimage(); largeimage.loadimage(); $(this).click(function() { return false }); $(this).hover(function(e) { mousepos.x = e.pageX; mousepos.y = e.pageY; activate() }, function() { deactivate() }); function activate() { if (!running) { running = true; smallimagedataPos = $("#PPMainImg").offset(); smallimagedataPos.l = smallimagedataPos.left; smallimagedataPos.t = smallimagedataPos.top; smallimagedataPos.r = smallimagedataW + smallimagedataPos.l; smallimagedataPos.b = smallimagedataH + smallimagedataPos.t; if (!largeimage || $.browser.safari) { largeimage = new Largeimage(a[0].href) } if (!largeimageloaded || $.browser.safari) { largeimage.loadimage() } else { stage = new Stage(); stage.activate(); lens = new Lens; lens.activate() } $("#zoomMouseoverText").css("display", "none"); a[0].blur(); return false } }; function deactivate() { running = false; largeimageloaded = false; $(lens.node).unbind('mousemove'); lens.remove(); if ($('div.jqZoomWindow').length > 0) { stage.remove() } a.unbind('mousemove'); firstime = 0; if (jQuery('.zoom_ieframe').length > 0) { jQuery('.zoom_ieframe').remove() } $("#zoomMouseoverText").css("display", "inline") }; function Smallimage(image) { this.node = image[0]; this.loadimage = function() { this.node.src = image[0].src }; a.css({ 'cursor': 'crosshair', 'display': 'block' }); if (a.css('position') != 'absolute' && a.parent().css('position')) { a.css({ 'cursor': 'crosshair', 'position': 'relative', 'display': 'block' }) } if (a.parent().css('position') != 'absolute') { a.parent().css('position', 'relative') } if ($.browser.safari || $.browser.opera) { $("#PPMainImg").css({ position: 'absolute', top: '0px', left: '0px' }) } smallimagedataW = 357; smallimagedataH = 305; smallimagedataPos = $("#PPMainImg").offset(); smallimagedataPos.l = smallimagedataPos.left; smallimagedataPos.t = smallimagedataPos.top; smallimagedataPos.r = smallimagedataW + smallimagedataPos.l; smallimagedataPos.b = smallimagedataH + smallimagedataPos.t; a.height(smallimagedataH); a.width(smallimagedataW); return this }; function Lens() { this.node = document.createElement("div"); $(this.node).addClass('jqZoomPup'); this.node.onerror = function() { $(lens.node).remove(); lens = new Lens(); lens.activate() }; this.loadlens = function() { lensdata.w = (settings.zoomWidth) / scale.x; lensdata.h = (settings.zoomHeight) / scale.y; $(this.node).css({ width: lensdata.w + 'px', height: lensdata.h + 'px', position: 'absolute', display: 'none', borderWidth: 1 + 'px' }); $(this.node).addClass('jqZoomPup').html("<div id='zc1'><div id='zc2'><div id='zc3'><div id='zcT' style='height:" + lensdata.h + "px; width:" + lensdata.w + "px;'></div></div></div>"); a.append(this.node) }; return this }; Lens.prototype.activate = function() { this.loadlens(); (settings.alwaysOn) ? lens.center() : lens.setposition(null); $(a).bind('mousemove', function(e) { mousepos.x = e.pageX; mousepos.y = e.pageY; lens.setposition(e) }); return this }; Lens.prototype.setposition = function(e) { if (e) { mousepos.x = e.pageX; mousepos.y = e.pageY } if (firstime == 0) { var lensleft = (smallimagedataW) / 2 - (lensdata.w) / 2; var lenstop = (smallimagedataH) / 2 - (lensdata.h) / 2; $('div.jqZoomPup').show(); this.node.style.visibility = 'visible'; firstime = 1 } else { var lensleft = mousepos.x - smallimagedataPos.l - (lensdata.w) / 2; var lenstop = mousepos.y - smallimagedataPos.t - (lensdata.h) / 2 } if (overleft()) { lensleft = 0 + bleft } else if (overright()) { if ($.browser.msie) { lensleft = smallimagedataW - lensdata.w + bleft + 1 } else { lensleft = smallimagedataW - lensdata.w + bleft - 1 } } if (overtop()) { lenstop = 0 + btop } else if (overbottom()) { if ($.browser.msie) { lenstop = smallimagedataH - lensdata.h + btop + 1 } else { lenstop = smallimagedataH - lensdata.h - 1 + btop } } lensleft = parseInt(lensleft); lenstop = parseInt(lenstop); $('div.jqZoomPup', a).css({ top: lenstop, left: lensleft }); this.node.style.left = lensleft + 'px'; this.node.style.top = lenstop + 'px'; largeimage.setposition(); function overleft() { return mousepos.x - (lensdata.w + 2 * 1) / 2 - bleft < smallimagedataPos.l }; function overright() { return mousepos.x + (lensdata.w + 2 * 1) / 2 > smallimagedataPos.r + bleft }; function overtop() { return mousepos.y - (lensdata.h + 2 * 1) / 2 - btop < smallimagedataPos.t }; function overbottom() { return mousepos.y + (lensdata.h + 2 * 1) / 2 > smallimagedataPos.b + btop }; return this }; Lens.prototype.center = function() { $('div.jqZoomPup', a).css('display', 'none'); var lensleft = (smallimagedataW) / 2 - (lensdata.w) / 2; var lenstop = (smallimagedataH) / 2 - (lensdata.h) / 2; this.node.style.left = lensleft + 'px'; this.node.style.top = lenstop + 'px'; $('div.jqZoomPup', a).css({ top: lenstop, left: lensleft }); largeimage.setposition(); if ($.browser.msie) { $('div.jqZoomPup', a).show() } else { setTimeout(function() { $('div.jqZoomPup').fadeIn('fast') }, 10) } }; Lens.prototype.getoffset = function() { var o = {}; o.left = parseInt(this.node.style.left); o.top = parseInt(this.node.style.top); return o }; Lens.prototype.remove = function() { $('div.jqZoomPup', a).remove() }; function Largeimage(url) { this.url = url; this.node = new Image(); this.loadimage = function() { if (!this.node) this.node = new Image(); this.node.style.position = 'absolute'; this.node.style.display = 'none'; this.node.style.left = '-5000px'; this.node.style.top = '10px'; loader = new Loader(); if (!preloadshow) { loader.show(); preloadshow = true } document.body.appendChild(this.node); this.node.src = this.url }; this.node.onload = function() { this.style.display = 'block'; var w = Math.round($(this).width()); var h = Math.round($(this).height()); this.style.display = 'none'; scale.x = (w / smallimagedataW); scale.y = (h / smallimagedataH); if ($('div.preload').length > 0) { $('div.preload').remove() } largeimageloaded = true; if (running) { stage = new Stage(); stage.activate(); lens = new Lens(); lens.activate() } if ($('div.preload').length > 0) { $('div.preload').remove() } }; return this }; Largeimage.prototype.setposition = function() { this.node.style.left = Math.ceil(-scale.x * parseInt(lens.getoffset().left) + bleft) + 'px'; this.node.style.top = Math.ceil(-scale.y * parseInt(lens.getoffset().top) + btop) + 'px' }; function Stage() { this.node = document.createElement("div"); $(this.node).addClass('jqZoomWindow'); $(this.node).css({ position: 'absolute', width: Math.round(settings.zoomWidth) + 'px', height: Math.round(settings.zoomHeight) + 'px', display: 'none', zIndex: 10000, overflow: 'hidden' }); return this }; Stage.prototype.activate = function() { if (!this.node.firstChild) this.node.appendChild(largeimage.node); $("#BOR_PPMC_ContII").append(this.node); $(this.node).show(); if ($.browser.msie && $.browser.version < 7) { this.ieframe = $('<iframe class="zoom_ieframe" frameborder="0" src="#"></iframe>').css({ position: "absolute", zIndex: 99, width: settings.zoomWidth, height: settings.zoomHeight }).insertBefore(this.node) }; largeimage.node.style.display = 'block' }; Stage.prototype.remove = function() { $('.jqZoomWindow').remove() }; function Loader() { this.node = document.createElement("div"); $(this.node).addClass('preload'); $(this.node).html(settings.preloadText); $(this.node).appendTo("body").css('visibility', 'hidden'); this.show = function() { loadertop = smallimagedataPos.t + (smallimagedataH - $(this.node).height()) / 2; loaderleft = smallimagedataPos.l + (smallimagedataW - $(this.node).width()) / 2; $(this.node).css({ top: loadertop, left: loaderleft, position: 'absolute', visibility: 'visible' }) }; return this } }) } })(jQuery); function trim(stringa) { while (stringa.substring(0, 1) == ' ') { stringa = stringa.substring(1, stringa.length) } while (stringa.substring(stringa.length - 1, stringa.length) == ' ') { stringa = stringa.substring(0, stringa.length - 1) } return stringa };


$("#BOR_PPMC_BGM").css("height", $("#BOR_PPMC_ContII").innerHeight() - 36 + "px");
$("#BOR_PPMC_Space").css("height", $("#BOR_PPMC_ContII").innerHeight() + 22 + "px");

$("div.BOR_AHM_Space").each(function() {
    $(this).css("height", $(this).children(".BOR_AHM_Cont").innerHeight() + "px");
});

$(function() {
    $("#BOR_Accounts").css("margin-right", $("#BOR_Cart").innerWidth() + 9 + "px");

    //Chad Holy	
    //	$('.BOR_PPMC_Scroll').jScrollPane({
    //			verticalDragMinHeight: 27,
    //			verticalDragMaxHeight: 27
    //	});

    try {
        $("#BOR_PPMC_Right .PPTC").addClass("displayNone").removeClass("PPTC");
        $('.BOR_PP_ReviewScroll').jScrollPane({
            verticalDragMinHeight: 31,
            verticalDragMaxHeight: 31
        });
    }
    catch (e) {  //catch errors and suppress them
    }

    var BOR_SBG = function() {
        if ($("#BOR_Search_Input").length > 0 && $("#BOR_Search_Input").val().length == 0)
            $("#BOR_Search_Input").addClass("BOR_Serch_InputNF");
        else
            $("#BOR_Search_Input").removeClass("BOR_Serch_InputNF");
    };
    $("#BOR_Search_Input").focus(function() {
        $(this).removeClass("BOR_Serch_InputNF");
    }).blur(function() {
        BOR_SBG();
    });
    BOR_SBG();

    var BOR_EText = function() {
        if ($("#BOR_EmailInput").val() == "Enter Your Email")
            $("#BOR_EmailInput").val("");
        else if ($("#BOR_EmailInput").val() == "")
            $("#BOR_EmailInput").val("Enter Your Email");
    };
    $("#BOR_EmailInput").focus(function() {
        BOR_EText();
    }).blur(function() {
        BOR_EText();
    });


    setTimeout(function() {
        if ($("#BOR_Footer")) {
            var BOR_FootH = 0;
            $("#BOR_Footer .BOR_FooterCol").each(function() {
                if ($(this).innerHeight() >= BOR_FootH)
                    BOR_FootH = $(this).innerHeight();
            });
            $("#BOR_Footer .BOR_FooterCol").css("height", BOR_FootH + "px");
        }
    }, 100);



    if ($("#BOR_HomeScroll_Cont").length) {
        var BHSStep = 2;
        var BHSTime;
        var BOR_HomeScroll = function(ST, SS) {
            if (($("#BOR_HomeScroll_Cont").data("hover") != "true" || ST == "click") && $("#BOR_HomeScroll_Cont").data("an") != "true") {
                $("#BOR_HomeScroll_Cont").data("an", "true");
                $("#BOR_HomeScroll_Cont .BOR_HomeScroll_StepA").removeClass("BOR_HomeScroll_StepA");
                $("#BOR_HS_Step_" + SS).addClass("BOR_HomeScroll_StepA");
                setTimeout(function() {
                    $("#BOR_HomeScroll_Cont .BOR_HS_PageA").fadeOut(600, function() {
                        $("#BOR_HS_Page_" + SS).fadeIn(600, function() {
                            $("#BOR_HomeScroll_Cont .BOR_HS_PageA").removeClass("BOR_HS_PageA");
                            $(this).addClass("BOR_HS_PageA");
                            $("#BOR_HomeScroll_Cont").data("an", "false");
                            if (BHSStep == 4)
                                BHSStep = 1;
                            else
                                BHSStep = BHSStep + 1;
                            BHSTime = setTimeout(function() {
                                BOR_HomeScroll("auto", BHSStep);
                            }, 4000);
                        });
                    });
                }, 20);
            }
        };
        $("#BOR_HomeScroll_ContII").hover(function() {
            clearTimeout(BHSTime);
            $("#BOR_HomeScroll_Cont").data("hover", "true");
        }, function() {
            $("#BOR_HomeScroll_Cont").data("hover", "false");
            BHSTime = setTimeout(function() {
                BOR_HomeScroll("auto", BHSStep);
            }, 4000);
        });
        $("#BOR_HomeScroll_Cont .BOR_HomeScroll_Step").click(function() {
            if ($(this).hasClass("BOR_HomeScroll_StepA") == false) {
                clearTimeout(BHSTime);
                BHSStep = parseInt($(this).attr("id").split("_")[3]);
                BOR_HomeScroll("click", BHSStep);
            }
        });
        BHSTime = setTimeout(function() {
            BOR_HomeScroll("auto", BHSStep);
        }, 3500);
    }


    // Below is a modified version of hm leftNav open/close js.  It has been commentted out
    // as it interfers with StorefrontWithMenu.Master.cs page's navigation implementation. -CH

//    $("a.BOR_LN_Acord").live("click", function() {
//        if ($(this).data("an") != "true") {
//            $(this).data("an", "true");
//            var $this = $(this);
//            if ($(this).hasClass("BOR_LN_AcordA")) {
//                //Close
//                setTimeout(function() {
//                    $this.siblings("div.BOR_LN_AcordP").slideUp(300, function() {
//                        $this.removeClass("BOR_LN_AcordA").data("an", "false");
//                    });
//                }, 20);
//            }
//            else {
//                //Open
//                if ($(this).data("userClick") == "false") {
//                    $this.addClass("BOR_LN_AcordA")
//                    setTimeout(function() {
//                        $this.siblings("div.BOR_LN_AcordP").slideDown(300, function() {
//                            $this.data("an", "false");
//                        });
//                    }, 20);
//                }
//                else {
//                    window.location.href = $this[0].href;
//                }
//            }
//        }
//        return false;
//    });


    $("a.BOR_LN_Kaw").live("click", function() {
        if ($(this).data("an") != "true") {
            $(this).data("an", "true");
            var $this = $(this);
            if ($(this).hasClass("BOR_LN_KawA")) {
                setTimeout(function() {
                    $this.siblings("div.BOR_LN_KawP").slideUp(300, function() {
                        $this.removeClass("BOR_LN_KawA").data("an", "false");
                    });
                }, 20);
            }
            else {
                $this.addClass("BOR_LN_KawA")
                setTimeout(function() {
                    $this.siblings("div.BOR_LN_KawP").slideDown(300, function() {
                        $this.data("an", "false");
                    });
                }, 20);
            }
        }
        return false;
    });



    try {

        //CH
        $('select.BOR_SDD').selectmenu({
            style: 'dropdown',
            change: function() {
                //alert("Redirect the user here."); //CH
            }
        });
    }
    catch (e) {  //catch and suppress error
    }

    //$("#PPMainImg").jqzoom();

    $("#BOR_PPMC_Left div.PPMainImgSwatch").live("click", function() {
        $("#BOR_PPMC_Left div.PPMainImgSwatchA").removeClass("PPMainImgSwatchA");
        $(this).addClass("PPMainImgSwatchA");
        $("#PPMainImg").html('<img src="' + $(this).attr("medsrc") + '" class="leftElement" height="305" width="357" />');
        return false;
    });


    var BOR_TabChange = function(thistab) {
        if ($("#BOR_PPMC_Tabs").data("an") != "true") {
            $("#BOR_PPMC_Tabs").data("an", "true");
            var tabhtml = $("#PPT_" + thistab).html();
            $("#PPTA_" + thistab).html(tabhtml).addClass("BOR_PPMC_TabA").siblings().removeClass("BOR_PPMC_TabA").html("");
            var tabpos = (88 * thistab) - 293;
            $("#BOR_PPMC_TabsA").css("background-position", tabpos + "px 0px");

            setTimeout(function() {
                $("#BOR_PPMC_Right .PPTC_A").fadeOut(300, function() {
                    $("#PPTC_" + thistab).fadeIn(300, function() {
                        $("#BOR_PPMC_Right .PPTC_A").removeClass("PPTC_A");
                        $(this).addClass("PPTC_A");
                        $("#BOR_PPMC_Tabs").data("an", "false");
                    });
                });
            }, 20);
        }
    };

    $("#BOR_PPMC_TabsA .BOR_PPMC_Tab").live("click", function() {
        if ($(this).hasClass("BOR_PPMC_TabA") == false) {
            var thistab = parseInt($(this).attr("id").split("_")[1]);
            BOR_TabChange(thistab);
        }
        return false;
    });
    $("#BOR_PPMC_Right a.PPT_Link").live("click", function() {
        var thistab = parseInt($(this).attr("pptl"));
        BOR_TabChange(thistab);
        return false;
    });

    $("#BOR_ReviewLink").live("click", function() {
        $('html, body').animate({ scrollTop: $("#BOR_Reviews").offset().top - 10 }, 1000);
        return false;
    });

    $("#BOR_VTC").live("click", function() {
        $('html, body').animate({ scrollTop: $("#BOR_COL_Header").offset().top - 10 }, 1000);
        return false;
    });

    $("#BOR_BTT").live("click", function() {
        $('html, body').animate({ scrollTop: 0 }, 1000);
        return false;
    });


    $("#BOR_FWMCont .BOR_FWM").hover(function() {
        $(this).children(".BOR_FWMC").css("display", "inline");
    }, function() {
        $(this).children(".BOR_FWMC").css("display", "none");
    });

});


/* IINDEV SELECT DROPDOWN CODE HERE */

//(function($) {
//    $(function() {

//        // calling selects
//        findAndInitCustomSelects()

//    })// Doc Ready Ends


//    // Custom Select
//    var customSelectOpened = false
//    // var $toBeReplacedWithCustomDropdown	= false

//    function findAndInitCustomSelects() {
//        var $customSelectInputArr = $('select.iindevSelect')
//        if ($customSelectInputArr.length) {
//            $customSelectInputArr.each(function(i) {
//                handleCustomSelectIssues($(this), i);
//            })

//            $('body').click(function() {
//                if (customSelectOpened) {
//                    $('div.customDropdown ul').css({ 'left': '-999999px' }).removeClass('opened')
//                    customSelectOpened = false
//                }
//            })
//        }
//    } // findAndInitCustomSelects() ends

//    //var customSelectWidth	= 0
//    //var $customSelectDiv	= false

//    function handleCustomSelectIssues($customSelectInput, customInputItemNo) {
//        var selectOptions = ''
//        $customSelectInput.find('option').each(function(i) {
//            $(this).data('index', i)
//            selectOptions += '<li' + (($(this).attr('selected') == true) ? ' class="selected"' : '') + '>' + $(this).text() + '</li>'
//        })

//        $customSelectInput.css({ 'visibility': 'hidden', 'position': 'absolute', 'left': '-999999px', 'top': '0' })
//        $customSelectInput.after('<div class="customDropdown"><div class="ul-head"><div class="txtContainer">' + $('select.iindevSelect:eq(' + customInputItemNo + ') option:selected').text() + '</div><div class="customDropdownArrow"></div></div>' + ((selectOptions != '') ? ('<ul>' + selectOptions + '</ul>') : '') + '</div>')

//        var customSelectWidth = $customSelectInput.width()

//        if ($customSelectInput.attr('class').indexOf('wdt') >= 0) {
//            var csutomSelectSettingsArr = $customSelectInput.attr('class').split(' ')

//            for (var i = 0, j = csutomSelectSettingsArr.length; i < j; i++) {
//                if (csutomSelectSettingsArr[i].indexOf('wdt') >= 0) {
//                    customSelectWidth = parseInt(csutomSelectSettingsArr[i].substr(3))
//                    break;
//                }
//            }
//        }

//        var $customSelectDiv = $('div.customDropdown').eq(customInputItemNo)

//        $customSelectDiv.css({ 'zIndex': 9999 - customInputItemNo, 'width': customSelectWidth, 'float': $customSelectInput.css('float'), 'clear': $customSelectInput.css('clear'), 'margin-top': $customSelectInput.css('margin-top'), 'margin-right': $customSelectInput.css('margin-right'), 'margin-bottom': $customSelectInput.css('margin-bottom'), 'margin-left': $customSelectInput.css('margin-left') })
//        $customSelectDiv.find('.ul-head').css({ 'width': customSelectWidth })

//        var $customSelectDiv_ul = $customSelectDiv.find('ul')
//        $customSelectDiv_ul.css({ 'left': '-999999px', 'width': customSelectWidth - 2 })

//        $customSelectDiv.find('div.ul-head').click(function(e) {
//            e.stopPropagation()
//            if (customSelectOpened) {

//                if ($customSelectDiv_ul.hasClass('opened')) $customSelectDiv_ul.css({ 'left': '-999999px' }).removeClass('opened')
//                else {
//                    $('div.customDropdown').find('ul').css({ 'left': '-999999px' }).removeClass('opened')
//                    $customSelectDiv_ul.css({ 'left': 0 }).addClass('opened')
//                    customSelectOpened = true
//                }
//            }
//            else {
//                $customSelectDiv_ul.css({ 'left': 0 }).addClass('opened')
//                customSelectOpened = true
//            }
//        })

//        $customSelectDiv.find('li').each(function(i) {
//            var $this_li = $(this)
//            $this_li.css({ 'width': customSelectWidth - (parseInt($this_li.css('padding-left')) + parseInt($this_li.css('padding-right'))) })
//            $this_li.click(function(e) {
//                e.stopPropagation()

//                // remove and add the selected class
//                $customSelectDiv_ul.find('li.selected').removeClass('selected')
//                $this_li.addClass('selected')

//                // Remove previously selected option and set the newly selected option
//                $customSelectInput.find('option[selected="selected"]').removeAttr('selected')
//                $customSelectInput.find('option:eq(' + i + ')').attr('selected', true)

//                //console.log( $customSelectInput.find('option[selected="selected"]').val() )
//                //console.log( $customSelectInput.find('option:eq('+i+')').data('index') )

//                // hide the open options
//                $customSelectDiv_ul.css({ 'left': '-999999px' }).removeClass('opened')
//                customSelectOpened = false

//                // Replacing the selected text of the upper span
//                $customSelectDiv.find('div.txtContainer').html($this_li.text())

//            })
//        })
//    } // Ending Function handleCustomSelectIssues

//    // Custom Select Ends

//    $('a#holiday_link').click(function(e) {
//        e.preventDefault()
//        $(this).find('span.holiday_link_area').toggleClass('show')
//    })




//})(jQuery) // Ending jQuery Shield





