	function strReplace(str, str1, str2) {
		while(str.indexOf(str1) > 0) {
			str = str.replace(str1, str2);
		}
		return str;
	}
	function AgregarCeros(Str){
  	
  	arrValores = Str.split("/");
  	for(i=0;i < arrValores.length; i++){
    	if(parseInt(arrValores[i]) < 10 && arrValores[i].length == 1){
      	arrValores[i] = "0" + arrValores[i];
      }
    }
  	
  	strNuevaFecha = arrValores[0] + "/" + arrValores[1] + "/" + arrValores[2];
  	
  	return strNuevaFecha;
  }
	
	function fechaMayorQue(strFecha1, strFecha2){ 
    var bRes = false; 
   strFecha1 = AgregarCeros(strFecha1);
   strFecha2 = AgregarCeros(strFecha2)
	    /*var sDia0 = strFecha1.substr(0, 2); 
	    var sDia1 = strFecha2.substr(0, 2); 
	    var sMes0 = strFecha1.substr(3, 2); 
	    var sMes1 = strFecha2.substr(3, 2); */
	    var sDia0 = strFecha1.substr(3, 2); 
	    var sDia1 = strFecha2.substr(3, 2); 
	    var sMes0 = strFecha1.substr(0, 2); 
	    var sMes1 = strFecha2.substr(0, 2); 
	    
    var sAno0 = strFecha1.substr(6, 4); 
    var sAno1 = strFecha2.substr(6, 4); 
    if (parseInt(sAno0) > parseInt(sAno1)){
    bRes = true; 
    
    } else { 
     
     if (parseInt(sAno0) == parseInt(sAno1)){ 
      
      if (sMes0 > sMes1){
      	 bRes = true; 
      } else { 
       if (sMes0 == sMes1) 
        if (sDia0 > sDia1) bRes = true; 
      } 
     } 
    } 
    return(bRes); 
   } 
	
	function Chr(CharCode)
{
	return String.fromCharCode(CharCode);
}
	
	function strReplace(str, strBusqueda, strReemplazo) {
		while(str != str.replace(strBusqueda, strReemplazo)) {
			str = str.replace(strBusqueda, strReemplazo);
		}
		return str;
	}
	
	function mostrarDiv(strDiv) {
		document.getElementById(strDiv).style.position="relative";
		document.getElementById(strDiv).style.width="";
		document.getElementById(strDiv).style.height="";
		document.getElementById(strDiv).style.top=0;
		document.getElementById(strDiv).style.left="";
		MM_showHideLayers(strDiv,'','show');
	}

	function ocultarDiv(strDiv) {
		document.getElementById(strDiv).style.position="absolute";
		document.getElementById(strDiv).style.width="";
		document.getElementById(strDiv).style.height="";
		document.getElementById(strDiv).style.top="";
		document.getElementById(strDiv).style.left=0;
		MM_showHideLayers(strDiv,'','hidden');
	}
	
	function verLink(strLink){
		window.open(strLink);
	}
	
	function PermitirSoloEnteros(evt)	{                               
		var key = document.all  ?  evt.keyCode: evt.which;              
		return (key < 13 || (key >= 48 && key <= 57) ) ;        	

	}

/* funcion trim que la uso en el resto de las funciones */
	function trim(inputString) {
   
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { 
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { 
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { 
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; 
	} 
	
	
	function CapturarEnter(e, strFuncion){
		if(document.all){
       intTecla=event.keyCode;
    } else {
       intTecla=e.which; 
    }
 	  if(intTecla==13){
        eval(strFuncion);
  	}
	
  }
	
	function roundNumber(numero, intDecimales) {
	var rlength = intDecimales; 
	if (numero > 8191 && numero < 10485) {
		numero = numero-5000;
		var newnumber = Math.round(numero*Math.pow(10,rlength))/Math.pow(10,rlength);
	} else {
		var newnumber = Math.round(numero*Math.pow(10,rlength))/Math.pow(10,rlength);
	}
	return newnumber;
  }
  
	function InChar(strSearch, charSearchFor)
	{
		for (i=0; i < Len(strSearch); i++)
		{
		    if (charSearchFor == Mid(strSearch, i, 1))
		    {
				return i;
		    }
		}
		return -1;
	}

	function InStr(strSearch, strSearchFor)
	{
		for (i=0; i < Len(strSearch); i++)
		{
		    if (strSearchFor == Mid(strSearch, i, Len(strSearchFor)))
		    {
					return i;
		    }
		}
		return -1;
	}

  function Len(str) {  
  	return String(str).length;  
  }

	function Mid(str, start, len) {
	  if (start < 0 || len < 0) return "";
	
	  var iEnd, iLen = String(str).length;
	  if (start + len > iLen)
	          iEnd = iLen;
	  else
	          iEnd = start + len;
	
	  return String(str).substring(start,iEnd);
	}

	function Left(str, n){
		if (n <= 0)
		    return "";
		else if (n > String(str).length)
		    return str;
		else
		    return String(str).substring(0,n);
	}

	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);
	    }
	}

function getContenido (contenido) {
	var abreTag = "";
	var contenidoLimpio = "";
	
	contenido = replaceSubstring(contenido, "<HR>", "-----");
	contenido = replaceSubstring(contenido, "&nbsp;", "");
	contenido = replaceSubstring(contenido, "</P>", "{BR}{BR}");
	contenido = replaceSubstring(contenido, "<BR>", "{BR}");
	
	for (i = 0; i < contenido.length; i++) {
		if ((contenido.substring(i, i + 1) == "<") && (abreTag == "")) {
			abreTag = "<";
		}
		if (abreTag == "") {
			contenidoLimpio = contenidoLimpio + contenido.substring(i, i + 1);
		}
		
		if ((contenido.substring(i, i + 1) == ">") && (abreTag != "")) {
			abreTag = "";
		}
	}
	contenidoLimpio = replaceSubstring(contenidoLimpio, "{BR}", "<BR>");
	return contenidoLimpio;
}

function replaceSubstring(inputString, fromString, toString) {
	var temp = inputString;
	if (fromString == "") {
	  return inputString;
	}
	if (toString.indexOf(fromString) == -1) { 
	  while (temp.indexOf(fromString) != -1) {
	     var toTheLeft = temp.substring(0, temp.indexOf(fromString));
	     var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
	     temp = toTheLeft + toString + toTheRight;
	  }
	} else { 
	  var midStrings = new Array("~", "`", "_", "^", "#");
	  var midStringLen = 1;
	  var midString = "";
	
	  while (midString == "") {
	     for (var i=0; i < midStrings.length; i++) {
	        var tempMidString = "";
	        for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
	        if (fromString.indexOf(tempMidString) == -1) {
	           midString = tempMidString;
	           i = midStrings.length + 1;
	        }
	     }
	  }
	  while (temp.indexOf(fromString) != -1) {
	     var toTheLeft = temp.substring(0, temp.indexOf(fromString));
	     var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
	     temp = toTheLeft + midString + toTheRight;
	  }
	  while (temp.indexOf(midString) != -1) {
	     var toTheLeft = temp.substring(0, temp.indexOf(midString));
	     var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
	     temp = toTheLeft + toString + toTheRight;
	  }
	}
	return temp;
}

function emptyObjCmb(obj){
		for (i=0; i < obj.length; i++) {
	 		obj.options[i] = null;
	 	}
	 	obj.options.length = 0;
	}
	
Array.prototype.inArray = function (value)
// Returns true if the passed value is found in the
// array.  Returns false if it is not.
{
    var i;
    for (i=0; i < this.length; i++) {
        // Matches identical (===), not just similar (==).
        if (this[i] === value) {
            return true;
        }
    }
    return false;
};
	