

jQuery.fn.supersleight = function(settings) {
    settings = jQuery.extend({
        imgs: true,
        backgrounds: true,
        shim: '/scripts/x.gif',
        apply_positioning: true
    }, settings);

    return this.each(function() {
        if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 7 && parseInt(jQuery.browser.version, 10) > 4) {
            jQuery(this).find('*').andSelf().each(function(i, obj) {
                var self = jQuery(obj);
                // background pngs
                if (settings.backgrounds && self.css('background-image').match(/\.png/i) !== null) {
                    var bg = self.css('background-image');
                    var src = bg.substring(5, bg.length - 2);
                    var mode = (self.css('background-repeat') == 'no-repeat' ? 'crop' : 'scale');
                    var styles = {
                        'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + mode + "')",
                        'background-image': 'url(' + settings.shim + ')'
                    };
                    self.css(styles);
                };
                // image elements
                if (settings.imgs && self.is('img[src$=png]')) {
                    var styles = {
                        'width': self.width() + 'px',
                        'height': self.height() + 'px',
                        'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + self.attr('src') + "', sizingMethod='scale')"
                    };
                    self.css(styles).attr('src', settings.shim);
                };
                // apply position to 'active' elements
                if (settings.apply_positioning && self.is('a, input') && (self.css('position') === '' || self.css('position') == 'static')) {
                    self.css('position', 'relative');
                };
            });
        };
    });
};

jQuery(document).ready(function() {

    jQuery(".item_image_top").supersleight();

    jQuery(".menuoverstate").each(function(i) {

        preload_image = new Image();
        preload_image.src = this.src.replace(".gif", "_o.gif");

        jQuery(this).hover(
            function() {
                if (this.src.indexOf("_o.gif") == -1) {
                    this.src = this.src.replace(".gif", "_o.gif");
                }

            },

            function() {
                this.src = this.src.replace("_o.gif", ".gif");

            });

    }
        );
});


jQuery(document).ready(function() {


    jQuery(".hidden-content").hide();

    jQuery("#[id^=nav]").toggle(function() {
        jQuery(this).addClass("active");
    }, function() {
        jQuery(this).removeClass("active");
    });

    jQuery("#[id^=nav]").click(function() {
        jQuery(this).next(".hidden-content").slideToggle("slow");
    });

});



jQuery(document).ready(function() {

    // add fade effect to special buttons

    jQuery(".hoverfade").hover(function() {
        jQuery(this).fadeTo(200, 0.7);
    },
    function() {
        jQuery(this).fadeTo(200, 1.0);
    });




    // drop down menus
    enteredCat = false;
    waitingCat = false;

    jQuery("#catButton").bind('mouseenter', function() {

        waitingCat = true;

        setTimeout(function() {

            if (waitingCat) {

                if (jQuery("#catBox").hasClass("menuHide") == true) {
                    jQuery("#catBox").removeClass("menuHide");
                }



                position = jQuery("#catButton").position();
                jQuery("#catBox").css("top", position.top + 41 + "px");
                //jQuery("#catBox").css("right", jQuery("#new-header").position().left);
                jQuery("#catBox").css("left", jQuery("#new-header").position().left);
                jQuery("#catBox").hide();
                jQuery("#catBox").slideDown(200);
                enteredCat = false;
                waitingCat = false;
            }
        }, 250);


    }).bind('mouseleave', function() {

        waitingCat = false;
        setTimeout(function() {
            if (enteredCat == false)
                jQuery("#catBox").slideUp(200);
        }, 100);
    });

    jQuery("#catBox").bind('mouseenter', function() {
        enteredCat = true;
    });

    jQuery("#catBox").bind('mouseleave', function() {

        jQuery("#catBox").slideUp(200);
    });


    // drop down menus
    enteredBrand = false;
    waitingBrand = false;

    jQuery("#brandButton").bind('mouseenter', function() {

        waitingBrand = true;

        setTimeout(function() {

            if (waitingBrand) {

                if (jQuery("#brandBox").hasClass("menuHide") == true) {
                    jQuery("#brandBox").removeClass("menuHide");
                }

                position = jQuery("#brandButton").position();
                jQuery("#brandBox").css("top", position.top + 41 + "px");
                jQuery("#brandBox").css("left", jQuery("#new-header").position().left);
                jQuery("#brandBox").hide();
                jQuery("#brandBox").slideDown(200);
                enteredBrand = false;
                waitingBrand = false;
            }
        }, 250);

    }).bind('mouseleave', function() {

        waitingBrand = false;
        setTimeout(function() {
            if (enteredBrand == false)
                jQuery("#brandBox").slideUp(200);
        }, 100);
    });

    jQuery("#brandBox").bind('mouseenter', function() {
        enteredBrand = true;
    });

    jQuery("#brandBox").bind('mouseleave', function() {

        jQuery("#brandBox").slideUp(200);
    });


    // drop down menus
    enteredTent = false;
    waitingTent = false;

    jQuery("#tentBox li").hover(function() {

        this.style.backgroundColor = "#99cc00";
    }, function() {
        this.style.backgroundColor = "#EBEBD6";

    });

    jQuery("#tentButton").bind('mouseenter', function() {

        waitingTent = true;

        setTimeout(function() {

            if (waitingTent) {

                if (jQuery("#tentBox").hasClass("menuHide") == true) {
                    jQuery("#tentBox").removeClass("menuHide");
                }
                position = jQuery("#tentButton").position();
                jQuery("#tentBox").css("top", position.top + 41 + "px");
                jQuery("#tentBox").css("left", jQuery("#tentButton img").position().left);
                jQuery("#tentBox").hide();
                jQuery("#tentBox").slideDown(200);
                enteredTent = false;
                waitingTent = false;
            }
        }, 250);

    }).bind('mouseleave', function() {

        waitingTent = false;
        setTimeout(function() {
            if (enteredTent == false)
                jQuery("#tentBox").slideUp(200);
        }, 100);
    });

    jQuery("#tentBox").bind('mouseenter', function() {
        enteredTent = true;
    });

    jQuery("#tentBox").bind('mouseleave', function() {

        jQuery("#tentBox").slideUp(200);
    });


    /* Camping menu */


    // drop down menus
    enteredCamping = false;
    waitingCamping = false;

    jQuery("#campingBox li").hover(function() {

        this.style.backgroundColor = "#99cc00";
    }, function() {
        this.style.backgroundColor = "#EBEBD6";

    });

    jQuery("#campingButton").bind('mouseenter', function() {

        waitingCamping = true;

        setTimeout(function() {

            if (waitingCamping) {

                if (jQuery("#campingBox").hasClass("menuHide") == true) {
                    jQuery("#campingBox").removeClass("menuHide");
                }

                position = jQuery("#campingButton").position();
                jQuery("#campingBox").css("top", position.top + 41 + "px");
                jQuery("#campingBox").css("left", jQuery("#campingButton img").position().left);
                jQuery("#campingBox").hide();
                jQuery("#campingBox").slideDown(200);
                enteredCamping = false;
                waitingCamping = false;
            }
        }, 250);

    }).bind('mouseleave', function() {

        waitingCamping = false;
        setTimeout(function() {
            if (enteredCamping == false)
                jQuery("#campingBox").slideUp(200);
        }, 100);
    });

    jQuery("#campingBox").bind('mouseenter', function() {
        enteredCamping = true;
    });

    jQuery("#campingBox").bind('mouseleave', function() {

        jQuery("#campingBox").slideUp(200);
    });


    /* Clothing menu */


    // drop down menus
    enteredClothing = false;
    waitingClothing = false;

    jQuery("#clothingBox li").hover(function() {

        this.style.backgroundColor = "#99cc00";
    }, function() {
        this.style.backgroundColor = "#EBEBD6";

    });

    jQuery("#clothingButton").bind('mouseenter', function() {
        waitingClothing = true;

        setTimeout(function() {

            if (waitingClothing) {

                if (jQuery("#clothingBox").hasClass("menuHide") == true) {
                    jQuery("#clothingBox").removeClass("menuHide");
                }

                position = jQuery("#clothingButton").position();
                jQuery("#clothingBox").css("top", position.top + 41 + "px");
                jQuery("#clothingBox").css("left", jQuery("#clothingButton img").position().left);
                jQuery("#clothingBox").hide();
                jQuery("#clothingBox").slideDown(200);
                enteredClothing = false;
                waitingClothing = false;
            }
        }, 250);

    }).bind('mouseleave', function() {

        waitingClothing = false;
        setTimeout(function() {
            if (enteredClothing == false)
                jQuery("#clothingBox").slideUp(200);
        }, 100);
    });

    jQuery("#clothingBox").bind('mouseenter', function() {
        enteredClothing = true;
    });

    jQuery("#clothingBox").bind('mouseleave', function() {

        jQuery("#clothingBox").slideUp(200);
    });

    /* Footwear */




    // drop down menus
    enteredFootwear = false;
    waitingFootwear = false;

    jQuery("#footwearBox li").hover(function() {

        this.style.backgroundColor = "#99cc00";
    }, function() {
        this.style.backgroundColor = "#EBEBD6";

    });

    jQuery("#footwearButton").bind('mouseenter', function() {
        waitingFootwear = true;

        setTimeout(function() {

            if (waitingFootwear) {

                if (jQuery("#footwearBox").hasClass("menuHide") == true) {
                    jQuery("#footwearBox").removeClass("menuHide");
                }

                position = jQuery("#footwearButton").position();
                jQuery("#footwearBox").css("top", position.top + 41 + "px");
                jQuery("#footwearBox").css("left", jQuery("#footwearButton img").position().left);
                jQuery("#footwearBox").hide();
                jQuery("#footwearBox").slideDown(200);
                enteredFootwear = false;
                waitingFootwear = false;
            }
        }, 250);

    }).bind('mouseleave', function() {

        waitingFootwear = false;
        setTimeout(function() {
            if (enteredFootwear == false)
                jQuery("#footwearBox").slideUp(200);
        }, 100);
    });

    jQuery("#footwearBox").bind('mouseenter', function() {
        enteredFootwear = true;
    });

    jQuery("#footwearBox").bind('mouseleave', function() {

        jQuery("#footwearBox").slideUp(200);
    });


    /* Clearance */

    /* Footwear */




    // drop down menus
    enteredClearance = false;
    waitingClearance = false;

    jQuery("#clearanceBox li").hover(function() {

        this.style.backgroundColor = "#99cc00";
    }, function() {
        this.style.backgroundColor = "#EBEBD6";

    });

    jQuery("#clearanceButton").bind('mouseenter', function() {
        waitingClearance = true;

        setTimeout(function() {

            if (waitingClearance) {

                if (jQuery("#clearanceBox").hasClass("menuHide") == true) {
                    jQuery("#clearanceBox").removeClass("menuHide");
                }

                position = jQuery("#clearanceButton").position();
                jQuery("#clearanceBox").css("top", position.top + 41 + "px");
                jQuery("#clearanceBox").css("left", jQuery("#clearanceButton img").position().left);
                jQuery("#clearanceBox").hide();
                jQuery("#clearanceBox").slideDown(200);
                enteredClearance = false;
                waitingClearance = false;
            }
        }, 250);

    }).bind('mouseleave', function() {

        waitingClearance = false;
        setTimeout(function() {
            if (enteredClearance == false)
                jQuery("#clearanceBox").slideUp(200);
        }, 100);
    });

    jQuery("#clearanceBox").bind('mouseenter', function() {
        enteredClearance = true;
    });

    jQuery("#clearanceBox").bind('mouseleave', function() {

        jQuery("#clearanceBox").slideUp(200);
    });

});
