﻿// JavaScript Document
/*dreamweaver js function*/

function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
}
function mainPlay() {
	if(thisMovie("frontVisual")) thisMovie("frontVisual").menuPlay();
}
function mainPause() {
	if(thisMovie("frontVisual")) thisMovie("frontVisual").menuPause();
}
	 
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


/**
 * ========================================
 *
 * chLang
 * ----------------------------------------
 *
 */
 
function chLang(lang) {
	var currentPath=location.href.toString();
	var switchTc='/chi/';
	var switchSc='/gbx/';
	var switchEn='/eng/';
	var switchJp='/jp/';
	lang = '/'+lang+'/';

	switch (lang){
		case '/eng/':
			currentPath=currentPath.replace(switchTc, switchEn);
			currentPath=currentPath.replace(switchSc, switchEn);
			currentPath=currentPath.replace(switchJp, switchEn);
			break;
		case '/chi/':
			currentPath=currentPath.replace(switchEn, switchTc);
			currentPath=currentPath.replace(switchSc, switchTc);
			currentPath=currentPath.replace(switchJp, switchTc);
			break;
		case '/gbx/':
			currentPath=currentPath.replace(switchEn, switchSc);
			currentPath=currentPath.replace(switchTc, switchSc);
			currentPath=currentPath.replace(switchJp, switchSc);
			break;
		case '/jp/':
			currentPath=currentPath.replace(switchEn, switchJp);
			currentPath=currentPath.replace(switchTc, switchJp);
			currentPath=currentPath.replace(switchSc, switchJp);
			break;	
		default:
	}

	document.location=currentPath;
}

/**
 * ========================================
 *
 * ajax function
 * ----------------------------------------
 *
 */
var submenu;
$(document).ready(function(){
	
	$('.btn-likebox').click(function(){
		$('.facebook-likebox').show();
    })
	
	$('.facebook-likebox').mouseover(function(){
		$('.facebook-likebox').show();
	}).mouseout(function(){
		$('.facebook-likebox').hide();
	});
	
						 
    $('.master').fadeIn(2000);
    $('.frontHeader, .frontFooter').fadeIn(2000);
	$('.outerFade').css('opacity','0'); //for FF
	$('#inner').css('filter','alpha(opacity=0)'); //for IE
	//$('#inner h4').hide();
	

     $("menu a[class^='m']")
		.css( {backgroundPosition: "0px 0px"} )
		.mouseover(function(){
			mainPause();
			$("menu a[class^='m']").each(function(index){
				$(this).stop().animate({backgroundPosition:"(0px 0px)"}, {duration:200, complete:function(){
						$(this).css({backgroundPosition: "0px 0px"})
				}});
				//$(this).next().hide(); //hide submenu when mouseover other main menu
				//return false
			});
			$(this).stop().animate({backgroundPosition:"(0px -29px)"}, {duration:200});
			
			if ($(this).parent().children("ul").size() == 1)
			{
				$(this).next().mouseover(function() {
					  $(this).prev().stop().animate({backgroundPosition:"(0px -29px)"}, {duration:200});
					  $(this).stop().show();
					  return false;
					  $("menu ul li").children('a').mouseout(function(){
													$(this).delay(200);
													return true;
					  });
				 });
/*
				 $(this).next().mouseout(function(){
					$(this).prev().stop().animate({backgroundPosition:"(0px 0px)"}, {duration:200, complete:function(){
						$(this).prev().css({backgroundPosition: "0px 0px"});
						$('menu ul').hide();
						return false;
					  //$("menu ul li").children('a').css("color","green");
					}});					
					
				});
				\*/
				$(this).next().stop().show();// Show the submenu
			}else{
				$(this).mouseout(function(){
					mainPlay();
					$(this).stop().animate({backgroundPosition:"(0px 0px)"}, {duration:200, complete:function(){
						$(this).css({backgroundPosition: "0px 0px"});
					}});
				});
			}
			
			
		});
	
	$("menu").mouseout(function(){
			mainPlay();
			$("menu a[class^='m']").each(function(index){
				$(this).stop().animate({backgroundPosition:"(0px 0px)"}, {duration:200, complete:function(){
						$(this).css({backgroundPosition: "0px 0px"});
					}});

				$(this).next().hide();
				return false;
			});
	});

    //$(".m01").hover(function(){$(this).next("ul").show();});
					
    //top menu end
		//change languages
		//$(".eng, .chi, .shi").css("display","none");
		$(".chanLang li:first").nextAll("li").hide();
		$(".chanLang").mouseenter(function(){
			$(".chanLang li:first").nextAll("li").fadeIn(500);
			$(".sel").addClass("active");
		}).mouseleave(function(){
			$(".chanLang li:first").nextAll("li").fadeOut(500);
			$(".sel").removeClass("active");
		});
		
		//load music
		//$(".header .bg-music").load("../frame-music.html");

});


//START inner content fade in - control by flash
function showContent(){
	$('.flashOpen').fadeOut(2000);
	// animate opacity to nill
	$('.outerFade, #inner').animate({
		opacity: 1
	}, 2000, function() {
	  //$('#inner h4').show(400);
      //this.style.removeAttribute("filter");
  });
	  
	
    //$('#inner').style.removeAttribute("filter");

}
//END inner content fade in - control by flash

/**
 * ========================================
 *
 * menu highlight
 * ----------------------------------------
 *
 *
 *
 *
 */
 
 
function hasClass(ele,cls) {

	return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));

} 

function addClass(ele,cls) {

	if (!this.hasClass(ele,cls)) ele.className += " "+cls;

}

function removeClass(ele,cls) {
	if (hasClass(ele,cls)) {
		var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
		ele.className=ele.className.replace(reg,' ');
	}
}


function hlRoom() {
	var currentPath=location.href.toString();

	if (currentPath.indexOf('city-view-room.html') > 0)
	{
		addClass(document.getElementById("cvr"), "current");
	}
	else if (currentPath.indexOf('hill-view-room.html') > 0)
	{
		addClass(document.getElementById("hvr"), "current");
	}
	else if (currentPath.indexOf('city-view-suite.html') > 0)
	{
		addClass(document.getElementById("cvs"), "current");
	}
	else if (currentPath.indexOf('aqua-room.html') > 0)
	{
		addClass(document.getElementById("ar"), "current");
	}
	else if (currentPath.indexOf('grand-aqua-suite.html') > 0)
	{
		addClass(document.getElementById("gas"), "current");
	}
	else if (currentPath.indexOf('aqua-suite.html') > 0)
	{
		addClass(document.getElementById("as"), "current");
	}
}

/**
 *
 *
 *
 *
 */
function hlDining() {
	var currentPath=location.href.toString();

	if (currentPath.indexOf('bar-lis.html') > 0)
	{
		addClass(document.getElementById("bar"), "current");
	}
	else if (currentPath.indexOf('lis.html') > 0)
	{
		addClass(document.getElementById("li"), "current");
	}
	else if (currentPath.indexOf('vip-rooms.html') > 0)
	{
		addClass(document.getElementById("vip"), "current");
	}
	else if (currentPath.indexOf('DiningRequestForm') > 0)
	{
		addClass(document.getElementById("DiningRequestForm"), "current");
		addClass(document.getElementById("vip"), "current");
	}
	
	else if (currentPath.indexOf('lis-lounge.html') > 0)
	{
		addClass(document.getElementById("ll"), "current");
	}
		else if (currentPath.indexOf('events.html') > 0)
	{
		addClass(document.getElementById("eve"), "current");
	}
		else if (currentPath.indexOf('outside-catering.html') > 0)
	{
		addClass(document.getElementById("out"), "current");
	}
	else if (currentPath.indexOf('/dining/') > 0)
	{
		addClass(document.getElementById("li"), "current");
	}
}
/**
 *
 *
 *
 *
 */
function hlDiscovery() {
	var currentPath=location.href.toString();

	if (currentPath.indexOf('shopping.html') > 0)
	{
		addClass(document.getElementById("shop"), "current");
	}
	else if (currentPath.indexOf('entertainment.html') > 0)
	{
		addClass(document.getElementById("ent"), "current");
	}
	else if (currentPath.indexOf('dining.html') > 0)
	{
		addClass(document.getElementById("din"), "current");
	}
	else if (currentPath.indexOf('hiking.html') > 0)
	{
		addClass(document.getElementById("hik"), "current");
	}
	else if (currentPath.indexOf('events.html') > 0)
	{
		addClass(document.getElementById("deve"), "current");
	}
	else if (currentPath.indexOf('heritage.html') > 0)
	{
		addClass(document.getElementById("her"), "current");
	}
	else if (currentPath.indexOf('culture.html') > 0)
	{
		addClass(document.getElementById("cul"), "current");
	}
	else if (currentPath.indexOf('/discovery/') > 0)
	{
		addClass(document.getElementById("shop"), "current");
	}
}
/**
 *
 *
 *
 *
 */
function hlServices() {
	var currentPath=location.href.toString();

	if (currentPath.indexOf('smart-services.html') > 0)
	{
		addClass(document.getElementById("sma"), "current");
	}
	else if (currentPath.indexOf('vip-rooms.html') > 0)
	{
		addClass(document.getElementById("vip"), "current");
	}
	else if (currentPath.indexOf('gym.html') > 0)
	{
		addClass(document.getElementById("gym"), "current");
	}
		else if (currentPath.indexOf('in-room-dining.html') > 0)
	{
		addClass(document.getElementById("inr"), "current");
	}
		else if (currentPath.indexOf('business-services.html') > 0)
	{
		addClass(document.getElementById("bus"), "current");
	}
		else if (currentPath.indexOf('service-call-centre.html') > 0)
	{
		addClass(document.getElementById("ser"), "current");
	}
		else if (currentPath.indexOf('technology.html') > 0)
	{
		addClass(document.getElementById("tec"), "current");
	}
		else if (currentPath.indexOf('city-shuttle-service.html') > 0)
	{
		addClass(document.getElementById("cit"), "current");
	}
	else if (currentPath.indexOf('/services/') > 0)
	{
		addClass(document.getElementById("sma"), "current");
	}
}
/**
 *
 *
 *
 *
 */
function hlLocation() {
	var currentPath=location.href.toString();

	if (currentPath.indexOf('location-map.html') > 0)
	{
		addClass(document.getElementById("location"), "current");
	}
	else if (currentPath.indexOf('how-to-get-here.html') > 0)
	{
		addClass(document.getElementById("here"), "current");
	}
}
/**
 *
 *
 *
 *
 */
function hlWhatsnew() {
	var currentPath=location.href.toString();

	if (currentPath.indexOf('new.html') > 0)
	{
			//revise it everytime start
		addClass(document.getElementById("buffetdinner"), "current");
			//revise it everytime end
	}
		else if (currentPath.indexOf('buffetdinner_menu.html') > 0)
	{
		addClass(document.getElementById("buffetdinner"), "current");
		addClass(document.getElementById("buffetdinner1"), "current");
	}
	else if (currentPath.indexOf('buffetdinner.html') > 0)
	{
		addClass(document.getElementById("buffetdinner"), "current");
	}
	else if (currentPath.indexOf('delectable_buffet.html') > 0)
	{
		addClass(document.getElementById("delectable"), "current");
	}
	else if (currentPath.indexOf('christmas_hampers.html') > 0)
	{
		addClass(document.getElementById("hampers"), "current");
	}
	else if (currentPath.indexOf('early_bird.html') > 0)
	{
		addClass(document.getElementById("early"), "current");
	}
	else if (currentPath.indexOf('real_christmas_cheer.html') > 0)
	{
		addClass(document.getElementById("Christmas"), "current");
	}
	else if (currentPath.indexOf('new-bar-lis-promotion.html') > 0)
	{
		addClass(document.getElementById("bar"), "current");
	}
		else if (currentPath.indexOf('mar_banquet.html') > 0)
	{
		addClass(document.getElementById("mar"), "current");
	}
		else if (currentPath.indexOf('mar_menu.html.html') > 0)
	{
		addClass(document.getElementById("mar"), "current");
		addClass(document.getElementById("mar1"), "current");
	}
		else if (currentPath.indexOf('mar_menu.html') > 0) 
	{
		addClass(document.getElementById("mar"), "current");
		addClass(document.getElementById("mar1"), "current");
	} 
	//copy start
		else if (currentPath.indexOf('new-crabs.html') > 0) 
	{
		addClass(document.getElementById("crabs"), "current");
	} 
	//copy start
		else if (currentPath.indexOf('best_hotel.html') > 0) 
	{
		addClass(document.getElementById("best"), "current");
	} 
	//copy end
	//copy start
		else if (currentPath.indexOf('mediterranean_breezes.html') > 0) 
	{
		addClass(document.getElementById("french"), "current");
	} 
	//copy end
	//copy start
		else if (currentPath.indexOf('op.html') > 0) 
	{
		addClass(document.getElementById("op"), "current");
	} 
	//copy end
		else if (currentPath.indexOf('new-celebrate-chinese-new-year-at-lhotel-island-south2.html') > 0) 
	{
		addClass(document.getElementById("chiny2-1"), "current");
	} 
		else if (currentPath.indexOf('new-extension-of-buy-2-get-1-free-offer.html') > 0) 
	{
		addClass(document.getElementById("aberdeen"), "current");
	} 
	    else if (currentPath.indexOf('20110616.html') > 0) 
	{
		addClass(document.getElementById("sea"), "current");
	} 
		else if (currentPath.indexOf('cake-promotion.html') > 0)
	{
		addClass(document.getElementById("cake"), "current");
	}
		else if (currentPath.indexOf('cake-menu.html') > 0) 
	{
		addClass(document.getElementById("cake"), "current");
		addClass(document.getElementById("cake2"), "current");
	} 
		else if (currentPath.indexOf('geopark-home.html') > 0) 
	{
		addClass(document.getElementById("geopark"), "current");
	} 
		else if (currentPath.indexOf('geopark-p.html') > 0) 
	{
		addClass(document.getElementById("geopark1"), "current");
		addClass(document.getElementById("geopark"), "current");
	} 
		else if (currentPath.indexOf('geopark-m.html') > 0) 
	{
		addClass(document.getElementById("geopark2"), "current");
		addClass(document.getElementById("geopark"), "current");
	} 
		else if (currentPath.indexOf('new-extension-of-buy-2-get-1-free-offer1.html') > 0) 
	{
		addClass(document.getElementById("extension1"), "current");
	} 
		else if (currentPath.indexOf('new-extension-of-buy-2-get-1-free-offer-ecoupon.html') > 0) 
	{
		addClass(document.getElementById("extension1"), "current");
		addClass(document.getElementById("extension2"), "current");
	} 
		else if (currentPath.indexOf('new-aqua-promotion.html') > 0) 
	{
		addClass(document.getElementById("aqua"), "current");
	}  
		else if (currentPath.indexOf('wedding-package-1.html') > 0) 
	{
		addClass(document.getElementById("wp1"), "current");
	}  
		else if (currentPath.indexOf('wedding-package-2.html') > 0) 
	{
		addClass(document.getElementById("wp2"), "current");
		addClass(document.getElementById("wp1"), "current");
	}  
		else if (currentPath.indexOf('wedding-package-3.html') > 0) 
	{
		addClass(document.getElementById("wp3"), "current");
		addClass(document.getElementById("wp1"), "current");
	}  
		else if (currentPath.indexOf('wedding-package-4.html') > 0) 
	{
		addClass(document.getElementById("wp4"), "current");
		addClass(document.getElementById("wp1"), "current");
	}  
		else if (currentPath.indexOf('wedding-package-5.html') > 0) 
	{
		addClass(document.getElementById("wp5"), "current");
		addClass(document.getElementById("wp1"), "current");
	}  
		else if (currentPath.indexOf('wedding-package-6.html') > 0) 
	{
		addClass(document.getElementById("wp6"), "current");
		addClass(document.getElementById("wp1"), "current");
	}  
		else if (currentPath.indexOf('wedding-package-7.html') > 0) 
	{
		addClass(document.getElementById("wp7"), "current");
		addClass(document.getElementById("wp1"), "current");
	}  
		else if (currentPath.indexOf('photo.html') > 0)
	{
		addClass(document.getElementById("photo"), "current");
	}
	else if (currentPath.indexOf('video.html') > 0)
	{
		addClass(document.getElementById("video"), "current");
	}

}

/**
 *
 *
 *
 *
 */
/**
 *
 *
 *
 *
 */


/*gobal background image height for ie*/

/*$(document).ready(function(){
  	gobal();
})

$(window).resize(function(){
	gobal();	
	
})

function gobal(){
	
var _wHeight = $(window).height();
$(window).scroll(function(){
if(_wHeight <= 768)
	{
			var wsct = $(this).scrollTop()
			if(wsct >= 100){
			$('.global').css({'background-position':'center bottom'})
		}
		else{
			$('.global').css({'background-position':'center top'})
		}
	}
else{
	$('.global').css({'background-position':'center top'})
}
})
}*/
