(function ($) {

function a_fix_small_products() {

	var max_height = 0;
	
		$('.testo_prodotto_small p').each(function (i, e) {
		
			var h = $(e).height();
		
			if (h > max_height) {
				max_height = h;
			}
			
		})
		.each(function (i, e) {
		
			$(e).css({
				
				minHeight: max_height+'px',
				height: max_height+'px'
			
			});
		});

}

function a_fix_styling_index() {

	var max_height = 0;

	$('#trasparent.stripe.styling ul li').each(function (i, e) {
	
		var h = $(e).height();
	
		if (h > max_height) {
			max_height = h;
		}
		
	})
	.each(function (i, e) {
	
		$(e).css({
			
			minHeight: max_height+'px',
			height: max_height+'px'
		
		});
	});

}

function a_fix_footer() {

	var w_w =  $(window).height();
	var w_h =  $('body').height();
	
	if (w_w > w_h) {
	
		var $back = $('div#back');
	
		var b_h = $back.height();
		
		var new_h = b_h + w_w - w_h;
		
		$back.css({
			
			height: new_h+'px'
		
		});
		
	
	}

}

function a_fix_bg() {
	
	var bg_w = 1018;
	var w_p = $('div#back.stripe.products div.container').offset();
	
	if (w_p != null) {
	
		var left = 0;
		var top = 0;
		var min_left = 300;
		
		left = w_p.left + min_left;
		
		if (bg_w + left < $(window).width()) {
			left = $(window).width() - bg_w;
		}

		$('div#back.stripe').css({
			backgroundPosition: left+'px '+top+'px'
		});
	
	}
	
}

$(function () {

	$(window).resize( function () {
		a_fix_bg();
		a_fix_footer();
	});

	a_fix_bg();
	a_fix_footer();
	a_fix_styling_index();
	a_fix_small_products();
	
});

})(jQuery);
