function validateValue(strValue, reg_type) {
/*
* DESCRIPTION: Validates that a string a matches a valid regular expression value.
* PARAMETERS:
* strValue - String to be tested for validity
* strMatchPattern - String containing a valid
* regular expression match pattern.
* RETURNS:
* True if valid, otherwise false.
*/
var objRegExp = new RegExp(/^[\sa-zA-Z]+$/);
if  (reg_type == "ALFA") objRegExp = /^[\xD1\xF1\sa-zA-Z]+$/;
else if (reg_type == "ALFNUM") objRegExp = /^[\xD1\xF1\sa-zA-Z0-9]+$/; //Alfa numericos
else if (reg_type == "NUM") objRegExp = /^[0-9]+$/; //numeros
else if (reg_type == "AMNT") objRegExp = /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;  //cantidades monetarias
else if (reg_type == "COMM") objRegExp = /^[\xD1\xF1\s\/\-\.a-zA-Z0-9]+$/; //Campos de texto

 //check if string matches pattern
 return objRegExp.test(strValue);
 
}


/*indica si una cadena esta vacia o solo tiene espacios en blanco*/
function isEmpty(str_val){
	if (str_val.length != 0)
		 for(var m = 0;  m < str_val.length; ++m)
  		 if (str_val.charAt(m) != " ")	return false;
	return true;
}


function validDate(strValue) {
/*
* DESCRIPTION: Valida que la fecha se defina solo
* en formato de 2 digitos para el dia, 2 para el mes,
* y 4 para el aņor. El separador es /.
* Esto se hace a traves de expresiones regulares
* Ej. dd/mm/yyyy
*
* RETURNS:
* true en caso de ser una fecha valida, false en caso contrario.
*
*/
  var objRegExp = /^\d{1,2}(\/)\d{1,2}\1\d{4}$/

  //check to see if in correct format
  if(!objRegExp.test(strValue))
    return false; //el formato de la cadena no es valido
  else{
    var strSeparator = strValue.substring(2,3) //definir el separador usado
    var arrayDate = strValue.split(strSeparator); //dividir en dia, mes y aņo
    //create a lookup for months not equal to Feb.
    var arrayLookup = { '01' : 31,'03' : 31, '04' : 30,'05' : 31,'06' : 30,'07' : 31,
                        '08' : 31,'09' : 30,'10' : 31,'11' : 30,'12' : 31}

	  var intDay = arrayDate[0];
    //checar el mes y dia 
    if(arrayLookup[arrayDate[1]] != null) {
      if(intDay <= arrayLookup[arrayDate[1]] && intDay != 0)
        return true; //es una fecha correcta
    }

    //Febrero se maneja como un caso especial considerando aņos bisiestos
    var intYear = parseInt(arrayDate[2]);
    var intMonth = parseInt(arrayDate[1]);
    if( ((intYear % 4 == 0 && intDay <= 29) || (intYear % 4 != 0 && intDay <=28)) && intDay !=0 && intMonth == 2)
      return true; //Feb. had valid number of days
  }
  return false; //si no se cumplen la condiciones es una fecha incorrecta
}


//utileria de impresion
	  function printit(){ 
	  var NS = (navigator.appName == "Netscape"); 
     if (NS) {
    window.print() ;  
     } else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>'     ;
     document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);
     WebBrowser1.outerHTML = "";  
      }
     }
