// JavaScript Document

//Define Global vars for nextNews
i = 0;
time = 8000;
element = '.info .rotation';
var actNextNews;
//End Define Global vars for nextNews


function nextNews()
{
    var amount = $(element).length;
    if(amount > i+1)//amount > that number order (i+1) of .content
							{
									$(element).eq(i).fadeOut("slow");

                                    $(element).eq(i+1).fadeIn("slow");

									i++;
									clearTimeout(actNextNews);
							}
							else
							{
									$(element).eq(i).fadeOut("slow");

                                    $(element).eq(0).fadeIn("slow");
                                    
									i = 0;
									clearTimeout(actNextNews);
							}
   if(time != 0) actNextNews = setTimeout(nextNews,time);
}

$(document).ready(function(){

	
	$("div.in").find("a.clicked").each(function(){

		$(this).click(function(){
					
			if(!($(this).siblings().css("display") == "block")){
				
				$("div.out_a").removeClass("out_b");				
				$(".all_item").hide("slow");
				$(this).siblings().show("normal");
				$(this).parent().parent().addClass("out_b");
				return false;
				
			}else{
				
				$(this).siblings(".all_item").hide("slow");
				$(this).siblings().hide("normal");
				$(this).parent().parent().removeClass("out_b");
				return false;
				
			}
			
			/*if($(this).parent().parent().css() == "out_a"){
			}else{
				$(this).parent().parent().removeClass("out_b");
			}*/
			
			
		  });
		  
		  });
		  
		  















//$(".header .down li:first-child").css("background", "none");

//Rotation
$(element).eq(0).css({display:"block"});

$("a.control").click(function (){nextNews();});

if(time != 0)
{
    actNextNews = setTimeout(nextNews,5000);
}



/*$("ul#menu").find("a.niv_1").each(function(){

		$(this).click(function(){
			
			//alert($(this).siblings("ul").css("display"));
			//alert($(this).attr("class"));
			if($(this).siblings("ul").css("display") == 'block'){
								
				$(this).siblings("ul").hide("slow");
				return false;
				
			}else{
				$(".niv_2").hide("slow");//oculta todos los "li" de segundo nivel...//
				$(".niv_4").hide("slow");//oculta todos los "li" de trecer nivel...//
				$(".niv_6").hide("slow");//oculta todos los "li" de cuarto nivel...//
				$(this).siblings("ul").show("slow");
				return false;
				}
		});
	});


$("ul.niv_2").find("a.niv_3").each(function(){

		$(this).click(function(){
			
			//alert($(this).siblings("ul").css("display"));
			//alert($(this).attr("class"));
			if($(this).siblings("ul").css("display") == 'block'){
								
				$(this).siblings("ul").hide("slow");
				
				
			}else{
				
				$(".niv_4").hide("slow");//oculta todos los "li" de trecer nivel...//
				$(".niv_6").hide("slow");//oculta todos los "li" de cuarto nivel...//
				$(this).siblings("ul").show("slow");
				
				}
		});
	});

$("ul.niv_4").find("a.niv_5").each(function(){

		$(this).click(function(){
			
			//alert($(this).siblings("ul").css("display"));
			//alert($(this).attr("class"));
			if($(this).siblings("ul").css("display") == 'block'){
								
				$(this).siblings("ul").hide("slow");
				
				
			}else{
				$(".niv_6").hide("slow");//oculta todos los "li" de cuarto nivel...//
				$(this).siblings("ul").show("slow");
				
				}
		});
	});

$("ul.niv_6").find("a.niv_7").each(function(){

		$(this).click(function(){
			
			//alert($(this).siblings("ul").css("display"));
			//alert($(this).attr("class"));
			if($(this).siblings("ul").css("display") == 'block'){
								
				$(this).siblings("ul").hide("slow");
				
				
			}else{
				
				$(this).siblings("ul").show("slow");
				
				}
				
		});
		
	});
	
});*/

});




