// *******************************************************************
// **   Writing for Julian Fernandez								**
// **																**
// *******************************************************************
function getCookie( nombre )
{
	var valor = null;
	var cadBuscada = escape( nombre ) + "=";
	var longitud = cadBuscada.length;
	var posIni = document.cookie.indexOf( cadBuscada );
	var posFin;
  if ( posIni != -1 )
  {
	posIni += longitud;
	posFin = document.cookie.indexOf( ";", posIni );
	if ( posFin == -1 )
	{
	  posFin = document.cookie.length;
	}
	valor = unescape( document.cookie.substring( posIni, posFin ) );
  }
  return valor;
}
function CookieAddKey(sCookieName,key,value)
{
  
    var values=getCookie(sCookieName);
    var sub=values.substring(values.indexOf(key),values.length);
    var indice=sub.indexOf("&");var subr="";
    if(indice!=-1)subr=sub.substring(0,sub.indexOf("&"));
	else subr=sub.substring(0,sub.length);
    values=values.replace(subr,key+"="+value); 
    setCookie(sCookieName,values);
}
function CookieItemsCount(sCookieName)
{
	var values=getCookie(sCookieName);
	var keys = values.split('=');
	return keys.length;
}

function setCookieFecha( nombre, valor )
{
  var fecha = new Date( 2003, 11, 30 );
//alert( fecha );
  document.cookie= escape(nombre) +"="+ escape(valor)+ "; expires= "+ fecha.toGMTString();
}	

	function setCookieFecha( nombre, valor, fecha )
	{
	  document.cookie= escape(nombre) +"="+ escape(valor)+ "; expires= "+ fecha.toGMTString();
	}	


    function delCookieOld( nombre )
	{
      var fecha = new Date();
      var valor = getCookie( nombre );
      document.cookie = nombre + "=" + valor + "; expires=" + fecha.toGMTString();
    }
    function delCookie( nombre )
	{
      var fecha = new Date();
      var valor = getCookie( nombre );

      document.cookie = escape(nombre) + "=" + escape(valor) + "; expires=" + fecha.toGMTString();
    }
    function correrFechaCookie( nombre, fecha )
	{
      //var fecha = new Date();
      var valor = getCookie( nombre );
      document.cookie = nombre + "=" + valor + "; expires=" + fecha.toGMTString();
    }

	function setCookie( nombre, valor )
	{
	  //var fecha = new Date( 2001, 11, 30 );
	  document.cookie= nombre +"="+ valor+";path=/";
		//+ "; expires= "+ fecha.toGMTString();
	}	

