var oTitle = document.title;

function swfPageChanged(title, path, skipTracking) {
	SWFAddress.setValue(path);
	SWFAddress.setTitle((title ? title+" | "+oTitle : oTitle));
};

function _pathChangeHandler(event) {
	var fFile = document.getElementById("roomGallery");

	if((!event.pathNames || event.pathNames.length < 1)) {
		try { fFile.showHome(); } catch(err) {};
		return;
	};
	
	try {
		switch(event.pathNames.length) {
			case 1: fFile.showGallery(event.pathNames[0]); break;
			case 2: fFile.showImage(event.pathNames[0],event.pathNames[1]); break;
			default: fFile.showHome(); break;
		};
	} catch(err) { setTimeout(function() { _pathChangeHandler(event); }, 2000); };
};

(function($) {
	$(document).ready(function() {
		var flashvars = { };
		var params = { menu: "false", bgColor:"#A5C885" };
		var attributes = { id: "roomGallery", style:"margin:-15px -5px 0;" };
		swfobject.embedSWF("/flash/RoomGallery.swf?v=1.9.2", "rooms", "720", "560", "9.0.0","/flash/expressInstall.swf", flashvars, params, attributes); 						   
		$('#roomGallery').focus();
	});
	SWFAddress.addEventListener(SWFAddressEvent.CHANGE, _pathChangeHandler); 
})(jQuery);