function rollOn(obj){obj.className=obj.className.replace('_Off','_On');}
function rollOff(obj){obj.className=obj.className.replace('_On','_Off');}

function rollImOn(obj){file=obj.src;obj.src=file.replace('_Off','_On');}
function rollImOff(obj){file=obj.src;obj.src=file.replace('_On','_Off');}

function rollLatOn(id){
	rollOff(document.getElementById('botdestacado'));
	rollOff(document.getElementById('botmasleido'));
	rollOff(document.getElementById('botultvideo'));
	
	document.getElementById('destacado').style.display='none';
	document.getElementById('masleido').style.display='none';
	document.getElementById('ultvideo').style.display='none';
	document.getElementById('ultvideo_vermas').style.display='none';
	
	document.getElementById('imdestacado').style.display='none';
	document.getElementById('immasleido').style.display='none';
	document.getElementById('imultvideo').style.display='none';
	
	document.getElementById(id).style.display='block';
	rollOn(document.getElementById('bot'+id));
	document.getElementById('im'+id).style.display='block';
	if(id == "ultvideo"){
		document.getElementById('ultvideo_vermas').style.display='block';
	}
}
function rollLatOn2(id){
	rollOff(document.getElementById('bothoy'));
	rollOff(document.getElementById('botsemana'));
	rollOff(document.getElementById('botmess'));
	
	document.getElementById('hoy').style.display='none';
	document.getElementById('semana').style.display='none';
	document.getElementById('mess').style.display='none';
	
	document.getElementById('imhoy').style.display='none';
	document.getElementById('imsemana').style.display='none';
	document.getElementById('immess').style.display='none';
	
	document.getElementById(id).style.display='block';
	rollOn(document.getElementById('bot'+id));
	document.getElementById('im'+id).style.display='block';
}
function rollentrevistas(id, cont){
	for(i=1; i<cont; i++){
		document.getElementById('entrevista_'+ i).style.display='none';
		document.getElementById('linkentrevista_'+ i).className ='iLinksOtrasEntrevistas';
	}
	document.getElementById('entrevista_'+ id).style.display='block';
	document.getElementById('linkentrevista_'+ id).className ='iLinksOtrasEntrevistas_on';
}
function apagaSubBotonera(){
	objsubbotonera=document.getElementById('subBtPcipal_1');
	objsubbotonera.className=objsubbotonera.className.replace('_On','_Off');
	objsubbotonera=document.getElementById('subBtPcipal_2');
	objsubbotonera.className=objsubbotonera.className.replace('_On','_Off');
	objsubbotonera=document.getElementById('subBtPcipal_3');
	objsubbotonera.className=objsubbotonera.className.replace('_On','_Off');
	objsubbotonera=document.getElementById('subBtPcipal_4');
	objsubbotonera.className=objsubbotonera.className.replace('_On','_Off');
	objsubbotonera=document.getElementById('subBtPcipal_5');
	objsubbotonera.className=objsubbotonera.className.replace('_On','_Off');
	objsubbotonera=document.getElementById('subBtPcipal_6');
	objsubbotonera.className=objsubbotonera.className.replace('_On','_Off');
	objsubbotonera=document.getElementById('subBtPcipal_7');
	objsubbotonera.className=objsubbotonera.className.replace('_On','_Off');
	objsubbotonera=document.getElementById('subBtPcipal_8');
	objsubbotonera.className=objsubbotonera.className.replace('_On','_Off');
	objsubbotonera=document.getElementById('subBtPcipal_9');
}

function cambiaEstadoOn(obj,subbotonera){
	objsubbotoneraactual=document.getElementById(subbotonera);
	obj.className=obj.className.replace('_Off','_On');
	apagaSubBotonera();
	objsubbotoneraactual.className=objsubbotoneraactual.className.replace('_Off','_On');		
}

function cambiaEstadoOff(obj,subbotonera){
	objsubbotoneraactual=document.getElementById(subbotonera);
	obj.className=obj.className.replace('_On','_Off');
	apagaSubBotonera();
	objsubbotoneraactual.className=objsubbotoneraactual.className.replace('_On','_Off');
}

function estadoOn(id){cambiaEstadoOn(document.getElementById(id),'sub'+id);}
function estadoOff(id){cambiaEstadoOff(document.getElementById(id),'sub'+id);}


function seleccionOpcion(idOpcion,nombreOpcion){
	document.getElementById('seccion').value=idOpcion;
	muestraOpciones('desplegableBuscador');
	document.getElementById('nombreOpcion').innerHTML=nombreOpcion;
}

function muestraOpciones(id){
	if(document.getElementById(id).style.display=='none'){
		document.getElementById(id).style.display='block';
	}else{
		document.getElementById(id).style.display='none';
	}
}


var actual_rotador=0;
var total_rotador=3;
var cad="";
var cad2="";
var posicion_rotador=0;
var hilo_rotador;
var rotador_stop = 0;

function ver_foto_rotador(indice){
	dif = actual_rotador - indice;
	if((dif==1) || (dif==-2)) ver_anterior_rotador();
	else if((dif==-1) || (dif==2)) ver_siguente_rotador();
}

function aparece_titular(){
	posicion_rotador++;
	posicion_rotador=71;
	if (posicion_rotador==71){
		posicion_rotador=0;
		clearInterval(hilo_rotador);
	}
	else{
		opa_ie = posicion_rotador*1;
		opa_ff = posicion_rotador*0.01;
	}
}

function desplazar_izq(){
	if(posicion_rotador==0){
		proximo_rotador=actual_rotador;
		proximo_rotador++;
		if (proximo_rotador==total_rotador) proximo_rotador = 0;
		for(k=0;k<total_rotador;k++){
			if(k==proximo_rotador){       							
				document.getElementById("derecha_rotador_activo_"+k).style.display="block";
				document.getElementById("derecha_rotador_desactivo_"+k).style.display="none";
			}
			else{
				document.getElementById("derecha_rotador_activo_"+k).style.display="none";
				document.getElementById("derecha_rotador_desactivo_"+k).style.display="block";
			}
		}
	}
	posicion_rotador++;
	
	ancho = parseInt(document.getElementById(cad).style.width)-10;
	if(ancho < 0) ancho = 0;
	ancho = ancho+"px";
	document.getElementById(cad).style.width=ancho;
	
	if (posicion_rotador==60){
		document.getElementById(cad).style.zIndex=0;
		document.getElementById(cad).style.width="621px"
		clearInterval(hilo_rotador);
		posicion_rotador=0;
		actual_rotador++;
		if (actual_rotador==total_rotador) actual_rotador = 0;
		for (i=0;i<total_rotador;i++){
			cad2 = "fotobig"+i;
			document.getElementById(cad2).style.zIndex=parseInt(document.getElementById(cad2).style.zIndex)+1;
		}
		hilo_rotador = setInterval("aparece_titular()",10);
	}
}

function desplazar_izq_hasta(indice){
		posicion_rotador++;
		document.getElementById(cad).style.width=(parseInt(document.getElementById(cad).style.width)-10)+"px";
		
		if (posicion_rotador==46){
			document.getElementById(cad).style.zIndex=0;
			document.getElementById(cad).style.width="621px"
			clearInterval(hilo_rotador);
			posicion_rotador=0;
			actual_rotador++;
			if (actual_rotador==total_rotador) actual_rotador = 0;
			for (i=0;i<total_rotador;i++){
				cad2 = "fotobig"+i;
				document.getElementById(cad2).style.zIndex=parseInt(document.getElementById(cad2).style.zIndex)+1;
			}
			if(cad=="fotobig"+indice)
				hilo_rotador = setInterval("aparece_titular()",10);
			else 
				hilo_rotador = setInterval("desplazar_izq_hasta("+indice+")",10);;
		}
}

function desplazar_der(){
	if(posicion_rotador==0){
		proximo_rotador=actual_rotador;
		proximo_rotador--;
		if (proximo_rotador<0) proximo_rotador = total_rotador-1;
		for(k=0;k<total_rotador;k++){
			if(k==proximo_rotador){       							
				document.getElementById("derecha_rotador_activo_"+k).style.display="block";
				document.getElementById("derecha_rotador_desactivo_"+k).style.display="none";
			}
			else{
				document.getElementById("derecha_rotador_activo_"+k).style.display="none";
				document.getElementById("derecha_rotador_desactivo_"+k).style.display="block";
			}
		}
	}
	
	posicion_rotador++;
	document.getElementById(cad).style.width=(parseInt(document.getElementById(cad).style.width)+10)+"px";
	if (posicion_rotador==46){
		clearInterval(hilo_rotador);
		posicion_rotador=0;
		actual_rotador--;
		if (actual_rotador<0) actual_rotador = total_rotador-1;
		hilo_rotador = setInterval("aparece_titular()",10);
	}
}

function ver_anterior_rotador(){
	if (posicion_rotador==0){
		a_mover=actual_rotador-1;
		if (a_mover<0) a_mover = total_rotador-1;
		cad="fotobig"+a_mover;
		cad="fotobig"+a_mover;
		document.getElementById(cad).style.width="161px";
		for (i=0;i<total_rotador;i++){
			cad2 = "fotobig"+i;
			document.getElementById(cad2).style.zIndex=parseInt(document.getElementById(cad2).style.zIndex)-1;
		}
		document.getElementById(cad).style.zIndex=10;
		hilo_rotador = setInterval("desplazar_der()",10);       			
	}
}

function ver_siguente_rotador(){
	if (posicion_rotador==0){
		cad="fotobig"+actual_rotador;
		hilo_rotador = setInterval("desplazar_izq()",10);  
	}
}

function enlazar(url){
	window.location=url;
}

function rotador_auto(){
	ver_siguente_rotador();
}

function modificatamanotipografia(val,obj){
	var par=document.getElementById(obj);
	var clds=par.childNodes;
	for (var z0=0;z0<clds.length;z0++){
		if (clds[z0].nodeName=='DIV' || clds[z0].nodeName=='A'){
			if(val==1){
				clds[z0].className=clds[z0].className.replace('_2','_3');
				clds[z0].className=clds[z0].className.replace('_1','_2');
			}else{
				clds[z0].className=clds[z0].className.replace('_2','_1');
				clds[z0].className=clds[z0].className.replace('_3','_2');
			}
		}
	}
}

function rotar() {
	if(actual_rotador == 2) {
		actual_rotador = 0;
		
	} else {
		actual_rotador++;
	}
	ver_foto_rotador(actual_rotador);
}

function setTextDefaultLogin(obj, texto, validador){
	if(obj.value==""){		
		obj.value=texto;		
	}else if(obj.value==texto){		
		obj.value="";
	}
}

function validateLogin(form){
	if(form.login_email.value=="" || form.login_email.value=="email profesional"){
		alert("Debe ingresar el usuario.");
		return false;
	}
	if(form.login_contrasena.value=="" || form.login_contrasena.value=="Password"){
		alert("Debe ingresar la contraseņa.");
		return false;
	}
	return true;
}

function changeInputType(
		  oldElm, // a reference to the input element
		  iType, // value of the type property: 'text' or 'password'
		  iValue, // the default value, set to 'password' in the demo
		  blankValue, // true if the value should be empty, false otherwise
		  noFocus) {  // set to true if the element should not be given focus
		 
		  if(!oldElm || !oldElm.parentNode || (iType.length<4) || 
		    !document.getElementById || !document.createElement) return;
		  var newElm = document.createElement('input');
		  newElm.type = iType;
		  if(oldElm.name) newElm.name = oldElm.name;
		  if(oldElm.id) newElm.id = oldElm.id;
		  if(oldElm.className) newElm.className = oldElm.className;
		  if(oldElm.size) newElm.size = oldElm.size;
		  if(oldElm.tabIndex) newElm.tabIndex = oldElm.tabIndex;
		  if(oldElm.accessKey) newElm.accessKey = oldElm.accessKey;
		  newElm.onfocus = function(){return function(){
		    if(this.hasFocus) return;
		    var newElm = changeInputType(this,'password',iValue,
		      (this.value.toLowerCase()==iValue.toLowerCase())?true:false);
		    if(newElm) newElm.hasFocus=true;
		  }}();
		  newElm.onblur = function(){return function(){
		    if(this.hasFocus)
		    if(this.value=='' || (this.value.toLowerCase()==iValue.toLowerCase())) {
		      changeInputType(this,'text',iValue,false,true);
		    }
		  }}();
		 // hasFocus is to prevent a loop where onfocus is triggered over and over again
		  newElm.hasFocus=false;
		  oldElm.parentNode.replaceChild(newElm,oldElm);
		  if(!blankValue) newElm.value = iValue;
		  if(!noFocus || typeof(noFocus)=='undefined') {
		    window.tempElm = newElm;
		    setTimeout("tempElm.hasFocus=true;tempElm.focus();",1);
		  }
		  return newElm;
		}
//setInterval("rotar()",5000);
