// (c) AFS 2008

if(!this.AFSBase){AFSConstants={SHORT_MONTHS:['Jan','Fév','Mar','Avr','Mai','Juin','Juil','Aou','Sep','Oct','Nov','Déc']};AFSBase=new function(){this.isset=function(value)
{return(value!=undefined)&&(value!=null);}
this.escapeHTML=function(text)
{return html.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');}
this.formatNumber=function(number,minLength){s=''+number;while(s.length<minLength){s='0'+s;}
return s;}}();Date.prototype.add=function(milliseconds){this.setTime(this.getTime()+Math.floor(milliseconds));}
Date.prototype.addSeconds=function(seconds){this.add(seconds*1000);}
Date.prototype.addDays=function(days){this.addSeconds(days*24*60*60);}
Date.prototype.addMonths=function(months){var m=this.getUTCMonth()+months;this.addYears(Math.floor(m/12));this.setUTCMonth(m%12);}
Date.prototype.addYears=function(years){this.setUTCFullYear(this.getUTCFullYear()+Math.floor(years));}
Date.prototype.getISOString=function(){return AFSBase.formatNumber(this.getUTCFullYear(),4)+'-'
+AFSBase.formatNumber(this.getUTCMonth()+1,2)+'-'
+AFSBase.formatNumber(this.getUTCDate(),2)+'T'
+AFSBase.formatNumber(this.getUTCHours(),2)+':'
+AFSBase.formatNumber(this.getUTCMinutes(),2)+':'
+AFSBase.formatNumber(this.getUTCSeconds(),2)+'Z';}
Date.prototype.setISOString=function(string){if(string.match(/^[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9]Z$/)){this.setUTCSeconds(string.substr(17,2));this.setUTCMinutes(string.substr(14,2));this.setUTCHours(string.substr(11,2));this.setUTCDate(string.substr(8,2));this.setUTCMonth(string.substr(5,2)-1);this.setUTCFullYear(string.substr(0,4));}
else{throw new Error('Invalid ISO date')}}}