function highlightCalendarCell(element,day) {
	//$(element).style.border = '1px solid #999999';
	$("#"+element).css("border","1px solid #999999");
}
	function resetCalendarCell(element) {
		//$(element).style.border = '1px solid #000000';
		$("#"+element).css("border","1px solid #000000");
		
	}
	
	function startCalendar(month, year) {
		//new Ajax.Updater('calendarInternal', 'rpc.php', {method: 'post', postBody: 'action=startCalendar&month='+month+'&year='+year+''});
		$.ajax({
		  url: "index.php/site/showCalendar",
		  type: "post",
		  data: "action=startCalendar&month="+month+"&year="+year,
		  success: function(data){
			$("#calendarInternal").html(data);
		  }
		});
		
	}
	
	function showEventForm(day,isEvent) {
		$('#evt_day').val(day);
		$('#evt_month').val($('#ccMonth').val());
		$('#evt_year').val($('#ccYear').val());
		
		$('#evtDate').val($('#ccMonth').val()+'_'+day+'_'+$('#ccYear').val());
		
		//displayEvents(day, $('#ccMonth').val(), $('#ccYear').val());
		
		if($('#addEventForm').visible) {
			// do nothing.
		} else {
			$('#addEventForm').show();
		}
		
		if(isEvent){
			$('.popup').css('display', 'block');
			displayEvents(day, $('#ccMonth').val(), $('#ccYear').val());
		}
	}
	
	function closePopup(){
		$('.popup').css('display', 'none');
		$("#eventPopup").html('');
	}
	function displayEvents(day, month, year) {
		//new Ajax.Updater('eventList', 'rpc.php', {method: 'post', postBody: 'action=listEvents&&d='+day+'&m='+month+'&y='+year+''});
		$.ajax({
		  url: "index.php/site/showCalendar",
		  type: "post",
		  data: "action=listEvents&d="+day+"&month="+month+"&year="+year,
		  success: function(data){
			$("#eventPopup").html(data);
		  }
		});
		
	}
	
	function highlightEvent(day) {
		$('#addEventForm').hide();
		$('#calendarDay_'+day+'').css('background','#<?= $eventColor ?>');
	}

	$(document).ready(function() {
		// put all your jQuery goodness in here.
		
		startCalendar(0,0);
		
	});
	
	

