	
	Event.observe(window, 'load', init, false);
	
	function init(){
		Event.observe('tour_date', 'blur', check_tour_date, false);
		Event.observe('tour_id', 'change', check_tour_date, false);
		Event.observe('guests', 'change', get_total, false);
		
		//$('submitform').style.display = 'none';

	}

	function check_tour_date(){
	  	var url = base_url+'reservation/check_tour_date';
		var pars = 'tour_date='+escape($F('tour_date'))+'&tour_id='+escape($F('tour_id'))+'&res_action=check_tour_date';
		var target = 'tour_date_response';
		var myAjax = new Ajax.Updater(target, url, {	method: 'post',	postBody: pars});
		
		new Effect.Appear('tour_date_response');



	}
	
		function get_total(){
		var url = base_url+'reservation/get_total';
		var pars = 'tour_id='+escape($F('tour_id'))+'&guests='+escape($F('guests'))+'&res_action=get_total';
		var target = 'tour_total_response';
		var myAjax = new Ajax.Updater(target, url, {	method: 'post',	postBody: pars});
	}
	
	
	function guest_cost(){
		var url = base_url+'reservation/guest_cost';
		var pars = 'tour_id='+escape($F('tour_id'))+'&res_action=get_tour_per_guest_cost';
		var target = 'guest_cost';
		var myAjax = new Ajax.Updater(target, url, {	method: 'post',	postBody: pars});
	}



/*

window.onload = function () {
	new Ajax.Autocompleter("function_name", "autocomplete_choices", base_url+"application/ajaxsearch/", {});

	$('function_search_form').onsubmit = function () {
		inline_results();
		return false;	
	}
}

function inline_results() {
	new Ajax.Updater ('function_description', base_url+'application/ajaxsearch', {method:'post', postBody:'description=true&function_name='+$F('function_name')});
	new Effect.Appear('function_description');

}
*/