// JavaScript Document
<!--

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); };
String.prototype.soloNumero = function() { return this.replace(/[^0-9]/ig, ""); };
String.prototype.esEntero = function() { return this.search(/[\D]/) == -1; };
String.prototype.esFloat = function() { return this.search(/^(\d+)\.(\d+)$|^(\d+)$/) > -1; };
String.prototype.aFloat = function() { return this.replace(/[,]/ig, "."); };
String.prototype.nospaces = function() { return this.replace(/\s+/g, ""); };
String.prototype.htmlEntities = function()
{
  var chars = new Array ('&','à','á','â','ã','ä','å','æ','ç','è','é',
                         'ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô',
                         'õ','ö','ø','ù','ú','û','ü','ý','þ','ÿ','À',
                         'Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë',
                         'Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö',
                         'Ø','Ù','Ú','Û','Ü','Ý','Þ','€','\"','ß','<',
                         '>','¢','£','¤','¥','¦','§','¨','©','ª','«',
                         '¬','­','®','¯','°','±','²','³','´','µ','¶',
                         '·','¸','¹','º','»','¼','½','¾');

  var entities = new Array ('amp','agrave','aacute','acirc','atilde','auml','aring',
                            'aelig','ccedil','egrave','eacute','ecirc','euml','igrave',
                            'iacute','icirc','iuml','eth','ntilde','ograve','oacute',
                            'ocirc','otilde','ouml','oslash','ugrave','uacute','ucirc',
                            'uuml','yacute','thorn','yuml','Agrave','Aacute','Acirc',
                            'Atilde','Auml','Aring','AElig','Ccedil','Egrave','Eacute',
                            'Ecirc','Euml','Igrave','Iacute','Icirc','Iuml','ETH','Ntilde',
                            'Ograve','Oacute','Ocirc','Otilde','Ouml','Oslash','Ugrave',
                            'Uacute','Ucirc','Uuml','Yacute','THORN','euro','quot','szlig',
                            'lt','gt','cent','pound','curren','yen','brvbar','sect','uml',
                            'copy','ordf','laquo','not','shy','reg','macr','deg','plusmn',
                            'sup2','sup3','acute','micro','para','middot','cedil','sup1',
                            'ordm','raquo','frac14','frac12','frac34');

  newString = this;
  for (var i = 0; i < chars.length; i++) {
    myRegExp = new RegExp();
    myRegExp.compile(chars[i],'g')
    newString = newString.replace (myRegExp, '&' + entities[i] + ';');
  }
  myRegExp = new RegExp();
  myRegExp.compile('\n','g');
  newString = newString.replace(myRegExp, '<br />');
  
  return newString;
}

function switchclass ( id ){
    var n = document.getElementById(id);
    if ( n.className == "side6" )
    {
         n.className = "side7";
    }
    else if ( n.className == "side7" )
    {
         n.className = "side6";
    }
}
function esBuenStr( string ){
 if (!string) return false;
 var badChars = "*|,\":<>[]{}`\';()@&$#%";
 for (var i = 0; i < string.length; i++) {
  if (badChars.indexOf(string.charAt(i)) != -1)
   return false;
 }
 return true;
}

function CheckEmail( string ){
  if (!string) return false;
  //if (!esBuenStr(string)) return false;
  if (string.search(/^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})$/) == -1)
    return false;
  return true;
}

function buenStr( string ){
  var badChars = /[^a-z0-9_\-]/ig;
  return string.replace(badChars, "");
}

function buenNumber( string ){
  var badChars = /[^0-9]/ig;
  return string.replace(badChars, "") > 0;
}

function RecPassword( mail, href, target ){
      if ( CheckEmail( mail.value ) ) {
            window.open( href + '?email=' + mail.value, target, 'width=350,height=120' );
      } else {
     window.open( href, target, 'width=350,height=120' );
   }
      return false;
}

function show(capa){
  document.getElementById(capa).style.display = 'block';
}

function hide(capa){
  document.getElementById(capa).style.display = 'none';
}
function pop(URL, titulo, dimx, dimy) {
  window.open(URL, titulo, "width=" + dimx + ",height=" + dimy + ",toolbar=0,menubar=0,location=0,status=0,directories=0,scrollbars=1,resizable=0");
}
function popr(URL, titulo, dimx, dimy) {
  window.open(URL, titulo, "width=" + dimx + ",height=" + dimy + ",toolbar=0,menubar=0,location=0,status=0,directories=0,scrollbars=1,resizable=1");
}
function on(src, color_entrada) {
  src.bgColor=color_entrada;src.style.cursor="hand";
}
function off(src,color_default) {
  src.bgColor=color_default;src.style.cursor="default";
}
function oncss(src, css) {
  src.className = css;src.style.cursor="hand";
}
function offcss(src, css) {
  src.className = css;src.style.cursor="default";
}

function ucfirst(str){
   // split string
   firstChar = str.substring(0,1);
   remainChar = str.substring(1);

   // convert case
   firstChar = firstChar.toUpperCase(); 
   remainChar = remainChar.toLowerCase();

   return firstChar + remainChar
}

function ucwords(str) {
   // split string on spaces
   arrStr = str.split(" ");

   var strOut = '';

   for (i=0; i<arrStr.length; i++){
       // split string
       firstChar = arrStr[i].substring(0,1);
       remainChar = arrStr[i].substring(1);

       // convert case
       firstChar = firstChar.toUpperCase(); 
       remainChar = remainChar.toLowerCase();

       strOut += firstChar + remainChar + ' ';
   }

   // return string, but drop the last space
   return strOut.substring(0, strOut.length - 1);
}

function enbld(f, str) {
   //alert("enabled("+f+","+str+")");
   // split string
   arrCampo = str.nospaces().split(",");

   var x;
   for (var i=0; i < arrCampo.length; i++){
     x = document.getElementsByTagName('input');
     for(j=0; j < x.length; j++){
       if (x[j].name == arrCampo[i] && x[j].type == 'text')
         x[j].disabled = false;
     }
   }

   return true;
}

function disbld(f, str) {
   //alert("disabled("+f+","+str+")");
   // split string
   arrCampo = str.nospaces().split(",");

   var x;
   for (var i=0; i < arrCampo.length; i++){
     x = document.getElementsByTagName('input');
     for(j=0; j < x.length; j++){
       if (x[j].name == arrCampo[i] && x[j].type == 'text')
         x[j].disabled = true;
     }
   }

   return true;
}

function VarDisplay(){
  
}
//-->