$(function () { 

	var enable = '1';

	$("#mondo1").mouseover(function () {
	
		
		
		if(enable!='1')
			return;
		
		enable='0';
		
		check(1);
		active(1);

		$("#mondo1_sub").animate({
				height: 'show'
		},1000,function() {
			$("#mondo1_sub_link").fadeIn(500);
			$("#info1").fadeIn(500,function() {
				enable = '1';
			});
		});
		
		
		
	});
	
	
	$("#mondo2").mouseover(function () {
		
		if(enable!='1')
			return;
		
		enable='0';
		
		check(2);
		active(2);
		
		$("#mondo2_sub").animate({
				height: 'show'
		},1000,function() {
			$("#mondo2_sub_link").fadeIn(500);
			$("#info2").fadeIn(500,function() {
				enable = '1';
			});
		});
		
		 
		
	});
	
	$("#mondo3").mouseover(function () {
		
		if(enable!='1')
			return;
		
		enable='0';
		
		
		check(3);
		active(3);
		
		$("#mondo3_sub").animate({
				height: 'show'
		},1000,function() {
			$("#mondo3_sub_link").fadeIn(500);
			$("#info3").fadeIn(500,function() {
				enable = '1';
			});
		});
		
		
	});
	
	function active(value)
	{
		$("#active").val(value);
	}
	
	function check(next)
	{
		clearTimeout(intval);
	
		var active = $("#active").val();
		
		if(active==next)
		{
			$("#mondo"+active).removeClass("mondo"+active+"hover");
			$("#mondo"+next).addClass("mondo"+next+"hover");
			return;
		}
		$("#mondo"+active+"_sub_link").fadeOut(500,function() {
			$("#mondo"+active+"_sub").hide(500);
			$("#info1").hide();
			$("#info2").hide();
			$("#info3").hide();
			
			$("#imgBg"+active).fadeOut(500);
			$("#imgBg"+next).fadeIn(500);
			
			$("#mondo"+active).removeClass("mondo"+active+"hover");
			$("#mondo"+next).addClass("mondo"+next+"hover");
			
		}); 

		
	}
	
	

	
});
 
var conta = -1;
function ciclo()
{
	conta++;	
	if(conta>3) conta=1;
	$("#mondo"+conta).mouseover();
	intval=setTimeout("ciclo()", 3000);
}
	
ciclo();
 

