/* bgiframe
 * Version 2.1.1
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(b($){$.m.E=$.m.g=b(s){h($.x.10&&/6.0/.I(D.B)){s=$.w({c:\'3\',5:\'3\',8:\'3\',d:\'3\',k:M,e:\'F:i;\'},s||{});C a=b(n){f n&&n.t==r?n+\'4\':n},p=\'<o Y="g"W="0"R="-1"e="\'+s.e+\'"\'+\'Q="P:O;N:L;z-H:-1;\'+(s.k!==i?\'G:J(K=\\\'0\\\');\':\'\')+\'c:\'+(s.c==\'3\'?\'7(((l(2.9.j.A)||0)*-1)+\\\'4\\\')\':a(s.c))+\';\'+\'5:\'+(s.5==\'3\'?\'7(((l(2.9.j.y)||0)*-1)+\\\'4\\\')\':a(s.5))+\';\'+\'8:\'+(s.8==\'3\'?\'7(2.9.S+\\\'4\\\')\':a(s.8))+\';\'+\'d:\'+(s.d==\'3\'?\'7(2.9.v+\\\'4\\\')\':a(s.d))+\';\'+\'"/>\';f 2.T(b(){h($(\'> o.g\',2).U==0)2.V(q.X(p),2.u)})}f 2}})(Z);',62,63,'||this|auto|px|left||expression|width|parentNode||function|top|height|src|return|bgiframe|if|false|currentStyle|opacity|parseInt|fn||iframe|html|document|Number||constructor|firstChild|offsetHeight|extend|browser|borderLeftWidth||borderTopWidth|userAgent|var|navigator|bgIframe|javascript|filter|index|test|Alpha|Opacity|absolute|true|position|block|display|style|tabindex|offsetWidth|each|length|insertBefore|frameborder|createElement|class|jQuery|msie'.split('|'),0,{}))

$(document).ready(function(){

    function menuFixer() {
        $("ul.topLevelMenu > li:eq(4)").addClass("left");
        $("ul.topLevelMenu > li:eq(5)").addClass("left");
        $("ul.topLevelMenu > li:eq(6)").addClass("left");
        $("ul.topLevelMenu > li:eq(7)").addClass("left");
    }

    $(window).ready(function(){
        var mySpace = $(window).width();

        if(mySpace <= 1200) {
            $("ul.topLevelMenu > li:eq(4)").addClass("left");
            $("ul.topLevelMenu > li:eq(5)").addClass("left");
            $("ul.topLevelMenu > li:eq(6)").addClass("left");
            $("ul.topLevelMenu > li:eq(7)").addClass("left");
        }
    });

    $(window).bind("resize", function() {
        var mySpace = $(window).width();

        if(mySpace <= 1200) {
            var resizeTimer = null;

            if(resizeTimer)
            clearTimeout(resizeTimer);
            resizeTimer = setTimeout(menuFixer, 100);
        }else if (mySpace >= 1201) {
            $("ul.topLevelMenu > li:eq(4)").removeClass("left");
            $("ul.topLevelMenu > li:eq(5)").removeClass("left");
            $("ul.topLevelMenu > li:eq(6)").removeClass("left");
            $("ul.topLevelMenu > li:eq(7)").removeClass("left");
        }
    });


var isIE6 = (BrowserDetect.browser == "Explorer" && BrowserDetect.version < 7);
if (isIE6) {
    $("ul.topLevelMenu").superfish();
    var myUls = $("ul.topLevelMenu").find(">li:has(ul)");
    var myAs = $("ul.topLevelMenu").find("a");
    $(myUls).mouseover(function(){
        $("ul", this).bgIframe({
            opacity: false
        });
    });
    $(myAs).focus(function(){
        $("ul", $(".nav>li:has(ul)")).bgIframe({opacity:true});
    });
} // end IE6


/*
    $("ul.topLevelMenu").superfish({
        hoverClass : "sfHover",
        delay : 750,
        speed : "fast"
    }).find(">li:has(ul)").mouseover(function(){
        $("ul", this).bgIframe({opacity:true});    }).find("a").focus(function(){
            $("ul", $(".nav>li:has(ul)")).bgIframe({opacity:false});
    });
*/
    $("ul.topLevelMenu ul li:visible").blur(function() {
        $(this).fadeOut("fast");
    });

    $("ul.topLevelMenu ul li:has(ul)").addClass("hasChild");
    $("li.hasChild > a span").addClass("addArrow");

    $("a.cancel").attr("href", "javascript:history.go(-1)");
    $("a#print").attr("onClick", "window.print();");

    $(".autoClear").focus(function() {
        if( this.value == this.defaultValue ) {this.value = "";}}).blur(function() {if( !this.value.length ) {this.value = this.defaultValue;}
    });

    $("div.productCrossSell:first").addClass("first");
    $("div.productCrossSell:last").addClass("last");

    $("div.collection:even").addClass("even");
    $(".pagination dt").append("&nbsp;&nbsp;/");
    $("#pageSortTop .productSort dd:first").append("<span>/</span>");
    $("#pageSortBottom .productSort dd:first").append("<span>/</span>");
    $("#continueShopping").prepend("&lt;&nbsp;")
    $(".features li").prepend("- ");
    $("#breadcrumb li a").after("<span>/</span>");
    $("#breadcrumb li:first a").addClass("home");
    $('.richText li:has(a)').addClass('arrow');

});
