//<!--  |||||||||||||||||||||  -->//
//<!--|  © MENTEFACTUAL 2007  |-->//
//<!--  |||||||||||||||||||||  -->//
//<!--  www.mentefactual.com   -->//
//<!-- 	    elvisor_mf         -->//

/*========================================== */
//==========================================COOKIES ON/OFF.
//---devuelve si el navegador acepta cookies.
function aceptaCookies() {
//alert("en function   " + document.cookie.length);
	if (document.cookie=="") {
        return false;
	} else {
		return true;
	}
}

//==========================================EXISTE COOKIE.
//--devuelve el valor de un cookie de nombre nombre,
//--llamando a valorCookie, o null si no existe.
function obtenerCookie(nombre) {
	var arg = nombre + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j =i +alen;
		if (document.cookie.substring(i,j) == arg) { return valorCookie(j); }
		i = document.cookie.indexOf(" ",i)+1;
		if (i == 0) { break; }
	}
	return null;
}

//==========================================VALOR DE COOKIE.
//--devuelve el campo valor de un cookie de nombre offset.
function valorCookie (offset) {
	var endstr =document.cookie.indexOf (";",offset);
	if (endstr ==-1) {
		endstr =document.cookie.length;
	}
	return unescape(document.cookie.substring(offset,endstr));
}

//==========================================FECHA COOKIE EXPIRA.
//--devuelve la fecha de expiraci—n del cookie.
function finalFechaCoohie() {
	var expdate =new Date ();
	fijarCookieDate(expdate); //Correct for Mac date bug (call only once).
	expdate.setTime(expdate.getTime()+((24*365) *60 *60 *1000)); //24 horas * 365.
	return expdate;
}
//--Function to correct for 2.x Mac date bug.
function fijarCookieDate (date) {
	var base = new Date(0);
	var skew = base.getTime();//dawn of (Unix)time -should be 0
	if (skew > 0) { //Except on the Mac -ahead of its time
		date.setTime (date.getTime()-skew);
	}
}

//==========================================REGISTRA COOKIE.
//--registra un cookie en el HD cliente.
function registraCookie(nombre,valor,expira,path,domain,secure) {
	document.cookie =nombre+"="+escape(valor)+ ((expira)?";expires="+expira.toGMTString():"")+((path)?";path="+ path:"")+((domain)?";domain="+domain:"")+((secure)?";secure=":"");
}
/*========================================== */
