function fecha(){
		dows = new Array("Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado");
		months = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
		now = new Date();
		dow = now.getDay();
		d = now.getDate();
		m = now.getMonth();
		h = now.getTime();
		y = now.getYear();
		document.write(dows[dow]+" "+d+" de "+months[m]+" de "+y);

}
function menu(tag){
	if (tag != "") {
		document.getElementById(tag).style.color="#041C41";
		document.getElementById(tag).style.textDecoration="underline";
		document.getElementById(tag).style.fontWeight ="bold";

		}
		else{
		}
	}
function validaGestion(){
		/*alert(acceso.usuario.value);*/
		if (document.acceso.usuario.value != ""){
			if (document.acceso.password.value != ""){
				document.acceso.submit();
			}else{
			alert("Debe rellenar el campo PASSWORD para continuar")
			}
		}else{
			if (document.acceso.password.value != ""){
			alert("Debe rellenar el campo USUARIO para continuar")
			}else{
			alert("Por favor, rellene los campos USUARIO y PASSWORD y luego pulse ENTRAR")
			}
		}

}

function recomendar(){
		//alert(formrecomendar.nombre.value);
		if (document.formrecomendar.nombre.value != ""){
			if (document.formrecomendar.email.value != ""){
				document.formrecomendar.submit();
			}else{
			alert("Debe rellenar el campo EMAIL DE DESTINO para continuar")
			}
		}else{
			if (document.formrecomendar.email.value != ""){
			alert("Debe rellenar el campo NOMBRE para continuar")
			}else{
			alert("Por favor, rellene los campos NOMBRE Y EMAIL DE DESTINO y luego pulse ENVIAR")
			}
		}

}

function keyDown()
{
var ieKey = event.keyCode;
if (ieKey == 13  && interruptor==false) {   
validaGestion();
}
}

function imprimirNoticia(id){
var v=(parseInt(window.screen.width)/2)-285;
var h=(parseInt(window.screen.height)/2)-175;
	window.open('/imprimir_noticia.asp?IdNoticia=' + id,'','width=570,height=350,directories=no, scrollbars=yes, toolbars=no, status=no,location=no, resizable=no, left=' + v + ',top=' + h)

}
function imprimir(dir){
var v=(parseInt(window.screen.width)/2)-285;
var h=(parseInt(window.screen.height)/2)-175;
	window.open(dir,'','width=570,height=350,directories=no, scrollbars=yes, toolbars=no, status=no,location=no, resizable=no, left=' + v + ',top=' + h)

}
function cerrarNoticia(){
	window.print();
	window.close();
	//alert("Esta alerta está unicamente de prueba. De momento no se va a imprimir esta pantalla")
}

function popRecomendar(noticia){
var v=(parseInt(window.screen.width)/2)-160;
var h=(parseInt(window.screen.height)/2)-85;
	window.open('/recomendar.asp?IdNoticia=' + noticia,'','width=320,height=170,directories=no, scrollbars=no, toolbars=no, status=no,location=no, resizable=no, left=' + v + ',top=' + h)

}


function imprimirPantalla(id){
var v=(parseInt(window.screen.width)/2)-285;
var h=(parseInt(window.screen.height)/2)-175;
	window.open(id,'','width=570,height=350,directories=no, scrollbars=yes, toolbars=no, status=no,location=no, resizable=no, left=' + v + ',top=' + h)

}

function validarEmail(valor) {
	
			
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
	document.comentario.submit();
  } else {
	alert("La dirección de email es incorrecta.");
	return (false);
  }
		
		
		
}

//FUNCION PARA VALIDAR FECHAS

function getYear(d) { 
   return (d < 1000) ? d + 1900 : d;
   }
 
 function isDate (day, month, year) {
   // month argument must be in the range 1 - 12
   month = month - 1;  // javascript month range : 0- 11
   var tempDate = new Date(year,month,day);
   if ( (getYear(tempDate.getYear()) == year) &&
      (month == tempDate.getMonth()) &&
      (day == tempDate.getDate()) )
       return true;
   else
      return false
   }
 
 function fechak(fecha)
 {
 if (fecha.value!="")
 {
 fecha2=fecha.value
 p=fecha2.split("/")
  if (isDate(p[0],p[1],p[2])==false)
  {
   alert("No es por nada, pero la fecha que acaba de introducir no es válida.")
   fecha.value=""
   fecha.focus()
  }
}
}
