//<![CDATA[

var time;
var time2;
var banner_sel_id; 

$(document).ready(function(){

	$("a.video_button").click(function() {
		player = document.getElementById("myytplayer");
		player.loadVideoById($(this).attr("href"));
		
		return false; 
	});
	
	banner_sel_id = 0;
	
	$("a.sublink").click(function(){
		//clearInterval(time);
		//clearInterval(time2);
		//time2 = setTimeout('setTimer()', 30000);
		//changeBanner($(this).attr("href"));
		//return false;
	});
	
	changeBanner(0);
	setTimer();
});

function setTimer()
{
	time = setInterval('changeBanner(banner_sel_id + 1)', 6000);
}

function changeBanner(id)
{
	if(id > 3)
	{
		id = 0;
	}
	
	$("#banner_grande_" + banner_sel_id).hide();
	$("#boton_" + banner_sel_id).attr("class","");
	
	$("#banner_grande_" + id).show();
	$("#boton_" + id).attr("class","selected"); 
	
	banner_sel_id = parseInt(id);
}

function loadVideoPlayer(video)
{
	var params = { allowScriptAccess: "always" };
	var atts = { id: "myytplayer" };
	swfobject.embedSWF("http://www.youtube.com/v/"+video+"?enablejsapi=1&playerapiid=ytplayer", "reproduccion_actual", "326", "179", "8", null, null, params, atts);
}
//]]>
