function MostrarMes(frm,dia,mes,anno) { window.open('Mes.asp?hhFrm='+ frm +'&hhDia='+ dia +'&hhMes='+ mes +'&hhAnno='+ anno +'','1','width=300,height=180') } function KeyEnter() { if (window.event.keyCode == 13) { return; } } function pf(num) //parse un numero y lo redondea { var var1; var1 = parseFloat(num); var1 = Math.round(num*100)/100; return var1; } function FechaValida(dia, mes, anio) { var devuelve; if (anio!='') { if ((mes==4 || mes==6 || mes==9 || mes==11 || mes==8 || mes==10 || mes==12) && dia<=30) { devuelve=true; } if ((mes==1 || mes==3 || mes==5 || mes==7 || mes==8 || mes==10 || mes==12) && dia<=31) { devuelve= true; } if (mes == 2) { var isleap = (anio % 4 == 0 && (anio % 100 != 0 || anio % 400 == 0)); if (dia > 29 || (dia == 29 && !isleap)) { devuelve= false; } else { devuelve= true; } } } else { devuelve = false; } return devuelve; }; function EsDecimal(Cadena) { var valor, strValor; if (Cadena.indexOf(',') != -1) return false; strValor = Cadena.replace(',','.'); valor = parseFloat(strValor); if (isNaN(valor)) return false; if (strValor == valor.toString()) return true; else { i = strValor.length - 1; while (strValor.substr(i, 1) == '0' && i >= 0) { strValor = strValor.substr(0, strValor.length - 1); i--; }; if (strValor.substr(strValor.length - 1, 1) == ',') strValor = strValor.substr(0, strValor.length - 1); if (strValor == valor.toString()) return true; else { strValor = strValor.substr(0, strValor.indexOf(',') - 1) return false; } } } function StringVacio(Cadena) { if (Cadena.match(/\S/) != null && Cadena.length > 0) return false else return true; } function EsNumerico(Cadena) { if (Cadena.match(/\D/) != null) { return false; } else { return true; } } function FormatNumber(num,decimalNum,bolLeadingZero,bolParens,bolCommas) /********************************************************************** IN: NUM - the number to format decimalNum - the number of decimal places to format the number to bolLeadingZero - true / false - display a leading zero for numbers between -1 and 1 bolParens - true / false - use parenthesis around negative numbers bolCommas - put commas as number separators. RETVAL: The formatted number! **********************************************************************/ { if (isNaN(parseInt(num))) return "NaN"; var tmpNum = num; var iSign = num < 0 ? -1 : 1; // Get sign of number // Adjust number so only the specified number of numbers after // the decimal point are shown. tmpNum *= Math.pow(10,decimalNum); tmpNum = Math.round(Math.abs(tmpNum)) tmpNum /= Math.pow(10,decimalNum); tmpNum *= iSign; // Readjust for sign // Create a string object to do our formatting on var tmpNumStr = new String(tmpNum); // See if we need to strip out the leading zero or not. if (!bolLeadingZero && num < 1 && num > -1 && num != 0) if (num > 0) tmpNumStr = tmpNumStr.substring(1,tmpNumStr.length); else tmpNumStr = "-" + tmpNumStr.substring(2,tmpNumStr.length); // See if we need to put in the commas if (bolCommas && (num >= 1000 || num <= -1000)) { var iStart = tmpNumStr.indexOf("."); if (iStart < 0) iStart = tmpNumStr.length; iStart -= 3; while (iStart >= 1) { tmpNumStr = tmpNumStr.substring(0,iStart) + "," + tmpNumStr.substring(iStart,tmpNumStr.length) iStart -= 3; } } // See if we need to use parenthesis if (bolParens && num < 0) tmpNumStr = "(" + tmpNumStr.substring(1,tmpNumStr.length) + ")"; return tmpNumStr; // Return our formatted string! } function Right(str, n) { if (n <= 0) return ""; else if (n > String(str).length) return str; else { var iLen = String(str).length; return String(str).substring(iLen, iLen - n); } } function Mid(str, start, len) { if (start < 0 || len < 0) return ""; var iEnd, iLen = String(str).length; if (start + len > iLen) iEnd = iLen; else iEnd = start + len; return String(str).substring(start,iEnd); } function isMail(_email) { var emailReg = /^[a-z][a-z-_0-9\.]+@[a-z-_=>0-9\.]+\.[a-z]{2,3}$/i return emailReg.test(_email); } function isValidEmail(str) { return (str.indexOf(".") > 2) && (str.indexOf("@") > 0); }