function hlAccom01() {
	var currentPath=location.href.toString();

	if (currentPath.indexOf('/superior-harbour-view-room/') > 0)
	{
		addClass(document.getElementById("Rm1"), "hl");
	}
	else if (currentPath.indexOf('/deluxe-harbour-view-room/') > 0)
	{
		addClass(document.getElementById("Rm2"), "hl");
	}
	else if (currentPath.indexOf('/grand-deluxe-harbour-view-room/') > 0)
	{
		addClass(document.getElementById("Rm3"), "hl");
	}
	else if (currentPath.indexOf('/premier-harbour-view-room/') > 0)
	{
		addClass(document.getElementById("Rm4"), "hl");
	}
	else if (currentPath.indexOf('/premier-harbour-view-room-with-patio/') > 0)
	{
		addClass(document.getElementById("Rm5"), "hl");
	}
	else if (currentPath.indexOf('/executive-harbour-view-suite/') > 0)
	{
		addClass(document.getElementById("Rm6"), "hl");
	}
	else if (currentPath.indexOf('/premier-harbour-view-suite/') > 0)
	{
		addClass(document.getElementById("Rm7"), "hl");
	}
	else if (currentPath.indexOf('/presidential-suite/') > 0)
	{
		addClass(document.getElementById("Rm8"), "hl");
	}
	else if (currentPath.indexOf('/luxury-hotel-suites/') > 0)
	{
		addClass(document.getElementById("accomType1"), "hl");
	}		
	else if (currentPath.indexOf('/serviced-suites/') > 0)
	{
		addClass(document.getElementById("accomType2"), "hl");
	}	
}

function hlAccom02() {
	var currentPath=location.href.toString();

	if (currentPath.indexOf('/deluxe-harbour-view-room/') > 0)
	{
		addClass(document.getElementById("Rm1"), "hl");
	}
	else if (currentPath.indexOf('/grand-deluxe-harbour-view-room/') > 0)
	{
		addClass(document.getElementById("Rm2"), "hl");
	}
	else if (currentPath.indexOf('/premier-harbour-view-room/') > 0)
	{
		addClass(document.getElementById("Rm3"), "hl");
	}
	else if (currentPath.indexOf('/executive-harbour-view-suite/') > 0)
	{
		addClass(document.getElementById("Rm4"), "hl");
	}
	else if (currentPath.indexOf('/premier-harbour-view-suite/') > 0)
	{
		addClass(document.getElementById("Rm5"), "hl");
	}
	else if (currentPath.indexOf('/presidential-suite/') > 0)
	{
		addClass(document.getElementById("Rm6"), "hl");
	}
	else if (currentPath.indexOf('/harbour-club/') > 0)
	{
		addClass(document.getElementById("accomType3"), "hl");
	}	
}

function hlMedia() {
	var currentPath=location.href.toString();

	if (currentPath.indexOf('/contact-list/') > 0)
	{
		addClass(document.getElementById("btnContact"), "lightBtnContact");
	}else if (currentPath.indexOf('/hotel-brochure/') > 0)
	{
		addClass(document.getElementById("btnDl"), "lightBtnDl");
    }else if (currentPath.indexOf('/photo-gallery/') > 0)
	{
		addClass(document.getElementById("btnGallery"), "lightbtnGallery");
   }
}

//function hlImage(id){
//	var s = document.getElementById(id).src;
//	if s.i
//}

function hlRestaurant() {
	var currentPath=location.href.toString();

	if (currentPath.indexOf('/le-188/') > 0)
	{
		addClass(document.getElementById("restaurant1"), "hl");
	}
	else if (currentPath.indexOf('/kwan-cheuk-heen/') > 0)
	{
		addClass(document.getElementById("restaurant2"), "hl");
	}else if (currentPath.indexOf('/harbour-grand-cafe/') > 0)
	{
		addClass(document.getElementById("restaurant3"), "hl");
	}else if (currentPath.indexOf('/lobby-lounge/') > 0)
	{
		addClass(document.getElementById("restaurant4"), "hl");
	}else if (currentPath.indexOf('/nagomi-restaurant/') > 0)
	{
		addClass(document.getElementById("restaurant5"), "hl");
	}
}

function hlHomeNav() {
	var currentPath=location.href.toString();

	if (currentPath.indexOf('/location/') > 0)
	{
		addClass(document.getElementById("home1"), "hl");
	}
	else if (currentPath.indexOf('/guest-services/') > 0)
	{
		addClass(document.getElementById("home2"), "hl");
	}else if (currentPath.indexOf('/press-release/') > 0)
	{
		addClass(document.getElementById("home3"), "hl");
} else if (currentPath.indexOf('/hong-kong-events/') > 0)
	{
		addClass(document.getElementById("home4"), "hl");
	}
}

function hlFitnessNav() {
	var currentPath=location.href.toString();

	if (currentPath.indexOf('/health-club') > 0)
	{
		addClass(document.getElementById("fitness1"), "hl");
	}
	else if (currentPath.indexOf('/hotel-swimming-pool/') > 0)
	{
		addClass(document.getElementById("fitness2"), "hl");
	}else if (currentPath.indexOf('/spa-treatments/') > 0)
	{
		addClass(document.getElementById("fitness3"), "hl");
	}
}

function hlWeddingsNav() {
	var currentPath=location.href.toString();

	if (currentPath.indexOf('grand-ballroom.html') > 0)
	{
		addClass(document.getElementById("ballroom"), "hl");
    }else if (currentPath.indexOf('salon-rooms.html') > 0)
	{
		addClass(document.getElementById("salon"), "hl");
	}else if (currentPath.indexOf('/venues/') > 0)
	{
		addClass(document.getElementById("venues"), "hl");
    }else if (currentPath.indexOf('/wedding-planning/') > 0)
	{
		addClass(document.getElementById("weddingPlan"), "hl");
    }else if (currentPath.indexOf('/weddings/hong-kong-weddings/') > 0)
	{
		addClass(document.getElementById("hkWeddings"), "hl");
	}
}

function hlEventsNav() {
	var currentPath=location.href.toString();

	if (currentPath.indexOf('grand-ballroom.html') > 0)
	{
		addClass(document.getElementById("ballroom"), "hl");
    }else if (currentPath.indexOf('salon-rooms.html') > 0)
	{
		addClass(document.getElementById("salon"), "hl");
	}else if (currentPath.indexOf('/banquets/') > 0)
	{
		addClass(document.getElementById("venues"), "hl");
	}else if (currentPath.indexOf('/meeting-facilities/') > 0)
	{
		addClass(document.getElementById("meetingFacilities"), "hl");
    }else if (currentPath.indexOf('/private-functions/') > 0)
	{
		addClass(document.getElementById("occasions"), "hl");
	}else if (currentPath.indexOf('/conference-accommodation/') > 0)
	{
		addClass(document.getElementById("conferences"), "hl");
	}
}

function hlContactNav() {
	var currentPath=location.href.toString();

	if (currentPath.indexOf('/contact-list/') > 0)
	{
		addClass(document.getElementById("contact1"), "hl");
	}
	else if (currentPath.indexOf('/enews/') > 0)
	{
		addClass(document.getElementById("contact2"), "hl");
	}
}

function hlTopMenu() {
	var currentPath=location.href.toString();

	if (currentPath.indexOf('/luxury-hotel/') > 0)
	{
		addClass(document.getElementById("luxuryHotel"), "hl");
	}
	else if (currentPath.indexOf('/accommodation/') > 0)
	{
		addClass(document.getElementById("accom"), "hl");
	}
	else if (currentPath.indexOf('/fine-dining/') > 0)
	{
		addClass(document.getElementById("dining"), "hl");
	}
	else if (currentPath.indexOf('/function-venues/') > 0)
	{
		addClass(document.getElementById("meetings"), "hl");
	}
	else if (currentPath.indexOf('/weddings/') > 0)
	{
		addClass(document.getElementById("weddings"), "hl");
	}
	else if (currentPath.indexOf('/fitness-centre/') > 0)
	{
		addClass(document.getElementById("fitness"), "hl");
	}
	else if (currentPath.indexOf('/hotel-packages/') > 0)
	{
		addClass(document.getElementById("offers"), "hl");
	}	
}

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 changeFontS(){
	var classname;
	var fonts = readCookie("fontsize");
	if(fonts != -1 && fonts != 0 && fonts != 1){
		fonts = 0;
	}
	fonts = parseInt(fonts) - 1;

	if (fonts < -1){
		fonts = -1;
	}

	if (fonts == 0){
		classname = "Medium";
	}else if (fonts == -1){
		classname = "Small";
	}else if (fonts == 1){
		classname = "Large";
	}else{
		classname = "Medium";
	}

	removeClass(document.getElementById("wrapper"), "Large");
	removeClass(document.getElementById("wrapper"), "Medium");
	removeClass(document.getElementById("wrapper"), "Small");
	addClass(document.getElementById("wrapper"), ""+classname);

	createCookie("fontsize",fonts,5);
}

function changeFontL(){
	var classname;

	var fonts = readCookie("fontsize");
	if(fonts != -1 && fonts != 0 && fonts != 1){
		fonts = 0;
	}
	fonts = parseInt(fonts) + 1;




	if (fonts > 1){
		fonts = 1;
	}

	if (fonts == 0){
		classname = "Medium";
	}else if (fonts == -1){
		classname = "Small";
	}else if (fonts == 1){
		classname = "Large";
	}else{
		classname = "Medium";
	}

	removeClass(document.getElementById("wrapper"), "Large");
	removeClass(document.getElementById("wrapper"), "Medium");
	removeClass(document.getElementById("wrapper"), "Small");

		addClass(document.getElementById("wrapper"), ""+classname);

	createCookie("fontsize",fonts,5);
}

// cookie script http://www.quirksmode.org/js/cookies.html
function createCookie(name,value,days){
	if (days){
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";

	if(value == null){
		value = 1;
	}else if (value > 1)
	{
		value = 1;
	}else if (value < -1)
	{
		value = -1;
	}

	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name){
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}

	return null;
}

function readFontSize(){
	var classname;

	var fonts = readCookie("fontsize");
	if(fonts != -1 && fonts != 0 && fonts != 1){
		fonts = 0;
	}
	fonts = parseInt(fonts);


	if (fonts > 1)	{
		fonts = 1;
	}

	if (fonts == 0){
		classname = "Medium";
	}else if (fonts == -1){
		classname = "Small";
	}else if (fonts == 1){
		classname = "Large";
	}else{
		classname = "Medium";
	}

	removeClass(document.getElementById("wrapper"), "Large");
	removeClass(document.getElementById("wrapper"), "Medium");
	removeClass(document.getElementById("wrapper"), "Small");

	addClass(document.getElementById("wrapper"), ""+classname);
	
	createCookie("fontsize",fonts,5);
}

/*dreamweaver js function*/

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];}
}

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;
}

/**
 * ========================================
 *
 * chLang
 * ----------------------------------------
 *
 */
 
function chLang(lang) {
	var currentPath=location.href.toString();
	var switchTc='/tc/';
	var switchEn='/en/';
	var switchSc='/sc/';
	var switchJp='/jp/';
	lang = '/'+lang+'/';

	switch (lang){
		case '/jp/':
			currentPath=currentPath.replace(switchTc, switchJp);
			currentPath=currentPath.replace(switchSc, switchJp);
			currentPath=currentPath.replace(switchEn, switchJp);
			break;
		case '/sc/':
			currentPath=currentPath.replace(switchTc, switchSc);
			currentPath=currentPath.replace(switchJp, switchSc);
			currentPath=currentPath.replace(switchEn, switchSc);
			break;
		case '/en/':
			currentPath=currentPath.replace(switchTc, switchEn);
			currentPath=currentPath.replace(switchSc, switchEn);
			currentPath=currentPath.replace(switchJp, switchEn);
			break;
		case '/tc/':
			currentPath=currentPath.replace(switchEn, switchTc);
			currentPath=currentPath.replace(switchSc, switchTc);
			currentPath=currentPath.replace(switchJp, switchTc);
			break;
		default:
	}

	document.location=currentPath;
}
