// JavaScript Document

function setCookie(nombre, valor, diasQueExpira){
	var fecha = new Date()
	fecha.setDate(fecha.getDate() + diasQueExpira)
	document.cookie=nombre + "=" +escape(valor)+
		((diasQueExpira==null) ? "" : ";expires="+fecha.toGMTString())
}

function getCookie(name, InCookie){	
	var prop = name + "="; // propiedad buscada
	var plen = prop.length;
	var clen = InCookie.length;
	var i=0;
	if (clen>0) { // Cookie no vacío
		i = InCookie.indexOf(prop,0); // aparición de la propiedad
		if (i!=-1) { // propiedad encontrada
			// Buscamos el valor correspondiente
			j = InCookie.indexOf(";",i+plen);
			if(j!=-1) // valor encontrado
				return unescape(InCookie.substring(i+plen,j));
			else //el último no lleva ";"
				return unescape(InCookie.substring(i+plen,clen));
		}
		else
			return "";
	}
	else
		return ""
}

function CambiarEstilo(id) {
	var css=document.getElementsByTagName("link")[0]; 
	//var elemento = document.getElementById(id);
	css.src = "paginas/estilo2.css";
}
function EstablecerCSS(title) {
      setCookie("estilo", title, 90);
	  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;
            }
      }
}