﻿Date.firstDayOfWeek = 0;
Date.format = 'yyyy-mm-dd';
$(function()
{

	var d=new Date();
	var thisDate=d.asString();
	d.addMonths(2);
	var limitDate=d.asString();

	$('#SDate')
		.datePicker(
			{
				createButton:false,
				startDate:thisDate,
				endDate:limitDate
			}
		)
		.bind('focus',
			function()
			{
				$(this).dpDisplay();
			}
		)
		.bind('dateSelected',
			function(e, selectedDate, $td){
				showDay('SDateTip', $("#SDate").val());
				$('#EDate').dpSetDisplayedMonth(selectedDate.getMonth(),selectedDate.getFullYear());
			}
		)
		.bind('dpClosed',
			function(){
				$("#EDate").focus();
			}
		)
	$('#EDate')
		.datePicker(
			{
				createButton:false,
				startDate:thisDate,
				endDate:limitDate
			}
		)
		.bind('focus',
			function()
			{
				$(this).dpDisplay();
			}
		)
		.bind('dateSelected',
			function(e, selectedDate, $td){
				showDay('EDateTip', $("#EDate").val());
				$("#totalday").html(dateDiff("D", $("#SDate").val(), $("#EDate").val()));
			}
		)
});


