jQuery(document).ready(function(){

	// STICKY FOOTER 
	var footerHeight = jQuery('.footer').height();
	var mainBottom = footerHeight + 40 + 'px';
	var footerTop = footerHeight + 20 + 'px';
	jQuery('#main').css('padding-bottom', mainBottom);
	jQuery('.footer').css('margin-top', '-'+footerTop);
	
	// RECENTLY VIEWED TOOLTIP
	jQuery(".recently-viewed a[title]").tooltip({tip: '#tooltip',  offset: [-30, 40], effect: 'slide'}).dynamic( {bottom: {direction: 'down', bounce: true } });
	
	// EQUAL HEIGHTS
	function equalHeight(group) {
		var tallest = 0;
		group.each(function() {
			var thisHeight = jQuery(this).height();
			if(thisHeight > tallest) {
				tallest = thisHeight;
			}
		});
		group.height(tallest);
	}	
	equalHeight(jQuery(".product-list"));
	equalHeight(jQuery(".recent-product"));
	equalHeight(jQuery(".little"));
	var downScrollerHeight = jQuery(".recent-product").height();
	jQuery(".recent-product-wrap").height(downScrollerHeight);
	
	// PRODUCT VIEWS	
	jQuery(".more-view-wrap").each(function(){       
        var rowDiv = document.createElement("div");
        jQuery(rowDiv).addClass("scrolling-row");
        for(i=0; i< jQuery(this).find("> .more-view").length ; i+= 4)
        {       
                jQuery(rowDiv).append( jQuery(this).find("> .more-view").slice(i, i+4).clone() );           
                jQuery(this).append(rowDiv);
                rowDiv = document.createElement("div");
                jQuery(rowDiv).addClass("scrolling-row");
        }
        jQuery(this).find("> .more-view").remove(); 
	});
	jQuery(".more-view-list").scrollable({effect:"linear"});
	jQuery(".more-view-wrap").tabs("#prod-img > a", {effect: "fade"});
	jQuery(".tabbed-menu").tabs(".tabbed-content > div", {effect: "fade", tabs: "li"});
	jQuery("#prod-img a").fancybox({"titleShow":false,"autoScale":false,"autoDimensions":false});

	// FANCYBOX
	jQuery(".main-image > a").fancybox({'titlePosition' : 'over'});
	jQuery("#atc_finish, #atw_finish, #wclear").fancybox({'autoScale':false,'padding':0,'titleShow' : false});
	jQuery(".fancyclose").click(function(){$.fancybox.close();return false;});
        jQuery(" a.addtocart").click(function(){
        //    jQuery('#atc_finish').fancybox().trigger('click');
        });

	// SEARCHBOX WIDTH
	var cartWidth = jQuery("#top-cart").width();
	var searchWidth = cartWidth + 27;
	jQuery("#s").width(searchWidth);
	
	//ZOOM MAIN IMAGE SINGLE PRODUCT
	$("#prod-img").append('<div class="zooming">Ver vídeo</div>');
	
	$(".zooming").show();
	$("#prod-img").hover(function(){
		$(this).find(".zooming");
	},function(){
		$(this).find(".zooming");
	});
});
jQuery(window).load(function(){
	
	// LOGO LINE HEIGHT
	var logoheight = jQuery("#logo h1").height()+"px";
	jQuery("#logo .description").css("line-height", logoheight);
	
	// MOVING SHARE BOX
	jQuery("#wpsc_akst_form").appendTo("#share-box");

});


    

