CABECERA = {
	inicio : function (){
		CABECERA.formularioIdentificacion();
		$("form#form_buscar").bind("submit", CABECERA.formularioBusqueda);
		CABECERA.lanzaFechaYHora();
		
		$("#piemediosmenu li a:eq(0)").hover( 
			function() { $("#modulo1").show(); }, 
			function() { $("#modulo1").hide(); } );
		$("#modulo1").hover(
			function() { $(this).show()},
			function() { $(this).hide()} );
		$("#piemediosmenu li a:eq(1)").hover( 
			function() { $("#modulo2").show(); }, 
			function() { $("#modulo2").hide(); } );
		$("#modulo2").hover( 
			function() {$(this).show()}, 
			function() {$(this).hide()});
  },
  formularioIdentificacion : function (){
		/*if($.cookie('login') != null){
			$("div#noidentificado").hide();
			$("div#identificado").show();
			$("span.nombre").append ($.cookie('login'));
		}else{
			$("div#identificado").hide();
		}*/
	   
  },
  formularioBusqueda : function () {
		if (this.query.value == "") {
			alert ("Indique algo para buscar");
			this.query.focus();
			return false;
		}
	},
	timeoutID : null,
	this_month : new Array ("enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"),
	this_day_e : new Array ("Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"),
	lanzaFechaYHora :  function () {
		/* Sincronizamos el cambio de fecha al cambio de minuto */
		CABECERA.fechaYHora();
		var fObj = new Date() ;
		iEspera = (60 - fObj.getSeconds())*1000;
		window.setTimeout("CABECERA.lanzaFechaYHoraCadaMinuto()", iEspera);
	},
	lanzaFechaYHoraCadaMinuto :  function () {
		CABECERA.fechaYHora();
		CABECERA.timeoutID = window.setInterval("CABECERA.fechaYHora()", 60000);
	},
	fechaYHora : function() {
		var fecha = CABECERA.dameFecha();
		var hora = CABECERA.dameHora();
		$("#fecha").html(fecha+" - <span id=\"hora\">"+hora+"</span>");
	},
	dameFecha : function() {
		var today = new Date();
		var day   = today.getDate();
		var month = today.getMonth();
		var year  = today.getFullYear();
		var dia = today.getDay();
		
		return( " " + CABECERA.this_day_e[dia] + " " + day + " " + CABECERA.this_month[month] + " " + year);
	},
	dameHora : function () {
		var fObj = new Date() ; 
		var horas = fObj.getHours() ; 
		var minutos = fObj.getMinutes() ;
		
		if (horas <= 9) horas = "0" + horas; 
		if (minutos <= 9) minutos = "0" + minutos; 
		
		return horas+":"+minutos+" h";
	},
	
	muestraOtrosMedios : function() {
		/*alert(this);*/
		$("#modulo1").show();
		//return false;
	},
	
	ocultaOtrosMedios : function() {
		/*alert(this);*/
		$("#modulo1").hide();
		//return false;
	}
}
$(document).ready(CABECERA.inicio);

