// JavaScript Document
// kageredate.js

(function($){
	firstDays=function() {
		var myDay="";
		if ((reunions != null)) {
			myDay=reunions[i][0] + "-" + reunions[i][1] + "-" + reunions[i][2];
		}
		return myDay;
	}
	setDays = function(day, month, year) {
			var result = [true, '', ''];	//par défaut, on affiche la date
			//return [true, "ui-state-hover"];
			var boolReunion = false;
			var rl = 0;
			var i = 0;
			if ((reunions != null)) {
				rl = reunions.length;
				for (i = 0; i < rl; i++) {
					if ((day == reunions[i][0]) && (month == reunions[i][1] - 1) && (year == reunions[i][2])) {
						result = [true, "important", evenname];
						boolReunion = true;
					}
				}
			}
			return result;
	}
	$(function(){
		$('#datepicker').datepicker({
			dateFormat: 'dd-mm-yy',
			firstDay: 1,
			minDate: new Date(2010, 1 - 1, 1),
			maxDate: '+1y + 1m' ,
			defaultDate: $('#vdatepicker').val(),
			//"setDate",new Date ($("#vdatePicker").val())),
			beforeShowDay: function(date) {
				return setDays(date.getDate(), date.getMonth(), date.getFullYear());
			},
			onSelect: function(date) { 
				kageredate(date);                       
			}
		});
		$("a.zoom").fancybox();
		$("a.zoom1").fancybox({
			'overlayOpacity'	:	0.7,
			'overlayColor'		:	'#FFF'
		});
		$("a.zoom2").fancybox({
			'zoomSpeedIn'		:	500,
			'zoomSpeedOut'		:	500,
			'overlayShow'		:	false
		});
	});	
	/* PATCH*/
	$(window).load(function(){
	/*
	* Bricolage indispensable pour colorer les dates choisies
	* chaque fois que le datepicker se redessine !
	*/
	/*
	$("td.important > a", this).css("color","#990000");
			$("td.important > a", this).css("background","#dddddd");
	*/
	$("#datepicker").bind("mouseover", function(){
		if ($("td.important > a", this).eq(0).css("color") != "#ffffff") {
			$("td.important > a", this).css("color","#ffffff");
			$("td.important > a", this).css("background","#3399fe");
			/*("td.important > a", this).css("border-color","#00FF00");*/
			$("td.important > a", this).css("border-color","#CCCCCC");
		}
	});
	$("#datepicker").mouseover();
});	//fin window load
			
})(jQuery);
