$(function(){
	$('#booknowform').ajaxForm(function() { 
        $('#booknowform').hide();
        $('#thankyou_div').fadeIn();
		return false;
    }); 
	
	$('select').bind('change',function(){
		$('#'+$(this).attr('id')+'_span').text($(this).val());
	});
	$('.selectspan').css('display','block');
	
	
	$('#arrive').datepicker({ 
		showAnim: 'show',
		duration: '',
		onClose: function(date) { 
			if (date=='calendar') return false;
			($('#start_d')[0]).selectedIndex = date.substring(3,5) - 1;
			$('#start_d_span').text(date.substring(3,5));
			($('#start_m')[0]).selectedIndex = date.substring(0,2) - 1;
			$('#start_m_span').text(date.substring(0,2));
			($('#start_y')[0]).selectedIndex = date.substring(6) - 2008;
			$('#start_y_span').text(date.substring(6));
			$(this).val('calendar');
		}
	});	
	
	$('#depart').datepicker({ 
		showAnim: 'show',
		duration: '',
		onClose: function(date) { 
			if (date=='calendar') return false;
			($('#end_d')[0]).selectedIndex = date.substring(3,5) - 1;
			$('#end_d_span').text(date.substring(3,5));
			($('#end_m')[0]).selectedIndex = date.substring(0,2) - 1;
			$('#end_m_span').text(date.substring(0,2));
			($('#end_y')[0]).selectedIndex = date.substring(6) - 2008;
			$('#end_y_span').text(date.substring(6));
			$(this).val('calendar');
		}
	});
	
	if ($.browser.safari){
		$('select').css('opacity','0');
	}
	
	$('#ui-datepicker-div').css({top: '0px', left: '0px'}).appendTo('#datepicker_place');
});
