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)).split("\n");
} 

function setCookie (name, value, expires, path,domain) 
{
   var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? ";domain=" + domain : "");
   document.cookie = curCookie;
}
function salirRegistro() {
   var expires = 0;
   var path = '/';
   var domain = '.vive.in';
   var curCookie = 'vivein' + "=" + escape('') + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "")+((domain) ? "; domain=" + domain: "");
   document.cookie = curCookie;
  // incluirObjeto("AJAX_QUITAR_USUARIO",'menu_usuario');
   if (document.location.href.indexOf("zonadeusuario") >= 0)
       document.location = "/";
   else if(document.location.href.indexOf("registro") >= 0)
       document.location = "/";
   else if (document.location.href.indexOf('#') >= 0) // Se mira si tiene un ancla y se quita
       document.location = document.location.href.substring(0,document.location.href.indexOf('#'));
   else
       document.location = document.location;       
}

