//jQuery.noConflict();


try{
	$('html').addClass('jsHide');
		jQuery(document).ready(function(){
			
					
			if(jQuery().pukkaPNGFix){
				jQuery('.pngFix').pukkaPNGFix();
			}
			
			
			var fly=new Object(); //fly weight object
				
			if(jQuery().fancybox && !jQuery(document.body).hasClass("loggedIn")){ 
				jQuery("#alt-menu li.legal a,#alt-menu li.privacy a").addClass("iframe");
				jQuery("#alt-menu li.legal a,#alt-menu li.privacy a").fancybox({
					'hideOnContentClick': false,
					'frameWidth':720,
					'frameHeight':550
				});
				jQuery(".page_joinEmail #mod_flexForms .flexForm_div_agreement input").attr('disabled','disabled')
				jQuery(".page_joinEmail #mod_flexForms .fancybox").fancybox({
					'hideOnContentClick': false,
					'frameWidth':720,
					'frameHeight':550,
					callbackOnClose:function(){
						jQuery(".page_joinEmail #mod_flexForms .flexForm_div_agreement input").attr('disabled','')
					}
				});
				
				
				
				
				jQuery("#mod_pukkaPictures .picture a").fancybox({
					'zoomSpeedIn': 500,
					'zoomSpeedOut': 500,
					'zoomOpacity': true
				});
				
				jQuery("#restaurant-gallery ul.restaurant-gallery-list li a, #beachclub-gallery ul.beachclub-gallery-list li a").fancybox({
					'zoomSpeedIn': 500,
					'zoomSpeedOut': 500,
					'zoomOpacity': true
				});
			}	
			
			/*MAIN MENU HOTEL LIST ANIMATION*/
			jQuery("#main-menu ul li:first a:first").click(function(){
				var t=jQuery(this);
				var submenu=jQuery("ul.menuLevel2",t.parent());
				submenu.css("height",submenu.height()+"px");
				submenu.slideToggle("slow");
				return false;
			});
			/*END MAIN MENU HOTEL LIST ANIMATION*/
			
			/*TAB FUNCTIONALITY*/
			jQuery("#availability-checker").addClass("tab3 on");
			jQuery("#special-offers").addClass("tab2 off");
			jQuery("#best-prices").addClass("tab1 off");
			
			var off=jQuery("div.content",jQuery("*:[class^=tab][class*=off]"));
			off.hide();
			
			jQuery("#special-offers h2:first,#availability-checker h2:first,#best-prices h2:first").click(function(){
				var parent=jQuery(this).parent();
				var toshow=jQuery("div.content",parent);
				var tohideparent=jQuery("*:[class^=tab][class*=on]");
				var tohide=jQuery("div.content",tohideparent);
				
				if(!parent.hasClass("on") && !jQuery("#availability-checker .content,#special-offers .content,#best-prices .content").is(":animated")){
					tohide.animate({
						"opacity":"hide"
					},500,function(){
						var index=parent.css("z-index");
						tindex=tohideparent.css("z-index");
						tohideparent.removeClass("on");
						tohideparent.addClass("off");
						tohideparent.css("z-index",index);
						if(jQuery.support.opacity==false){
							this.style.removeAttribute('filter');
						}
					});
					
					toshow.animate({
						"opacity":"show"
					},800,function(){
						parent.css("z-index",tindex);
						jQuery("*:[class^=tab]").not(parent).removeClass("on");
						jQuery("*:[class^=tab]").not(parent).addClass("off");
						parent.removeClass("off");
						parent.addClass("on");
						if(jQuery.support.opacity==false){
							this.style.removeAttribute('filter');
						}
					});
				}
			});
			/*END TAB FUNCTIONALITY*/
			
			/*ROTATOR FUNCTIONALITY*/
			
			if(!jQuery("#holder").hasClass("edit")){
				jQuery(".rotator-nav").css("z-index",3);
				jQuery(".rotator-nav li").addClass("link");
				jQuery(".rotator li").css({
					"position":"absolute",
					"top":0,
					"left":0
				});
				
				jQuery(".rotator").each(function(i,e){
					jQuery("li:not(:first)",jQuery(e)).css({
						"display":"none",
						"z-index":0
					});
				});
				
				
				jQuery("#special-offers .rotator-nav li.next,#special-offers .rotator-nav li.prev,#best-prices .rotator-nav li.next,#best-prices .rotator-nav li.prev").click(function(){
					var rotator=jQuery(this).parent().prev("ul.rotator");
					var rotatorsize=jQuery("li",rotator).size();
					var tohide=jQuery("li:visible",rotator);
					var tohideindex=jQuery("li",rotator).index(tohide);
					var state="";
					var animate=false;
					
					if(jQuery(this).hasClass("next")){
						var toshow=jQuery("li",rotator).eq((tohideindex+1));
						state="up";
					}else{
						var toshow=jQuery("li",rotator).eq((tohideindex-1));
						state="down";
					}
					
					switch(state){
						case "up":
							((tohideindex+1)<rotatorsize)?animate=true:animate=false;
						break;
						case "down":
							((tohideindex-1)>=0)?animate=true:animate=false;
						break;
					}
					
					if(animate){
						tohide.css("z-index","2");
						toshow.css("z-index","1");
						toshow.show();
						
						tohide.animate({
							"opacity":"hide"
						},500,function(){
							tohide.css("z-index","1");
							toshow.css("z-index","2");
							if(jQuery.support.opacity==false){
								this.style.removeAttribute('filter');
							}
						});
					}
				});
			}
			/*END ROTATOR FUNCTIONALITY*/
			
			
			/* pukkaPackages */
			
			if(!jQuery("#holder").hasClass("edit")){
				jQuery("#mod_pukkaPackages .itemContent").animate({
						"height":"toggle",
						"opacity":"toggle"
				},0);
			}
			jQuery("#mod_pukkaPackages .itemPreviewTitle").addClass("link");
			var packagesTitles=jQuery("#mod_pukkaPackages .itemPreviewTitle");
			packagesTitles.click(function(){
				var t=this;
				var jt=jQuery(t);
				var parent=jt.parent();
				jQuery(".itemContent",parent).animate({
					"height":"toggle",
					"opacity":"toggle"
				},1000,"easeOutCirc",function(){
					(jQuery(this).is(":visible"))?jt.addClass("expanded"):jt.removeClass("expanded");
					if(jQuery.support.opacity==false){
						jQuery(".alt-logo").css("zoom","0");
						jQuery(".alt-logo").css("zoom","1");
						this.style.removeAttribute('filter');
						
					}
				});
				
			});
			
			/*END pukkaPackages*/
			
			
			
			/*pukkaDownloads*/
			
			if(!$('#page_partners').length){
			
				jQuery(".widget_viewMediaAttachments .itemContent").animate({
						"height":"toggle",
						"opacity":"toggle"
				},0);
				jQuery(".widget_viewMediaAttachments .mediaAttachmentItemTitle").addClass("link");
				
				var titles=jQuery(".widget_viewMediaAttachments .mediaAttachmentItemTitle");
				titles.click(function(){
					var t=this;
					var jt=jQuery(t);
					var parent=jt.parent();
					jQuery(".itemContent",parent).animate({
						"height":"toggle",
						"opacity":"toggle"
					},1000,"easeOutCirc",function(){
						(jQuery(this).is(":visible"))?jt.addClass("expanded"):jt.removeClass("expanded");
						if(jQuery.support.opacity==false){
							jQuery(".alt-logo").css("zoom","0");
							jQuery(".alt-logo").css("zoom","1");
							this.style.removeAttribute('filter');
							
						}
					});
					
				});
			}
			/*END pukkaDownloads*/
			

			
			/*NEWS TICKER*/
			
			var animConfig = {
				timeout: 2000,
				fadeOut: 1600,
				width: 0
			};
			
			var curOffer = -1;
			offerAnimation = function() {
				if(curOffer<$('#news-ticker dd').length-1){
					curOffer++;
				} else {
					curOffer = 0;
				}
				$('#news-ticker p.text').width(0);
				$('#news-ticker p.text').html($('#news-ticker dd').eq(curOffer).html());
				animConfig.width = $('#news-ticker p.text a').width();
				$('#news-ticker p.text').animate({width: animConfig.width},{duration: animConfig.width * 10, easing: 'linear', complete: function(){
					setTimeout('offerAnimation()', animConfig.timeout);
					}
				});
			}

			setTimeout(function() {
				animConfig.width = jQuery('#news-ticker p.text a').width();
				offerAnimation();
			}, animConfig.timeout);
			
			/*END NEWS TICKER*/
			
			
			/*HOME PAGE FEATURE ROTATOR*/
			jQuery("#feature-box .pager li").css("cursor","pointer");
			jQuery("#feature-box .pager li").click(function(){
				var t=jQuery(this);
				var num=t.text();
				var superparent=t.parent().parent();
				var toshow=jQuery(".feature-list li.item"+num,superparent);
				var tohide=jQuery(".feature-list li:visible",superparent);
				var sel=jQuery(".pager li.selected",superparent);
				
				if(!tohide.hasClass("item"+num)){
					tohide.animate({
						"opacity":"toggle"
					},500,"easeOutCirc",function(){
						if(jQuery.support.opacity==false){
							this.style.removeAttribute('filter');
						}
						
						toshow.animate({
							"opacity":"toggle"
						},1000,"easeOutCirc",function(){
							sel.removeClass("selected");
							t.addClass("selected");
							if(jQuery.support.opacity==false){
								this.style.removeAttribute('filter');
							}
						});
					});
					
				}
			});
			/*END HOME PAGE FEATURE ROTATOR*/
			
			jQuery("#feature-box .close-btn,#open-features").click(function(){
				jQuery("#feature-box").animate({
					"opacity":"toggle"
				},1000,function(){
					if(jQuery.support.opacity==false){
						this.style.removeAttribute('filter');
					}
				});
			});
			
			
			
			
			
			$('#videoList').mouseenter(function(){
				$('#videoList').stop();
				$('#videoKnob').stop();
				$('#videoList').animate({top:0},"slow");
				$('#videoKnob').animate({height:36},"slow");
			});
			if(jQuery().fancybox && !jQuery(document.body).hasClass("edit")){
			$('#videoList').mouseleave(function(){
				$('#videoList').stop();
				$('#videoKnob').stop();
				$('#videoList').animate({top:237},"slow");
				$('#videoKnob').animate({height:68},"slow");
			});}
			$('#videoList').click(function(){
				$('#videoList').stop();
				$('#videoKnob').stop();
				$('#videoList').animate({top:237},"slow");
				$('#videoKnob').animate({height:68},"slow");
			});

			
			$('#videoList a').fancybox({
				'frameWidth'  : 480,
				'frameHeight' : 360,
				'hideOnContentClick' : false,
				'zoomSpeedIn' : 500,
				'zoomSpeedOut' : 500,
				'zoomOpacity' : true
			});
			
			if(jQuery().cycle){
			jQuery('#feature-box .feature-list ul').after('<div id="pager">').cycle({ 
				fx:     'scrollRight', 
				speed:  'slow', 
				timeout: 8000,
				pause:   1,
				pager:  '#feature-box #pager',
				cleartypeNoBg:true,
				cleartype:  1
			});
			}
			
			/*#bestrate-content ul*/
			if(jQuery().cycle){
			jQuery('#feature-box-groupBRW .content-brw ul').before('<div class="pager">').cycle({ 
				fx:     'scrollRight', 
				speed:  'slow', 
				timeout: 8000,
				pause:   1,
				pager:  '#feature-box-groupBRW .content-brw .pager',
				cleartypeNoBg:true,
				cleartype:  1
			});
			}
		});
		
}catch(error){

}


function createPlayer(theFile) {
    var flashvars = {
            file:theFile, 
            autostart:"true",
			controlbar: "over",
			backcolor: "#000000",
			frontcolor: "#FFFFFF"
    }
    var params = {
            allowfullscreen:"true", 
            allowscriptaccess:"always"
    }
    var attributes = {
            id:"player1",  
            name:"player1"
    }
    swfobject.embedSWF("/templates/main/libs/player.swf", "videoHolder", "480", "360", "9.0.115", false, flashvars, params, attributes);
}
