 /***********************************************************
  //
  // This file is used by Surpass Bookings Systems.
  //
  // Altering ANY INFORMATION on this page may cause the Booking System
  // to stop functioning. 
  // Please do not change any informaiton on this page
  // For more info please contact support@surpassbookings.com.au
  //
  ************************************************************/


function include_dom_script(script_filename) {
    var html_doc = document.getElementsByTagName('head').item(0);
    var js = document.createElement('script');
    js.setAttribute('language', 'javascript');
    js.setAttribute('type', 'text/javascript');
    js.setAttribute('src', script_filename);
    html_doc.appendChild(js);
    return false;
}

function include_dom_css(css_filename) {
    var html_doc = document.getElementsByTagName('head').item(0);
    var js = document.createElement('link');
    js.setAttribute('rel', 'stylesheet');
    js.setAttribute('type', 'text/css');
    js.setAttribute('href', css_filename);
    html_doc.appendChild(js);
    return false;
}

 include_dom_script('http://www.surpassbookings.com.au/scripts/prototype.js');
 include_dom_css('http://www.surpassbookings.com.au/scripts/ar.css')

 include_dom_script('http://www.surpassbookings.com.au/scripts/shadowbox-build-3.0b/shadowbox.js');
 include_dom_css('http://www.surpassbookings.com.au/scripts/shadowbox-build-3.0b/shadowbox.css')

 include_dom_script('http://www.surpassbookings.com.au/scripts/date-picker-v4/js/datepicker.js');
 include_dom_css('http://www.surpassbookings.com.au/scripts/date-picker-v4/css/datepicker.css')

 include_dom_script('http://www.surpassbookings.com.au/scripts/sbs_js_live.js');

function loadSurpass()
{

	var html_body = document.getElementsByTagName('head').item(0);
	var js = document.createElement('script');
	js.setAttribute('language', 'javascript');
	js.setAttribute('type', 'text/javascript');
	js.setAttribute('src', 'http://www.surpassbookings.com.au/scripts/wz_tooltip.js');
	html_body.appendChild(js);

	var adminBod = $('admin_body');
	if (adminBod != null)
	{
		display_Admin_Area('http://www.castawaystrinitybeach.com.au/get_booking_dets.php?pid=grj53');
	}
	display_tours();


}


function loadShadowSpecials()
{	
	Shadowbox.setup("a.sps_shadowbox_spec");
}



function sbsGetAvailability()
{
	var cDay = getSelectedIndexVal('avail_date-dd');
	var cMonth = getSelectedIndexVal('avail_date-mm');
	var cYear = getSelectedIndexVal('avail_date');
	var cDate = cYear+'-'+cMonth+'-'+cDay;

	display_Admin_Area('http://www.castawaystrinitybeach.com.au/get_booking_dets.php?pid=grj53&sdate='+cDate);
}

function display_Admin_Area(PAGE_URL) {
	var URL = PAGE_URL;

	var divSC = $('saving-content');
	if (divSC != null)
	{
		$('saving-content').innerHTML = '  Loading Latest Availability & Rates for Castaways Trinity Beach';
		$('sps_saving').style.display = 'block';
	}

	new Ajax.Request(URL,
	  { method: 'post',

		onSuccess: function (openbox) {
				   var data = openbox.responseText;
				   $('admin_body').innerHTML = data;

				 Shadowbox.setup("a.sps_shadowbox_img");
				 Shadowbox.setup("a.sps_shadowbox_drive");
				 Shadowbox.setup("a.sps_shadowbox_book");
				 Shadowbox.setup("a.sps_shadowbox_spec");
				sbsLoadCal();
				if (divSC != null)
				{
					$('sps_saving').style.display = 'none'; 
				}
		}
	  }
	);
}



