var flashvars = {};
var params = {};
    params.menu = "false";
    params.quality = "high";
    params.allowscriptaccess = "sameDomain";
    params.wmode = "transparent";    
var attributes = {};
    attributes.align = "middle";

swfobject.embedSWF("", "top", "950px", "180px", "8.0.0", false, flashvars, params, attributes);

$(document).ready(function(){ 
  
	$("#fplayer").click(function(){
		location.href="http://get.adobe.com/es/flashplayer/";
	});
	$("#logo").click(function(){
		location.href="index.php";
	});
	$(".options>ul>li>a").click(function(){
		if($(this).next().size()>0){ 
			$(this).next().slideToggle();
			return false;
		}
		else return true;
	});
	$(".menup a").hover(function(){
		$(this).stop().animate({paddingLeft: "50px"},200);
	}, function(){
		$(this).stop().animate({paddingLeft: "45px"},200);
	});
	var current=0;
	var size=$("#images>div").size();
	$("#images>div").each(function(){
		$("#ibuttons").append("<a href='#'></a>");
	});
	$("#ibuttons a:first").addClass("active");
	var timeo=null;
	var timer=setInterval(function(){
		anim();
	},6000);
	function anim(){
		current++;
		if(current>(size-1)) current=0;
		$("#images>div").hide();	
		$("#ibuttons a").removeClass("active");
		$($("#images>div").get(current)).fadeTo(800,1);
		$($("#ibuttons a").get(current)).addClass("active");
	}
	$("#ibuttons a").click(function(){
		clearInterval(timer);
		clearTimeout(timeo);
		current=$(this).index()-1;
		anim();
		timeo=setTimeout(function(){
			reactivar();
		},9000);
		return false;
	});
	function reactivar(){
		timer=setInterval(function(){
			anim();
		},6000);
	}
	
	var neventos=$(".eventos .evento").size();
	var ecurrent=0;
	var etimer=setInterval(function(){
		eanim();
	},6000);
	function eanim(){
		ecurrent++;
		if(ecurrent>(neventos-1)) ecurrent=0;
		$(".eventos .eslide").animate({top:(ecurrent*(120)*-1)+"px"},600);
	}
	
	$("#images img").click(function(){
			location.href=$(this).next().attr("href");
			return false;
	});

});


