function calendar( dates, location, date_style, events_style )
{
	this.dates = dates;
	this.calendar_elmt = document.getElementById( location );
	this.date_style = date_style;
	this.events_style = events_style;
	
	this.display = cldr_display;
	this.all_dates_to_string = cldr_all_dates_to_string;
}


function cldr_display()
{
	this.calendar_elmt.innerHTML = this.all_dates_to_string();
}


function cldr_all_dates_to_string()
{
	var dates_string = "";
	
	for( i = 0; i < this.dates.length; i++ )
	{
		dates_string += this.dates[i].to_string( this.date_style, this.events_style );
		if( i < this.dates.length - 1 ) dates_string += "<br />";
	}
	
	return dates_string;
}




function calendar_date( date, events )
{
	this.date = date;
	this.events = events;
	
	this.to_string = date_to_string;
}


function date_to_string( date_style, events_style )
{
	var date_string = "<span class='" + date_style + "'>" + this.date + "</span><br />";
	
	date_string += "<span class='" + events_style + "'><ul>";
	
	for( j = 0; j < this.events.length; j++ )
		date_string +=  "<li>" + this.events[j] + "</li>";
		
	date_string += "</ul></span>";
	
	return date_string;
}





