var liText = new Array();
var z=0;
$(function() {
	
	$(".news-item").each(function(){
		liText.push( $(this).html() );
	});
	for (i=0; i<liText.length; i++){
		liText[i] = "<p>" + liText[i] + "</p>";
 	}
});
function Visualizza(){
	
	if(z==liText.length){
		z=0;
	}
	
	$(".mask").empty();
	$(".mask").append(liText[z]);
	z++;
	$strip = $(".mask p");
	$strip.animate({left: 0 },300,function(){
		$(this).animate({left: 0 },9000,function(){
			$(this).animate({opacity: 'hide' }, 700, function(){
				Visualizza();				
			});										 
		});										 
	});

	$strip.hover(function(){
		$(this).stop()},
		function(){
			$(this).animate({opacity: 'hide' }, 700, function(){
				Visualizza();				
			});									
		});
}

$(window).bind("load", function() {
	Visualizza();
});

(function($) {
$.fn.quickview = function() { 
	var menus = this;
	var allContentAreas = $('.quick-view-content');
	
	return this.each(function() {
	$(this).mouseover(function() {
		$(menus).not($(this)).removeClass('over');
		var nextElement = this.className.replace(' over','');
		var thisContentArea = '.quick-view-content.' + nextElement;
		
		$(allContentAreas).hide();
		$(this).addClass('over');
		$(thisContentArea).show();
	   });
	});
};
})
(jQuery);
$((function(){
	var quickViewContent = $('.quick-view-content');
	if (quickViewContent.length < 2)
	{
		$('.quick-view-panel .top-corners')[0].innerHTML += qcontent;
	}
	quickViewContent = $('.quick-view-content'); 
	var maxEl = quickViewContent[0].offsetHeight;
	for (var i = 1; i < quickViewContent.length; i++)
	{
		if (quickViewContent[i].offsetHeight > maxEl) maxEl = quickViewContent[i].offsetHeight;
	}
	quickViewContent.css ({height: maxEl-31 });
	$('.quick-view-menu > li').quickview();
	$('.quick-view-content + .quick-view-content').hide();
	var botCorner = $('.bot-corners');
	var topCorner = $('.top-corners');
	var quickViewMenu = $('.quick-view-menu');
	var calculateBox = $('.calculateBox');
	if (botCorner != null && topCorner != null && quickViewMenu != null && calculateBox!= null)
	{
        var newHeight = Math.max(maxEl, topCorner.height(), quickViewMenu.height()) + 18;		
	    botCorner.css ({height: newHeight });


	}
}));

