  $(document).ready(function() {
   bindCalendar();  
  });
  
  function bindCalendar()
  {
    $('.arrDtTextBox').datepicker({ yearRange: '2009',minDate: new Date(2009, 3 - 1, 20), maxDate: new Date(2010, 10 - 1, 31), defaultDate: new Date(2009, 3 - 1, 20), dateFormat: 'dd/mm/yy',nextText:'N',prevText: 'P',hideIfNoPrevNext: true, beforeShowDay: nationalDays,showStatus: true ,firstDay: 1,changeFirstDay: false, initStatus: '', dayStatus: '',statusForDate: describeDate,helpText: '<div class="holidayHelpText">Bank Holidays are marked in yellow</div>',weekStatus: ''} );
    $('.arrivalDateContainerTxtBox').datepicker({ yearRange: '2009',minDate: new Date(2009, 3 - 1, 20), maxDate: new Date(2010, 10 - 1, 31), defaultDate: new Date(2009, 3 - 1, 20), dateFormat: 'dd/mm/yy',nextText:'N',prevText: 'P',hideIfNoPrevNext: true, beforeShowDay: nationalDays,showStatus: true ,firstDay: 1,changeFirstDay: false, initStatus: '', dayStatus: '',statusForDate: describeDate,helpText: '<div class="holidayHelpText">Bank Holidays are marked in yellow</div>',weekStatus: ''} );
    $('.rightLocationBookThirdDdl .ddlYear').datepicker({ yearRange: '2009',minDate: new Date(2009, 3 - 1, 20), maxDate: new Date(2010, 10 - 1, 31), defaultDate: new Date(2009, 3 - 1, 20), dateFormat: 'dd/mm/yy',nextText:'N',prevText: 'P',hideIfNoPrevNext: true, beforeShowDay: nationalDays,showStatus: true ,firstDay: 1,changeFirstDay: false, initStatus: '', dayStatus: '',statusForDate: describeDate,helpText: '<div class="holidayHelpText">Bank Holidays are marked in yellow</div>',weekStatus: ''} );
    $('.rightLocationBookFirstDdlNew .ddlYear').datepicker({ yearRange: '2009',minDate: new Date(2009, 3 - 1, 20), maxDate: new Date(2010, 10 - 1, 31), defaultDate: new Date(2009, 3 - 1, 20), dateFormat: 'dd/mm/yy',nextText:'N',prevText: 'P',hideIfNoPrevNext: true, beforeShowDay: nationalDays,showStatus: true ,firstDay: 1,changeFirstDay: false, initStatus: '', dayStatus: '',statusForDate: describeDate,helpText: '<div class="holidayHelpText">Bank Holidays are marked in yellow</div>',weekStatus: ''} );
  
    $('.arrDtTextBox').attr("READONLY", "true");
    $('.arrivalDateContainerTxtBox').attr("READONLY", "true");
    $('.rightLocationBookThirdDdl .ddlYear').attr("READONLY", "true");
    $('.rightLocationBookFirstDdlNew .ddlYear').attr("READONLY", "true");  
  }
  
  natDays = [[1, 1, 2009, 'NYD', 'New Year Day'], [4, 10, 2009,'GFD','Good Friday'], [4, 13, 2009,'ESD','Easter Monday'], [5, 4, 2009,'EMD', 'Early May Bank Holiday'], [5, 25, 2009,'SPH','Spring Bank Holiday'], [8, 31, 2009,'SUM','Summer Bank Holiday'], [12, 25, 2009,'CHD','Christmas Day'], [12, 28, 2009,'BXD','Boxing Day'], [1, 1, 2010,'NYD','New Year Day'], [4, 2, 2010,'GFD','Good Friday'], [4, 5, 2010,'ESD','Easter Monday'], [5, 3, 2010,'EMD', 'Early May Bank Holiday'], [5, 31, 2010,'SPH','Spring Bank Holiday'], [8, 30, 2010,'SUM','Summer Bank Holiday'], [12, 27, 2010,'CHD','Christmas Day'], [12, 28, 2010,'BXD','Boxing Day']];
    function nationalDays(date) {
    	 //alert(date.getFullYear());
    	 
    	//disabling few dates
	if((date.getMonth() == 0) || (date.getMonth() == 1) || (date.getMonth() == 10) || (date.getMonth() == 11) || ((date.getMonth() == 2) && (date.getDate() < 19)))
	{
	   return [false, 'DisabledDate'];
        }
        for (i = 0; i < natDays.length; i++) {
          if (date.getMonth() == natDays[i][0] - 1 && date.getDate() == natDays[i][1] && date.getFullYear() == natDays[i][2]) {
            //return [false, natDays[i][2] + '_day'];
           //alert('BankHoliday' + natDays[i][3]);
            return [true, 'BankHoliday' + natDays[i][3]];
          }
        }
        
      return [true, ''];
    }


   function describeDate(date)
   {
        for (i = 0; i < natDays.length; i++) {
          if (date.getMonth() == natDays[i][0] - 1 && date.getDate() == natDays[i][1] && date.getFullYear() == natDays[i][2]) {
            //return [false, natDays[i][2] + '_day'];
           //alert('BankHoliday' + natDays[i][3]);
            return '<div>' + natDays[i][4] + '</div>';
          }
        }
        return '';
   }
   
      function ShowCal()
	    { 
	        var flgBtnClicked =  document.getElementById('hdnCalBtnClicked');
	        //alert(flgBtnClicked.value);
	        if(flgBtnClicked.value == "1")
	        {
	         //alert("show");
                //$('.arrDtTextBox').datepicker({ yearRange: '2009',minDate: new Date(2009, 3 - 1, 1), maxDate: new Date(2009, 11 - 1, 30), defaultDate: new Date(2009, 3 - 1, 20), dateFormat: 'dd/mm/yy'});
                //$(".selector").datepicker({ yearRange: '2000:2010' })
            }
            document.getElementById('hdnCalBtnClicked').value="0";     
             //alert(flgBtnClicked.value);       
        }
        
     function ShowCalOnOffers()        
     {
     }
        
        /*
        function SetFocus()
        {
            document.getElementById('hdnCalBtnClicked').value="1";
            document.getElementById('txtDate').focus();
        }
        */
     