// JavaScript Document
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

function reinicia() {
	var lista = document.getElementById('nav_videos').getElementsByTagName('a');
	var numero = document.getElementById('nav_videos').getElementsByTagName('a').length;
		
	for (var i=0;i<numero;i++) {
		lista[i].className = lista[i].className.replace(' activo',"");
	}
}

function cambio_estado(obj) {
	reinicia();
	obj.className = obj.className+" activo";
}

function abridorjmgh(){
	var relfinal = this.rel.split("-");
	var url = this.href;
	window.open(url , "popup" , "width="+relfinal[1]+",height="+relfinal[2]+",scrollbars="+relfinal[3]+",resizable="+relfinal[4]+"")
	return false;
}

function cambiaenlaces(){
	var enlaces = document.getElementsByTagName("a");
	for (i = 0; i < enlaces.length; i++){
		var rel = enlaces[i].rel.split("-");
		var relfinal = rel[0];
		if (relfinal=='external') {
			enlaces[i].target="_blank";
			enlaces[i].title = enlaces[i].title+" (se abre en ventana nueva)";
		}
	}
}

function duracion(enlace){
	var temp = new Array();
	temp = enlace.split('#');
	var segundos = temp[2];
	return segundos;
};

function empieza(enlace){
	var temp = new Array();
	temp = enlace.split('#');
	var segundos = temp[1];
	return segundos;
};
