$(document).ready(function () {
		$(" #nav ul ").css({display: "none"}); // Opera Fix
		$(" #nav li").hover(function(){
			$(this).find('ul.first').css({visibility: "visible",display: "none"}).show(400);
			$(this).find('a.off').addClass('active');
		},function(){
			$(this).find('ul.first').css({visibility: "hidden"});
			$(this).find('a.active').removeClass('active');
		});
});
var timeOut='';
		
function showdisplay(){
	
	var eVisibleId = $("#novedades div:visible").attr("id").substr(3,1);

	var eToShow = "img" + (parseInt(eVisibleId)+1) ;
	
	eVisibleId = "img" + eVisibleId;

	if(eToShow == 'img4'){
		eToShow = "img1";	
	}
	timeOut = setTimeout("changeElement('"+eVisibleId+"','"+eToShow+"')",3000);
	timeOut;
}
function changeElement(e1,e2){
	$("#"+e1).fadeOut("fast", function(){
		$("#"+e2).fadeIn("slow");
	});
	showdisplay();
}
function claerTimeOut(){
	clearTimeout(timeOut);
}
function aleatorio(inferior,superior){
    numPosibilidades = superior - inferior;
    aleat = Math.random() * numPosibilidades;
    aleat = Math.floor(aleat);
    return parseInt(inferior) + aleat;
} 
function showImg(){
	var numAlert = aleatorio(1,3);
	$("#img"+numAlert).show("slow");
}



