// JavaScript Document

function MM_preloadImages() { //v3.0
	var d = document;
	if(d.images)
	{
		if(!d.MM_p) d.MM_p = new Array();
		var i, j = d.MM_p.length, a = MM_preloadImages.arguments;
		for(i = 0; i < a.length; i++)
			if (a[i].indexOf("#") != 0)
			{
				d.MM_p[j] = new Image;
				d.MM_p[j++].src = a[i];
			}
	}
}

function trim(s)
{
	return s.replace(/^\s+|\s+$/g, "");
}

function esvacio(s, mensaje)
{
	if(trim(s) == "") 
	{
		alert(mensaje);
		return true;
	}
	return false;
}

function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

function validarEntero(valor)
{
     //intento convertir a entero.
     //si era un entero no le afecta, si no lo era lo intenta convertir
     valor = parseInt(valor);

      //Compruebo si es un valor numérico
      if (isNaN(valor)) {
            //entonces (no es numero) devuelvo el valor cadena vacia
            return false;
      }else{
            //En caso contrario (Si era un número) devuelvo el valor
            return true;
      }
} 
