/* jQuery.noConflict(); */
try{
		jQuery(document).ready(function(){
					
			if(jQuery().fancybox){ //namespace check
				jQuery("#mod_pukkagalleries div.picture a, a[rel*=lightbox]").fancybox({ 
					'zoomSpeedIn': 500,
					'zoomSpeedOut': 500,
					'zoomOpacity':true
				});
				$(".iframe").fancybox({ 
					'zoomSpeedIn': 500,
					'zoomSpeedOut': 500,
					'zoomOpacity':true,
					'frameWidth':500,
					'frameHeight':370
				});
				jQuery("#content div.video a").fancybox({ 
					'zoomSpeedIn': 500,
					'zoomSpeedOut': 500,
					'zoomOpacity':true,
					'frameWidth':420,
					'frameHeight':370
				});
				jQuery("a#fancyOpen").fancybox({ 
					'zoomSpeedIn': 500,
					'zoomSpeedOut': 500,
					'zoomOpacity':true,
					'frameWidth':420,
					'frameHeight':370
				});
			}
			
			if(jQuery.browser.msie && jQuery.browser.version=="6.0"){				
				jQuery("#main-menu .hong-kong h2:first,#main-menu .kowloon h2:first,#main-visual .welcome-text .header:first,#main-content h2:first,#main-content .video .category .play-button:first").css("opacity",.7);
			}
			jQuery("#main-menu .hong-kong h2:first,#main-menu .kowloon h2:first ").css("cursor","pointer");
			
			jQuery("#main-menu .hong-kong,#main-menu .kowloon").animate({
				"top":297
			},1500);
			
			var timeoutHK;
			var timeoutKW;
			var slidedowntimerHK;
			var slidedowntimerKW;
			jQuery("#main-menu .hong-kong,#main-menu .kowloon").hover(function(){
				var item=jQuery(this);
				if(item.hasClass("hong-kong")) {
					clearTimeout(slidedowntimerHK)
				}else{
					clearTimeout(slidedowntimerKW);
				}
				var top=item.css("top");
				if(item.hasClass("hong-kong")) {
					timeoutHK = setTimeout(function(){
						if(top=="297px"){
							item.animate({
								"top":263
							},500,"easeOutQuad");
						}				
					},200)
				}else{
					timeoutKW = setTimeout(function(){
						if(top=="297px"){
							item.animate({
								"top":263
							},500,"easeOutQuad");
						}				
					},200)					
				}
			},function(){
				var item=jQuery(this);
				if(item.hasClass("hong-kong")) {
					clearTimeout(timeoutHK)
				}else{
					clearTimeout(timeoutKW);
				}
				var top=parseInt(item.css("top").replace(/px/,""));
				if(top>=263 && top<=297){
					if(item.hasClass("hong-kong")) {
						slidedowntimerHK =setTimeout(function(){	
							item.animate({
								"top":297
							},800,"easeOutQuad");
						},4000);
					}else{
						slidedowntimerKW =setTimeout(function(){	
							item.animate({
								"top":297
							},800,"easeOutQuad");
						},4000);
					}
				}
			});
			
			var weatherWidget=jQuery("#weatherandtime");
			jQuery("#page_default #welcome .intro").css("opacity",.7);
			
			jQuery("#page_default #welcome .header .read-more").click(function(){
				var welcome=jQuery(this).parent().parent();
				var divWelcomeHeight=welcome.innerHeight();
				var headerHeight=jQuery(this).parent().innerHeight();
				var animateHeight=(divWelcomeHeight-headerHeight);
				var animate="";
				var up=false;
				if(welcome.hasClass("up")){
					animate="+="+animateHeight+"px";
					up=true;
				}else{
					animate="-="+animateHeight+"px";
					up=false;
				}
				
				welcome.stop().animate({
					"top":animate
				},600,function(){
					(up) ? welcome.removeClass("up") : welcome.addClass("up");
				});
				weatherWidget.stop().animate({
					"top":animate
				},600);
				
				
				
				return false;
			});
			
			
			jQuery('#special-offers div.rotate') 
				.after('<div id="nav">') 
				.cycle({ 
					fx:     'fade', 
					speed:  'slow', 
					timeout: 8000, 
					pager:  '#special-offers #nav',
					height:'auto'
				});
			jQuery('#special-offers #nav a').addClass("link");
			

		
		
// Font Size Controls
			var originalFontSize = jQuery("#main-content.harbour_grand p").css("font-size");
			
			// if exists load saved value, otherwise store it
			if(jQuery.cookie('mainFontSize')) {
				var jQuerygetSize = jQuery.cookie('mainFontSize');
				jQuery("#main-content.harbour_grand p").css({fontSize : jQuerygetSize + (jQuerygetSize.indexOf("px")!=-1 ? "" : "px")}); // IE fix for double "pxpx" error
			} else {
				jQuery.cookie('mainFontSize', originalFontSize);
			}
			
			// Reset Font Size
			var originalFontSize = jQuery('#main-content.harbour_grand p').css('font-size');
			jQuery(".resetFont").click(function(){
			jQuery('#main-content p').css('font-size', originalFontSize);
			});
			
			// Increase Font Size
			jQuery(".increaseFont").click(function(){
				var currentFontSize = jQuery('#main-content.harbour_grand p').css('font-size');
				var currentFontSizeNum = parseFloat(currentFontSize, 16);
				var newFontSize = currentFontSizeNum+2;
				if (newFontSize<20){
					jQuery('#main-content.harbour_grand p').css('font-size', newFontSize);
					jQuery.cookie('mainFontSize',newFontSize);
				}
				
				return false;
			});
			
			// Decrease Font Size
			jQuery(".decreaseFont").click(function(){
				var currentFontSize = jQuery('#main-content.harbour_grand p').css('font-size');
				var currentFontSizeNum = parseFloat(currentFontSize, 16);   
				var newFontSize = currentFontSizeNum-2;
				if (newFontSize>10){
					jQuery('#main-content.harbour_grand p').css('font-size', newFontSize);
					jQuery.cookie('mainFontSize',newFontSize);
				}
				
				return false;
			});
			
			
			
			jQuery('#feature ul#best-rate').cycle({ 
				fx:     'fade', 
				speed:  'fast', 
				timeout: 4000, 
				next:   '#next1',
				cleartypeNoBg:true
			});
			
			jQuery('#feature .item3 .widget-content').cycle({ 
				fx:     'fade', 
				speed:  'fast', 
				timeout: 4000, 
				next:   '#next2',
				cleartypeNoBg:true
			});
			
			/* ACCORDIONS */
				if(!jQuery(document.body).hasClass("loggedIn")){
					jQuery("#mod_pukkaSimpleRooms .moduleBody").accordion({
						active: 0,
						header: 'h3',
						animated: 'easeslide',
						event: 'click',
						autoHeight: true
					});
					jQuery("#mod_pukkaRestaurants.viewList .moduleBody,"+
					       "#mod_pukkaPackages.viewList .moduleBody,"+
					       "#mod_pukkaGalleries.viewList .moduleBody,"+
					       "#mod_pukkaMeetings.viewList .moduleBody,"+
						   "#mod_pukkaNews.viewList .moduleBody,"+
					       "#mod_pukkaActivities.viewList .moduleBody,"+
					       "#mod_pukkaVenues.viewList .moduleBody").accordion({
						active: 0,
						header: 'h3',
						animated: 'easeslide',
						event: 'click',
						autoHeight: true
					});
				}
			/* END ACCORDIONS */

			
			/* jQuery('#main-visual').crossSlide({
				fade: 1
			}, [
				{
					src:  'flash/rotate/group_harbour.jpg',
					from: '100% 100% 1.2x',
					to:   '100% 100% 1x',
					time: 5
				}, {
					src:  'flash/rotate/kowloon_pool.jpg',
					from: '100% 100% 1.2x',
					to:   '100% 100% 1x',
					time: 5
				}, {
					src:  'flash/rotate/HK_bathroom.jpg',
					from: '100% 100% 1.2x',
					to:   '100% 100% 1x',
					time: 5
				}, {
					src:  'flash/rotate/kowloon_wedding_hall.jpg',
					from: '100% 100% 1.2x',
					to:   '100% 100% 1x',
					time: 5
				}, {
					src:  'flash/rotate/HK_lobby.jpg',
					from: '100% 100% 1.2x',
					to:   '100% 100% 1x',
					time: 5
				}
			]); */
			
			jQuery("#print a").click(function(){
				window.print();
				return false;
			});
			
			jQuery("#sub-menu ul.shortcuts li ul.menuLevel2").each(function(){
				jQuery("li:last", jQuery(this)).addClass("last");
			});
			
			// open all external links in new window
			$("a").filter(function() {
			    return this.hostname && this.hostname !== location.hostname;
			}).attr('target', '_blank');
			
			
			
			
		});
		
			
}catch(error){

}