function checkEmail() 
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form1.txtEmail.value))
	{
		return (true)
	}
	return (false)
}
function CompruebaDatos(elCIF) 
{
  var resul = false;
  var temp = elCIF.toUpperCase(); // pasar a mayúsculas
  if (!/^[A-Za-z0-9]{9}$/.test(temp))  // Son 9 dígitos? 
  //   alert ("Longitud incorrecta, un CIF consta de 9 dígitos");
	 resul = false;
  else if (!/^[ABCDEFGHKLMNPQS]/.test(temp)) // Es una letra de las admitidas ?
     //alert("El primer dígito es incorrecto, debe ser una letra de las siguientes: A,B,C,D,E,F,G,H,K,L,M,N,P,Q,S ");
	 resul = false;
  else 
     resul = true;
  return resul;
}
// Función de validación del CIF, indica el dígito de control.
// La función recibe el CIF completo: A58818501
/*function ValidaCIF(F) 
{

  var v1 = new Array(0,2,4,6,8,1,3,5,7,9); 
  var temp = 0; 
  var temp1;
  for( i = 2; i <= 6; i += 2 ) 
    {
      temp = temp + v1[ parseInt(F.substr(i-1,1)) ];
      temp = temp + parseInt(F.substr(i,1));
    };
  temp = temp + v1[ parseInt(F.substr(7,1)) ];
  temp = (10 - ( temp % 10));
  if( temp == 10 )
    alert( "El dígito de control es: J ó 0" );
  else
    alert( "El dígito de control es: "+temp ); 
  return true;
}*/
function DevuelveLengthSinEspacios(dato)
{
	return TrimLeft(dato).length;
}
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;
  		while ((i <= len) && (str.charAt(i) == " "))
			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;
}
