// Dynamically compute the current year and add 2 more years
var now = new Date;
var thisYear = now.getUTCFullYear();
var nextYear = thisYear + 2;
var thisMonth = now.getMonth() + 1;
var thisDay = now.getUTCDate();

function currentDate() { document.write("Todays Date: " + thisMonth +  "/"  + thisDay + "/" + thisYear); }

$(document).ready(function(){ //jQuery functions will need to be placed inside the ready event so that they are executed when the document DOM has been fully loaded and ready to be manipulated.

	//Reservation Widget Version 1
	$("#startDate").datepicker({
		showOn: "button", 								 
		buttonImage: "css/icn-calendar.gif", 
		buttonImageOnly: true,
		buttonText: 'Date',
		changeMonth: true,
		changeYear: true,
		dateFormat: 'yy-mm-dd',
		yearRange: thisYear + ":" + nextYear, //see date calculation variables above
		//yearRange: "2008:2018",
		monthRange: "January:December"
	});
	
	// validate signup form on keyup and submit
    $("#reservationFrm1").validate({
  rules: {
    arrvDate: {
      required: true,
      dateISO: true
    },
	
	adults: {
      required: true
    },
	
	child: {
      required: true
    },
	
	rooms: {
      required: true
    }
  },
		messages: {
			arrvDate: {
				required: "Arrival Date Required",
				dateISO: "*Invalid Arrival Date Format (2008-12-05)"
			},
			adults: {
				required: "Number of Adults Required"
			},
			child: {
				required: "Number of Children Required"
			},
			rooms: {
				required: "Number of Rooms Required"
			}
		},
		
			errorElement: "li", //wraps the error message in a list element
			errorLabelContainer: "#allErrors ul" //puts errors in an unorderd list
		});
  	 
}); //end of ready event
