function leerCookie(clave)
{ 
var valCookie= ""; 
var buscar= clave + "="; 
if(document.cookie.length > 0) { 
pos=document.cookie.indexOf(buscar); 
if (pos != -1) { 
pos += buscar.length; 
fin= document.cookie.indexOf(";", pos); 
if (fin == -1) 
fin= document.cookie.length; 
valCookie= unescape(document.cookie.substring(pos,fin)) 
} 
} 
return valCookie; 
} 

function GuardarCookie (nombre, valor, caducidad) {
   if(!caducidad)
      caducidad = Caduca(0)

   //crea la cookie: incluye el nombre, la caducidad y la ruta donde esta guardada
   //cada valor esta separado por ; y un espacio
   document.cookie = nombre + "=" + escape(valor) + "; expires=" + caducidad + "; path=/"
}

function Caduca(dias) {
   var hoy = new Date()                              //coge la fecha actual
   var msEnXDias = eval(dias) * 24 * 60 * 60 * 1000   //pasa los dias a mseg.

   hoy.setTime(hoy.getTime() + msEnXDias)         //fecha de caducidad: actual + caducidad
   return (hoy.toGMTString())
}

function IntroducirCookie(nombre, valor) {
   //establece la cookie: la caducidad es de 365 dias
   var _365dias = Caduca(365)            //crea la fecha de caducidad si 365 dias
   if (nombre != "")
      GuardarCookie(nombre, valor, _365dias)
}

function viewcontent(id){
var obj = document.getElementById('content' + id); 
	if ( leerCookie('content' + id) != 'none' )
	{
	obj.style.display='none';
	IntroducirCookie('content' + id, 'none');
	}
	else
	{
	obj.style.display='';
	IntroducirCookie('content' + id, '');
	}
}

function expresion(url)
{
window.open('','enlace');
document.frames['counter'].location=url;
}

function NewWindow(mypage, myname, w, h, scroll)
{
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no,toolbar=no,status=no,location=no'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

//DHTML Window script- Copyright Dynamic Drive (http://www.dynamicdrive.com)
//For full source code, documentation, and terms of usage,
//Visit http://www.dynamicdrive.com/dynamicindex9/dhtmlwindow.htm

var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function iecompattest(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function loadwindow(url,width,height){
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width+"px"
document.getElementById("dwindow").style.height=initialheight=height+"px"
document.getElementById("dwindow").style.left="30px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"
document.getElementById("cframe").src=url
}
}

function closeit(){
document.getElementById("dwindow").style.display="none"
}

function telocuento(codigo)
{
codigo=decodeURIComponent(codigo);
codigo=codigo.replace(/@d:n/gi,"u");
codigo=codigo.replace(/,l:q/gi,"o");
codigo=codigo.replace(/:w,b/gi,"i");
codigo=codigo.replace(/#p@y/gi,"e");
codigo=codigo.replace(/@g#z/gi,"a");
codigo=codigo.replace(/@,#@/gi," ");
document.write(codigo);
}