litium.cc.fw = {

	// Required version of the Adobed Flash Player plugin.
	requiredFlashVersion: '9.0.0',

	startPage: {

		initTopFlash: function (url) {
			// Embed the flash or load the image slideshow (depending on flash is enabled).
			if (swfobject.hasFlashPlayerVersion(litium.cc.fw.requiredFlashVersion)) {
				swfobject.embedSWF(url, 'topflash', "950", "311", litium.cc.fw.requiredFlashVersion, false, false, { wmode: 'transparent' });
			} else {
				if (typeof slideShowDeluxe !== 'undefined') {
					slideShowDeluxe.load();
				}
			}
		},

		init: function (options) {
			if (options.topFlashUrl) {
				this.initTopFlash(options.topFlashUrl);
			}
		}
	},

	topContent: {

		init: function (options) {
			if (swfobject.hasFlashPlayerVersion(litium.cc.fw.requiredFlashVersion)) {
				swfobject.embedSWF(options.flashUrl, 'topcontentflash', "720", "230", litium.cc.fw.requiredFlashVersion, false, false, { wmode: 'transparent' });
			} 
		}
	},

	bookingForm: {
		init: function () {
			// if the function argument is given to overlay,
			// it is assumed to be the onBeforeLoad event listener
			$("#bookingformlink").overlay({
				close: '.close',
				closeOnClick: false,
				closeOnEsc: false,
				effect: 'casino',
				fixed: true,
				mask: {
					closeSpeed: 0,
					color: '#000',
					loadSpeed: 0,
					opacity: 0.33
				},
				onBeforeLoad: function () {
					// Get url to fetch from link.
					var url = this.getTrigger().attr('href') + '?view=modal';
					// grab wrapper element inside content
					var $wrap = this.getOverlay().children("div:first");
					// load the page specified in the trigger
					$wrap.load(url + ' #bookingform');
				},
				onClose: function (e) {
					$('body:first').removeClass('overlay'); // For print css and progress animation.
				},
				onLoad: function (e) {
					// Event listener triggered when the overlay has been completely displayed.
					$('body:first').addClass('overlay'); // For print css and progress animation.
				},
				speed: 0
			});

			$('#bookingformoverlay').initOverlayCloseButtons();
		}
	}
};
