//---------------------------------------------------------------------------------------------
//Inicia comprobador Ajax
//---------------------------------------------------------------------------------------------

function GetXmlHttpObject() {
var xmlHttp=null;
	
try {
xmlHttp = new XMLHttpRequest();
} catch(err1) {
  try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      xmlHttp = false;
    }
  }
}
return xmlHttp;
}
//---------------------------------------------------------------------------------------------
//Termina comprobador Ajax
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
//Termina comprobador Ajax
//---------------------------------------------------------------------------------------------
function NextField(oEvent) {
	
	var oEvent = (oEvent)? oEvent : event;
	
	if(oEvent.keyCode==13) {
			//return false;
			oEvent.keyCode = 9;
		}
}
//---------------------------------------------------------------------------------------------
//Termina comprobador Ajax
//---------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------
//Inicia abrir popup's
//---------------------------------------------------------------------------------------------
function MM_openBrWindow(theURL,winName,features,w,h,mw,mh) {
 var winl = ((screen.width-w)/2)-mw;
 var wint = ((screen.height-h)/2)-mh;
 var settings = features+',';
 settings +='height='+h+',';
 settings +='width='+w+',';
 settings +='top='+wint+',';
 settings +='left='+winl+',';
 
 newwindow=window.open(theURL,winName,settings);
if (window.focus) {newwindow.focus()}
	return false;
}
//---------------------------------------------------------------------------------------------
//Termina abrir popup's
//---------------------------------------------------------------------------------------------
	
//---------------------------------------------------------------------------------------------
//Inicia encode HTML
//---------------------------------------------------------------------------------------------
function encodeMyHtml(encodedHtml) {
	
    encodedHtml = encodedHtml.replace(/á/g,"%E1");
    encodedHtml = encodedHtml.replace(/é/g,"%E9");
    encodedHtml = encodedHtml.replace(/í/g,"%ED");
    encodedHtml = encodedHtml.replace(/ó/g,"%F3");
    encodedHtml = encodedHtml.replace(/ú/g,"%FA");
    encodedHtml = encodedHtml.replace(/Á/g,"%C1");
    encodedHtml = encodedHtml.replace(/É/g,"%C9");
    encodedHtml = encodedHtml.replace(/Í/g,"%CD");
    encodedHtml = encodedHtml.replace(/Ó/g,"%D3");
    encodedHtml = encodedHtml.replace(/Ú/g,"%DA");
    encodedHtml = encodedHtml.replace(/ñ/g,"%F1");
    encodedHtml = encodedHtml.replace(/Ñ/g,"%D1");
    encodedHtml = encodedHtml.replace(/\r|\n|\r\n/g,"\n");
    encodedHtml = encodedHtml.replace(/ /g,"%20");
     return encodedHtml;
   } 
	 
function decodeMyHtml(encodedHtml) {
     while (encodedHtml > 0)
           {
             lastpercent = val.lastIndexOf("%");
             if (lastpercent != -1) // we found a % char. Need to handle
                {
                  // everything *after* the %
                  frag = val.substring(lastpercent+1,val.length);
                  // re-assign val to everything *before* the %
                  val  = val.substring(0,lastpercent);
                  if (frag.length >= 2) // end contains unencoded
                     {
                     //  alert ("frag is greater than or equal to 2");
                       encval = frag.substring(0,2);
                       newStr = frag.substring(2,frag.length) + newStr;
                       //convert the char here. for now it just doesn't add it.
                       if ("01234567890abcdefABCDEF".indexOf(encval.substring(0,1)) != -1 &&
                           "01234567890abcdefABCDEF".indexOf(encval.substring(1,2)) != -1)
                          {
                           encval = String.fromCharCode(parseInt(encval, 16)); // hex to base 10
                           newStr = encval + newStr; // prepend the char in
                          }
                       // if so, convert. Else, ignore it.
                     }
                  // adjust length of the string to be examined
                  encodedHtml = lastpercent;
                 // alert ("encodedHtml at the end of the found % if is: " + encodedHtml);
                }
            else { newStr = val + newStr; encodedHtml = 0; } // if there is no %, just leave the value as-is
           } // end while
	 return encodedHtml;
	 
} 
//---------------------------------------------------------------------------------------------
//Termina encode HTML
//---------------------------------------------------------------------------------------------
