function ltrim(s){return s.replace(/^\s+/,"");};function rtrim(s){return s.replace(/\s+$/,"");};function trim(s){return rtrim(ltrim(s));};function doNumber(s){return s.replace(/\D/gi,"");};function string(car,num){var t='';for(var i=0;i<num;i++)t+=car;return t;};function FormatNumberCero(N,NumDig){var i=string('0',NumDig)+N;var l=i.length;return i.substring(l-NumDig,l);};function FormatNumber(N,NumDec){var ns=N.toFixed(NumDec);var c=ns.replace(/\x2E/g,',');if(c.indexOf(',')==-1)c+=','+string('0',NumDec);return c;};function FormatDate(oneDate){var theDay=FormatNumberCero(oneDate.getDate(),2);var theMonth=FormatNumberCero(oneDate.getMonth()+1,2);var theYear=FormatNumberCero(oneDate.getFullYear(),4);return theDay+'/'+theMonth+'/'+theYear;};function DateDiff(Fec1,Fec2){var oneMinute=60 * 1000;var oneHour=oneMinute * 60;var oneDay=oneHour * 24;var diff=Fec2.getTime()-Fec1.getTime();return Math.floor(diff/oneDay);};function AddMonth(FecIni,NM){var diasMes=[31,28,31,30,31,30,31,31,30,31,30,31];var theDay=FecIni.getDate();var theMonth=FecIni.getMonth();var theYear=FecIni.getFullYear();var Anos=Math.floor(NM/12);var Meses=NM-(Anos*12);theMonth+=Meses;if(theMonth>11){theMonth-=12;theYear++;};theYear+=Anos;if(theDay>diasMes[theMonth])theDay=diasMes[theMonth];return new Date(theYear,theMonth,theDay,0,0,0);};function StringToDate(Str){var d=parseInt(Str.substr(0,2),10);var m=parseInt(Str.substr(3,2),10);var a=parseInt(Str.substr(6,4),10);return new Date(a,m,d);};