

//Back to top slider

jQuery(document).ready(function() {
   
    jQuery('a[href=#totop]').click(function(){
        jQuery('html, body').animate({scrollTop:0}, 600);
        return false;
    });

});

// Product Slider

jQuery(document).ready(function() {
    jQuery('#featured-products').jcarousel();
});

// FancyBox jQuery

jQuery(document).ready(function() {
		
			 jQuery("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true }); 
		});

// Slider Homepage
jQuery(document).ready(function(){	
	jQuery("#slider").easySlider({
		auto: true,
		continuous: true,
		numeric: true
	});
});

// Set Grid height
if(window.onload) {
	var temp = window.onload;
	window.onload = function(e) {
		temp(e);
		setGridHeight();
	};
} else {
	window.onload = function(e) {
		setGridHeight();
	};
}

var setGridHeight = function() {
	jQuery(".generic-product-grid tr").each(function() {
		var max = 0;
		jQuery(this).children().each(function() {
			var height = jQuery(this).find(".padder").height()+parseInt(jQuery(this).find(".padder .add-to").css("margin-bottom"));
			if(height > max)
				max = height;
		});
		jQuery(this).find(".padder").css({
			position: 'relative',
			height: max
		}).children(".price-box").css({
			position: 'absolute',
			bottom: '90px'
		}).parent().children("a").css({
			position: 'absolute',
			bottom: '54px'
		}).parent().children(".add-to").css({
			position: 'absolute',
			bottom: 0
		});
	});
//});
};
