$(document).ready(function() {

    
$('#linkedDatepicker').datepicker({ 
    beforeShow: readSelected,
    onSelect: updateLinked, 
    minDate: 0, 
    maxDate: +365, 
    showOn: 'both', 
    dateFormat:'mm/dd/yy',
    buttonImageOnly: true, 
    buttonImage: 'http://www.ocmdhotels.com/images/ocmdhotels/calendar2.gif',
    gotoCurrent: true
   })
   
var currentTime = new Date()
var amonth = currentTime.getMonth() + 1
var aday = currentTime.getDate()
var ayear = currentTime.getFullYear()
if(amonth<10) amonth= "0" + amonth 

    $('#selectMonth').val(amonth);
    $('#selectDay').val(aday);  
    $('#selectYear').val(ayear); 

    
});

// Prepare to show a date picker linked to three select controls  
function readSelected() {  
    $('#linkedDatepicker').val($('#selectMonth').val() + '/' +  
        $('#selectDay').val() + '/' + $('#selectYear').val());  
    return {};}  


// Update three select controls to match a date picker selection  
function updateLinked(date) {  
    $('#selectMonth').val(date.substring(0, 2));
    $('#selectDay').val(date.substring(3, 5));  
    $('#selectYear').val(date.substring(6, 10));  
}
