$(function(){
// Datepicker from
	$('#from').datepicker({
		inline: true,
		constrainInput: true,
		dateFormat: 'dd-mm-yy',
		onSelect: function(dateText, inst){

			s_date = new array();
			s_date = explode("-", dateText);
			var day = Number(s_date[0]);
			var month = Number(s_date[1]);
			var year = Number(s_date[2]);
			var tomorrow = 	day + parseInt(2);
			start_date = date("d-m-Y", mktime( 0,0,0, month, tomorrow, year)  );
			$("#to").datepicker( "option", "minDate", start_date);
		},
		beforeShow: function(input, inst){
        	inst.dpDiv.css({
            	marginTop: '0px',
                marginLeft: '0px',
				'font-size': '1.1em'
			});

			$("#to").datepicker( "setDate" , '' );
		}
	});
	
	// Datepicker To
	$('#to').datepicker({
		inline: true,
		dateFormat: 'dd-mm-yy',
		constrainInput: true,
        beforeShow: function (textbox, instance) {   
        	instance.dpDiv.css({
            	marginTop: '0px',
                marginLeft: '0px',
				'font-size': '1.1em'			
			});
		}

	});
	



});



$(function(){

	$('#mfrombottom').datepicker({
		inline: true,
		dateFormat: 'dd-mm-yy',
		constrainInput: true,
		onSelect: function(dateText, inst){

			s_date = new array();
			s_date = explode("-", dateText);
			var day = Number(s_date[0]);
			var month = Number(s_date[1]);
			var year = Number(s_date[2]);
			var tomorrow = 	day + parseInt(2);
			start_date = date("d-m-Y", mktime( 0,0,0, month, tomorrow, year)  );
			$("#tobottom").datepicker( "option", "minDate", start_date);
		},

        beforeShow: function (textbox, instance) {   
        	instance.dpDiv.css({
            	marginTop: (-10) + 'px',
                marginLeft: 60-textbox.offsetWidth + 'px',
				'font-size': '13px'
			});
		}

	}); 

	$('#tobottom').datepicker({
		inline: true,
		dateFormat: 'dd-mm-yy',
		constrainInput: true,
        beforeShow: function (textbox, instance) {   
        	instance.dpDiv.css({
            	marginTop: (-10) + 'px',
                marginLeft: 60-textbox.offsetWidth + 'px',
				'font-size': '13px'
			});
		}

	});

	var minBookDate = new Date ();
	var maxBookDate = new Date ();

	minBookDate.setDate(minBookDate.getDate() + 3);	
	maxBookDate.setDate(maxBookDate.getDate() + 8);	 

	var theyear = minBookDate.getFullYear();
	var themonth = minBookDate.getMonth()+1;
	var theday = minBookDate.getDate();
	if(theday<10){
		theday = "0"+themonth;
	}
	if(themonth<10){
		themonth = "0"+themonth;
	}


	$('input#mfrombottom').val(theday+"-"+themonth+"-"+theyear);

	theyear = maxBookDate.getFullYear();
	themonth = maxBookDate.getMonth()+1;
	theday = maxBookDate.getDate();

	if(theday<10){
		theday = "0"+themonth;
	}
	if(themonth<10){
		themonth = "0"+themonth;
	}

	$('input#tobottom').val(theday+"-"+themonth+"-"+theyear);


});
