function replacehtmlCookie(value){
var strtmp;
strtmp=value;
strtmp=strtmp.replace(String.fromCharCode(225),"á");
strtmp=strtmp.replace(String.fromCharCode(233),"é");
strtmp=strtmp.replace(String.fromCharCode(237),"í");
strtmp=strtmp.replace(String.fromCharCode(243),"ó");
strtmp=strtmp.replace(String.fromCharCode(250),"ú");
strtmp=strtmp.replace(String.fromCharCode(193),"Á");
strtmp=strtmp.replace(String.fromCharCode(201),"É");
strtmp=strtmp.replace(String.fromCharCode(205),"Í");
strtmp=strtmp.replace(String.fromCharCode(211),"Ó");
strtmp=strtmp.replace(String.fromCharCode(218),"Ú");
strtmp=strtmp.replace(String.fromCharCode(224),"à");
strtmp=strtmp.replace(String.fromCharCode(232),"è");
strtmp=strtmp.replace(String.fromCharCode(236),"ì");
strtmp=strtmp.replace(String.fromCharCode(242),"ò");
strtmp=strtmp.replace(String.fromCharCode(249),"ù");
strtmp=strtmp.replace(String.fromCharCode(192),"À");
strtmp=strtmp.replace(String.fromCharCode(200),"È");
strtmp=strtmp.replace(String.fromCharCode(204),"Ì");
strtmp=strtmp.replace(String.fromCharCode(210),"Ò");
strtmp=strtmp.replace(String.fromCharCode(217),"Ù");
strtmp=strtmp.replace(String.fromCharCode(226),"â");
strtmp=strtmp.replace(String.fromCharCode(234),"ê");
strtmp=strtmp.replace(String.fromCharCode(238),"î");
strtmp=strtmp.replace(String.fromCharCode(244),"ô");
strtmp=strtmp.replace(String.fromCharCode(251),"û");
strtmp=strtmp.replace(String.fromCharCode(194),"Â");
strtmp=strtmp.replace(String.fromCharCode(202),"Ê");
strtmp=strtmp.replace(String.fromCharCode(206),"Î");
strtmp=strtmp.replace(String.fromCharCode(212),"Ô");
strtmp=strtmp.replace(String.fromCharCode(220),"Û");
strtmp=strtmp.replace(String.fromCharCode(228),"ä");
strtmp=strtmp.replace(String.fromCharCode(235),"ë");
strtmp=strtmp.replace(String.fromCharCode(239),"ï");
strtmp=strtmp.replace(String.fromCharCode(246),"ö");
strtmp=strtmp.replace(String.fromCharCode(252),"ü");
strtmp=strtmp.replace(String.fromCharCode(196),"Ä");
strtmp=strtmp.replace(String.fromCharCode(203),"Ë");
strtmp=strtmp.replace(String.fromCharCode(207),"Ï");
strtmp=strtmp.replace(String.fromCharCode(214),"Ö");
strtmp=strtmp.replace(String.fromCharCode(220),"Ü");
strtmp=strtmp.replace(String.fromCharCode(241),"ñ");
strtmp=strtmp.replace(String.fromCharCode(209),"Ñ");
strtmp=strtmp.replace(String.fromCharCode(231),"ç");
strtmp=strtmp.replace(String.fromCharCode(199),"Ç");
strtmp=strtmp.replace(String.fromCharCode(223),"ß");
return strtmp;
}
function SetCookieSession (name, value) {
var argv = SetCookieSession.arguments;
var argc = SetCookieSession.arguments.length;
var path = (argc > 3) ? argv[3] : "/";
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (replacehtmlCookie(value)) +
((path == null || !path) ? "/" : ("; path=" + path)) +
((domain == null) ? "; domain=cursos.elpais.com" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
// Expires never
//var expires = (argc > 2) ? argv[2] : null;
var expires= new Date();
expires.setYear(9999);
var path = (argc > 3) ? argv[3] : "/";
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (replacehtmlCookie(value)) +
"; expires=" + expires.toGMTString() +
((path == null) ? "/" : ("; path=" + path)) +
((domain == null) ? "; domain=cursos.elpais.com" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function GetCookie (name) {
var arg = name + "=";
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 getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function deleteCookie(name,value){
var argv = deleteCookie.arguments;
var argc = deleteCookie.arguments.length;
var expires= new Date();
var path = (argc > 3) ? argv[3] : "/";
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
"; expires=" + expires.toGMTString() +
((path == null) ? "/" : ("; path=" + path)) +
((domain == null) ? "; domain=cursos.elpais.com" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function deleteOldCookie(name,value){
var argv = deleteOldCookie.arguments;
var argc = deleteOldCookie.arguments.length;
var expires= new Date();
var path = (argc > 3) ? argv[3] : "/";
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
"; expires=" + expires.toGMTString() +
((path == null) ? "/" : ("; path=" + path)) +
((domain == null) ? "; domain=cursos.elpais.com" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
/*A borrar en dos semanas (chapi)*/
if(GetCookie('user_idioma') || GetCookie('USER_IDIOMA') || GetCookie('pfichas') || (typeof(GetCookie('NOMBRE_USER'))=='string' && GetCookie('NOMBRE_USER')=="null")){
deleteOldCookie("af_prov","");
deleteOldCookie("C_ID_PUENTE","");
deleteOldCookie("curso","");
deleteOldCookie("id_venta","");
if(GetCookie("INV")){
SetCookie("INV",GetCookie("INV"));
}
deleteOldCookie("INV","");
deleteOldCookie("INV_17","");
deleteOldCookie("INV_18","");
deleteOldCookie("MAIL_USER","");
deleteOldCookie("NOMBRE_USER","");
deleteOldCookie("PASSWORD_USER","");
/*a borrar el viernes */
deleteCookie("MAIL_USER","");
deleteCookie("NOMBRE_USER","");
deleteCookie("PASSWORD_USER","");
deleteCookie("USER_PFICHAS","");
deleteCookie("nombre_centro","");
deleteCookie("login_centro","");
deleteCookie("password_centro","");
deleteCookie("pfichas","");
deleteOldCookie("pfichas","");
deleteOldCookie("SINV","");
deleteOldCookie("user_af_prov","");
deleteOldCookie("user_divisa","");
deleteOldCookie("USER_DIVISA","");
deleteOldCookie("user_idioma","");
deleteOldCookie("USER_IDIOMA","");
deleteOldCookie("user_id_venta","");
deleteOldCookie("user_locator","");
deleteOldCookie("USER_PAIS","");
deleteOldCookie("USER_PFICHAS","");
deleteOldCookie("USER_PORTAL","");
deleteOldCookie("user_portalf","");
deleteOldCookie("nombre_centro","");
deleteOldCookie("login_centro","");
deleteOldCookie("password_centro","");
}