(function()  {

	function formatDate(d) {
        var s = "";
        var curr_date = d.getDate();
        var curr_month = d.getMonth() + 1;
        var curr_year = d.getFullYear();

        s = s + curr_year;
        if (curr_month < 10) {
           s = s + '0';
        }
        s = s + curr_month;
        if (curr_date < 10) {
           s = s + '0';
        }
        s = s + curr_date;
        return s;
    }

    jq14('.date-pick')
        .datePicker({
            inline:true,
            startDate:'01/01/1996'
        }).bind('dateSelected', function(e, selectedDate, $td, state) {
        	var selectedDate = new Date(selectedDate);
        	var link = document.getElementById('runlink');
        	window.location = link.value+"&date="+formatDate(selectedDate);
		})
})();
