
/*
copyright Bart de Jong 2000-2009
*/


function cellaction(cell,action,date) {
	if (action == 'mouseover') {
//		cell.style.backgroundColor = list_mouseover_color;
		if (database.events_on_date(date)) {
			text = database.events_on_date(date);
//			alert(text);
			ddrivetip(text);
		}
		else {
//			window.status += 'n';
		}
	}
	else if (action == 'mouseout') {
		hideddrivetip();
		if (cell.id == 'today') {
//			cell.style.backgroundColor = list_mouseover_color;
		}
		else {
//			cell.style.backgroundColor = 'transparent';
		}
	}
}


function Calendar_event(start_date,name,num_present,participants) {
	this.start_date		= start_date;
	this.name			= name;
	this.num_present	= num_present;
	this.participants	= participants;
}


function addCalendarEvent(start_date,name,num_present,participants) {
	calendar_event = new Calendar_event(start_date,name,num_present,participants);
	this.calendar_events[this.calendar_events.length] = calendar_event;
}


function events_on_date(date) {
//	alert(date);
	text = '';
	ev = false;
	for (i=0; i<this.calendar_events.length; i++) {
		calendar_event = this.calendar_events[i];
//		window.status += this.events[i].start_date;
//window.status += calendar_event.start_date+' == '+date;
		if (calendar_event.start_date == date) {
			text += calendar_event.name;
			ev = true
			if (calendar_event.num_present>0) {
//				text += '<br />met : '+calendar_event.participants+'<br /><br />';
//				text += calendar_event.num_present+' aanwezige(n)<BR>';
			}
		}
	}
	if (text != '') {
		if (ev) {return text+'<br /><br />klik aan voor meer informatie';}
		else {return text;}
	}
	else
		return false;
}


function Calendar() {
	this.calendar_events	= new Array();

	this.addEvent			= addCalendarEvent;
	this.events_on_date		= events_on_date;
}





