
//'**************************************************************************
//' Módulo       : Home de Finanzas, submodulo Buscar Emisora
//' Descripción  : Funciones para validar criterio proporcionado por el 
//'				   usuario del portal.
//' Parámetros   : 
//'                
//' Comentarios  : Funciones repetidas en diferentes archivos tanto en español
//'				   como en ingles (Ej.- mercados_stock_search.html y 
//'				   resultados_busqueda.jsp).
//' -------------------------------------------------------------------------
//' 28/05/08	 Eduardo Gonzalez  Creacion del archivo JS para englobar las
//'								   funciones utilizadas por el submodulo Buscar
//'								   Emisora. Se incluye la invocación del script 
//'								   en los archivos :
//'								   /c719_040/jsp/capturaEmisora.jsp
//'								   /esp/finanzas/mercados/resultados_busqueda.jsp
//'								   /eng/finanzas/mercados/resultados_busqueda_eng.jsp
//'*************************************************************************** 


var whitespace = " \t\n\r"

function isWhitespace (s){
   var i;

	// Search through string's characters one by one
	// until we find a non-whitespace character.
	// When we do, return false; if we don't, return true.
	for (i = 0; i < s.length; i++){
		// Check that current character isn´t whitespace.
		var c = s.charAt(i);
		if (whitespace.indexOf(c) == -1) return false;
	}

	// All characters are whitespace.
	return true;
}

function isAlphaString(string){
	for(var i=0;i<string.length;i++){
		if(!isSpanishCharac(string.charAt(i))){
			return false;
		}
	}
	return true;
}

function isAlpha( ch ){
	if ( ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) )
		return true;
	else
		return false;
}

function isSpanishCharac( ch ){
	for(var i=0;i<ch.length;i++){
		if( !isAlpha(ch.charAt(i)) && ch.charAt(i) != 'á' 
			&& ch.charAt(i) != 'é'  && ch.charAt(i) != 'í' 
			&& ch.charAt(i) != 'ó' && ch.charAt(i) != 'ú' 
			&& ch.charAt(i) != 'ñ' && ch.charAt(i) != 'Ñ' 
			&& ch.charAt(i) != 'Á' && ch.charAt(i) != 'É'  
			&& ch.charAt(i) != 'Í' && ch.charAt(i) != 'Ó' 
			&& ch.charAt(i) != 'Ú'){
			return false;
		}
	}
	return true;
}
