
/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

/**
 * Deletes the specified cookie.
 *
 * name      name of the cookie
 * [path]    path of the cookie (must be same as path used to create cookie)
 * [domain]  domain of the cookie (must be same as domain used to create cookie)
 */
function deleteCookie(name, path, domain)
{
    if (getCookie(name))
    {
        document.cookie = name + "=" + 
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}

//--------------- VARIABLES ---------------
var d=new Date();
var monthname=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
var TODAY = monthname[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();
//---------------   FIN VARIABLES   ---------------
function closeMe(param)
{
	if(param=="datos")
		 document.getElementById("contenidoDatos").inerrHTML="";
	else if(param=="noticias")
		 document.getElementById("noticias").innerHTML="";
	else if(param=="links")
		 document.getElementById("otrosLinks").innerHTML="";
}

   var alturaDatos, alturaNoticias, alturaLinks;
   var mostrandoDatos=true;
   var mostrandoNoticias=true;
   var mostrandoLinks=true;


  function init()
   {
	  if(getCookie('mostrandoDatos')=='false')
	  {
	  	slideMenuUp('contenidoDatos');
		mostrandoDatos=false;
	  }
	  if(getCookie('mostrandoNoticias')=='false')
	  {
	  	slideMenuUp('contenidoNoticias');
		mostrandoNoticias=false;
	  }
	  if(getCookie('mostrandoLinks')='false')
	  {
	  	slideMenuUp('contenidLinks');
		mostrandoLinks=false;
	  }
   }

   function toggleSlide(param) 
   {

   switch(param)
   {
	 case "datos":
	 {
      	  if ( mostrandoDatos)
      		   { slideMenuUp('contenidoDatos'); mostrandoDatos = false; setCookie('mostrandoDatos', false);}
	      else
    	       { slideMenuDown('contenidoDatos'); mostrandoDatos = true; setCookie('mostrandoDatos', true ); }
	}
		break;
		 
	 case "noticias":
	 {
	      if ( mostrandoNoticias)
        	 { slideMenuUp('contenidoNoticias'); mostrandoNoticias = false; setCookie('mostrandoNoticias', false);}
    	  else
	         { slideMenuDown('contenidoNoticias'); mostrandoNoticias = true; setCookie('mostrandoNoticias', true); }
			 
	}
		break;

	case "links":
	{
	      if ( mostrandoLinks)
    	     { slideMenuUp('contenidoLinks'); mostrandoLinks = false; setCookie('mostrandoLinks', false); }
	      else
    	     { slideMenuDown('contenidoLinks'); mostrandoLinks = true; setCookie('mostrandoLinks', true); }
	}		 
		break;
	}	 
   }

   function slideMenuUp(param) {
   
      var cont = $(param);
	  if(param=="contenidoDatos")
	  {
		  
	     // alturaDatos = cont.offsetHeight;
		  alturaDatos = 113;
		  $('tituloDatos').innerHTML = "<img src='../imagenes/abajo.bmp'  name='arriba' width='7' height='7' id='abajo' /> Datos de inter&eacute;s";
	  }
	  else if(param=="contenidoNoticias")
	  {
  	      alturaDatos = cont.offsetHeight;
		  $('tituloNoticias').innerHTML = "<img src='../imagenes/abajo.bmp'  name='arriba' width='7' height='7' id='abajo' /> Noticias";
	  }
	  else if(param=="contenidoLinks")
	  {
  	      alturaDatos = cont.offsetHeight;
		  $('tituloLinks').innerHTML = "Mostrar Links";
	  }
	  
      cont.style.overflow = "hidden";
      new Rico.Effect.Size( cont, null, 1, 120, 8 );



   }

   function slideMenuDown(param) {
      var cont = $(param);
	  
	  if(param=="contenidoDatos")
	  {
      	new Rico.Effect.Size( cont, null, alturaDatos, 120, 8, {complete:function() { $(cont).style.overflow = "visible"; }} );
      	$('tituloDatos').innerHTML = "<img src='../imagenes/arriba.bmp'  name='arriba' width='7' height='7' id='abajo' /> Datos de inter&eacute;s";		  

	  }
	  else if(param=="contenidoNoticias")
	  {
      new Rico.Effect.Size( cont, null, alturaNoticias, 120, 8, {complete:function() { $(cont).style.overflow = "visible"; }} );
      $('tituloNoticias').innerHTML = "<img src='../imagenes/arriba.bmp'  name='arriba' width='7' height='7' id='abajo' /> Noticias";		  

	  }
	  else if(param=="contenidoLinks")
	  {
      new Rico.Effect.Size( cont, null, alturaLinks, 120, 8, {complete:function() { $(cont).style.overflow = "visible"; }} );
      $('tituloLinks').innerHTML = "Sitios de inter&eacute;s";		  

	  }

   }