// Font Replacement
Cufon.replace('.category-title h1,.footer h4, .product-view .product-shop .product-name h1,.page-title h1, .page-title h2,.wired-home .subscribe strong', {
	hover: true
});

jQuery(document).ready(function() {

	// Featured Products
    jQuery('#featured').jcarousel();
    
	// FancyBox jQuery
	jQuery("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
    	
	// Slider Homepage
	jQuery('#slider').cycle({
        fx: 'fade',
        speed: 2000,
		timeout: 5000,
        pager: '#controls',
		slideExpr: '.panel',
		prev: '#prev1',
		next: '#next1',
		pause: 'true',
    });
    
	// Show next & prev arrows when hovered
	jQuery('#slider').hover(function () {
		jQuery('.nav a').css('visibility','visible');
	}, function() {
		jQuery('.nav a').css('visibility','hidden');
	});
    
    //---------------- Added By BAA ----------------------//
    
    // Hover effect for brands
    
    jQuery(".amshopby-featured-wrapper a span").hover(function() {
    //Get image url and assign it to 'thumbOver'
    var thumbOver = jQuery(this).find("img").attr("src"); 

    //Set a background image(thumbOver) on the <a> tag - Set position to bottom
    jQuery(this).css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
    
    jQuery(this).find("img").stop().animate({"opacity": "0"}, "fast");
	},
	function() {
    jQuery(this).find("img").stop().animate({"opacity": "1"}, "slow");
	});
    
    /*jQuery("span.a").hover(
	function() {
	jQuery(this).stop().animate({"opacity": "0"}, "fast");
	},
	function() {
	jQuery(this).stop().animate({"opacity": "1"}, "slow");
	});*/
    
    // Bring up a random list of brands on each page load
    /*jQuery('.subpromo ul').each(function(){
        // get current ul
        var ul = jQuery(this);
        // get array of list items in current ul
        var liArr = ul.children('li');
        // sort array of list items in current ul randomly
        liArr.sort(function(a,b){
              // Get a random number between 0 and 10
              var temp = parseInt( Math.random()*10 );
              // Get 1 or 0, whether temp is odd or even
              var isOddOrEven = temp%2;
              // Get +1 or -1, whether temp greater or smaller than 5
              var isPosOrNeg = temp>5 ? 1 : -1;
              // Return -1, 0, or +1
              return( isOddOrEven*isPosOrNeg );
        })
        // append list items to ul
        .appendTo(ul);            
    });*/
    
});

