//#============================================================================================
function TrimLeft( str ) {
	var resultStr = "";
	var i = len = 0;

	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str == null)	
		return null;

	// Make sure the argument is a string
	str += "";

	if (str.length == 0) 
		resultStr = "";
	else {	
  		// Loop through string starting at the beginning as long as there
  		// are spaces.
//	  	len = str.length - 1;
		len = str.length;
		
  		while ((i <= len) && (str.charAt(i) == " " || str.charAt(i) == "\n" || str.charAt(i) == "\r") )
			i++;

   	// When the loop is done, we're sitting at the first non-space char,
 		// so return that char plus the remaining chars of the string.
  		resultStr = str.substring(i, len);
  	}

  	return resultStr;
}

//#============================================================================================
function TrimRight( str ) {
	var resultStr = "";
	var i = 0;

	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str == null)	
		return null;

	// Make sure the argument is a string
	str += "";
	
	if (str.length == 0) 
		resultStr = "";
	else {
  		// Loop through string starting at the end as long as there
  		// are spaces.
  		i = str.length - 1;
  		while ((i >= 0) && (str.charAt(i) == " " || str.charAt(i) == "\n" || str.charAt(i) == "\r"))
 			i--;
 			
 		// When the loop is done, we're sitting at the last non-space char,
 		// so return that char plus all previous chars of the string.
  		resultStr = str.substring(0, i + 1);
  	}
  	
  	return resultStr;  	
}

//#============================================================================================
function Trim( str ) {
	var resultStr = "";
	
	resultStr = TrimLeft(str);
	resultStr = TrimRight(resultStr);
	
	return resultStr;
}

//#============================================================================================

function validaextension(objeto, arrayNoAllow)
{
  var extArray;
  //extArray = new Array(".bmp");
  extArray = arrayNoAllow;
  var file=objeto.value;
  allowSubmit = true;
  if(!file) return;
  while (file.indexOf("\\") != -1)
         file = file.slice(file.indexOf("\\") + 1);
  ext = file.slice(file.indexOf(".")).toLowerCase();
  for(var i = 0; i < extArray.length; i++)
       {
		 if (extArray[i] == ext) 
		     { 
			   //Si esta esa extension, no es valida
			   allowSubmit = false; 
			   break;  
			 }
	   }
	   
  //if (allowSubmit==false)
  	   //alert(msgerror1 + (extArray.join("  ")) + "\n" + msgerror2);
  
  return allowSubmit;
}//fin validaextension

//#=============================================================================
function isNumeric(c)
{
        var sNumbers = "01234567890";
        if (sNumbers.indexOf(c) == -1)
                return false;
        else return true;
        
}  
//#=============================================================================
function isAlpha(c)
{
        var lCode = c.charCodeAt(0);
        if (lCode >= 65 && lCode <= 122 )
         {     
                return true;
         }
       else 
        return false;
}  
//#=============================================================================
function isPunct(c)
{
        var lCode = c.charCodeAt(0);
        if (lCode >= 32 && lCode <= 47 )
          {     
                return true;
         }
        else 
        return false;
}
//#=============================================================================
function submitear(nameform, actionform)
{
	str = eval("document.forms."+nameform+".action='"+actionform+"'");
	str = eval("document.forms."+nameform+".submit()");
}
//#=============================================================================
function showMessage(url, ancho, alto, nomvnt) 
{
	izquierda = (screen.width) ? (screen.width-ancho)/2 : 100
	arriba = (screen.height) ? (screen.height-alto)/2 : 100
	opciones = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=' + ancho + ',height=' + alto + ',left=' + izquierda + ',top=' + arriba + ''
	nomvnt = window.open(url, nomvnt, opciones);
	nomvnt.focus();
}	

function showHide(div)

{

	if(div.style.display == "none") 

		div.style.display = "block";

	else

		div.style.display = "none";


}

