
/***************************************
 *              jevent.js              *
 ***************************************
 * Jewish holidays and events          *
 ***************************************
 * June 5, 2003 - Sivan 5, 5763        *
 *  v1.1                               *
 *                                     *
 * (c) Gabriel Zerbib,                 *
 *   gabriel@bumpt.net                 *
 *   http://www.bumpt.net              *
 *                                     *
 * It is strictly forbidden to use or  *
 * reproduce all or parts of this      *
 * program without author's explicit   *
 * permission.                         *
 * Commercial use of this program is   *
 * subject to purchase. Please contact *
 * the author.                         *
 ***************************************/

function JEvent(type, startDate, endDate)
{
	this.startDate = startDate;
	this.endDate = endDate;
	this.type = type;

	this.name = "";
	this.link = "";

	this.localize();

	this.format = function()
	{
		switch(this.endDate.minus(this.startDate))
		{
			case 0: return "";
			case 1: return "AND";
			default: return "FROM_TO";
		}
	}

	this.display = function()
	{
		switch(this.format())
		{
			case "AND": case "FROM_TO":
				return this.startDate.WeekdayName() + " " + this.startDate.getDay() + " " + (this.startDate.getMonth() != this.endDate.getMonth() ? this.startDate.MonthName() : "") + " " + this.conj() + " " + this.endDate.WeekdayName() + " " + this.endDate;

			default:
				return this.startDate.WeekdayName() + " " + this.startDate;				
		}
	}
}