// JavaScript Document
//Extensions de l'Objet Date de Javascript




Date.prototype.addMonth = function(n){
	
	this.setMonth(this.getMonth()+n);

	return 	this;
	
}


Date.prototype.addYear = function(n){

	this.setFullYear(this.getFullYear()+n);
	return 	this;
	
}


Date.prototype.getMonthFirstDay = function(n){

	var _date = new Date(this.getTime());
	_date.setDate(1);
	return _date.getDay();
	
}



Date.prototype.getMonthLength = function(n){
	
	var time = this.getTime();
	var cur_date = new Date(time);
	
	cur_date.setDate(1);
	
	var cur_date_time = cur_date.getTime();
	
	cur_date.setMonth(cur_date.getMonth()+1);

	var next_month_time = cur_date.getTime();
	
	var diff = Math.floor((next_month_time-cur_date_time)/(1000*3600*24));
	
	return diff;
	
}





