  if (!window.$) function $(s) {return document.getElementById(s)};
  function onLoadActions()
  {
		function isPast(d) {
			var tomorrow = new Date();
			tomorrow.setDate(tomorrow.getDate()-1);
			return d < tomorrow;
		}
		$('submitButton').onclick= function()
		{
			if (this.form.onsubmit())
				this.form.submit();
		};
		if ($('reservation-date') && $('travel-date') && $('frmReservation'))
		{
		  Calendar.setup({
				inputField:$('reservation-date'), 
				button:$('reservation-date-calendar'),
				ifFormat:"%m/%d/%Y", 
				step:1, 
				showsTime:false, 
				disableFunc:isPast});
		  Calendar.setup({
				inputField:$('travel-date'), 
				button:$('travel-date-calendar'), 
				ifFormat:"%m/%d/%Y", 
				step:1, 
				showsTime:false,
				disableFunc:isPast});
		  $('frmReservation').onsubmit = function() { return validateForm($('frmReservation')); };			
		  $('reservation-date').onchange = $('travel-date').onchange = function() {
				var d = new Date(this.value);
				var errors='';
				if (!isNaN(d)) {
					if (parseInt(d.getFullYear()/100)==19)
						d.setFullYear(d.getFullYear()+100);
					this.value = d.print('%m/%d/%Y');
					if (isPast(d))
						errors += this.id + ' cannot be in the past';
				}
				else
					errors += this.value + ' is not a valid date';
				$('errors').innerHTML = errors;
				if (errors!='') {
					//scroll(0,0);
					this.className += ' error';
				}
				else
				{
					this.className = this.className.replace(' error','');
					
				}
				
			};
		}
		if (window.MooTools)
		{
			$('shortForm').removeClass('hide');
			var toggle = $('toggleOptional');
			var optionalFields = $$('.optional');
			var toggleOptionalFields = function() {
				optionalFields.each(function(el) {
					el.toggleClass('hide');
					});
			};
			//toggleOptionalFields();
			toggle.addEvent('click', function() {
				toggle.set('html', toggle.get('html')=='Have special requests? Use the full form.'?'In a hurry? Use the quick reservation form':'Have special requests? Use the full form.');
				toggleOptionalFields();
			});
		}
  
  }
  if (window.MooTools)
		window.addEvent('load', onLoadActions);
  else
		window.onload=onLoadActions;

