	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;
}
