jQuery(document).ready(function(){   
        //TOP NAV DROP MENU JS//
        qm_create(0,false,200,5,false,false,false,false);
        
        //WHATS NEW - HOMEPAGE//
        if (jQuery("ul#whatsNew").length !== 0){jQuery('ul#whatsNew').jcarousel();}                 
        
        //DESIGNER BIO - HOMEPAGE//
        if (jQuery("div.rotatorLeft").length !== 0){
            //extending jQuery with ':random' selector, best put into separate plugin js file
            jQuery.jQueryRandom = 0;
            jQuery.extend(jQuery.expr[":"],
            {
                random: function(a, i, m, r) {
                    if (i == 0) {
                        jQuery.jQueryRandom = Math.floor(Math.random() * r.length);
                    };
                    return i == jQuery.jQueryRandom;
                }
            });        
            //end :random extend
    
            jQuery(function() {
              jQuery('.rotatorLeft img').not(':random').hide(); //hide all images except one initially
              setInterval(function(){
                jQuery('.rotatorLeft img:visible').fadeOut('slow')
                  .siblings('img:random').fadeIn('slow') //find a random image
                   .end().appendTo('.rotatorLeft');}, 
                3000); //3 second interval
            });
            
            jQuery(function() {
              jQuery('.rotatorRight img').not(':random').hide(); //hide all images except one initially
              setInterval(function(){
                jQuery('.rotatorRight img').delay(1500);
                jQuery('.rotatorRight img:visible').fadeOut('slow')
                  .siblings('img:random').fadeIn('slow') //find a random image
                   .end().appendTo('.rotatorRight');}, 
                3000); //3 second interval
            });
        }
          
        //HANDLES CLEARING THE SEARCHBOX (ORIGINAL WAS NOT WORKING AND NEITHER IS THIS ONE... WILL LOOK INTO LATER)
        jQuery("#sli_search_1").focus(function(){ if (jQuery(this).val() == 'keyword or product') {jQuery(this).val(''); }});
        jQuery("#sli_search_1").blur(function(){ if (jQuery(this).val() == '') {jQuery(this).val('keyword or product');} }); 
        jQuery("#tbNavZip").focus(function(){ if (jQuery(this).val() == 'zip code') {jQuery(this).val(''); }});
        jQuery("#tbNavZip").blur(function(){ if (jQuery(this).val() == '') {jQuery(this).val('zip code');} }); 
        jQuery("#tbZip").focus(function(){ if (jQuery(this).val() == 'zip code') {jQuery(this).val(''); }});
        jQuery("#tbZip").blur(function(){ if (jQuery(this).val() == '') {jQuery(this).val('zip code');} }); 
        jQuery("#tbQuantity").focus(function(){ if (jQuery(this).val() == '1') {jQuery(this).val(''); }});
        //jQuery("#tbQuantity").blur(function(){ if (jQuery(this).val() == '') {jQuery(this).val('1');} }); 
        

        //HANDLES SHOW/HIDE EXTRA FOOTER
        if (jQuery("#seoFooterContent .headingContainer").length !== 0){
            jQuery('.switchgroup1').slideUp();
            jQuery('#seoFooterContent .headingContainer').each(function() {
                jQuery(this).click(function() {
                    jQuery(this).next('div').slideToggle();
                    jQuery(this).toggleClass('active');
                });     
            });
        }
        
        //HANDLES THE POP UP IMAGES ON THE PRODUCT LISTING PAGES
        if (jQuery(".plProd").length !== 0){jQuery(".plProd").hover(
            function() { 
                jQuery(this).find('.plProdHover').animate({top: "0px", height: "45px"});
            },function() { 
                jQuery(this).find('.plProdHover').animate({top: "45px", height: "0px"});
            });
        }
        
        //HANDLES THE SORT ON THE PRODUCT LISTING PAGES
        if (jQuery(".prodSort").length !== 0){
            jQuery('ul.prodSort').removeClass('noscript');
            jQuery('.prodSort li.prodSortItems span').click(function () {jQuery(this).parent().find('ul').toggle();});                  
            jQuery('.prodSort li.prodSortItems ul li a').click(function () {
                var url = jQuery(this).attr('href');
                jQuery(this).parent().parent().hide();
                if (jQuery(this).attr('target') === '_blank') {
                    window.open(url);
                    return false;
                } else if (url.indexOf('http://') >= 0 === false) {
                    window.location.href = url;
                } else {
                    window.location.href = window.location.href.split(window.location.pathname)[0] + url;
                }                
            });            
            jQuery(document).bind('click', function (e) {var clicked = $(e.target);if (!clicked.parents().hasClass('prodSort')) {jQuery('.prodSort li.prodSortItems ul').hide();}});
         }
    

});

//GREYBOX//
var GB_ROOT_DIR = "/global/greybox/";

//TOP NAV DROP MENU JS//
var qmad = new Object();qmad.bvis="";qmad.bhide="";qmad.bhover="";
