// JavaScript Document
function mostrarFecha() 
{ 
	
	var nombremes = new Array ('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre');
	var fechacompleta = new Date() ; 
	var mes = fechacompleta.getMonth();	
	var num = fechacompleta.getDate();
	var ano=fechacompleta.getFullYear();
	fecha =  num + " de " + nombremes[mes] + " de " + ano ;
document.getElementById("mostrarFecha").innerHTML = fecha;
	
}


function mostrar(){
	
	var op = document.getElementById('seleccion').value;
	if(op==2) {
		document.getElementById('ano').style.display="none";
		document.getElementById('palabras').style.display="block";
		document.getElementById('botOK').style.display="block";

	}
	if(op==1) {
		document.getElementById('ano').style.display="block";
		document.getElementById('palabras').style.display="none";
		document.getElementById('botOK').style.display="block";
	}
	if(op==-1) {
		document.getElementById('ano').style.display="none";
		document.getElementById('palabras').style.display="none";
		document.getElementById('botOK').style.display="none";
	}

}

function listar(){
	 op = document.getElementById('seleccion').value;
		if(op==1) {
			anyo = document.getElementById('ano').value;
			location.href="noticias_listado.php?anyo="+anyo;
			
		}
		if(op==2) {
			pal = document.getElementById('palabras').value;
			location.href="noticias_listado.php?pal="+pal;
			
		}
		

}
function enviar(total){

if (document.getElementById('destacado').checked==true && total>=4) {
	alert("No se puede seleccionar mas noticias como destacadas");
	document.getElementById('destacado').checked=false;
	return false;
}

if (document.getElementById('fecha').value=="") {
	alert("Debe rellenar el campo fecha");
	return false;
}
if (document.getElementById('titulo').value=="") {
	alert("Debe rellenar el campo Titulo");
	return false;
}

document.getElementById('formulario').submit();	
}

function eliminar_noticia(id){
if (confirm("¿Desea borrar esta noticia?")) {
		location.href="noticia_eliminar.php?id="+id;
	}

}
