/**
 * Librairie javascript du calendrier
 *
 * @author		Julie Tétard <julie@2jstudio.com> 
 * @version		2.0
 * @package		Mediaweb
 * @subpackage 	js
 * @category 	calendar
 */
 
 

/**
 * Instructions de chargement des fonctions d'initialisation
 */
	
	MW_smartAttachEvent(window, 'load', MW_calendar_initEvents, false);



/**
 * Fonctions d'initalisation
 */

	/**
	 * Fonction initialisant les actions
	 *
	 * @return		-
	 */
	function MW_calendar_initEvents() 
	{
		// Target des liens
		if (document.getElementById('dates')) {
			var tdTab = document.getElementById('dates').getElementsByTagName('td');
			for (i = 0 ; i < tdTab.length ; i++) {
				if (tdTab[i].className == 'active' || tdTab[i].className == 'filled') {
					MW_smartAttachEvent(tdTab[i], 'click', MW_calendar_loadDate, false);
				}
				if (tdTab[i].innerHTML != '&nbsp;') {
					MW_smartAttachEvent(tdTab[i], 'mouseover', MW_rollOver, false);
					MW_smartAttachEvent(tdTab[i], 'mouseout', MW_rollOut, false);
				}
			}
		}
	}

	/**
	 * Fonction appelant une date du calendrier
	 *
	 * @param		object	event		Objet évenement
	 * @return		-
	 */
	function MW_calendar_loadDate(event) {
		// On récupère l'image cible
		var target = MW_smartGetTarget(event);
		// Append img
		document.location = 'calendar.php?rubId=' + document.getElementById('rubId').value + '&date=' + 
							 + document.getElementById('date').options[document.getElementById('date').selectedIndex].value 
							 + target.innerHTML;
	}

