function modificarEstado()  {

	document.getElementById("capaModificarEstado").className="modEst";
	document.getElementById("capaModificarEstado").innerHTML="<table width=100% height=100% border=0 cellspacing=3 cellpadding=9><tr style=cursor:pointer; onclick=javascript:establecerEstado(1);><td width=25%><img src=img/usuario-conectado.png></td><td width=75%>Conectado</td></tr><tr style=cursor:pointer; onclick=javascript:establecerEstado(2);><td width=25%><img src=img/usuario-ausente.png></td><td width=75%>Ausente</td></tr><tr style=cursor:pointer; onclick=javascript:establecerEstado(3);><td width=25%><img src=img/usuario-no-disponible.png></td><td width=75%>No disponible</td></tr><tr style=cursor:pointer; onclick=javascript:cancelarmodest();><td width=100% colspan=2>Cancelar</td></tr></table>";

}
function cancelarmodest()  {

	document.getElementById("capaModificarEstado").className="";
	document.getElementById("capaModificarEstado").innerHTML="";

}
function establecerEstado(estado) {

	var user=document.getElementById("nombreUsuario").value;
	document.getElementById("invisible4").src="establecerEstado.php?user="+user+"&estado="+estado;
	cancelarmodest();

}
function quitarErrorLogin() {

	var capa=document.getElementById("capaErrorLogin");
	capa.innerHTML="";
	capa.className="";

		//Vaciamos y quitamos clase CSS para hacer desaparecer.
}

function hazLoginAutomatico(user,pass) {

	document.getElementById("userLogin").value=user;
	document.getElementById("passLogin").value=pass;

	document.formlogin.submit();

}
function botonRegistro(como) {

	if(como=="encima") {

		setTimeout("document.getElementById('botonRegistro').className='inputRegistroOver1'",50);
		setTimeout("document.getElementById('botonRegistro').className='inputRegistroOver2'",100);
		setTimeout("document.getElementById('botonRegistro').className='inputRegistroOver3'",150);
		setTimeout("document.getElementById('botonRegistro').className='inputRegistroOver4'",200);
			//Con setTimeout decidimos en milisegundos cuando se va a ejecutar una accion. En este caso, cambio de clase CSS.
	}
	else if(como=="fuera") {
		setTimeout("document.getElementById('botonRegistro').className='inputRegistroOver4'",50);
		setTimeout("document.getElementById('botonRegistro').className='inputRegistroOver3'",100);
		setTimeout("document.getElementById('botonRegistro').className='inputRegistroOver2'",150);
		setTimeout("document.getElementById('botonRegistro').className='inputRegistroOver1'",200);
		setTimeout("document.getElementById('botonRegistro').className='inputRegistro'",250);
	}
	else if(como=="click") {

		//Si se hace click en botonRegistro

		activarRegistro();

	} //SI NO ENCUENTRA LA ACCION A REALIZAR: ERROR
	else { alert("Error: no se encuentra la accion (variable |como|)"); }
}

function activarRegistro() {

	abiertaono=parent.document.getElementById("ventanasAbiertasOtros").value;
	USUARIO=parent.document.getElementById("nombreUsuario").value;

	if(!abiertaono || abiertaono=="invisible") {
		parent.document.getElementById("capaGeneralOtros").className="generalOtros";
		parent.document.getElementById("capaGeneralOtrosSombra").className="generalOtrosS";
		parent.document.getElementById("capaGeneralOtros").innerHTML="<table width=100% border=0 height=100% cellspacing=0 cellpadding=4 style=\"background-image:url('img/fondo-titulo-ventana4.png');background-position:right top;-moz-border-radius:15px;background-color:ff8f00; background-repeat:no-repeat;\"><TR><TD ondblclick=\"javascript:maxrest('Otros');\" width=70% style=border-bottom-width:1px;border-bottom-color:ff8f00;border-bottom-style:dotted;><table width=100% border=0><TR><TD width=5%><img src=img/inicio.png border=0></TD><td width=35% class=tituloventana style=color:white;><b>Registro de usuarios</b></td><td width=60%></td></TR></table><input type=hidden id=estadoVentanaOtros value=normal></TD><TD width=30% ondblclick=\"javascript:maxrest('Otros');\" align=right style=border-bottom-width:1px;border-bottom-color:ff8f00;border-bottom-style:dotted;><table width=100 height=25 border=0 cellspacing=2 cellpadding=0><TR><TD width=33% align=center class=botonesVentana onclick=javascript:minimizarVentana('Otros'); onmouseover=\"javascript:cambiaClase('minimizarOtros','botonesVentanaOver');\" onmouseout=\"javascript:cambiaClase('minimizarOtros','botonesVentana');\" id=minimizarOtros><img src=img/boton-ventana-minimizar.png border=0></TD><TD width=33% align=center class=botonesVentana id=maxrestOtros onclick=javascript:maxrest('Otros'); onmouseover=\"javascript:cambiaClase('maxrestOtros','botonesVentanaOver');\" onmouseout=\"javascript:cambiaClase('maxrestOtros','botonesVentana');\"><img src=img/boton-ventana-maximizar.png id=btnmaxrestOtros></TD><TD width=33% align=center class=botonesVentana onclick=javascript:cerrarVentana('Otros'); onmouseover=\"javascript:cambiaClase('cerrarOtros','botonesVentanaOver');\" onmouseout=\"javascript:cambiaClase('cerrarOtros','botonesVentana');\" id=cerrarOtros><img src=img/boton-ventana-cerrar.png border=0></TD></TR></table></TD></TR><TR><TD width=100% height=100% colspan=2 style=background-color:white;-moz-border-radius:15px;><iframe id=iframeTutoriales src=registro.php width=100% height=98% border=0 style=border-width:0px;></iframe></TD></TR></table>";
		parent.document.getElementById("ventanasAbiertasOtros").value="visible";
	
		parent.document.getElementById("ventanasAbiertasOtrosCapa").innerHTML="<table class=ventanaBandeja width=100% border=0 onclick=javascript:minimizarVentana('Otros'); onmouseover=\"this.className='ventanaBandejaEncima';\" onmouseout=\"this.className='ventanaBandeja';\" onmousedown=\"this.className='ventanaBandejaAbajo';\" onmouseup=\"this.className='ventanaBandejaEncima';\"><tr><TD width=25%><img src=img/inicio.png border=0></TD><td width=75%>Registro</td></tr></table>";
		
	} else { alert(' YA TIENES UNA VENTANA DE REGISTRO ABIERTA! '); }

}


function botonEntrar(como) {

	if(como=="encima") {

		setTimeout("document.getElementById('botonEntrar').className='inputEntrarOver1'",50);
		setTimeout("document.getElementById('botonEntrar').className='inputEntrarOver2'",100);
		setTimeout("document.getElementById('botonEntrar').className='inputEntrarOver3'",150);
		setTimeout("document.getElementById('botonEntrar').className='inputEntrarOver4'",200);

	}
	else if(como=="fuera") {
		setTimeout("document.getElementById('botonEntrar').className='inputEntrarOver4'",50);
		setTimeout("document.getElementById('botonEntrar').className='inputEntrarOver3'",100);
		setTimeout("document.getElementById('botonEntrar').className='inputEntrarOver2'",150);
		setTimeout("document.getElementById('botonEntrar').className='inputEntrarOver1'",200);
		setTimeout("document.getElementById('botonEntrar').className='inputEntrar'",250);
	}
	else if(como=="click") {

		document.formlogin.submit();

	}
	else { alert("Error: no se encuentra la accion (variable |como|)"); }
}


function moverMenuArriba(cual,como) {

	if(como=="encima") {

		setTimeout("document.getElementById('menuArriba"+cual+"').className='menuArriba1'",50);
		setTimeout("document.getElementById('menuArriba"+cual+"').className='menuArriba2'",100);
		setTimeout("document.getElementById('menuArriba"+cual+"').className='menuArriba3'",150);
		setTimeout("document.getElementById('menuArriba"+cual+"').className='menuArriba4'",200);
		setTimeout("document.getElementById('menuArriba"+cual+"').className='menuArriba5'",250);

	}
	if(como=="fuera") {

		setTimeout("document.getElementById('menuArriba"+cual+"').className='menuArriba5'",50);
		setTimeout("document.getElementById('menuArriba"+cual+"').className='menuArriba4'",100);
		setTimeout("document.getElementById('menuArriba"+cual+"').className='menuArriba3'",150);
		setTimeout("document.getElementById('menuArriba"+cual+"').className='menuArriba2'",200);
		setTimeout("document.getElementById('menuArriba"+cual+"').className='menuArriba1'",250);
		setTimeout("document.getElementById('menuArriba"+cual+"').className='menuArriba0'",300);

	}

}

function cambiaMenuDentroFieldset2(cual,como) {

	if(como=="encima") {
		document.getElementById(cual).className="menuDentroFieldset2Encima";
	}
	if(como=="fuera") {
		document.getElementById(cual).className="menuDentroFieldset2";
	}

}

function actualizarUltMsgForo() {

	document.getElementById("capaUltMsgForo").innerHTML="<table width=100% border=0 cellspacing=0 cellpadding=5><TR><TD width=100% align=center style=font-size:14pt;font-weight:bolder;color:red;>Cargando...</TD></TR></table>";

	document.getElementById("invisible1").src="actualizar.php?que=ultmsgforo";

	setTimeout('actualizarUltMsgForo()',600000);
}


function cerrarCapa(cual) {

	document.getElementById(cual).className="";
	document.getElementById(cual).innerHTML="";

}


function rellenarCapa(cual,conque) {

	document.getElementById(cual).innerHTML=conque;

}

function entrarA(donde) {

	var user=document.getElementById("nombreUsuario").value;
	if(!user || user=="") {
		alert("Debes estar logueado para poder entrar");
	} else {
		document.getElementById("invisible").src="entrar.php?donde="+donde;
			var codigos=document.getElementById("ventanasAbiertasCodigos");
			var foro=document.getElementById("ventanasAbiertasForo");
			var tutoriales=document.getElementById("ventanasAbiertasTutoriales");
			var otros=document.getElementById("ventanasAbiertasOtros");

			if(codigos.value=="visible") { minimizarVentana('Codigos'); }
			if(foro.value=="visible") { minimizarVentana('Foro'); }
			if(tutoriales.value=="visible") { minimizarVentana('Tutoriales'); }
			if(otros.value=="visible") { minimizarVentana('Otros'); }
	}
}
function cerrarVentana(cual) {

	document.getElementById("capaGeneral"+cual).innerHTML="";
	document.getElementById("capaGeneral"+cual).className="";
	document.getElementById("capaGeneral"+cual+"Sombra").className="";

	parent.document.getElementById("ventanasAbiertas"+cual+"Capa").innerHTML="";
	parent.document.getElementById("ventanasAbiertas"+cual+"Capa").className="";

	document.getElementById("ventanasAbiertas"+cual).value="";
	
}

function maxrest(cual) {

	var estado=document.getElementById("estadoVentana"+cual).value;
	if(estado=="normal") {
		document.getElementById("capaGeneral"+cual).className="general"+cual+"Max";
		document.getElementById("capaGeneral"+cual+"Sombra").className="";
	
		document.getElementById("btnmaxrest"+cual).src="img/boton-ventana-restaurar.png";
		document.getElementById("estadoVentana"+cual).value="maximizado";
	}
	else {
		document.getElementById("capaGeneral"+cual).className="general"+cual;
		document.getElementById("capaGeneral"+cual+"Sombra").className="general"+cual+"S";
	
		document.getElementById("btnmaxrest"+cual).src="img/boton-ventana-maximizar.png";
		document.getElementById("estadoVentana"+cual).value="normal";
	}
}

function minimizarVentana(cual) {

	var estadoVentana=document.getElementById("ventanasAbiertas"+cual).value;

	if(estadoVentana=="visible") {
		document.getElementById("capaGeneral"+cual+"Sombra").className="";
		setTimeout('document.getElementById("capaGeneral'+cual+'").className="minimizado1"',150);
		setTimeout('document.getElementById("capaGeneral'+cual+'").className="minimizado2"',300);
		setTimeout('document.getElementById("capaGeneral'+cual+'").className="minimizado3"',450);
		setTimeout('document.getElementById("capaGeneral'+cual+'").className="minimizado4"',600);
		setTimeout('document.getElementById("capaGeneral'+cual+'").className="minimizado5"',750);

		document.getElementById("ventanasAbiertas"+cual).value="invisible";
	} else {

		var estado=document.getElementById("estadoVentana"+cual).value;
		if(estado=="normal") {

			var codigos=document.getElementById("ventanasAbiertasCodigos");
			var foro=document.getElementById("ventanasAbiertasForo");
			var tutoriales=document.getElementById("ventanasAbiertasTutoriales");
			var otros=document.getElementById("ventanasAbiertasOtros");

			if(codigos.value=="visible") { minimizarVentana('Codigos'); }
			if(foro.value=="visible") { minimizarVentana('Foro'); }
			if(tutoriales.value=="visible") { minimizarVentana('Tutoriales'); }
			if(otros.value=="visible") { minimizarVentana('Otros'); }

			document.getElementById("capaGeneral"+cual+"Sombra").className="general"+cual+"S";
			setTimeout('document.getElementById("capaGeneral'+cual+'").className="minimizado5"',50);
			setTimeout('document.getElementById("capaGeneral'+cual+'").className="minimizadoDisplaySi"',150);
			setTimeout('document.getElementById("capaGeneral'+cual+'").className="minimizado4"',300);
			setTimeout('document.getElementById("capaGeneral'+cual+'").className="minimizado3"',450);
			setTimeout('document.getElementById("capaGeneral'+cual+'").className="minimizado2"',600);
			setTimeout('document.getElementById("capaGeneral'+cual+'").className="minimizado1"',750);
			setTimeout('document.getElementById("capaGeneral'+cual+'").className="general'+cual+'"',900);

		} else {

			var codigos=document.getElementById("ventanasAbiertasCodigos");
			var foro=document.getElementById("ventanasAbiertasForo");
			var tutoriales=document.getElementById("ventanasAbiertasTutoriales");
			var otros=document.getElementById("ventanasAbiertasOtros");

			if(codigos.value=="visible") { minimizarVentana('Codigos'); }
			if(foro.value=="visible") { minimizarVentana('Foro'); }
			if(tutoriales.value=="visible") { minimizarVentana('Tutoriales'); }
			if(otros.value=="visible") { minimizarVentana('Otros'); }

			document.getElementById("capaGeneral"+cual+"Sombra").className="";
			setTimeout('document.getElementById("capaGeneral'+cual+'").className="minimizado5M"',50);
			setTimeout('document.getElementById("capaGeneral'+cual+'").className="minimizadoDisplaySi"',150);
			setTimeout('document.getElementById("capaGeneral'+cual+'").className="minimizado4M"',300);
			setTimeout('document.getElementById("capaGeneral'+cual+'").className="minimizado3M"',450);
			setTimeout('document.getElementById("capaGeneral'+cual+'").className="minimizado2M"',600);
			setTimeout('document.getElementById("capaGeneral'+cual+'").className="minimizado1M"',750);
			setTimeout('document.getElementById("capaGeneral'+cual+'").className="general'+cual+'Max"',900);

		}
		document.getElementById("ventanasAbiertas"+cual).value="visible";
	}

}

function cambiaClase(capa,clase) {

	document.getElementById(capa).className=clase;

}

function nuevoMsgForoDsdIndx() {

	var user=document.getElementById("nombreUsuario").value;

	entrarA('foro');
	setTimeout('compruebanuevoMsgForoDsdIndx("'+user+'")',1800);

}
function compruebanuevoMsgForoDsdIndx(user) {

	var control=document.getElementById("controlForo").value;

	if(control=="abierto") {
		cambiarDireccion("foro/mensajes.php?categoria=3&subcategoria=0&abrir=si&queabrir=nuevoMensaje(3,0)&user="+user+"","iframeForo");
	} else {
		nuevoMsgForoDsdIndx();
	}
}

function leerMsgForoDesdeIndex(id,pagina) {

	entrarA('foro');

	setTimeout('cambiarDireccion("foro/mensaje.php?id='+id+'&pagina='+pagina+'#abajo","iframeForo")',1800);

}

function cursos(id,cual2) {

	entrarA('Tutoriales');

	if(cual2==1) { cual="ejercicio"; } else { cual="manual"; }

	setTimeout('cambiarDireccion("cursos/index.php?autoabre=si&id='+id+'&que='+cual+'","iframeTutoriales")',2000);

}

function cambiarDireccion(direccion,frame) {

	document.getElementById(frame).src=direccion;

}
function mueveReloj(){
    momentoActual = new Date();
    hora = momentoActual.getHours();
    minuto = momentoActual.getMinutes();
    segundo = momentoActual.getSeconds();

    str_segundo = new String (segundo);
    if (str_segundo.length == 1) {
       segundo = "0" + segundo;
    }

    str_minuto = new String (minuto);
    if (str_minuto.length == 1) {
       minuto = "0" + minuto;
    }

    str_hora = new String (hora);
    if (str_hora.length == 1) {
       hora = "0" + hora;
    }

    horaImprimible = hora + ":" + minuto + ":" + segundo;

    document.getElementById("reloj").value = horaImprimible;

    setTimeout("mueveReloj()",1000);
    setTimeout("document.getElementById('reloj').className='bordeNada'",500);
    setTimeout("document.getElementById('reloj').className='bordeRojo'",0);
}

function abrirMenuInicio() {

	var estado=document.getElementById("estadoMenuInicio");

	if(estado.value=="cerrado") {
		document.getElementById("menuInicioAbierto").className="menuInicioAbierto";
		document.getElementById("menuInicioAbiertoS").className="menuInicioAbiertoS";
		document.getElementById("menuInicioAbierto").innerHTML="<table width=94% cellspacing=0 cellpadding=4 align=center height=100% border=0><tr><td width=100% colspan=2 align=center><b>Iniciar</b></tr><tr><td width=100% colspan=2 style=font-size:4px;>&nbsp;</td></tr><tr style=cursor:pointer; onmouseover=javascript:cambia('inicioForo','inicioEncima'); onmouseout=javascript:cambia('inicioForo','nada'); ONCLICK=javascript:entrarA('foro');abrirMenuInicio();><td width=10% id=inicioForo class=nada><img src=img/foro.png border=0></td><td width=90% id=inicioForo2 class=nada2>Foro</td></tr><tr><td width=100% colspan=2 style=font-size:4px;>&nbsp;</td></tr><tr style=cursor:pointer; ONCLICK=javascript:entrarA('codigos');abrirMenuInicio(); onmouseover=javascript:cambia('inicioCodigos','inicioEncima'); onmouseout=javascript:cambia('inicioCodigos','nada');><td width=10% class=nada id=inicioCodigos><img src=img/codigos.png border=0></td><td width=90% class=nada2 id=inicioCodigos2>Aula Virtual</td></tr><tr><td width=100% colspan=2 style=font-size:4px;>&nbsp;</td></tr><tr ONCLICK=javascript:entrarA('Tutoriales');abrirMenuInicio(); style=cursor:pointer; onmouseover=javascript:cambia('inicioTutoriales','inicioEncima'); onmouseout=javascript:cambia('inicioTutoriales','nada');><td width=10% class=nada id=inicioTutoriales><img src=img/tutoriales.png border=0></td><td width=90% class=nada2 id=inicioTutoriales2>Tutoriales</td></tr><tr><td width=100% colspan=2 style=font-size:4px;>&nbsp;</td></tr><tr ONCLICK=javascript:entrarA('Tracker');abrirMenuInicio(); style=cursor:pointer; onmouseover=javascript:cambia('inicioTracker','inicioEncima'); onmouseout=javascript:cambia('inicioTracker','nada');><td width=10% class=nada id=inicioTracker><img src=img/tracker.png border=0></td><td width=90% class=nada2 id=inicioTracker2>Tracker</td></tr><tr><td width=100% colspan=2 style=font-size:8px;>&nbsp;</td></tr></table>";
		estado.value="abierto";
	}

	else if(estado.value=="abierto") {
		document.getElementById("menuInicioAbierto").className="";
		document.getElementById("menuInicioAbiertoS").className="";
		document.getElementById("menuInicioAbierto").innerHTML="";
		estado.value="cerrado";
	}

}

function cambia(id,clase) {

		document.getElementById(id).className=clase;
		document.getElementById(id+"2").className=clase+"2";
}
function logout(talvez) {

if(talvez=="auto") { 
	cerrarChat();
		var user=document.getElementById("nombreUsuario").value;
		document.getElementById("invisible").src="logout.php?auto=si&user="+user;
} else {
	cerrarChat();
		var user=document.getElementById("nombreUsuario").value;
		document.getElementById("invisible").src="logout.php?user="+user;
}

}

function subirAvatar() {

	document.getElementById("invisible").src="subirAvatar.php";

}

function subirAvatr() {

	document.formsubiravatar.submit();
}

function compruebaUsuarioDisponible() {

	var user=document.getElementById("user").value;

	document.getElementById("invisible").src="comprueba-usuario-disponible.php?user="+user;

}

function loginAutomatico(user,pass)  {

	top.document.getElementById("userLogin").value=user;
	top.document.getElementById("passLogin").value=pass;

	top.botonEntrar('click');

}
function compruebaPassword() {

	var pass=document.getElementById("pass").value;
	var pass2=document.getElementById("pass2").value;

	if(pass==pass2) {
		document.getElementById("passCoinciden").src="img/ok-verde.png";
	} else {
		document.getElementById("passCoinciden").src="img/no-rojo.png";
	}

}
function cancelarSubirAvatar() {

		document.getElementById("capaSubirAvatar").innerHTML="";
		document.getElementById("capaSubirAvatar").className="";
		document.getElementById("capaSubirAvatarSombra").className="";

}

function compruebaRegistro() {

	document.todoRegistro.submit();

}

function actualizarUsuariosConectados() {

	var como=document.getElementById("comousers").value;
	if(como=="conectados") {

		document.getElementById("capaUsuariosConectados").innerHTML="<table width=100% border=0 cellspacing=0 cellpadding=5><TR><TD width=100% align=center style=font-size:14pt;font-weight:bolder;color:red;>Cargando...</TD></TR></table>";
	
		document.getElementById("invisible2").src="actualizar.php?que=usuariosConectados";
	
		setTimeout('actualizarUsuariosConectados()',300000);

	} else {

		document.getElementById("capaUsuariosConectados").innerHTML="<table width=100% border=0 cellspacing=0 cellpadding=5><TR><TD width=100% align=center style=font-size:14pt;font-weight:bolder;color:red;>Cargando...</TD></TR></table>";
	
		document.getElementById("invisible2").src="actualizar.php?que=usuariosConectadosTodos";
	
		setTimeout('actualizarUsuariosConectados()',300000);
	}
}
function meterTodosUsuarios() {

	document.getElementById("comousers").value="todos";
	actualizarUsuariosConectados();
}
function meterSoloConectados() {

	document.getElementById("comousers").value="conectados";
	actualizarUsuariosConectados()

}

function irAForoTutorialesDsdTutoriales() {

	var user=parent.document.getElementById("nombreUsuario").value;
	parent.entrarA('foro');
	setTimeout('parent.cambiarDireccion("foro/mensajes.php?categoria=2&subcategoria=0&user='+user+'","iframeForo")',800);
}

function movimientoInfoForoSolo(cual,como) {

	if(como=="encima") {
		document.getElementById("filaUltMsgForo"+cual).style.fontWeight="bold";
		document.getElementById("txtUltMsgForo"+cual).style.display="block";
	}

	if(como=="fuera") {
		document.getElementById("filaUltMsgForo"+cual).style.fontWeight="normal";
		document.getElementById("txtUltMsgForo"+cual).style.display="none";
	}

}

function actualizarUltimosEjercicios() {

	document.getElementById("capaUltimosEjercicios").innerHTML="<table width=100% border=0 cellspacing=0 cellpadding=5><TR><TD width=100% align=center style=font-size:14pt;font-weight:bolder;color:red;>Cargando...</TD></TR></table>";

	document.getElementById("invisible3").src="actualizar.php?que=ultimosEjercicios";

//	setTimeout('actualizarUltimosEjercicios()',60000);

}

function actualizarUltimosManuales() {

	document.getElementById("capaUltimosManuales").innerHTML="<table width=100% border=0 cellspacing=0 cellpadding=5><TR><TD width=100% align=center style=font-size:14pt;font-weight:bolder;color:red;>Cargando...</TD></TR></table>";

	document.getElementById("invisible4").src="actualizar.php?que=ultimosManuales";

//	setTimeout('actualizarUltimosManuales()',60000);

}

function entrarProblemasDsdIndx() {

	entrarA('Tutoriales');

	setTimeout("document.getElementById('iframeTutoriales').src='tutoriales/problemas.php'",1800);

}

function entrarProblemaDsdIndx(id) {

	entrarA('Tutoriales');

	setTimeout("document.getElementById('iframeTutoriales').src='tutoriales/problemas.php?auto=si&queiniciar=entrarProblema("+id+")'",1800);


}
function entrarManualesDsdIndx(id) {

	entrarA('Tutoriales');

	setTimeout("document.getElementById('iframeTutoriales').src='tutoriales/tutoriales.php'",1800);


}
function entrarManualDsdIndx(id) {

	entrarA('Tutoriales');

	setTimeout("document.getElementById('iframeTutoriales').src='tutoriales/tutoriales.php?auto=si&queiniciar=entrarTutorial("+id+")'",1800);


}

function abrirChat() {

abierto=document.getElementById("abiertoChat").value;
	if(abierto=="si") {
		maxminChat();
	} else {
		document.getElementById("invisibleChat").src="chat/entrar.php";
	}

}

function cerrarChat() {

var user=document.getElementById("nombreUsuario").value;

document.getElementById("abiertoChat").value="";
document.getElementById("maxminChat").value="";
document.getElementById("invisibleChat").src="chat/salirfuera.php?user="+user;
	document.getElementById("ventanaChat").className="";
	document.getElementById("ventanaChat").innerHTML="";
	document.getElementById("ventanaChatS").className="";

}

function maxminChat() {

maxmin=document.getElementById("maxminChat").value;
	if(maxmin=="max") {
		var txtxtxt="<a href=javascript:maxminChat();>Maximizar</a> | <a href=javascript:cerrarChat();>Salir</a>";
		document.getElementById("maxminChat").value="min";
		document.getElementById("autofoco").value="no";
		setTimeout('document.getElementById("ventanaChat").className="ventanaChat2"',50);
		setTimeout('document.getElementById("ventanaChatS").className="ventanaChatS2"',50);
		setTimeout('document.getElementById("ventanaChat").className="ventanaChat3"',100);
		setTimeout('document.getElementById("iframeChat").style.height="10px"',100);
		setTimeout('document.getElementById("ventanaChatS").className="ventanaChatS3"',100);
		setTimeout('document.getElementById("ventanaChat").className="ventanaChat4"',150);
		setTimeout('document.getElementById("ventanaChatS").className="ventanaChatS4"',150);
		setTimeout('document.getElementById("ventanaChat").className="ventanaChat5"',200);
		setTimeout('document.getElementById("ventanaChatS").className="ventanaChatS5"',200);
		setTimeout('document.getElementById("ventanaChat").className="ventanaChat6"',250);
		setTimeout('document.getElementById("ventanaChatS").className="ventanaChatS6"',250);
		setTimeout('document.getElementById("ventanaChat").className="ventanaChat7"',300);
		setTimeout('document.getElementById("ventanaChatS").className="ventanaChatS7"',300);
		setTimeout('document.getElementById("botoneschas").innerHTML="'+txtxtxt+'"',300);
	} else {
		var txtxtxt="<a href=javascript:maxminChat();>Minimizar</a> | <a href=javascript:cerrarChat();>Salir</a>";
		document.getElementById("maxminChat").value="max";
		document.getElementById("autofoco").value="si";
		setTimeout('document.getElementById("ventanaChat").className="ventanaChat7"',50);
		setTimeout('document.getElementById("ventanaChatS").className="ventanaChatS7"',50);
		setTimeout('document.getElementById("ventanaChat").className="ventanaChat6"',100);
		setTimeout('document.getElementById("iframeChat").style.height="100%"',100);
		setTimeout('document.getElementById("ventanaChatS").className="ventanaChatS6"',100);
		setTimeout('document.getElementById("ventanaChat").className="ventanaChat5"',150);
		setTimeout('document.getElementById("ventanaChatS").className="ventanaChatS5"',150);
		setTimeout('document.getElementById("ventanaChat").className="ventanaChat4"',200);
		setTimeout('document.getElementById("ventanaChatS").className="ventanaChatS4"',200);
		setTimeout('document.getElementById("ventanaChat").className="ventanaChat3"',250);
		setTimeout('document.getElementById("ventanaChatS").className="ventanaChatS3"',250);
		setTimeout('document.getElementById("ventanaChat").className="ventanaChat2"',300);
		setTimeout('document.getElementById("ventanaChatS").className="ventanaChatS2"',300);
		setTimeout('document.getElementById("botoneschas").innerHTML="'+txtxtxt+'"',300);
		setTimeout('document.getElementById("ventanaChat").className="ventanaChat"',350);
		setTimeout('document.getElementById("ventanaChatS").className="ventanaChatS"',350);
	}

}

function mensajesPrivados() {


abierto=document.getElementById("abiertoMP").value;
	if(abierto=="si") {
		maxminMP();
	} else {
		document.getElementById("invisibleMP").src="mp/entrar.php";
	}

}

function cerrarMP() {

var user=document.getElementById("nombreUsuario").value;

document.getElementById("abiertoMP").value="";
document.getElementById("maxminMP").value="";
	document.getElementById("ventanaMP").className="";
	document.getElementById("ventanaMP").innerHTML="";
	document.getElementById("ventanaMPS").className="";

}


function maxminMP() {

maxmin=document.getElementById("maxminMP").value;
	if(maxmin=="max") {
		document.getElementById("maxminMP").value="min";
		document.getElementById("ventanaMP").style.display="none";
		document.getElementById("ventanaMPS").style.display="none";
	} else {
		document.getElementById("maxminMP").value="max";
		document.getElementById("ventanaMP").style.display="block";
		document.getElementById("ventanaMPS").style.display="block";
	}

}


function actualizaIconoMP() {

	var user=document.getElementById("nombreUsuario").value;
	document.getElementById("invisible4").src="actualizarIconomp.php?user="+user;

	setTimeout("actualizaIconoMP()",300000);
}


function miPerfil() {

abierto=document.getElementById("abiertoPerfil").value;
var user=document.getElementById("nombreUsuario").value;
	if(abierto=="si") {
		maxminPerfil();
	} else {
	document.getElementById("invisible2").src="perfil/entrar.php?donde=miperfil&user="+user;
	}

}
function cerrarPerfil() {

var user=document.getElementById("nombreUsuario").value;

document.getElementById("abiertoPerfil").value="";
document.getElementById("maxminPerfil").value="";
	document.getElementById("ventanaPerfil").className="";
	document.getElementById("ventanaPerfil").innerHTML="";
	document.getElementById("ventanaPerfilS").className="";

}

function maxminPerfil() {

maxmin=document.getElementById("maxminPerfil").value;
	if(maxmin=="max") {
		document.getElementById("maxminPerfil").value="min";
		document.getElementById("ventanaPerfil").style.display="none";
		document.getElementById("ventanaPerfilS").style.display="none";
	} else {
		document.getElementById("maxminPerfil").value="max";
		document.getElementById("ventanaPerfil").style.display="block";
		document.getElementById("ventanaPerfilS").style.display="block";
	}

}

function verPerfil(user) {

abierto=document.getElementById("abiertoPerfil").value;
	if(abierto=="si") {
	document.getElementById("invisible2").src="perfil/entrar.php?donde=perfil&user="+user;
	} else {
	document.getElementById("invisible2").src="perfil/entrar.php?donde=perfil&user="+user;
	}

}

function enviarMpdsdIndx(destino) {

	var user=document.getElementById("nombreUsuario").value; if(user=="Anonimo") { alert('No puedes como anonimo'); } else {
		document.getElementById("invisibleMP").src="mp/entrar.php?auto=si&que=escribir.php&autouser="+destino;
}
}

function desconectar(quien) {

var user=document.getElementById("nombreUsuario").value;

	if(user=="CHuLoYo") {
	
		document.getElementById("invisible3").src="desconectar.php?user="+quien;
	
	}

}

function comprobarMensajesEnElJuegoDeC() {
	var user=document.getElementById("nombreUsuario").value;
	document.getElementById("invisiblisimo").src="comprobarmensajeseneljuegodec.php?user="+user;

	//setTimeout("comprobarMensajesEnElJuegoDeC()",600000);

}

function actualizaAlertasContenido() {

	var user=document.getElementById("nombreUsuario").value;
	document.getElementById("invisiblisimo2").src="actualizaAlertas.php?user="+user;

}

function paso2Alerta(deque,ultFecha) {

	switch(deque) {
	
		case "mforo":
			document.getElementById("invisiblisimo2").src="actualizaAlertas2.php?tablabd=foro_mensajes&campo=fecha&ultimaFecha="+ultFecha;
		break;
	
		case "rforo":
			document.getElementById("invisiblisimo2").src="actualizaAlertas2.php?tablabd=foro_respuestas&campo=fecha&ultimaFecha="+ultFecha;
		break;
	
		case "users":
			document.getElementById("invisiblisimo2").src="actualizaAlertas2.php?tablabd=users&campo=fechareg&ultimaFecha="+ultFecha;
		break;
	
		case "tutoriales":
			document.getElementById("invisiblisimo2").src="actualizaAlertas2.php?tablabd=tutoriales_tutoriales&campo=fecha&ultimaFecha="+ultFecha;
		break;
	
		case "problemas":
			document.getElementById("invisiblisimo2").src="actualizaAlertas2.php?tablabd=tutoriales_problemas&campo=fecha&ultimaFecha="+ultFecha;
		break;

		case "comtuto":
			document.getElementById("invisiblisimo2").src="actualizaAlertas2.php?tablabd=tutoriales_comentarios&donde=tutoriales&campo=fecha&ultimaFecha="+ultFecha;
		break;

		case "comejer":
			document.getElementById("invisiblisimo2").src="actualizaAlertas2.php?tablabd=tutoriales_comentarios&donde=problemas&campo=fecha&ultimaFecha="+ultFecha;
		break;
	
	}

}

function ocultaAlertasContenido() {

	document.getElementById("alertasContenido").style.display="none";
}

function verCategoriasForoIndex() {

	document.getElementById("invisiblisimo2").src="mostrarCategoriasForo.php";

}

function entrarACategoriaForo(id) {

	var user=parent.document.getElementById("nombreUsuario").value;
	parent.entrarA('foro');
	setTimeout('parent.cambiarDireccion("foro/foro.php?categoria='+id+'&subcategoria=0&user='+user+'","iframeForo")',1100);
}
function entrarASubCategoriaForo(cat,subcat) {

	var user=parent.document.getElementById("nombreUsuario").value;
	parent.entrarA('foro');
	setTimeout('parent.cambiarDireccion("foro/mensajes.php?categoria='+cat+'&subcategoria='+subcat+'&user='+user+'","iframeForo")',1100);
}

function agrandaralertas() {

	document.getElementById("capaAlertasContenido2").className="alertasgrande";

}

function encogeralertas() {

	document.getElementById("capaAlertasContenido2").className="alertasnormal";

}

function mostrarLenguajesTutorialesEnIndex() {

	document.getElementById("invisible5").src="muestraLenguajesEnIndex.php?que=tutoriales";

}

function mostrarLenguajesEjerciciosEnIndex() {

	document.getElementById("invisible5").src="muestraLenguajesEnIndex.php?que=problemas";

}

function desplazaTexto(modo,texto) {

var txt=new Array();

if(texto=="Estado") {

	txt[0]="E";
	txt[1]="Es";
	txt[2]="Est";
	txt[3]="Esta";
	txt[4]="Estad";
	txt[5]="Estado";
	txt[6]="Estado d";
	txt[7]="Estado de";
	txt[8]="Estado de ";
	txt[9]="Estado de u";
	txt[10]="Estado de us";
	txt[11]="Estado de usu";
	txt[12]="Estado de usua";
	txt[13]="Estado de usuar";
	txt[14]="Estado de usuari";
	txt[15]="Estado de usuario";
	capa=1;

}
if(texto=="Buscar") {

	txt[0]="B";
	txt[1]="Bu";
	txt[2]="Bus";
	txt[3]="Busc";
	txt[4]="Busca";
	txt[5]="Buscar";
	txt[6]="Buscar ";
	txt[7]="Buscar e";
	txt[8]="Buscar en";
	txt[9]="Buscar en ";
	txt[10]="Buscar en l";
	txt[11]="Buscar en la";
	txt[12]="Buscar en la ";
	txt[13]="Buscar en la w";
	txt[14]="Buscar en la we";
	txt[15]="Buscar en la web";
	capa=3;

}
if(texto=="Perfil") {
	txt[0]="M";
	txt[1]="Mo";
	txt[2]="Mod";
	txt[3]="Modi";
	txt[4]="Modif";
	txt[5]="Modifi";
	txt[6]="Modific";
	txt[7]="Modifica";
	txt[8]="Modificar";
	txt[9]="Modificar ";
	txt[10]="Modificar P";
	txt[11]="Modificar Pe";
	txt[12]="Modificar Per";
	txt[13]="Modificar Perf";
	txt[14]="Modificar Perfi";
	txt[15]="Modificar Perfil";
	capa=2;

}

var tiempo=20;
	if(modo=="encima") {

		for (i=0;i<txt.length;i++) {

			setTimeout("document.getElementById('estadoMenuLogin"+capa+"').innerHTML='"+txt[i]+"'",tiempo);
			tiempo=tiempo+20;
		}

	}
	if(modo=="fuera") {

		txt=txt.reverse();

		var colActual="000000";
		for (i=0;i<txt.length;i++) {

			setTimeout("document.getElementById('estadoMenuLogin"+capa+"').innerHTML='"+txt[i]+"'",tiempo);
			tiempo=tiempo+20;
		}
	}

}

function buscador() {

	document.getElementById("capaBuscador").style.display="block";
	document.getElementById("capaBuscadorS").style.display="block";

	setTimeout("document.getElementById('cadenaBusqueda').focus()",100);
}

function ocultaBusqueda() {

	document.getElementById("capaBuscador").style.display="none";
	document.getElementById("capaBuscadorS").style.display="none";

}

function iniciaBusqueda(siono) {

	document.getElementById("botonBuscar").innerHTML="<a href=javascript:; onclick=javascript:iniciaNuevaBusqueda();>Iniciar nueva b&uacute;squeda</a>";


	var tiempo=15;

	for(alto=190;alto<=480;alto=alto+10) {
		setTimeout('document.getElementById("capaBuscador").style.height="'+alto+'px"',tiempo);
		setTimeout('document.getElementById("capaBuscadorS").style.height="'+alto+'px"',tiempo);
	
		tiempo=tiempo+15;

	}

	if(siono=="si"){setTimeout("document.formularioBuscador.submit()",450);}
	setTimeout('document.getElementById("cadenaBusqueda").disabled=1',500);
}

function iniciaNuevaBusqueda() {

	document.getElementById("cadenaBusqueda").disabled=0;
	document.getElementById("capaResultadosBusqueda").innerHTML="";
	document.getElementById("botonBuscar").innerHTML="<a href=javascript:; onclick=javascript:iniciaBusqueda('si');>Buscar</a>";
	

	var tiempo=15;

	for(alto=480;alto>=190;alto=alto-10) {
		setTimeout('document.getElementById("capaBuscador").style.height="'+alto+'px"',tiempo);
		setTimeout('document.getElementById("capaBuscadorS").style.height="'+alto+'px"',tiempo);
	
		tiempo=tiempo+15;

	}document.getElementById("cadenaBusqueda").value="";
	document.getElementById("cadenaBusqueda").focus();

}
