function MM_openBrWindow(theURL,winName,features){
	window.open(theURL,winName,features);
} // end function

function ValidarCaracteres(tipo,checkStr){
	switch(tipo){
		case 0: // solo caracteres
			var checkOK = 'ABCDEFGHIJKLMNÑOPQRSTUVWXYZ' + 'abcdefghijklmnñopqrstuvwxyz ';
			break;
		case 1: // telefono
			var checkOK = '1234567890()- ';
			break;
		case 2: // Todo
			var checkOK = 'ABCDEFGHIJKLMNÑOPQRSTUVWXYZ' + 'abcdefghijklmnñopqrstuvwxyz 1234567890()-_.#°,;';
			break;
	} // end switch
	var allValid = true;
	for (i = 0; i < checkStr.length; i++){
		ch = checkStr.charAt(i);
		for (j = 0; j <= checkOK.length; j++){
			if (ch == checkOK.charAt(j)){
				break;
			} // end if
			if (j == checkOK.length){
				allValid = false;
				break;
			} // end if
		} // end for
		if (!allValid){
			allValid = true;
			return false;
		} // end if
	} // end for
	allValid = true;
	return true;
} // end function

function ValidarEmail(valor) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
		return (true)
	} else {
		return (false);
	} // end if
} // end function

function AllTrim(sString){
	while (sString.substring(0,1) == ' '){
		sString = sString.substring(1, sString.length);
	} // end while
	while (sString.substring(sString.length-1, sString.length) == ' '){
		sString = sString.substring(0,sString.length-1);
	} // end while
	return sString;
} // end function

function ValidarFecha(fecha) {
	dia = fecha.split('/')[0];
	mes = fecha.split('/')[1];
	anyo = fecha.split('/')[2];
	if (anyo % 4 != 0) {
		febrero = 28;
	} else {
		if (anyo % 100 == 0) {
			if (anyo % 400 == 0) {
				febrero = 29;
			} else {
				febrero = 28;
			} // end if
		} else {
			febrero = 29;
		} // end if
	} // end if
	if ((mes == 2) && (dia > 29)) {
		alert('Febrero no tiene ' + dia + ' dias');
		return (false);
	} // end if
	if ((mes == 2) && (dia > febrero)) {
		alert('El año seleccionado no es un año bisiesto');
		return (false);
	} // end if
	if (((mes == 4) || (mes == 6) || (mes == 9) || (mes == 11)) && ((dia > 30))) {
		alert('El mes seleccionado no tiene mas de 30 dias');
		return (false);
	} // end if
	return (true);
} // end function