////////////CALENDAR FUNCTIONS////////////

      // this handler is designed to work both for onSelect and onTimeChange
      // events.  It updates the input fields according to what's selected in
      // the calendar.
	  
      function updateFields(cal) {
              var intdate = cal.selection.get();
              if (intdate) {
                      date = Calendar.intToDate(intdate);
                      document.getElementById("date").value = intdate;//Calendar.printDate(date, "%Y-%m-%d");
					  $("#check_date_button_placeholder").animate({
    						opacity: '0'
  							}, 800, function() {
    							// Animation complete.
								$("#check_date_button_placeholder").css({'display': 'none'});
  						});
					  
					  //$$('#check_date_button_placeholder').set('morph', {duration: '800'});
					  //$$('#check_date_button_placeholder').morph({'opacity': '0'});
              }
      };

	  function changeOfCalendar(cal) {
              var intdate = cal.selection.get();
			  if (intdate) {
				  date = Calendar.intToDate(intdate);
                      document.getElementById("date").value = intdate;//Calendar.printDate(date, "%Y-%m-%d");
              }			  
      };
	  
	  var d = new Date();
	  var todaysDate = Calendar.dateToInt(d);  //get today's date and make the calendar not go lower than that date when selecting
	  
      Calendar.setup({
              cont         : "calendar_container",
              weekNumbers  : false,
              bottomBar    : false,
              onSelect     : updateFields,
			  min: todaysDate
      });
	  
	/*// this makes the clouds move left.. imperfect code
	function executeMoveFrontClouds() {
		$$('#cloud_front1, #cloud_front2').each(function(el) {
	    	var curleft = el.getStyle('left').toInt();
			var minPosition = (((window.getScrollWidth() - 960)/2)+el.getStyle('width').toInt())*-1;
			if (curleft < minPosition)
				curleft = window.getScrollWidth();
			el.setStyle('left', curleft-1);
			
	 	});
	
	}
	function executeMoveBackClouds() {
		$$('#cloud_back1, #cloud_back2').each(function(el) {
	    	var curleft = el.getStyle('left').toInt();
			el.setStyle('left', curleft-1);
			
	 	});
	
	}
	
	setInterval ( "executeMoveFrontClouds()", 300 );
	setInterval ( "executeMoveBackClouds()", 700 );
	*/
	