/*
	*** Illustratoren Organisation Berlin ***
	JavaScript for www.illustratorenberlin.de
	(c) Mareike Hybsier - http://www.die-programmiererin.de
*/


function highlight_date () {
	var today = new Date();
	var current_month = stringify(today.getMonth() + 1) + stringify(today.getYear() - 100);
	var current_day = today.getDate();
	var dates = document.getElementsByTagName("li");
	
	var _element;
	var _day;
	var _month;
	
	for (var i = 0; i < dates.length; i++) {
		_element = dates[i];
		_day = parseFloat((_element.getAttribute("id")).slice(1,3));	// day of the date - float from string of the format dd
		_month = (_element.getAttribute("id")).slice(3,7);				// month and year of the date - string of format mmyy
		if (_month == current_month) {									// string comparison
			if (_day >= current_day) {									// number comparison
				_element.setAttribute("class", "active");				// set the current date to active
				_element.setAttribute("className", "active");			// dirty hack for Win IE 6 + 7
			} else {
				dates[i + 1].setAttribute("class", "active");			// set the next date to active
				dates[i + 1].setAttribute("className", "active");		// dirty hack for Win IE 6 + 7
			} return;
		}
	}
}

function stringify (_number) {
	return (_number < 10) ? ("0" + _number) : _number;
}