$(function()
{
	$('.cal1')
		.dpSetPosition($.dpConst.POS_TOP, $.dpConst.POS_RIGHT)
		.datePicker(
		{
			createButton:false,
			startDate:'06/05/2011',
			month:4,
			year:2012
			
		})
		.bind(
			'click',
			function()
			{
				$(this).dpDisplay();
				this.blur();
				return false;
			}
		)	
		.bind(
			'dateSelected',
			function(e, selectedDate, $td)
			{
				Date.format = 'yyyy-mm-dd';
				var url = '/tf/tripfinder/index.php/launches/search/' + selectedDate.asString();
				window.location.href = url;
			}
		);
	$('.cal2')
		.dpSetPosition($.dpConst.POS_TOP, $.dpConst.POS_RIGHT)
		.datePicker(
		{
			createButton:false,
			startDate:'06/01/2011',
			month:5,
			year:2012
			
		})
		.bind(
			'click',
			function()
			{
				$(this).dpDisplay();
				this.blur();
				return false;
			}
		)	
		.bind(
			'dateSelected',
			function(e, selectedDate, $td)
			{
				Date.format = 'yyyy-mm-dd';
				var url = '/tf/tripfinder/index.php/launches/search/' + selectedDate.asString();
				window.location.href = url;
			}
		);
	$('.cal3')
                .datePicker(
                {
                        createButton:false,
                        startDate:'07/01/2011',
                        month:6,
                        year:2012

                })
                .bind(
                        'click',
                        function()
                        {
                                $(this).dpDisplay();
                                this.blur();
                                return false;
                        }
                )

                .bind(
                        'dateSelected',
                        function(e, selectedDate, $td)
                        {
                                Date.format = 'yyyy-mm-dd';
                                var url = '/tf/tripfinder/index.php/launches/search/' + selectedDate.asString();
                                window.location.href = url;
                        }
                );
	$('.cal4')
                .datePicker(
                {
                        createButton:false,
                        startDate:'08/01/2011',
                        month:7,
                        year:2012

                })
                .bind(
                        'click',
                        function()
                        {
                                $(this).dpDisplay();
                                this.blur();
                                return false;
                        }
                )

                .bind(
                        'dateSelected',
                        function(e, selectedDate, $td)
                        {
                                Date.format = 'yyyy-mm-dd';
                                var url = '/tf/tripfinder/index.php/launches/search/' + selectedDate.asString();
                                window.location.href = url;
                        }
                );
	$('.cal5')
                .datePicker(
                {
                        createButton:false,
                        startDate:'09/01/2011',
                        month:8,
                        year:2012

                })
                .bind(
                        'click',
                        function()
                        {
                                $(this).dpDisplay();
                                this.blur();
                                return false;
                        }
                )

                .bind(
                        'dateSelected',
                        function(e, selectedDate, $td)
                        {
                                Date.format = 'yyyy-mm-dd';
                                var url = '/tf/tripfinder/index.php/launches/search/' + selectedDate.asString();
                                window.location.href = url;
                        }
                );


	$('.date-pick').datePicker();
	$('#cal1').dpSetPosition($.dpConst.POS_TOP, $.dpConst.POS_RIGHT);
        $('#cal2').dpSetPosition($.dpConst.POS_TOP, $.dpConst.POS_RIGHT);
        $('#cal3').dpSetPosition($.dpConst.POS_TOP, $.dpConst.POS_RIGHT);
        $('#cal4').dpSetPosition($.dpConst.POS_TOP, $.dpConst.POS_RIGHT);
		$('#cal5').dpSetPosition($.dpConst.POS_TOP, $.dpConst.POS_RIGHT);
});

