/*funcion que crear html per augmentar tamanys de fonts */
function tamanyText(){
document.write("<ul id=\"tamano\"><li>Tamany del text | <a href=\"javascript:void(null)\" onclick=\"setActiveStyleSheet('normal', 1);return false;\" onkeypress=\"setActiveStyleSheet('normal', 1);return false;\">A <span class=\"oculto\">(Tama&ntilde;o pequeño)</span></a></li>");
document.write("<li class=\"tamanoB\"><a href=\"javascript:void(null)\" onclick=\"setActiveStyleSheet('med', 1);return false;\"  onkeypress=\"setActiveStyleSheet('med', 1);return false;\">A <span class=\"oculto\">(Tama&ntilde;o mediano)</span></a></li>");
document.write("<li class=\"tamanoC noborder\"><a href=\"javascript:void(null)\" onclick=\"setActiveStyleSheet('gran', 1);return false;\" onkeypress=\"setActiveStyleSheet('gran', 1);return false;\">A <span class=\"oculto\">(Tama&ntilde;o Grande)</span></a></li></ul>");
}

function setActiveStyleSheet(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;
	  setCookie('tamany', title, new Date(2015,10,10));
    }
  }
}

function getActiveStyleSheet() {
  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 getPreferredStyleSheet() {
  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;
}





function getDomain() {
	var index=location.hostname.indexOf(".");
	if(index==-1) return location.hostname;
	return location.hostname.substring(index,location.hostname.length);
}

function setCookie(name, value, date){
	document.cookie = name + "=" + escape(value) + (date?";expires=" + date.toGMTString(date.getTime()):"") + ";Domain=" + getDomain() +";Path=/";
}

function getCookie(name) {
	var begin=document.cookie.indexOf(name+"=");
	if(begin==-1) return null;
	var end=document.cookie.indexOf(";",begin);
	if(end==-1) end=document.cookie.length;
	return document.cookie.substring(document.cookie.indexOf("=",begin)+1,end);
}

function delCookie(name) {
	setCookie(name,"",new Date(1999,1,1));
}

var vartamany = getCookie('tamany');


if (vartamany == "normal") {  setActiveStyleSheet('normal', 1); }
if (vartamany == "med") {  setActiveStyleSheet('med', 1) }
if (vartamany == "gran") {  setActiveStyleSheet('gran', 1) }