/**
*@fileoverview Erweiterungen des JavaScript "Date" Objekts
*@author Guido FÆnders, fuenders@traveltainment.de
*/

var monNames = new Array("Sty.","Lut.","Mar.","Kwi.","Maj","Cze.","Lip.","Sie.","Wrz.","Pa"+String.fromCharCode(378)+".","Lis.","Gru.");

function twoDigit(val){
  return parseInt(val,10)<10?"0"+parseInt(val,10):parseInt(val,10);
}
/**
*@param {int} month Anzahl der Monate, um die das Datum erhöht werden soll
* (optional, default=1)
*@addon
*/
Date.prototype.addMonth=function(month){
  if(typeof(month)=='undefined') month=1;
  month = parseInt(month);
  var years=Math.floor(month/12);
  this.addYear(years);
  month = month%12;
  if((this.getMonth()+month)>11){
    this.addYear();
    this.setMonth((this.getMonth()+month)%12);
  }else{
    this.setMonth(this.getMonth()+month);
  }
}

/**
*@param {int} years Anzahl der Jahre, um die das Datum erhöht werden soll
* (optional, default=1)
*@addon
*/
Date.prototype.addYear=function(years){
  if(typeof(years)=='undefined') years=1;
  years = parseInt(years);
  var aktYear = this.getFullYear();
  this.setYear(aktYear+years);
  return this;
};
/**
*@param {int} days Anzahl der Tage, um die das Datum erhöht werden soll
* (optional, default=1)
*@addon
*/
Date.prototype.addDay=function(days){
  if(typeof(days)=='undefined') days=1;
  days = parseInt(days);
  var aktTs = this.getTime();
  var addTs = days*86400000;
  this.setTime(aktTs+addTs);
  return this;
};
/**
*Setzt Die Uhrzeit eines Dateobjekts auf 00:00:00:00 (HH:MM:SS:MS)
*@addon
*/
Date.prototype.resetTime = function(){
  this.setHours(0,0,0,0);
  return this;
};