function isset(variable) {
    try {
        if (typeof(eval(variable)) != 'undefined')
			if (eval(variable) != null)
				return true;
     } catch(e) {}
    return false
}

function imagenOn(imagen,nombre) {
	var imagen_on = "images/" + nombre + "_on.jpg"
	imagen.src = imagen_on
}

function imagenOff(imagen,nombre) {
	var imagen_off = "images/" + nombre + "_off.jpg"
	imagen.src = imagen_off
}

function mostrarAcentos(texto) {
	texto = texto.replace(/%C3%A1/gi,"á")
	texto = texto.replace(/%C3%81/gi,"Á")
	texto = texto.replace(/%C3%A9/gi,"é")
	texto = texto.replace(/%C3%89/gi,"É")
	texto = texto.replace(/%C3%AD/gi,"í")
	texto = texto.replace(/%C3%8D/gi,"Í")
	texto = texto.replace(/%C3%B3/gi,"ó")
	texto = texto.replace(/%C3%93/gi,"Ó")
	texto = texto.replace(/%C3%BA/gi,"ú")
	texto = texto.replace(/%C3%9A/gi,"Ú")
	texto = texto.replace(/%C3%BC/gi,"ü")
	texto = texto.replace(/%C3%9C/gi,"Ü")
	texto = texto.replace(/%C3%B1/gi,"ñ")
	texto = texto.replace(/%C3%91/gi,"Ñ")
	texto = texto.replace(/%C2%A1/gi,"¡")
	texto = texto.replace(/%C2%BF/gi,"¿")
	return texto
}

function enviaRuta() {
	var ruta = document.getElementById("ruta");
	ruta.click();
	var rutaFake = document.getElementById("rutaFake");
	rutaFake.value = ruta.value;
}

function validarEmail() {
	var email = document.getElementById("email")
	var arroba = email.value.indexOf("@")
	var punto = email.value.lastIndexOf(".")
	var longitud = email.value.length
	if (arroba < 1 || punto == -1) {
		email.style.color = "#cc0000"
		return false
	} else if (punto > arroba && ((punto - arroba) < 2 || (longitud - punto) < 3 || (longitud - punto) > 5)) {
		email.style.color = "#cc0000"
		return false
	} else if (punto < arroba) {
		email.style.color = "#cc0000"
		return false
	} else {
		email.style.color = "#444444"
		return true
	}
}

function desmarcarEmail() {
	var email = document.getElementById("email")
	email.style.color = "#444444"
	borrarRespuesta()
}

function validarMail() {
	var mail = document.getElementById("mail")
	var arroba = mail.value.indexOf("@")
	var punto = mail.value.lastIndexOf(".")
	var longitud = mail.value.length
	if (arroba < 1 || punto == -1) {
		mail.style.color = "#cc0000"
		return false
	} else if (punto > arroba && ((punto - arroba) < 2 || (longitud - punto) < 3 || (longitud - punto) > 5)) {
		mail.style.color = "#cc0000"
		return false
	} else if (punto < arroba) {
		mail.style.color = "#cc0000"
		return false
	} else {
		mail.style.color = "#444444"
		return true
	}
}

function desmarcarMail() {
	var mail = document.getElementById("mail")
	mail.style.color = "#444444"
	borrarResultado("recordatorio")
}

function validarNumero(campo,evento) {
	if (isNaN(campo.value))
		campo.style.color = "#cc0000"
	else
		campo.style.color = "#444444"
}

function validarDia() {
	var dia = document.getElementById("dia")
	if (isNaN(dia.value)) {
		dia.style.color = "#cc0000"
		return false
	} else if (dia.value < 1 || dia.value > 31) {
		dia.style.color = "#cc0000"
		return false
	} else {
		dia.style.color = "#444444"
		if (dia.value.length < 2)
			dia.value = "0" + dia.value
		return true
	}
}

function desmarcarDia() {
	var dia = document.getElementById("dia")
	dia.style.color = "#444444"
	borrarRespuesta()
}

function validarMes() {
	var mes = document.getElementById("mes")
	if (isNaN(mes.value)) {
		mes.style.color = "#cc0000"
		return false
	} else if (mes.value < 1 || mes.value > 12) {
		mes.style.color = "#cc0000"
		return false
	} else {
		mes.style.color = "#444444"
		if (mes.value.length < 2)
			mes.value = "0" + mes.value
		return true
	}
}

function desmarcarMes() {
	var mes = document.getElementById("mes")
	mes.style.color = "#444444"
	borrarRespuesta()
}

function validarYear() {
	var year = document.getElementById("year")
	var fecha = new Date()
	if (isNaN(year.value)) {
		year.style.color = "#cc0000"
		return false
	} else if (year.value < 1900 || year.value > fecha.getFullYear()) {
		year.style.color = "#cc0000"
		return false
	} else {
		year.style.color = "#444444"
		return true
	}
}

function desmarcarYear() {
	var year = document.getElementById("year")
	year.style.color = "#444444"
	borrarRespuesta()
}

function validarCP() {
	var cp = document.getElementById("cp")
	if (isNaN(cp.value)) {
		cp.style.color = "#cc0000"
		return false
	} else if (cp.value.length < 5) {
		cp.style.color = "#cc0000"
		return false
	} else {
		cp.style.color = "#444444"
		return true
	}
}

function desmarcarCP() {
	var cp = document.getElementById("cp")
	cp.style.color = "#444444"
	borrarRespuesta()
}

function diaMesYear() {
	var dia = document.getElementById("dia")
	var mes = document.getElementById("mes")
	var year = document.getElementById("year")
	
	if ((mes.value == 4 || mes.value == 6 || mes.value == 9 || mes.value == 11) && dia.value == 31)
		return false
	else if (mes.value == 2 && dia.value > 29)
		return false
	else if (year.value%4 != 0 && mes.value == 2 && dia.value == 29)
		return false
	else
		return true
}

function longitudMax(longitud,campo,evento) {
	var code = evento.keyCode
	
	if (code == 13)
		return false
	
	if (code != 8 && code != 46 && code != 37 && code != 38 && code != 39 && code != 40)
		return (campo.value.length < longitud)
}

function validarComentarioForm() {
	var c = document.getElementById("comentario")
	if (c.value == "")
		return false
	else return true
}

function validarLoginForm() {
	var n = document.getElementById("nick")
	var p = document.getElementById("pass")
	if (n.value == "" || p.value == "") {
		if (n.value == "")
			n.focus()
		else if (p.value == "")
			p.focus()
		return false
	} else return true
}

function mostrarResultadoLogin(texto) {
	var resultado = document.getElementById("resultado_login")
	if (texto == "Ok") {
		borrarLoginForm()
		window.location = "index.php"
	} else if (texto == "Nick") {
		resultado.innerHTML = "El usuario no existe"
		borrarLoginForm()
	} else if (texto == "Password") {
		var pass = document.getElementById("pass")
		resultado.innerHTML = "El password no es correcto"		
		pass.value = ""
	} else if (texto == "No_Pupilo") {
		resultado.innerHTML = "Aún no eres pupilo"
		borrarLoginForm()
	} else {
		resultado.innerHTML = "Ha ocurrido un error";
		borrarLoginForm();
	}
}

function borrarLoginForm() {
	var nick = document.getElementById("nick")
	var pass = document.getElementById("pass")
	nick.value = ""
	pass.value = ""
}

function validarRecordatorioForm() {
	var m = document.getElementById("mail")
	if (m.value == "" || !validarMail()) {
		if (m.value != "" && !validarMail())
			m.value = ""
		if (m.value == "")
			m.focus()
		return false
	} else return true
}

function mostrarResultadoRecordatorio(texto) {
	var resultado = document.getElementById("resultado_recordatorio")
	var mail = document.getElementById("mail")
	if (texto == "Ok") {
		mail.value = ""
		mostrarAviso("Recordatorio")
	} else if (texto == "Email") {
		resultado.innerHTML = "El email no está registrado"
		mail.value = ""
	} else {
		resultado.innerHTML = "Ha ocurrido un error";
		mail.value = ""
	}
}

function borrarRespuesta() {
	var respuesta = document.getElementById("respuesta")
	if (respuesta.innerHTML != "")
		respuesta.innerHTML = ""
}

function borrarResultado(seccion) {
	var resultado = document.getElementById("resultado_" + seccion)
	if (resultado.innerHTML != "")
		resultado.innerHTML = ""
}

function overMain(nombre){
	var overMain_base = document.getElementById("overMain_base")
	var overMain_mensaje = document.getElementById("overMain_mensaje")
	var seccion = document.getElementById("overMain_" + nombre)
	
	if (seccion.style.visibility == "visible") {
		overMain_base.style.visibility = "hidden"
		overMain_base.style.height = "0px"
		
		seccion.style.visibility = "hidden"
		seccion.style.height = "0px"
	} else {		
		var otra_seccion1
		var otra_seccion2
		var otra_seccion3
		var altura
		
		if (nombre == "login") {
			otra_seccion1 = document.getElementById("overMain_aviso")
			otra_seccion2 = document.getElementById("overMain_recordatorio")
			otra_seccion3 = document.getElementById("overMain_subir")
			altura = "73px"
		} else if (nombre == "recordatorio") {
			otra_seccion1 = document.getElementById("overMain_aviso")
			otra_seccion2 = document.getElementById("overMain_login")
			otra_seccion3 = document.getElementById("overMain_subir")
			altura = "49px"
		} else {
			otra_seccion1 = document.getElementById("overMain_aviso")
			otra_seccion2 = document.getElementById("overMain_login")
			otra_seccion3 = document.getElementById("overMain_recordatorio")
			altura = "73px"			
		}
		
		if (isset(overMain_mensaje)) {
			overMain_mensaje.style.visibility = "hidden"
			overMain_mensaje.style.height = "0px"
		}
		
		overMain_base.style.visibility = "visible"
		overMain_base.style.height = altura
		
		seccion.style.visibility = "visible"
		seccion.style.height = altura
		
		otra_seccion1.style.visibility = "hidden"
		otra_seccion1.style.height = "0px"
		otra_seccion2.style.visibility = "hidden"
		otra_seccion2.style.height = "0px"
		otra_seccion3.style.visibility = "hidden"
		otra_seccion3.style.height = "0px"
	}
}

function mostrarAviso(texto) {
	var columnMain_table1 = parent.document.getElementById("columnMain_table1")
	var columnMain_table2 = parent.document.getElementById("columnMain_table2")
	var columnInfo_table = parent.document.getElementById("columnInfo_table")
	var overMain_base = parent.document.getElementById("overMain_base")
	var overMain_login = parent.document.getElementById("overMain_login")
	var overMain_subir = parent.document.getElementById("overMain_subir")
	var overMain_recordatorio = parent.document.getElementById("overMain_recordatorio")
	var overMain_mensaje = parent.document.getElementById("overMain_mensaje")
	var overMain_info = parent.document.getElementById("overMain_info")
	var overMain_aviso = parent.document.getElementById("overMain_aviso")
	var aviso = parent.document.getElementById("aviso")
	
	if (isset(columnMain_table1)) {
		columnMain_table1.style.borderWidth = "0px"
		columnMain_table2.style.borderWidth = "0px"
		columnInfo_table.style.borderWidth = "0px"
	}
	
	if (isset(overMain_login)) {
		overMain_login.style.visibility = "hidden"
		overMain_login.style.height = "0px"
	}
	
	if (isset(overMain_subir)) {
		overMain_subir.style.visibility = "hidden"
		overMain_subir.style.height = "0px"
	}
	
	if (isset(overMain_recordatorio)) {
		overMain_recordatorio.style.visibility = "hidden"
		overMain_recordatorio.style.height = "0px"
	}
	
	if (isset(overMain_mensaje)) {	
		overMain_mensaje.style.visibility = "hidden"
		overMain_mensaje.style.height = "0px"	
	}
	
	if (texto == "Mensaje1" || texto == "Mensaje2" || texto == "Mensaje3") {
		var player = parent.document.getElementById("player")
		var video = parent.document.getElementById("main_titulo")
		
		if (texto == "Mensaje1") {
			video.innerHTML = "Revelación no estrenada"
			player.loadFile({file:"avisos/Revelacion_no_estrenada.flv"})
		} else if (texto == "Mensaje2") {
			video.innerHTML = "Únete para ver este vídeo"
			player.loadFile({file:"avisos/Unete_para_ver_este_video.flv"})
		} else {
			video.innerHTML = "Tienes que ser miembro"
			player.loadFile({file:"avisos/Tienes_que_ser_miembro.flv"})
		}
			
		player.sendEvent("playpause")
		
		if (isset(overMain_info)) {
			overMain_base.style.visibility = "visible"
			overMain_base.style.height = overMain_info.style.height
		} else {
			overMain_base.style.visibility = "hidden"
			overMain_base.style.height = "0px"
		}
		
		overMain_aviso.style.visibility = "hidden"
		overMain_aviso.style.height = "0px"
	} else {
		if (texto == "Unete")
			aviso.innerHTML = "Tu solicitud será rigurosamente revisada por \"El Líder\""
		else if (texto == "Reuniones")
			aviso.innerHTML = "Tu petición será evaluada por \"El Líder\""
		else if (texto == "Contacta")
			aviso.innerHTML = "\"El Líder\" ha recibido tu mensaje"
		else if (texto == "Subir")
			aviso.innerHTML = "Tenemos tu video. Pronto recibirás un mensaje nuestro"
		else if (texto == "Recordatorio")
			aviso.innerHTML = "Te hemos enviado un mail con la nueva contraseña"
		else if (texto == "Baja")
			aviso.innerHTML = "Has sido eliminado de La Secta"
			
		if (isset(overMain_info)) {
			overMain_info.style.visibility = "hidden"
			overMain_info.style.height = "0px"	
		}
			
		overMain_base.style.visibility = "visible"
		overMain_base.style.height = "49px"
		
		overMain_aviso.style.visibility = "visible"
		overMain_aviso.style.height = "49px"
	}	
	
	parent.location = "index.php#top"
}

function cargarAviso(aviso) {
	var form = parent.document.getElementById("form")
	
	if (aviso == "visitante")
		form.src = "revelacion_form.php?id=0&autoplay=yes"
	else
		form.src = "video_form.php?id=0&autoplay=yes"
}

function cargarVideo(id,votable) {
	var columnMain_table1 = document.getElementById("columnMain_table1")
	var columnMain_table2 = document.getElementById("columnMain_table2")
	var columnInfo_table = document.getElementById("columnInfo_table")
	var overMain_base = document.getElementById("overMain_base")
	var overMain_aviso = document.getElementById("overMain_aviso")
	var overMain_mensaje = document.getElementById("overMain_mensaje")
	var columnInfo_veredicto = document.getElementById("columnInfo_veredicto")
	var columnInfo_revelaciones = document.getElementById("columnInfo_revelaciones")
	var form = document.getElementById("form")
	var visto_main = document.getElementById("visto" + id)	
	var visto_info
	
	if (isset(columnInfo_revelaciones.contentDocument))
		visto_info = columnInfo_revelaciones.contentDocument.getElementById("visto" + id)
	else
		visto_info = columnInfo_revelaciones.document.getElementById("visto" + id)
	
	columnMain_table1.style.borderWidth = "0px"
	columnMain_table2.style.borderWidth = "0px"
	columnInfo_table.style.borderWidth = "0px"
	
	overMain_base.style.visibility = "hidden"
	overMain_base.style.height = "0px"
	
	overMain_aviso.style.visibility = "hidden"
	overMain_aviso.style.height = "0px"
	
	if (isset(overMain_mensaje)) {
		overMain_mensaje.style.visibility = "hidden"
		overMain_mensaje.style.height = "0px"	
	}
	
	if (votable) {
		columnInfo_veredicto.style.visibility = "visible"
		columnInfo_veredicto.style.height = "110px"
	} else if (isset(columnInfo_veredicto)) {
		columnInfo_veredicto.style.visibility = "hidden"
		columnInfo_veredicto.style.height = "0px"
	}
	
	cambiarFecha()
	
	if (isset(visto_main))
		visto_main.innerHTML = parseInt(visto_main.innerHTML) + 1
	if (isset(visto_info))
		visto_info.innerHTML = parseInt(visto_info.innerHTML) + 1
		
	form.src = "video_form.php?id=" + id + "&autoplay=yes"
	
	window.location = "#top"
}

function cargarRevelacion(id,primero,rss) {
	var overMain_base = parent.document.getElementById("overMain_base")
	var overMain_aviso = parent.document.getElementById("overMain_aviso")
	var form = parent.document.getElementById("form")
	var visto_info = document.getElementById("visto" + id)
	var visto_main = parent.document.getElementById("visto" + id)
	var main_videos = parent.document.getElementById("main_videos")
	var main_oculto = parent.document.getElementById("main_oculto")
	
	overMain_aviso.style.visibility = "hidden"
	overMain_aviso.style.height = "0px"
	
	parent.cambiarFecha()
	
	if (isset(visto_info))
		visto_info.innerHTML = parseInt(visto_info.innerHTML) + 1
	if (isset(visto_main))
		visto_main.innerHTML = parseInt(visto_main.innerHTML) + 1
	
	if (isset(main_oculto) && main_oculto.innerHTML != "") {
		main_videos.innerHTML = mostrarAcentos(main_oculto.innerHTML)
		main_oculto.innerHTML = ""
	}
		
	if (primero) {
		var video = "#video" + id		
		form.src = "revelacion_form.php?id=" + id + "&autoplay=no"
		window.location = video
	} else {
		var columnMain_table1 = parent.document.getElementById("columnMain_table1")
		var columnMain_table2 = parent.document.getElementById("columnMain_table2")
		var columnInfo_table = parent.document.getElementById("columnInfo_table")
		var overMain_mensaje = parent.document.getElementById("overMain_mensaje")
		
		overMain_base.style.visibility = "hidden"
		overMain_base.style.height = "0px"
		
		if (isset(columnMain_table1)) {
			columnMain_table1.style.borderWidth = "0px"
			columnMain_table2.style.borderWidth = "0px"
			columnInfo_table.style.borderWidth = "0px"
		}
		
		if (isset(overMain_mensaje)) {		
			overMain_mensaje.style.visibility = "hidden"
			overMain_mensaje.style.height = "0px"
		}
					
		form.src = "revelacion_form.php?id=" + id + "&autoplay=yes"
	}
	
	if (!rss)
		parent.location = "index.php#top"
}

function cargarVideoUsuario(id,votable,primero) {
	var overMain_base = parent.document.getElementById("overMain_base")
	var overMain_info = parent.document.getElementById("overMain_info")
	var overMain_aviso = parent.document.getElementById("overMain_aviso")
	var columnInfo_veredicto = parent.document.getElementById("columnInfo_veredicto")
	var form = parent.document.getElementById("form")
	var visto_main = parent.document.getElementById("visto" + id)
	var visto_info = document.getElementById("visto" + id)
	
	overMain_aviso.style.visibility = "hidden"
	overMain_aviso.style.height = "0px"
	
	if (isset(overMain_info) && overMain_info.style.height == "0px") {
		overMain_base.style.visibility = "hidden"
		overMain_base.style.height = "0px"
	}
	
	if (votable) {
		columnInfo_veredicto.style.visibility = "visible"
		columnInfo_veredicto.style.height = "110px"
	} else if (isset(columnInfo_veredicto)) {
		columnInfo_veredicto.style.visibility = "hidden"
		columnInfo_veredicto.style.height = "0px"
	}
	
	parent.cambiarFecha()
	
	if (isset(visto_info))
		visto_info.innerHTML = parseInt(visto_info.innerHTML) + 1
	if (isset(visto_main))
		visto_main.innerHTML = parseInt(visto_main.innerHTML) + 1
	
	if (primero) {
		var video = "#video" + id		
		form.src = "video_form.php?id=" + id + "&autoplay=no"
		window.location = video
	} else
		form.src = "video_form.php?id=" + id + "&autoplay=yes"
	
	parent.location = "index.php#top"
}

function cargarVideoComentarios(id) {
	var columnMain_table1 = document.getElementById("columnMain_table1")
	var columnMain_table2 = document.getElementById("columnMain_table2")
	var columnInfo_table = document.getElementById("columnInfo_table")
	var overMain_base = document.getElementById("overMain_base")
	var overMain_aviso = document.getElementById("overMain_aviso")
	var overMain_mensaje = document.getElementById("overMain_mensaje")
	var columnInfo_veredicto = document.getElementById("columnInfo_veredicto")
	var columnInfo_revelaciones = document.getElementById("columnInfo_revelaciones")
	var main_videos = document.getElementById("main_videos")
	var main_oculto = document.getElementById("main_oculto")
	var form = document.getElementById("form")
	var visto_main = document.getElementById("visto" + id)
	var visto_info
	
	if (isset(columnInfo_revelaciones.contentDocument))
		visto_info = columnInfo_revelaciones.contentDocument.getElementById("visto" + id)
	else
		visto_info = columnInfo_revelaciones.document.getElementById("visto" + id)
	
	columnMain_table1.style.borderWidth = "0px"
	columnMain_table2.style.borderWidth = "0px"
	columnInfo_table.style.borderWidth = "0px"
	
	overMain_base.style.visibility = "hidden"
	overMain_base.style.height = "0px"
	
	overMain_aviso.style.visibility = "hidden"
	overMain_aviso.style.height = "0px"
	
	if (isset(overMain_mensaje)) {
		overMain_mensaje.style.visibility = "hidden"
		overMain_mensaje.style.height = "0px"	
	}
	
	if (isset(columnInfo_veredicto)) {
		columnInfo_veredicto.style.visibility = "hidden"
		columnInfo_veredicto.style.height = "0px"
	}
	
	cambiarFecha()
	
	main_oculto.innerHTML = main_videos.innerHTML
	
	if (isset(visto_main))
		visto_main.innerHTML = parseInt(visto_main.innerHTML) + 1
	if (isset(visto_info))
		visto_info.innerHTML = parseInt(visto_info.innerHTML) + 1
		
	form.src = "video_form.php?id=" + id + "&autoplay=yes&comments=yes"
	
	window.location = "#top"
}

function cargarVideos(tipo) {
	var titulo = document.getElementById("titulo")
	var form = document.getElementById("form")
	
	if (tipo == "null") {
		var opciones = document.getElementsByName("videos")
		
		for (var i = 0; i < opciones.length; i++)
			if (opciones[i].checked)
				tipo = opciones[i].value
	}

	if (isset(titulo))
		form.src = "cargarvideos_form.php?tipo=" + tipo + "&cadena=" + titulo.value
	else
		form.src = "cargarvideos_form.php?tipo=" + tipo
}

function votarVideo(video,votacion) {
	var form = document.getElementById("form")
	var definitivo = document.getElementById("definitivo")
	
	if (isset(definitivo) && definitivo.checked)
		form.src = "votacion_form.php?video=" + video + "&votacion=" + votacion + "&definitivo=si"
	else
		form.src = "votacion_form.php?video=" + video + "&votacion=" + votacion
}

function addComentario(video_id) {
	var info_comentarios = document.getElementById("info_comentarios")
	var info_oculto = document.getElementById("info_oculto")
	var bot_anadir = document.getElementById("bot_anadir")
	
	var comentario = "<form method=\"post\" action=\"comentario_form.php\" enctype=\"multipart/form-data\" target=\"form\" onsubmit=\"return validarComentarioForm();\">"
	comentario += "<input type=\"hidden\" name=\"video\" value=\"" + video_id + "\">"
	comentario += "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"
	comentario += "<tr><td><textarea id=\"comentario\" name=\"comentario\" cols=\"27\" rows=\"6\" onkeypress=\"return longitudMax(200,this,event);\"></textarea></td></tr>"
	comentario += "<tr><td height=\"15\"></td></tr>"
	comentario += "<tr><td align=\"right\">"
	comentario += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"
	comentario += "<tr><td><a href=\"javascript:cancelarComentario()\"><img src=\"images/bot_cancelar_off.jpg\" alt=\"Cancelar\" border=\"0\" onmouseover=\"imagenOn(this,'bot_cancelar')\" onmouseout=\"imagenOff(this,'bot_cancelar')\" /></a></td>"
	comentario += "<td width=\"10\"></td>"
	comentario += "<td><input type=\"image\" src=\"images/bot_enviar_off.jpg\" alt=\"Enviar comentario\" border=\"0\" value=\"Submit\" onmouseover=\"imagenOn(this,'bot_enviar')\" onmouseout=\"imagenOff(this,'bot_enviar')\" />"
	comentario += "</table></td></tr></table></form>"
	
	bot_anadir.src = "images/bot_anadir_off.jpg"
	info_oculto.innerHTML = info_comentarios.innerHTML
	info_comentarios.innerHTML = comentario
}

function cancelarComentario() {
	var info_comentarios = document.getElementById("info_comentarios")
	var info_oculto = document.getElementById("info_oculto")
	
	info_comentarios.innerHTML = info_oculto.innerHTML
	info_oculto.innerHTML = ""
}

function mostrarComentarios(id) {
	var main_videos = document.getElementById("main_videos")
	var main_oculto = document.getElementById("main_oculto")
	var form = document.getElementById("form")
	
	if (main_oculto.innerHTML == "") {
		main_oculto.innerHTML = main_videos.innerHTML
		form.src = "vertodos_form.php?id=" + id + "&pagina=1"
	}
	
	window.location ="#columnMain_comentarios"
}

function cerrarComentarios() {
	var main_videos = document.getElementById("main_videos")
	var main_oculto = document.getElementById("main_oculto")
	
	main_videos.innerHTML = mostrarAcentos(main_oculto.innerHTML)
	main_oculto.innerHTML = ""
}

function cambiarPagina(id,pagina) {
	var form = document.getElementById("form")
	form.src = "vertodos_form.php?id=" + id + "&pagina=" + pagina
}

function cambiarUsuario(id) {
	var form = document.getElementById("form")
	form.src = "cambiarusuario_form.php?usuario=" + id
}

function borrarUsuario() {
	var respuesta = confirm("¿Estás seguro de que quieres darte de baja? AVISO: Tus vídeos seguirán en La Secta. Si deseas que eliminemos alguno de tus vídeos, envíanos un mail a info@lasecta.tv indicándonos el título.")
	
	if (respuesta) {
		var form = document.getElementById("form")
		form.src = "borrarusuario_form.php"
	}
}

function pedirExpulsion(id) {
	var form = document.getElementById("form")
	form.src = "pedirexpulsion_form.php?id=" + id
}

function marcarSeccion(tabla) {
	var recuadro = document.getElementById(tabla)

	recuadro.style.borderWidth = "3px"
	
	var recuadro1
	var recuadro2
	
	if (tabla == "columnMain_table1") {
		recuadro1 = document.getElementById("columnMain_table2")
		recuadro2 = document.getElementById("columnInfo_table")
		
		recuadro1.style.borderWidth = "0px"
		recuadro2.style.borderWidth = "0px"
		
		window.location = "#columnMain_title1"
	} else if (tabla == "columnMain_table2") {
		recuadro1 = document.getElementById("columnMain_table1")
		recuadro2 = document.getElementById("columnInfo_table")
		
		recuadro1.style.borderWidth = "0px"
		recuadro2.style.borderWidth = "0px"
		
		window.location = "#columnMain_title2"
	} else {
		recuadro1 = document.getElementById("columnMain_table1")
		recuadro2 = document.getElementById("columnMain_table2")
		
		recuadro1.style.borderWidth = "0px"
		recuadro2.style.borderWidth = "0px"
		
		window.location = "#columnInfo_title"
	}
}

function borrarInfo() {
	var video = parent.document.getElementById("main_titulo")
	var titulo = parent.document.getElementById("info_titulo")
	var autor = parent.document.getElementById("info_autor")
	var duracion = parent.document.getElementById("info_duracion")
	var visto = parent.document.getElementById("info_visto")
	var fecha = parent.document.getElementById("info_fecha")
	var info_comentarios = parent.document.getElementById("info_comentarios")
	var main_videos = parent.document.getElementById("main_videos")
	
	video.innerHTML = "..."
	titulo.innerHTML = "..."
	autor.innerHTML = "..."
	duracion.innerHTML = "..."
	visto.innerHTML = "..."
	fecha.innerHTML = "..."
	info_comentarios.innerHTML = "..."
	main_videos.innerHTML = ""
}

function verCondiciones() {
	window.open("condiciones.html","condiciones","scrollbars=yes,resizable=yes,width=450,height=600")
}

function logout() {
	var form = document.getElementById("form")
	form.src = "logout_form.php"
}