function breadcrumbs(){
  sURL = new String;
  bits = new Object;
  
  var x = 0;
  var stop = 0;
  var temp = "";
  var output = "<a href=\"/\" class=\"LBreadcrumbActive\">Inicio</a>  /  ";
  sURL = location.href;
  sURL = sURL.slice(8,sURL.length);
  chunkStart = sURL.indexOf("/");
  sURL = sURL.slice(chunkStart+1,sURL.length)
  while(!stop){
    chunkStart = sURL.indexOf("/");
    if (chunkStart != -1){
      bits[x] = sURL.slice(0,chunkStart)
      sURL = sURL.slice(chunkStart+1,sURL.length);
    }else{
      stop = 1;
    }
    x++;
  }
  
  for(var i in bits){
    output += temp;
    temp = "<a href=\"";
    for(y=1;y<x-i;y++){
      temp += "../";
    }
    temp += bits[i] + "/\" class=\"LBreadcrumbActive\">" + FormatTitle(bits[i]) + "</a>  /  "; 
  }
  if(Right(document.URL.toLowerCase(),10) == "index.html" || Right(document.URL.toLowerCase(),1) == "/" || Right(document.URL.toLowerCase(),9) == "index.htm"){
    output += "<span class=\"LBreadcrumbInactive\">" + document.title + "</span>";
  }
  else{
    output += temp + "<span class=\"LBreadcrumbInactive\">" + document.title + "</span>";
  }
  
  document.write(output);
}


function FormatTitle(output){
  output = output.replace(/~q/g,"?");
  output = output.replace(/~w/g,"¿");
  output = output.replace(/~a/g,"á");
  output = output.replace(/~e/g,"é");
  output = output.replace(/~i/g,"í");
  output = output.replace(/~o/g,"ó");
  output = output.replace(/~u/g,"ú");
  output = output.replace(/~n/g,"ñ");
  output = output.replace(/~N/g,"Ñ");
  output = output.replace(/_/g," ");
  return output;
}

function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
