function contactoOtroMotivo(valor)
{
	if(valor=='OTRO')
	{
		document.getElementById('otro_motivo').style.display='block';
		document.getElementById('otro_motivo2').style.display='block';
	}
	else{
		document.getElementById('otro_motivo').style.display='none';
		document.getElementById('otro_motivo2').style.display='none';
	}
}

function verificaContacto()
{
	if(document.contactar.contacto_email.value.length==0){
		alert("Debes introducir tu dirección de e-mail");
		document.contactar.contacto_email.focus();
		return false;
	}
	if(document.contactar.contacto_con.value==0){
		alert("Por favor, selecciona el motivo");
		return false;
	}
	if(document.contactar.contacto_con.value=='OTRO'){
		if(document.contactar.contacto_asunto.value.length==0){
			alert("Por favor, especifica el motivo");
			document.contactar.contacto_asunto.focus();
			return false;
		}else {document.contactar.contacto_subject.value=document.contactar.contacto_asunto.value;}
	}else {
		//alert(document.contactar.contacto_con.options[document.contactar.contacto_con.selectedIndex].text);
		document.contactar.contacto_subject.value=document.contactar.contacto_con.options[document.contactar.contacto_con.selectedIndex].text;
	}
	return true;
}

function verifica_felicitacio(form) {
	if(form.navidad_from.value==""){alert("Debes poner tu nombre");form.navidad_from.focus();return false;}
 	if(form.navidad_body.value.length>300){alert("Tu felicitación debe tener un máximo de 300 carácteres");form.navidad_body.focus();return false;}
		return true;
}


function EnviaAmigos(){
	document.getElementById('form-amigos').style.display="block";
	location.href="#amigos";
}

function EnviarFormAmigos()
{
	var ajax=nuevoAjax();
	nvd_from = document.felicita.navidad_from.value;
	nvd_to = document.felicita.navidad_to_email.value;
	nvd_body = document.felicita.navidad_body.value;
	document.getElementById('form-amigos').innerHTML="<img src='/img/general/ajax-loader.gif'> <small>Enviando...</small>";
	ajax.open("POST", "/sections/navidad2007/navidad-run.php", true);
	ajax.onreadystatechange=function()
	{
		document.getElementById('form-amigos').innerHTML="<div class='info'>La postal ha sido enviada a tu/s amigo/s. Gracias por participar</div>";
	}
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.send("navidad_from="+nvd_from+"&navidad_to_email="+nvd_to+"&navidad_body="+nvd_body);
}

function eliminarCommentPartido(COMMENT_ID){
	if(confirm("¿Estás seguro de eliminar este comentario del partido?"))
	{
		location.href="sections/partido/partido-delcomment.php?comment_id="+COMMENT_ID;
	}
}

function DenunciarComentarioPartido(COMMENT_ID){
	var ajax=nuevoAjax();
	document.getElementById('link_denuncia'+COMMENT_ID).style.display='none';
	document.getElementById('denuncia'+COMMENT_ID).style.display='block';
	ajax.open("GET", "/sections/partido/partido-denunciarcommentrun.php?comment_id="+COMMENT_ID, true);
	ajax.send(null);
}


function EliminarAbono(ABONO_ID,USER_ID){
	if(confirm("¿Estás seguro de eliminar este abono?"))
	{
		location.href="/sections/entradas/entradas-delabono.php?abono_id="+ABONO_ID+"&user_id="+USER_ID;
	}
}

function AbonoNoDisponible(ABONO_ID){
	if(confirm("¿Estás seguro de marcar como vendido/adquirido?"))
	{
		location.href="/sections/entradas/entradas-vendidorun.php?abono_id="+ABONO_ID;
	}
}

function EliminarEspia(ESPIA_ID){
	if(confirm("¿Estás seguro de eliminar esta noticia?"))
	{
		location.href="/sections/espia/espia-delespia.php?espia_id="+ESPIA_ID;
	}
}

function EliminarEspiaComment(ESPIA_ID,ESPIA_COMMENT_ID){
	if(confirm("¿Estás seguro de eliminar este comentario?"))
	{
		location.href="/sections/espia/espia-delcomment.php?espia_id="+ESPIA_ID+"&espia_comment_id="+ESPIA_COMMENT_ID;
	}
}

function EliminarIdolo(IDOLO_ID){
	if(confirm("¿Estás seguro de eliminar este ídolo?"))
	{
		location.href="/sections/idolo/idolo-delidolo.php?idolo_id="+IDOLO_ID;
	}
}

function EliminarPorque(PORQUE_ID){
	if(confirm("¿Estás seguro de eliminar este 'Por qué'?"))
	{
		location.href="/sections/porque/porque-delporque.php?porque_id="+PORQUE_ID;
	}
}

function EliminarMemorable(MEMORABLE_ID){
	if(confirm("¿Estás seguro de eliminar este partido memorable?"))
	{
		location.href="/sections/memorable/memorable-delmemorable.php?memorable_id="+MEMORABLE_ID;
	}
}

function DenunciarComentarioFoto(COMMENT_ID){
	var ajax=nuevoAjax();
	document.getElementById('link_denuncia'+COMMENT_ID).style.display='none';
	document.getElementById('denuncia'+COMMENT_ID).style.display='block';
	ajax.open("GET", "/sections/gallery/galleryDenounceCommentRun.php?comment_id="+COMMENT_ID, true);
	ajax.send(null);
}

function eliminarCommentFoto(COMMENT_ID){
	if(confirm("¿Estás seguro de eliminar este comentario?"))
	{
		location.href="/sections/gallery/galleryDelComment.php?comment_id="+COMMENT_ID;
	}
}

function denunciarComentarioVideo(COMMENT_ID){
	var ajax=nuevoAjax();
	document.getElementById('link_denuncia'+COMMENT_ID).style.display='none';
	document.getElementById('denuncia'+COMMENT_ID).style.display='block';
	ajax.open("GET", "/sections/videos/videos-denunciarcommentrun.php?comment_id="+COMMENT_ID, true);
	ajax.send(null);
}

function eliminarCommentVideo(COMMENT_ID){
	if(confirm("¿Estás seguro de eliminar este comentario?"))
	{
		location.href="/sections/videos/videos-delcomment.php?comment_id="+COMMENT_ID;
	}
}

function denunciarFoto()
{
	document.getElementById('link_denuncia').style.visibility="hidden";
	document.getElementById('denuncia').style.display='block';
}
function denunciarFotoRun(FOTO_ID)
{
 	var radio_choice = false;
	var ajax=nuevoAjax();

	for (counter = 0; counter < document.forms['FormDenuncia'].denuncia_motivo.length; counter++){
		if (document.forms['FormDenuncia'].denuncia_motivo[counter].checked){
			if(document.forms['FormDenuncia'].denuncia_motivo[counter].value=="OTRO"){
				if(document.forms['FormDenuncia'].denuncia_motivo_texto.value==""){
					alert("Por favor, indica un motivo");
				}else{
					motivo = document.forms['FormDenuncia'].denuncia_motivo_texto.value;
				}
			}else{
				motivo = document.forms['FormDenuncia'].denuncia_motivo[counter].value;
			}
			radio_choice = true;
		}
	}

	if(!radio_choice){
		alert("Por favor, indica un motivo");
	}else{
		ajax.open("GET", "/sections/gallery/galleryDenouncePhotoRun.php?foto_id="+FOTO_ID+"&motivo="+motivo, true);
		ajax.send(null);

		document.getElementById('denuncia').style.display="none";
		document.getElementById('denuncia_recibida').style.display="block";
	}

	return false;

}

function cancelarDenunciarFoto()
{
	document.getElementById('link_denuncia').style.visibility="visible";
	document.getElementById('denuncia').style.display='none';
}

function eliminarFoto(FOTO_ID,FOTO_URL){
	if(confirm("¿Estas seguro de eliminar esta fotografía?"))
	{
		location.href="/sections/gallery/galleryDelPhoto.php?foto_id="+FOTO_ID+"&foto_url="+FOTO_URL;
	}
}

function denunciarVideo()
{
	
	document.getElementById('link_denuncia').style.display="none";
	document.getElementById('denuncia').style.display='block';
}

function denunciarVideoRun(VIDEO_ID)
{
 	var radio_choice = false;
	var ajax=nuevoAjax();

	for (counter = 0; counter < document.forms['FormDenuncia'].denuncia_motivo.length; counter++){
		if (document.forms['FormDenuncia'].denuncia_motivo[counter].checked){
			if(document.forms['FormDenuncia'].denuncia_motivo[counter].value=="OTRO"){
				if(document.forms['FormDenuncia'].denuncia_motivo_texto.value==""){
					alert("Por favor, indica un motivo");
				}else{
					motivo = document.forms['FormDenuncia'].denuncia_motivo_texto.value;
				}
			}else{
				motivo = document.forms['FormDenuncia'].denuncia_motivo[counter].value;
			}
			radio_choice = true;
		}
	}

	if(!radio_choice){
		alert("Por favor, indica un motivo");
	}else{
		ajax.open("GET", "/sections/videos/videos-denunciarvideorun.php?video_id="+VIDEO_ID+"&motivo="+motivo, true);
		ajax.send(null);

		document.getElementById('denuncia').style.display="none";
		document.getElementById('denuncia_recibida').style.display="block";
	}

	return false;

}

function cancelarDenunciarVideo()
{
	document.getElementById('link_denuncia').style.display="block";
	document.getElementById('denuncia').style.display='none';
}


function eliminarVideo(VIDEO_ID,VIDEO_URL){
	if(confirm("¿Estás seguro de eliminar este vídeo?"))
	{
		location.href="/sections/videos/videos-delvideo.php?video_id="+VIDEO_ID+"&video_url="+VIDEO_URL;
	}
}

function DenunciarPost(POST_ID)
{
	//var ajax=nuevoAjax();
	//document.getElementById('link_denuncia'+POST_ID).className="";
	document.getElementById('link_denuncia'+POST_ID).style.visibility="hidden";
	document.getElementById('denuncia'+POST_ID).style.display='block';
	//ajax.open("GET", "/sections/foro/foro-denunciarpostrun.php?post_id="+POST_ID, true);
	//ajax.send(null);

}

function CancelarDenunciarPost(POST_ID)
{
	//var ajax=nuevoAjax();
	//document.getElementById('link_denuncia'+POST_ID).className="link_denuncia";
	document.getElementById('link_denuncia'+POST_ID).style.visibility="visible";
	document.getElementById('denuncia'+POST_ID).style.display='none';
	//ajax.open("GET", "/sections/foro/foro-denunciarpostrun.php?post_id="+POST_ID, true);
	//ajax.send(null);

}

function DenunciarPostRun(POST_ID)
{
 	var radio_choice = false;
	var ajax=nuevoAjax();

	for (counter = 0; counter < document.forms['FormDenuncia'+POST_ID].denuncia_motivo.length; counter++){
		if (document.forms['FormDenuncia'+POST_ID].denuncia_motivo[counter].checked){
			if(document.forms['FormDenuncia'+POST_ID].denuncia_motivo[counter].value=="OTRO"){
				if(document.forms['FormDenuncia'+POST_ID].denuncia_motivo_texto.value==""){
					alert("Especifica el motivo");
				}else{
					motivo = document.forms['FormDenuncia'+POST_ID].denuncia_motivo_texto.value;
				}
			}else{
				motivo = document.forms['FormDenuncia'+POST_ID].denuncia_motivo[counter].value;
			}
			radio_choice = true;
		}
	}

	if(!radio_choice){
		alert("Por favor, indica un motivo");
	}else{
		ajax.open("GET", "/sections/foro/foro-denunciarpostrun.php?post_id="+POST_ID+"&motivo="+motivo, true);
		ajax.send(null);

		//document.getElementById('link_denuncia'+POST_ID).style.visibility="hidden";
		document.getElementById('denuncia'+POST_ID).style.display="none";
		document.getElementById('denuncia_recibida'+POST_ID).style.display="block";
	}

	return false;
//	ajax.open("GET", "/sections/foro/foro-denunciarpostrun.php?post_id="+POST_ID, true);
//	ajax.send(null);

}


function eliminarPost(POST_ID){
	if(confirm("¿Eliminar el post?"))
	{
		location.href="/sections/foro/foro-delpost.php?post_id="+POST_ID;
	}
}
function eliminarTema(TEMA_ID){
	if(confirm("¿Eliminar el tema?"))
	{
		location.href="/sections/foro/foro-deltema.php?tema_id="+TEMA_ID;
	}
}
function obre_s(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=800,height=600');");
}

function error(){
 alert("El usuario o la contraseña són incorrectos");
 	window.location.href="/";
}

/*Alta de usuario*/

function disableEnterKey(e)
{
     var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

     if(key == 13)
          return false;
     else
          return true;
}

function unquote (my_string)
{
	var new_string = String (my_string);

	nRegClose=/\[\/quote\]/g;
	nRegOpen =/\[quote=/g;
	nRegOpenDiv = /\]/g;
	new_string = new_string.replace (nRegClose, "</div>");
	new_string = new_string.replace (nRegOpen, "<p style='font-weight:bold;'>");
	new_string = new_string.replace (nRegOpenDiv, " escribi&oacute;:</p><div style='background:;border:1px solid ;padding:4px;'>");

	return "<small style='line-height:20px;'>"+new_string+"</small>";
}


function nuevoAjax()
{
	/* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
	lo que se puede copiar tal como esta aqui */
//	var xmlhttp=false;
//
//	try
//	{
//		// Creacion del objeto AJAX para navegadores no IE
//		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
//	}
//	catch(e)
//	{
//		try
//		{
//			// Creacion del objet AJAX para IE
//			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
//		}
//		catch(E)
//		{
//			if (!xmlhttp && typeof XMLHttpRequest!='undefined') xmlhttp=new XMLHttpRequest();
//		}
//	}
//	return xmlhttp;

            var obj;

            if(window.XMLHttpRequest)

            {

                        obj = new XMLHttpRequest();

            }

            else if(window.ActiveXObject)
            {
                        obj = new ActiveXObject("Microsoft.XMLHTTP");
            }

            return obj;

}

// Declaro los selects que componen el documento HTML. Su atributo ID debe figurar aqui.
var listadoSelects=new Array();
listadoSelects[0]="paises";
listadoSelects[1]="estados";

var listadoSelectsPartidos=new Array();
listadoSelectsPartidos[0]="temporada_id";
listadoSelectsPartidos[1]="partido_id";

var listadoSelectsAlbumes=new Array();
listadoSelectsAlbumes[0]="album";
listadoSelectsAlbumes[1]="subalbum1";
listadoSelectsAlbumes[2]="subalbum2";
listadoSelectsAlbumes[3]="subalbum3";
listadoSelectsAlbumes[4]="subalbum4";
listadoSelectsAlbumes[5]="subalbum5";


function buscarEnArray(array, dato)
{
	// Retorna el indice de la posicion donde se encuentra el elemento en el array o null si no se encuentra
	var x=0;
	while(array[x])
	{
		if(array[x]==dato) return x;
		x++;
	}
	return null;
}

function cargaContenido(idSelectOrigen)
{
	// Obtengo la posicion que ocupa el select que debe ser cargado en el array declarado mas arriba
	var posicionSelectDestino=buscarEnArray(listadoSelects, idSelectOrigen)+1;
	// Obtengo el select que el usuario modifico
	var selectOrigen=document.getElementById(idSelectOrigen);
	// Obtengo la opcion que el usuario selecciono
	var opcionSeleccionada=selectOrigen.options[selectOrigen.selectedIndex].value;

	if(opcionSeleccionada==0)
	{
		var x=posicionSelectDestino, selectActual=null;
		// Busco todos los selects siguientes al que inicio el evento onChange y les cambio el estado y deshabilito
		while(listadoSelects[x])
		{
			selectActual=document.getElementById(listadoSelects[x]);
			selectActual.length=0;

			var nuevaOpcion=document.createElement("option");
			nuevaOpcion.value=0;
			nuevaOpcion.innerHTML="Seleccionar opción...";
			selectActual.appendChild(nuevaOpcion);	selectActual.disabled=true;
			x++;
		}
	}
	// Compruebo que el select modificado no sea el ultimo de la cadena
	else if(idSelectOrigen!=listadoSelects[listadoSelects.length-1])
	{
		// Obtengo el elemento del select que debo cargar
		var idSelectDestino=listadoSelects[posicionSelectDestino];
		var selectDestino=document.getElementById(idSelectDestino);
		// Creo el nuevo objeto AJAX y envio al servidor el ID del select a cargar y la opcion seleccionada del select origen
		var ajax=nuevoAjax();

		ajax.open("GET", "/libs/ajax.provincias.php?select="+idSelectDestino+"&opcion="+opcionSeleccionada, true);
		ajax.onreadystatechange=function()
		{
			if (ajax.readyState==1)
			{
				// Mientras carga elimino la opcion "Selecciona Opcion..." y pongo una que dice "Cargando..."
				selectDestino.length=0;
				var nuevaOpcion=document.createElement("option");
				nuevaOpcion.value=0;
				nuevaOpcion.innerHTML="Cargando...";
				selectDestino.appendChild(nuevaOpcion); selectDestino.disabled=true;
			}
			if (ajax.readyState==4)
			{
				selectDestino.parentNode.innerHTML=ajax.responseText;
			}
		}
		ajax.send(null);
	}
}
function cargaPartidos(idSelectOrigen)
{
	// Obtengo la posicion que ocupa el select que debe ser cargado en el array declarado mas arriba
	var posicionSelectDestino=buscarEnArray(listadoSelectsPartidos, idSelectOrigen)+1;
	// Obtengo el select que el usuario modifico
	var selectOrigen=document.getElementById(idSelectOrigen);
	// Obtengo la opcion que el usuario selecciono
	var opcionSeleccionada=selectOrigen.options[selectOrigen.selectedIndex].value;
	// Si el usuario eligio la opcion "Elige", no voy al servidor y pongo los selects siguientes en estado "Selecciona opcion..."
	if(opcionSeleccionada==0)
	{
		var x=posicionSelectDestino, selectActual=null;
		// Busco todos los selects siguientes al que inicio el evento onChange y les cambio el estado y deshabilito
		while(listadoSelectsPartidos[x])
		{
			selectActual=document.getElementById(listadoSelectsPartidos[x]);
			selectActual.length=0;

			var nuevaOpcion=document.createElement("option"); nuevaOpcion.value=0; nuevaOpcion.innerHTML="Seleccionar opción...";
			selectActual.appendChild(nuevaOpcion);	selectActual.disabled=true;
			x++;
		}
	}
	// Compruebo que el select modificado no sea el ultimo de la cadena
	else if(idSelectOrigen!=listadoSelectsPartidos[listadoSelectsPartidos.length-1])
	{
		// Obtengo el elemento del select que debo cargar
		var idSelectDestino=listadoSelectsPartidos[posicionSelectDestino];
		var selectDestino=document.getElementById(idSelectDestino);
		// Creo el nuevo objeto AJAX y envio al servidor el ID del select a cargar y la opcion seleccionada del select origen
		var ajax=nuevoAjax();

		ajax.open("GET", "/libs/ajax.partidos.php?select="+idSelectDestino+"&opcion="+opcionSeleccionada, true);
		ajax.onreadystatechange=function()
		{
			if (ajax.readyState==1)
			{
				// Mientras carga elimino la opcion "Selecciona Opcion..." y pongo una que dice "Cargando..."
				selectDestino.length=0;
				var nuevaOpcion=document.createElement("option"); nuevaOpcion.value=0; nuevaOpcion.innerHTML="Cargando...";
				selectDestino.appendChild(nuevaOpcion); selectDestino.disabled=true;
			}
			if (ajax.readyState==4)
			{
				selectDestino.parentNode.innerHTML=ajax.responseText;
			}
		}
		ajax.send(null);
	}
}


function cargaSubalbumes(idSelectOrigen)
{
	// Obtengo la posicion que ocupa el select que debe ser cargado en el array declarado mas arriba
	var posicionSelectDestino=buscarEnArray(listadoSelectsAlbumes, idSelectOrigen)+1;
	// Obtengo el select que el usuario modifico
	var selectOrigen=document.getElementById(idSelectOrigen);
	// Obtengo la opcion que el usuario selecciono
	var opcionSeleccionada=selectOrigen.options[selectOrigen.selectedIndex].value;

	document.upload.album_id.value = opcionSeleccionada;

	// Si el usuario eligio la opcion "Elige", no voy al servidor y pongo los selects siguientes en estado "Selecciona opcion..."
	if(opcionSeleccionada==0)
	{
		var x=posicionSelectDestino, selectActual=null; trActual=null;
		// Busco todos los selects siguientes al que inicio el evento onChange y les cambio el estado y deshabilito
		while(listadoSelectsAlbumes[x])
		{
			selectActual=document.getElementById(listadoSelectsAlbums[x]);
			selectActual.length=0;

			var nuevaOpcion=document.createElement("option"); nuevaOpcion.value=0; nuevaOpcion.innerHTML="Seleccionar opción...";
			selectActual.appendChild(nuevaOpcion);	selectActual.disabled=true;

			trActual=document.getElementById('tr_'+listadoSelectsAlbums[x]);
			trActual.style.display='none';
			x++;
		}
	}
	// Compruebo que el select modificado no sea el ultimo de la cadena
	else if(idSelectOrigen!=listadoSelectsAlbumes[listadoSelectsAlbumes.length-1])
	{
		// Obtengo el elemento del select que debo cargar
		var idSelectDestino=listadoSelectsAlbumes[posicionSelectDestino];
		var selectDestino=document.getElementById(idSelectDestino);
		var trDestino=document.getElementById('tr_'+idSelectDestino);
		// Creo el nuevo objeto AJAX y envio al servidor el ID del select a cargar y la opcion seleccionada del select origen
		var ajax=nuevoAjax();

		ajax.open("GET", "/libs/ajax.subalbumes.php?select="+idSelectDestino+"&opcion="+opcionSeleccionada+"&ms="+new Date().getTime(), true);
		ajax.onreadystatechange=function()
		{
			if (ajax.readyState==1)
			{
				// Mientras carga elimino la opcion "Selecciona Opcion..." y pongo una que dice "Cargando..."
				selectDestino.length=0;
				var nuevaOpcion=document.createElement("option"); nuevaOpcion.value=0; nuevaOpcion.innerHTML="Cargando...";
				selectDestino.appendChild(nuevaOpcion); selectDestino.disabled=true;
			}
			if (ajax.readyState==4)
			{
				if(ajax.responseText!="none")
				{
					trDestino.style.display='';
					x=posicionSelectDestino+1;
					while(listadoSelectsAlbumes[x])
					{
						trDestino=document.getElementById('tr_'+listadoSelectsAlbumes[x]);
						trDestino.style.display='none';
						x++;
					}
					selectDestino.parentNode.innerHTML=ajax.responseText;
				}
				else
				{
					trDestino.style.display='none';
					x=posicionSelectDestino+1;
					while(listadoSelectsAlbumes[x])
					{
						trDestino=document.getElementById('tr_'+listadoSelectsAlbumes[x]);
						trDestino.style.display='none';
						x++;
					}
				}
			}
		}
		ajax.send(null);
	}
}

function cargaTagsAlbum(albumId){
	var tagsAlbum 	= document.getElementById('tagsAlbum');
	var ajax		= nuevoAjax();
	var labelTags 	= document.getElementById('labelRecomendadas');

	ajax.open("GET", "/libs/ajax.getAlbumTags.php?album_id="+albumId, true);
	ajax.onreadystatechange=function()
	{
		if (ajax.readyState==1)
		{
			// Mientras carga elimino la opcion "Selecciona Opcion..." y pongo una que dice "Cargando..."

			tagsAlbum.innerHTML="Cargando...";
		}

		if (ajax.readyState==4)
		{
			tagsAlbum.innerHTML=ajax.responseText;
			if(ajax.responseText==""){
				labelTags.style.display="none";
			}else{
				labelTags.style.display="block";
			}
		}
	}
	ajax.send(null);
}

function addTag2Foto(tagId,tagValue){
	var inputTags = document.upload.keywords;
	var tagLink	  = document.getElementById('tag'+tagId);
	inputTags.value = inputTags.value+" "+tagValue;
	tagLink.className="bgc10";
	tagLink.innerHTML = tagValue;
}

function cargaSubalbumesVideo(idSelectOrigen)
{
	// Obtengo la posicion que ocupa el select que debe ser cargado en el array declarado mas arriba
	var posicionSelectDestino=buscarEnArray(listadoSelectsAlbumes, idSelectOrigen)+1;
	// Obtengo el select que el usuario modifico
	var selectOrigen=document.getElementById(idSelectOrigen);
	// Obtengo la opcion que el usuario selecciono
	var opcionSeleccionada=selectOrigen.options[selectOrigen.selectedIndex].value;

	document.upload.album_id.value = opcionSeleccionada;

	// Si el usuario eligio la opcion "Elige", no voy al servidor y pongo los selects siguientes en estado "Selecciona opcion..."
	if(opcionSeleccionada==0)
	{
		var x=posicionSelectDestino, selectActual=null; trActual=null;
		// Busco todos los selects siguientes al que inicio el evento onChange y les cambio el estado y deshabilito
		while(listadoSelectsAlbumes[x])
		{
			selectActual=document.getElementById(listadoSelectsAlbums[x]);
			selectActual.length=0;

			var nuevaOpcion=document.createElement("option"); nuevaOpcion.value=0; nuevaOpcion.innerHTML="Seleccionar opción...";
			selectActual.appendChild(nuevaOpcion);	selectActual.disabled=true;

			trActual=document.getElementById('tr_'+listadoSelectsAlbums[x]);
			trActual.style.display='none';
			x++;
		}
	}
	// Compruebo que el select modificado no sea el ultimo de la cadena
	else if(idSelectOrigen!=listadoSelectsAlbumes[listadoSelectsAlbumes.length-1])
	{
		// Obtengo el elemento del select que debo cargar
		var idSelectDestino=listadoSelectsAlbumes[posicionSelectDestino];
		var selectDestino=document.getElementById(idSelectDestino);
		var trDestino=document.getElementById('tr_'+idSelectDestino);
		// Creo el nuevo objeto AJAX y envio al servidor el ID del select a cargar y la opcion seleccionada del select origen
		var ajax=nuevoAjax();

		ajax.open("GET", "/libs/ajax.subalbumesVideos.php?select="+idSelectDestino+"&opcion="+opcionSeleccionada+"&ms="+new Date().getTime(), true);
		ajax.onreadystatechange=function()
		{
			if (ajax.readyState==1)
			{
				// Mientras carga elimino la opcion "Selecciona Opcion..." y pongo una que dice "Cargando..."
				selectDestino.length=0;
				var nuevaOpcion=document.createElement("option"); nuevaOpcion.value=0; nuevaOpcion.innerHTML="Cargando...";
				selectDestino.appendChild(nuevaOpcion); selectDestino.disabled=true;
			}
			if (ajax.readyState==4)
			{
				if(ajax.responseText!="none")
				{
					trDestino.style.display='';
					x=posicionSelectDestino+1;
					while(listadoSelectsAlbumes[x])
					{
						trDestino=document.getElementById('tr_'+listadoSelectsAlbumes[x]);
						trDestino.style.display='none';
						x++;
					}
					selectDestino.parentNode.innerHTML=ajax.responseText;
				}
				else
				{
					trDestino.style.display='none';
					x=posicionSelectDestino+1;
					while(listadoSelectsAlbumes[x])
					{
						trDestino=document.getElementById('tr_'+listadoSelectsAlbumes[x]);
						trDestino.style.display='none';
						x++;
					}
				}
			}
		}
		ajax.send(null);
	}
}


function foro_over(src){
	src.style.background = '#FFF5E6';

}

function foro_out1(src){
	src.style.background = '#EFEFEF';


}

function foro_out2(src){
	src.style.background = '#F9F9F9';

}


function is_mail(texto){

    var mailres = true;
    var cadena = "abcdefghijklmn?opqrstuvwxyzABCDEFGHIJKLMN?OPQRSTUVWXYZ1234567890@._-";

    var arroba = texto.indexOf("@",0);
    if ((texto.lastIndexOf("@")) != arroba) arroba = -1;

    var punto = texto.lastIndexOf(".");

     for (var contador = 0 ; contador < texto.length ; contador++){
        if (cadena.indexOf(texto.substr(contador, 1),0) == -1){
            mailres = false;
            break;
     }
    }

    if ((arroba > 1) && (arroba + 1 < punto) && (punto + 1 < (texto.length)) && (mailres == true) && (texto.indexOf("..",0) == -1))
     mailres = true;
    else
     mailres = false;

    return mailres;
}



function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;


   for (i = 0; i < sText.length && IsNumber == true; i++)
      {
      Char = sText.charAt(i);
      if (ValidChars.indexOf(Char) == -1)
         {
         IsNumber = false;
         }
      }
   return IsNumber;

   }

/*****************************************/
/*****************ABONOS******************/
/*****************************************/

function verifica_abonos(form){
	if(form.partido_id.value==0){ alert("¿De qué partido hablamos?");form.partido_id.focus(); return false;}

	if(form.ubicacion_id.disabled==false)
	{
		if(form.ubicacion_id.value==0)
		{
			alert("¿Dónde está el asiento?");
			form.ubicacion_id.focus();
			return false;
		}
	}

	if(form.abono_precio.disabled==false)
	{
		if(form.abono_precio.value=="")
		{
			alert("¿Cuánto cuesta tu abono?");
			form.abono_precio.focus();
			return false;
		}
		if(!IsNumeric(form.abono_precio.value))
		{
			alert(form.abono_precio.value+"  no es un precio");
			form.abono_precio.focus();
			return false;
		}
	}

	if(form.abono_title.disabled==false)
	{
		if(form.abono_title.value=="")
		{
			alert("Pon un título a tu anuncio");
			form.abono_title.focus();
			return false;
		}
	}

	if(form.abono_mail.value=="" && form.abono_telefono.value==""){
		alert("Tienes que introducir alguna de las dos formas de contacto");
		form.abono_mail.focus();
		return false;

	}

	if(!form.abono_mail.value=="")
	{
		if(!is_mail(form.abono_mail.value))
		{
			alert(form.abono_mail.value+" no es una dirección de e-mail válida");
			form.abono_mail.focus();
			return false;
		}
	}
	 return true;
}

function oculta_abonos() {
	document.abonos.ubicacion_id.disabled=true;
	document.abonos.abono_precio.disabled=true;
	document.abonos.abono_title.disabled=false;

}

function muestra_abonos() {
	document.abonos.ubicacion_id.disabled=false;
	document.abonos.abono_precio.disabled=false;
	document.abonos.abono_title.disabled=true;
}

/*****************************************/
/*****************PORQUE******************/
/*****************************************/

function verifica_porque(form) {
	 var radio_choice = false;

	 for (counter = 0; counter < form.porque_motivo_id.length; counter++) if (form.porque_motivo_id[counter].checked)	radio_choice = true;
		 if(!radio_choice){alert("Elige tu motivo");return false;}
		 if(form.porque_body.value.length<100){alert("Debes introducir como mínimo 100 carácteres");
		 form.porque_body.focus();
		 return false;
	 }
	 return true;
}

function DenunciarPorque(PORQUE_ID){
	var ajax=nuevoAjax();
	document.getElementById('link_denuncia'+PORQUE_ID).style.display='none';
	document.getElementById('denuncia'+PORQUE_ID).style.display='block';
	ajax.open("GET", "/sections/porque/porque-denunciarporquerun.php?porque_id="+PORQUE_ID, true);
	ajax.send(null);
}

/*****************************************/
/*****************ESPIA*******************/
/*****************************************/

function verifica_espia(form) {
		 if(form.espia_title.value==""){alert("Tu noticia no tiene titular");form.espia_title.focus();return false;}
		 if(form.espia_body.value.length<100){alert("Debes introducir como mínimo 100 carácteres");form.espia_body.focus();return false;}
		 if(form.espia_fuente.value==""){alert("Tu noticia no tiene fuente");form.espia_fuente.focus();return false;}
	 return true;
}

function DenunciarEspia(ESPIA_ID)
{
	var ajax=nuevoAjax();
	document.getElementById('link_denuncia'+ESPIA_ID).style.display='none';
	document.getElementById('denuncia'+ESPIA_ID).style.display='block';
	ajax.open("GET", "/sections/espia/espia-denunciarespiarun.php?espia_id="+ESPIA_ID, true);
	ajax.send(null);

}

function DenunciarEspiaComment(ESPIA_ID,COMMENT_ID)
{
	var ajax=nuevoAjax();
	document.getElementById('link_denuncia_comment'+COMMENT_ID).style.display='none';
	document.getElementById('denuncia_comment'+COMMENT_ID).style.display='block';
	ajax.open("GET", "/sections/espia/espia-denunciarcommentespiarun.php?comment_id="+COMMENT_ID, true);
	ajax.send(null);

}

/*****************************************/
/**********PAARTIDO_COMMENT****************/
/*****************************************/

function verifica_partido_comment(form) {
	if(form.pc_comment_body.value==""){alert("No puedes introducir comentarios vacíos");form.pc_comment_body.focus();return false;}
	return true;
}




/*****************************************/
/*****************PORRIELA****************/
/*****************************************/

function porriela_edit_nueva() {
	document.getElementById('nueva').style.display='none';
	document.getElementById('mandar').style.display='block';
	document.mi_apuesta.apuesta_casa.disabled=false;
	document.mi_apuesta.apuesta_fuera.disabled=false;
	document.mi_apuesta.apuesta_casa.className='borde_input';
	document.mi_apuesta.apuesta_fuera.className='borde_input';
	document.mi_apuesta.apuesta_casa.focus();
}

function porriela_edit_cambiar() {
	document.getElementById('cambiar').style.display='none';
	document.getElementById('mandar').style.display='block';
	document.mi_apuesta.apuesta_casa.disabled=false;
	document.mi_apuesta.apuesta_fuera.disabled=false;
	document.mi_apuesta.apuesta_casa.className='borde_input';
	document.mi_apuesta.apuesta_fuera.className='borde_input';
	document.mi_apuesta.apuesta_casa.focus();
}

/*****************************************/
/*****************GALERIA*****************/
/*****************************************/

function verifica_upload(form){
	document.getElementById('bot_upload').disabled="disabled";
	if(form.album_id.value==0){ alert("Debes especificar el álbum"); document.getElementById('bot_caption').innerHTML="Subir foto"; document.getElementById('bot_upload').disabled=""; return false;}
	if(form.imagen.value.length==0){alert("Debes especificar la imagen"); document.getElementById('bot_caption').innerHTML="Subir foto"; document.getElementById('bot_upload').disabled=""; return false;}
	if(form.titulo.value.length==0){alert("Debes introducir un título para la imagen"); document.getElementById('bot_caption').innerHTML="Subir foto"; document.getElementById('bot_upload').disabled=""; return false;}
	if(form.keywords.value.length==0){alert("Debes introducir las etiquetas"); document.getElementById('bot_caption').innerHTML="Subir foto"; document.getElementById('bot_upload').disabled=""; return false;}
	return true;
}

function cambiar_album(form){
	location.href=""+form.album_id.options[form.album_id.selectedIndex].id+"-igfa-"+form.album_id.options[form.album_id.selectedIndex].value+".htm";
}

function verifica_delete(form) {
	 if(form.motivo_texto.value==""){alert("Debes indicar el motivo por el que deseas eliminar la foto");form.motivo_texto.focus();return false;}
	 return true;
}

function verifica_delete_video(form) {
	 if(form.motivo_texto.value==""){alert("Debes indicar el motivo por el que deseas eliminar el vídeo");form.motivo_texto.focus();return false;}
	 return true;
}

function verifica_delete_admin(form) {
	 var radio_choice = false;

	 for (counter = 0; counter < form.motivo_asunto.length; counter++)
	 {
	 	if(form.motivo_asunto[counter].checked)	radio_choice = true;
	 }

	 if(!radio_choice){alert("Indica el motivo");return false;}

	 return true;
}


/*****************************************/
/*****************VIDEO*******************/
/*****************************************/
function verifica_video(){
	document.getElementById('bot_upload').disabled="disabled";
	if(document.upload.album_id.value==0){ alert("Debes especificar el álbum");document.getElementById('bot_caption').innerHTML="Subir vídeo"; document.getElementById('bot_upload').disabled="";return false;}
	if(document.upload.titulo.value.length==0){alert("Debes introducir un título para el vídeo");document.getElementById('bot_caption').innerHTML="Subir vídeo"; document.getElementById('bot_upload').disabled="";return false;}
	return true;
}

/*****************************************/
/*****************IDOLO*******************/
/*****************************************/

function verifica_idolo(form) {

 if(form.idolo_name.value==""){alert("Elige a tu ídolo");return false;}
 form.idolo_body.value = trim(form.idolo_body.value,'');
 if(form.idolo_body.value.length<100){alert("Debes introducir como mínimo 100 carácteres");form.idolo_body.focus();return false;}
 return true;

}

function DenunciarIdolo(IDOLO_ID){
	var ajax=nuevoAjax();
	document.getElementById('link_denuncia'+IDOLO_ID).style.display='none';
	document.getElementById('denuncia'+IDOLO_ID).style.display='block';
	ajax.open("GET", "/sections/idolo/idolo-denunciaridolorun.php?idolo_id="+IDOLO_ID, true);
	ajax.send(null);
}

/*****************************************/
/*****************MEMORABLE***************/
/*****************************************/

function verifica_memorable(form) {

	 if(form.rival1.value=="0" && form.rival2.value==""){alert("¿Cuál fué el rival?");return false;}
	 if(form.memorable_titulo.value==""){alert("Pon un título a tu partido memorable");return false;}
	 if(form.memorable_body.value.length<100){alert("Debes introducir como mínimo 100 carácteres");form.memorable_body.focus();return false;}
	 if(form.rival1.value=="0") form.memorable_rival.value = form.rival2.value;
	 else form.memorable_rival.value = form.rival1.value;
	 return true;
}

function DenunciarMemorable(MEMORABLE_ID){
	var ajax=nuevoAjax();
	document.getElementById('link_denuncia'+MEMORABLE_ID).style.display='none';
	document.getElementById('denuncia'+MEMORABLE_ID).style.display='block';
	ajax.open("GET", "/sections/memorable/memorable-denunciarmemorablerun.php?memorable_id="+MEMORABLE_ID, true);
	ajax.send(null);
}


/*****************************************/
/*****************FORO********************/
/*****************************************/

function verifica_foro(form) {
	document.getElementById('bot_boton').disabled='disabled';
	if(form.action.value==1){
		if(form.post_title.value.length == 0){alert("Rellena el asunto");document.getElementById('bot_boton').disabled='';document.getElementById('bot_caption').innerHTML='Enviar';return false;}
		if(form.foro_id.value ==-1){alert("Elige un foro");document.getElementById('bot_boton').disabled='';document.getElementById('bot_caption').innerHTML='Enviar';return false;}
		if(form.post_body.value.length == 0){alert("Introduce el mensaje");document.getElementById('bot_boton').disabled='';document.getElementById('bot_caption').innerHTML='Enviar';return false;}
	}else{
		if(form.post_body.value.length == 0){alert("Introduce el mensaje");document.getElementById('bot_boton').disabled='';document.getElementById('bot_caption').innerHTML='Enviar';return false;}
	}

	return true;
}

function verifica_mover(form) {
		if(form.foro_id.value ==-1){alert("Elige un foro");return false;}
	return true;
}

function verifica_mover_foto(form) {
		if(form.album_id.value ==0){alert("Debes seleccionar un álbum de destino");return false;}
	return true;
}

function verifica_respuesta_rapida(form) {
	document.getElementById('bot_boton').disabled='disabled';
	if(form.post_body.value.length == 0){alert("Introduce el mensaje");document.getElementById('bot_boton').disabled='';document.getElementById('bot_caption').innerHTML='Enviar';return false;}
	return true;
}

function valid_form_search(pagi){

	document.form_search.pag.value=pagi;
	document.form_search.submit();
}

function Verifica(form) {
	if(form.user_name.value.length<3){alert("Tu nick debe tener como mínimo 3 carácteres.");form.user_name.focus();return false;}
	if(form.user_pass.value.length<4){alert("Tu contraseña debe tener como mínimo 4 carácteres.");form.user_pass.focus();return false;}
	if(form.conformidad.checked==false){alert("Debes aceptar las condiciones de uso para poder registrarte.");return false;}

	if(form.user_pass_conf.value!=form.user_pass.value){alert("Las contraseñas no coinciden.");form.user_pass_conf.focus();return false;}

	if(form.paises.value==-1){alert("Debes indicar un país");form.paises.focus();return false;}
	if(form.estados.value==-1 || form.estados.value.length==0){alert("Debes indicar una provincia");form.estados.focus();return false;}

	if(!is_mail(form.user_email.value)){alert("'"+form.user_email.value+"' no es válido, por favor revísalo.");form.user_email.focus();return false;}

	return true;
}

function verifica_recomendar(form) {

	if(form.nombre.value==""){
		alert("Debes introducir tu nombre");
		form.nombre.focus();
		return false;
	}

	if(!is_mail(form.email.value))
	{
		alert(form.email.value+" no es una dirección de e-mail válida");
		form.email.focus();
		return false;
	}

	if(form.recomendados.value==""){
		alert("Introduce los emails de tus amigos");
		form.recomendados.focus();
		return false;
	}
	return true;
}

function trim(str, chars) {
    return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}



function trim1 (string) {
	string = string.replace(/^s+/, '');
	for (var i = string.length; i > 0; i--) {
		if (/S/.test(string.charAt(i))) {
			string = string.substring(0, i);
			break;
		}
	}
	return string;
}



function VideosActionCookie(action)
{
	var cookie_date = new Date();
	cookie_date.setTime ( cookie_date.getTime() + 360000000 );
	document.cookie="a_ivi = " + action + "; expires = "+ cookie_date.toGMTString();
}


function VideosAlbumCookie(album_id)
{
	var cookie_date = new Date();
	cookie_date.setTime ( cookie_date.getTime() + 360000000 );
	document.cookie="a_id_ivi = " + album_id + "; expires = "+ cookie_date.toGMTString();
}

function FotosActionCookie(action,pos)
{
	var cookie_date = new Date();
	cookie_date.setTime ( cookie_date.getTime() + 360000000 );
	document.cookie="a_igf = " + action + ";" + baseDomainString() + "  expires = "+ cookie_date.toGMTString();
	document.cookie="p_igf = " + pos + ";" + baseDomainString() + "  expires = "+ cookie_date.toGMTString();
}

function baseDomainString(){
  e = document.domain.split(/\./);
  if(e.length > 1) {
    return("domain=." + e[e.length-2] + "." +  e[e.length-1]) + ";"  ;
  }else{
    return("");
  }
}

function FotosSearchCookie(vb,pos)
{
	var cookie_date = new Date();
	cookie_date.setTime ( cookie_date.getTime() + 360000000 );
	document.cookie="vb_id_igf = " + vb + ";" + baseDomainString() + "  expires = "+ cookie_date.toGMTString();
	document.cookie="p_igf = " + pos + ";" + baseDomainString() + "   expires = "+ cookie_date.toGMTString();
}

function FotosAlbumCookie(album_id,pos)
{
	var cookie_date = new Date();
	cookie_date.setTime ( cookie_date.getTime() + 360000000 );
	document.cookie="a_id_igf = " + album_id + ";" + baseDomainString() + "  expires = "+ cookie_date.toGMTString();
	document.cookie="p_igf = " + pos + ";" + baseDomainString() + "   expires = "+ cookie_date.toGMTString();
}

function selectsmile(n)
	{
		document.getElementById('smileselector1').className='';
		document.getElementById('smileselector2').className='';
		document.getElementById('smileselector3').className='';
		document.getElementById('smileselector4').className='';
		document.getElementById('smileselector' + n).className='selected';
		document.getElementById('commentsmile').value=n;
	}



function comprobar_user_pass(user_name){
	var comprobacion_user=nuevoAjax();

	comprobacion_user.open("GET", "/js/comprobacionUserName.php?user_name="+user_name+"&ms="+new Date().getTime(), false);

	comprobacion_user.send(null);

	if(comprobacion_user.responseText!="NO"){
		messageError(comprobacion_user.responseText);
		return false;
	}else {
		document.getElementById('mensajes').innerHTML = '&nbsp;';
		return true;
	}
}


function comprobar_email(user_email){
	var comprobacion_user=nuevoAjax();

	comprobacion_user.open("GET", "/js/comprobacionEmail.php?user_email="+user_email+"&ms="+new Date().getTime(), false);

	comprobacion_user.send(null);

	if(comprobacion_user.responseText!="NO"){
		messageError(comprobacion_user.responseText);
		return false;
	} else {
		document.getElementById('mensajes').innerHTML = '&nbsp;';
		return true;
	}

}

function messageError(text)
{
	document.getElementById('mensajes').style.display='block';
	document.getElementById('mensajes').innerHTML=text;
	document.location = "#errores";
}

function verifyNewUser()
{

	vuser_real_name = document.formulario.user_real_name.value;
	vuser_name = document.formulario.user_name.value;
	vuser_pass_conf = document.formulario.user_pass_conf.value;
	vuser_password = document.formulario.user_password.value;
	vuser_email = document.formulario.user_email.value;

	document.formulario.jsenabled.value="Y";

if(vuser_real_name.length!=0){if(vuser_real_name.length<3){messageError('Nombre completo incorrecto.');document.formulario.user_name.focus();return false;}}
	if(!comprobar(vuser_name,'txt',3,14)){messageError('Nombre de usuario incorrecto. <br />El nombre de usuario debe tener entre 3 y 14 caracteres. Solo debe contenter letras y números.');document.formulario.user_name.focus();return false;}
	
	if(!comprobar_user_pass(vuser_name)){document.formulario.user_name.focus();return false;}

	//alert(1);

	if(!comprobar(vuser_password,'txt',3,14)){messageError('Contrase&ntilde;a incorrecta. <br />La contrase&ntilde;a debe tener entre 3 y 14 caracteres. Solo debe contenter letras y números.');document.formulario.user_password.focus();return false;}
	if(!comprobar(vuser_pass_conf,'txt',3,14)){messageError('Contrase&ntilde;a de confirmación incorrecta. <br />Debe ser igual a la contraseña anterior.');document.formulario.user_pass_conf.focus();return false;}
	if(vuser_pass_conf!=vuser_password){messageError('Las contrase&ntilde;as no coinciden.');document.formulario.user_pass_conf.focus();return false;}

	if(!comprobar_email(vuser_email)){document.formulario.user_email.focus();return false;}
	if(!comprobar(vuser_email,'mail',6,255)){messageError('E-mail incorrecto.<br><br>Introduce una cuenta de e-mail correcta en la que recibiras el e-mail de validación.');document.formulario.user_email.focus();return false;}

	document.getElementById('mensajes').style.display='none';
	return true;


}


function comprobar(texto,valor,minLong,maxLong){
  var variable = texto;
  if(variable.length<minLong || variable.length>maxLong)return false;
  if(valor=='txt')var comp = /^([a-zA-Z0-9]{2,13})$/;
  if(valor=='mail')var comp = /[\w-\.]{3,}@([\w-]{2,}\.)*([\w-]{2,}\.)[\w-]{2,4}/;

  if (comp.test(texto)) {return true;}
  else {return false;}
}


function DescargarFotoOriginal(){
	var link_descarga = document.getElementById('descargar');
	var link_alta     = document.getElementById('alta');

	link_descarga.style.display="none";
	link_alta.style.display="block";
}

function editoresSearch() {
	var usr_keyw = document.getElementById("usr_keyw").value;

	var divResults = document.getElementById("editoresResults");
	var ajax=nuevoAjax();
	ajax.open("GET", "/sections/wiki/wiki-editoresSearch.php?usr_keyw="+usr_keyw, true);
	ajax.onreadystatechange=function()
	{
		if (ajax.readyState==1){
			// Mientras carga elimino la opcion "Selecciona Opcion..." y pongo una que dice "Cargando..."
			divResults.innerHTML = "<img src='/img/general/ajax-loader.gif'>";

		}
		if (ajax.readyState==4){
			divResults.innerHTML = ajax.responseText;
		}
	}
	ajax.send(null);
}

function wikiUploaderStatusChange(){
	var divUpload = document.getElementById('imgUploader');
	var linkStatus = document.getElementById('linkWikiChangeStatus');
	if(divUpload.style.display=='block'){
		divUpload.style.display='none';
		linkStatus.innerHTML = 'Añadir imagen al artículo';
	}else{
		divUpload.style.display='block';
		linkStatus.innerHTML = 'Cerrar';
	}
}

function ocultarTabla(){
	var divTabla = document.getElementById('idContent');
	var linkTabla = document.getElementById('linkOcultar');
	if(divTabla.style.display=='none'){
		divTabla.style.display='block';
		linkTabla.innerHTML = 'ocultar';
	} else {
		linkTabla.innerHTML = 'mostrar';
		divTabla.style.display='none';
	}
}

function denunciarWikiArticulo(){
	var divDenuncia = document.getElementById('formDenunciar');
	var linkDenunciar = document.getElementById('linkDenunciar');
		if(divDenuncia.style.display=='none'){
		divDenuncia.style.display='block';
		linkDenunciar.innerHTML = 'Cerrar';
	} else {
		divDenuncia.style.display='none';
		linkDenunciar.innerHTML = 'Denunciar artículo';
	}
}

function denunciarWikiArticuloRun(){
	if(document.denunciarArticulo.denunciaTexto.value.length == 0){
		alert("Por favor, copia la parte del texto que quieres denunciar");
		document.denunciarArticulo.denunciaTexto.focus();
	}else{
		document.denunciarArticulo.submit();
	}
}

function reportarAbusoAdmin(divAbuso,linkAbuso){
	var divAbuso = document.getElementById(divAbuso);
	var linkAbuso = document.getElementById(linkAbuso);
		if(divAbuso.style.display=='none'){
		divAbuso.style.display='block';
		linkAbuso.innerHTML = 'Cerrar';
	} else {
		divAbuso.style.display='none';
		linkAbuso.innerHTML = 'Reportar al administrador';
	}

}

function reportarAbusoAdminRun(divAbuso,linkAbuso,divReportado,formAbuso){
	var divAbuso = document.getElementById(divAbuso);
	var linkAbuso = document.getElementById(linkAbuso);
	var divReportado = document.getElementById(divReportado);
	var abusoInfo  = formAbuso.abusoInfo.value;
	var abusoTexto = formAbuso.abusoTexto.value;

	if(abusoTexto.length==0){
		alert("Por favor, indica el abuso realizado en la enciclopedia");

	}else{
		var ajax=nuevoAjax();
		ajax.open("GET", "/sections/wiki/wiki-reportarAbusoRun.php?abusoInfo="+abusoInfo+"&abusoTexto="+abusoTexto, true);
		ajax.onreadystatechange=function()
		{
			if (ajax.readyState==1){
				// Mientras carga elimino la opcion "Selecciona Opcion..." y pongo una que dice "Cargando..."
				divAbuso.innerHTML = "<img src='/img/general/ajax-loader.gif'>";

			}
			if (ajax.readyState==4){
				divAbuso.style.display='none';
				linkAbuso.style.display='none';
				divReportado.style.display='block';
			}
		}
		ajax.send(null);

	}

}

function cambiarStatusArticulo(page_id,currentStatus){
	var divOpen = document.getElementById('statusOpen');
	var divClosed = document.getElementById('statusClosed');

	if(currentStatus == 'closed'){
		divOpen.style.display  = 'block';
		divClosed.style.display = 'none';
	}else{
		divOpen.style.display  = 'none';
		divClosed.style.display = 'block';
	}

	var ajax=nuevoAjax();
	ajax.open("GET", "/sections/wiki/wiki-changePageStatus.php?page_id="+page_id+"&current="+currentStatus+"&ms="+new Date().getTime(), false);
	ajax.send(null);
}

function cambiarArticuloDestacado(page_id,current){
	var spanDestacado = document.getElementById('articuloDestacado');

	var ajax=nuevoAjax();
	ajax.open("GET", "/sections/wiki/wiki-changePageDestacado.php?page_id="+page_id+"&current="+current+"&ms="+new Date().getTime(), true);
	ajax.onreadystatechange=function()
		{
			if (ajax.readyState==1){
				// Mientras carga elimino la opcion "Selecciona Opcion..." y pongo una que dice "Cargando..."
				spanDestacado.innerHTML = "<img src='/img/general/ajax-loader.gif' width='16' height='16' />";
			}
			if (ajax.readyState==4){

				spanDestacado.innerHTML=ajax.responseText;
			}
		}
	ajax.send(null);
}

function showMenu(menuVal){
	var my_menu = document.getElementById('menu'+menuVal);
	var my_submenu = document.getElementById('iSubMenu'+menuVal);
	var Items = document.getElementsByName('subWal');
	
	for (counter = 0; counter < Items.length; counter++){
		 Items[counter].style.display='none';
	}
	
	var Items = document.getElementsByName('Wal');
	
	for (counter = 0; counter < Items.length; counter++){
		 Items[counter].className="linkMenu";
	}
	
	my_menu.className="linkMenuSelected";
	my_submenu.style.display="block";
}

function hideMenu(menuVal){
	var my_submenu = document.getElementById('iSubMenu'+menuVal);
	var Items = document.getElementsByName('Wal');
	
	for (counter = 0; counter < Items.length; counter++){
		 Items[counter].className="linkMenu";
	}

	my_submenu.style.display="none";
}
function checkAuthor(formulario)
{
  if (document.poemaForm.p_author.checked==false){
    document.getElementById("input_p_author_name").style.display="block";
    document.poemaForm.p_author_name.value='';
  }
  else {
    document.getElementById("input_p_author_name").style.display="none";
    document.poemaForm.p_author_name.value='';
  }
}

function outAuthor(poemaForm)
{

if(document.poemaForm.p_author_name.value.length==0){document.poemaForm.p_author.disabled=false}
}