$(document).ready(function(){
	//References
	var sections = $("#footerMenu li");
	var termSection = $(".termsMenu li")
	var loading = $("#loading");
	var content = $("#container");
	
	//Manage click events
	sections.click(function(){
		//show the loading bar
		showLoading();
		//load selected section
		switch(this.id){
			case "contact_us":
				//content.fadeOut();
				content.load("sections.html #contact_us", hideLoading);
				content.fadeIn(500);
				break;
			case "maps_direction":
				//content.fadeOut();
				content.load("sections.html #maps_direction", hideLoading);
				content.fadeIn(500);
				break;
			case "amenities_services":
				//content.fadeOut();
				content.load("sections.html #amenities_services", hideLoading);
				content.fadeIn(500);
				break;
			case "special_offer":
				//content.fadeOut();
				content.load("sections.html #special_offer", hideLoading);
				content.fadeIn(500);
				break;
			
			case "room_suites":
				//content.fadeOut();
				content.load("sections.html #room_suites", hideLoading);
				content.fadeIn(500);
				break;
			case "dining_leisure":
				//content.fadeOut();
				content.load("sections.html #dining_leisure", hideLoading);
				content.fadeIn(500);
				break;
				case "banquet_function":
				//content.fadeOut();
				content.load("sections.html #banquet_function", hideLoading);
				content.fadeIn(500);
				break;
			case "new_events":
				//content.fadeOut();
				content.load("sections.html #new_events", hideLoading);
				content.fadeIn(500);
				break;
			case "local_attraction":
				//content.fadeOut();
				content.load("sections.html #local_attraction", hideLoading);
				content.fadeIn(500);
				break;
			case "termsCondition":
				//content.fadeOut();
				content.load("sections.html #termsCondition", hideLoading);
				content.fadeIn(500);
				break;
			case "globalPrivacy":
				//content.fadeOut();
				content.load("sections.html #globalPrivacy", hideLoading);
				content.fadeIn(500);
				break;
			case "rulesRestriction":
				//content.fadeOut();
				content.load("sections.html #rulesRestriction", hideLoading);
				content.fadeIn(500);
				break;
			
		/*	case "external":
				content.fadeOut();
				content.load("external.html", hideLoading);
				content.fadeIn(500);
				break;*/
			default:
				//hide loading bar if there is no selected section	
				hideLoading();
				break;
		}
	});
	
	//Manage click events
	termSection.click(function(){
		//show the loading bar
		showLoading();
		//load selected section
		switch(this.id){
			case "termsCondition":
				//content.fadeOut();
				content.load("sections.html #termsCondition", hideLoading);
				content.fadeIn(500);
				break;
			case "maps_direction":
				//content.fadeOut();
				content.load("sections.html #maps_direction", hideLoading);
				content.fadeIn(500);
				break;
			case "globalPrivacy":
				//content.fadeOut();
				content.load("sections.html #globalPrivacy", hideLoading);
				content.fadeIn(500);
				break;
			case "rulesRestriction":
				//content.fadeOut();
				content.load("sections.html #rulesRestriction", hideLoading);
				content.fadeIn(500);
				break;
			default:
				//hide loading bar if there is no selected section	
				hideLoading();
				break;
		}
	});

	//show loading bar
	function showLoading(){
		loading
			.css({visibility:"visible"})
			.css({opacity:"1"})
			.css({display:"block"})
		;
	}
	//hide loading bar
	function hideLoading(){
		loading.fadeTo(1000, 0);
	};
});
