// Run in no Confict mode to stop conflicts with other scripts
// therefore we must now use $j instead of $
var $j = jQuery.noConflict();

/********************************
* Change height of our list     *
* items in drop down box to max *
********************************/
/*$j(document).ready(function() {
    var liArray = new Array();
    var count = 0;
    $j('li.level1').each(function() {
        liArray[count] = $j(this).height();
        count++;
    });
    var tallestLi = liArray.max();
    $j('li.level1').each(function() {
        $j(this).css('height', tallestLi+'px');
    });
});*/

$j(document).ready(function() {
    $j('input.input-text').focus(function() {
        $j(this).css('color', '#000');
    }).blur(
        function(){
            if($j(this).val() == 'Keyword, Product Code...'){
                $j(this).css('color', '#BCBEC0');
            }
        }
    );
});

/************************************
* Float positioning on navContainer *
*************************************/
/*$j(document).ready(function() {
    $j('li.level0').hover(function() {
        if($j(document).width() - $j(this).position().left > $j(document).width()/2){
            $j('.navContainer', this).removeClass('right').addClass('left');
            var liArray = new Array();
            var count = 0;
            $j('li.level1', this).each(function() {
                liArray[count] = $j(this).height();
                count++;
            });
            var tallestLi = liArray.max();
            $j('li.level1', this).each(function() {
                $j(this).css('height', tallestLi+'px');
            });
        }else{
            $j('.navContainer', this).removeClass('left').addClass('right');
        }
    }, function() {});
});*/

/**********************
* tabbed product area *
**********************/
$j(document).ready(function() {
    $j('.productTabs .tab').click(function() {
        var link = $j(this).html().toLowerCase();
        $j('.tabContent div.active, .productTabs li.active').removeClass('active');
        $j('.tabContent div.'+link+', .productTabs li.'+link).addClass('active');
    });
});

/********************************
* Hover animation on categories *
********************************/
/*$j(document).ready(function() {
    $j('.homeCategories li').hoverIntent(function() {
        $j(this).siblings().each(function() {
            $j('span', this).animate({'opacity':'0.3'},{'duration':'fast','queue':false});
        });
    }, function() {
        $j(this).siblings().each(function() {
            $j('span', this).animate({'opacity':'1'},{'duration':'fast','queue':false});
        });
    });
});*/

/************
* Side Tabs *
*************/
$j(document).ready(function() {
    $j('.sideTabs li img.tab').click(function() {
        var moreInfoDiv = $j(this).siblings('.moreInfo');
        if(moreInfoDiv.css('display') == 'block'){
            moreInfoDiv.hide('slide', {direction: 'left'}, 500);
        }else{
            moreInfoDiv.show('slide', {direction: 'left'}, 500);
        }
    });
    // Close button
    $j('.sideTabs li .moreInfo .close').click(function(){
        $j(this).parents('.moreInfo').hide('slide', {direction: 'left'}, 500);
    });
});

