/**
 * @author juan
 */

function redir(url, id) {
	if(!document.getElementById(id) || !url) return false;
	window.location= url+document.getElementById(id).value;
}


function volver(){
    history.back();
}

$(document).ready(function() {
    $('h1').css("text-shadow","0.1em 0.1em 0.1em #CFCFCF");
    $('h2').css("text-shadow","0.1em 0.1em 0.16em #EFEFEF");
    $('h3').css("text-shadow","0.1em 0.1em 0.18em #FEFEFE");
    $('#cuerpo strong').css("text-shadow","0.05em 0.05em 0.05em #CFCFCF");
});

function tooltip() {
    $('.lclie img').tipsy({gravity: 'n', fade: true});
}


function initPopupLinks() {
  if (!document.getElementsByTagName) return true;
  var pageLinks = document.getElementsByTagName("a");
  for (var i = 0; i < pageLinks.length; i++)
  {
    if (((pageLinks[i].className != null) &&
         (pageLinks[i].className != "")) ||
        ((pageLinks[i].parentNode.className != null) &&
         (pageLinks[i].parentNode.className != "")))
    {
      var linkClass = " " + pageLinks[i].className + " ";
      if ((linkClass == "  ") && (pageLinks[i].parentNode.className != ""))
      {
        linkClass = " " + pageLinks[i].parentNode.className + " ";
      }
      for (var theKey in popupLinkConfig)
      {
        if (linkClass.indexOf(" " + theKey + " ") > -1)
        {
          if ((pageLinks[i].target == "") || (pageLinks[i].target == null))
          {
            pageLinks[i].target = (popupLinkConfig[theKey][0] != "") ? popupLinkConfig[theKey][0] : theKey;
          }
          pageLinks[i].settings = popupLinkConfig[theKey][1];
          pageLinks[i].onclick = popUp;
        }
      }
    }
  }
  return true;
}

function textCounter(field, countfield, maxlimit)
{
    var conte = $('[name='+field+']').val();
	if (conte.length > maxlimit) // if too long...trim it!
        {
            $('[name='+field+']').val(conte.substring(0, maxlimit));
        }
	else  {// otherwise, update counter
            $('[name='+countfield+']').val(conte.length);
        }
}

function popUp()
{
  newWin = window.open(this.href, this.target, this.settings);
  newWin.focus();
  return false;
}

var popupLinkConfig = new Array;
// modificar las siguientes líneas para configurar los popups
popupLinkConfig["popup"] = new Array ( "Condiciones", "width=350,height=450,scrollbar=yes,menubar=no");
popupLinkConfig["glossary"] = new Array ( "help", "width=550,height=350,resizable=no,scrollbars=no");
