function readCookie(name) {

  var nameEQ = name + "=";

  var ca = document.cookie.split(';');

  for(var i=0;i < ca.length;i++) {

    var c = ca[i];

    while (c.charAt(0)==' ') c = c.substring(1,c.length);

    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);

  }

  return null;

}
function ObtenerEstiloFavorito() {

  var i, a;

  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {

    if(a.getAttribute("rel").indexOf("style") != -1

       && a.getAttribute("rel").indexOf("alt") == -1

       && a.getAttribute("title")

       ) return a.getAttribute("title");

  }

  return null;

}
 window.onload = function(e) {

  var cookie = readCookie("style");
  
  if (cookie==null) cookie="Estilo1";
 

  var title = cookie ? cookie : ObtenerEstiloFavorito();

  CambiarEstilo(title);

}  



var coldColor = "#FFFFCC"
var hotColor  = "#9D9D9D"
var motionPix = "0"

// do not edit below this line
// ======================================

var a='<style>'+

'A.InstantLink:link {'+
'  color:'+coldColor+';'+
'  text-decoration:none;'+
'  padding:0 '+motionPix+' 0 0;'+
'  }'+  

'A.InstantLink:visited {'+
'  color:'+coldColor+';'+
'  text-decoration:none;'+
'  padding:0 '+motionPix+' 0 0;}'+  

'A.InstantLink:active {'+
'  color:'+coldColor+';'+
'  text-decoration:none;'+
'  padding:0 '+motionPix+' 0 0;'+
'  }'+  

'A.InstantLink:hover {'+
'  color:'+hotColor+';'+
'  text-decoration:underline;'+
'  }'+
'</style>'
if (document.all || document.getElementById){
    document.write(a)
}

function mOver(direccion)
{
direccion.bgColor='#FFFFDF';
}
function mOut(direccion)
{
direccion.bgColor='#E9EAE8';
}
function mOver2(direccion)
{
direccion.style.color='#FFFFFF';
direccion.style.textDecoration='underline';
}
function mOut2(direccion)
{
direccion.style.color='#FFFFDD';
direccion.style.textDecoration='none';
}

function CambiarEstilo(title) {

   var i, a, main;

   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {

     if(a.getAttribute("rel").indexOf("style") != -1

        && a.getAttribute("title")) {

       a.disabled = true;

       if(a.getAttribute("title") == title) a.disabled = false;

     }

   }

}

function ObtenerEstilo() {

  var i, a;

  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {

    if(a.getAttribute("rel").indexOf("style") != -1

       && a.getAttribute("title")

       && !a.disabled) return a.getAttribute("title");

  }

  return null;

}
function createCookie(name,value,days) {

  if (days) {

    var date = new Date();

    date.setTime(date.getTime()+(days*24*60*60*1000));

    var expires = "; expires="+date.toGMTString();

  }

  else expires = "";

  document.cookie = name+"="+value+expires+"; path=/";

}


window.onunload = function(e) {

  var title = ObtenerEstilo();

  createCookie("style", title, 365);

}