addEvent(window, 'load', initBookingStatusForm, false);

var status_form = null;
var status_bkg_number = null;
var status_cnt_name = null;
var status_cnt_number = null;
var show_st_form_div = null;
var st_form_holder = null;
var st_form_content = null;

function initBookingStatusForm()
{
	status_form = id('status_form');

	if(status_form != null) {	
		status_bkg_number = id('status_booking_number');
		status_cnt_name = id('status_contact_name');
		status_cnt_number = id('status_contact_number');
		show_st_btn_holder = id('show_status_button_holder');
		st_form_holder = id('status_form_holder');
		st_form_content = id('status_form_content');		
	}
}

function showStatusForm()
{

	if(show_st_btn_holder.className == 'btn_disclosure expand'){
		show_st_btn_holder.className = 'btn_disclosure collapse';
		st_form_holder.style.display = 'block';
	} else {
		show_st_btn_holder.className = 'btn_disclosure expand';
		st_form_holder.style.display = 'none';
	}
	
}

function callShowBookingStatus()
{
	ajax_call('ca=website.booking_status&status_booking_number=' + status_bkg_number.value + '&status_contact_name=' + status_cnt_name.value + '&status_contact_number=' + status_cnt_number.value, 'bookingStatusReturned');
}

function loadStatusForm()
{
	ajax_call('ca=website.booking_status_form&status_booking_number=' + status_bkg_number.value + '&status_contact_name=' + status_cnt_name.value + '&status_contact_number=' + status_cnt_number.value, 'bookingStatusReturned');
}

function callCancelBooking()
{
	ajax_call('ca=website.status_cancel_action&status_booking_number=' + status_bkg_number.value + '&status_contact_name=' + status_cnt_name.value + '&status_contact_number=' + status_cnt_number.value, 'bookingStatusReturned');
}

function bookingStatusReturned(result)
{
	st_form_content.innerHTML = result;
	initBookingStatusForm();
}
