function hideHomeMenu(open) {
	jQuery('#features').animate({
		opacity: 0
	}, 'slow', function() {
	});
}	
			

/* jQuery.noConflict(); */
try{
					
		jQuery('html').addClass('js');
		

		
		jQuery(document).ready(function(){
			/* BUG IN IE6
			if(jQuery.browser.msie){
				jQuery('#main-visual-home').css({display: 'block'});
				jQuery('#main-visual-subpage').css({display: 'block'});
				jQuery('#main-content-home').css({display: 'block'});
				jQuery('#main-content-subpage').css({display: 'block'});
			} 
			/*
			 else {
				jQuery('#main-visual').css({opacity: 0, display: 'block'});
				jQuery('#main-content').css({opacity: 0, display: 'block'});
				//jQuery('#loaderImg').css({opacity:0,display:'block'});
						
				jQuery('#main-visual').animate({opacity: 1},"slow");
				jQuery('#main-content').animate({opacity: 1},"slow");
			} 
			window.onbeforeunload = function(){
				jQuery('#features').animate({opacity:0},"fast","linear",function(){});
				jQuery('#main-content').animate({opacity:0},"fast","linear",function(){});
				jQuery('#main-visual').animate({opacity:0},"fast","linear",function(){
					//jQuery('#loaderImg').css({'z-index':1000});
					//jQuery('#loaderImg').animate({opacity:1},"fast");
				});
				return;
				
			};
			
			*/
			
			
			jQuery('#roomType').customSelect("Room");
			jQuery('#nights').customSelect("Nights");
			jQuery('#adults').customSelect("Adults");
			jQuery('#children').customSelect("Children");
			
			
			jQuery('div#guest_comments').cycle({
				fx: 'fade',
				speed: 'slow',
				timeout: 8000
			});
			
			jQuery('div#guestComments').cycle({
				fx: 'fade',
				speed: 'slow',
				timeout: 8000
			}); 
					if(jQuery().cycle){ 
		
				
					jQuery('div#spoffers #offers').after('<div id="spoffers-pager">').cycle({
							fx:     'fade', 
							speed:  'slow', 
							timeout: 4500,
							pause:   1,
							pager: 'div#spoffers #spoffers-pager'

					});		
			
		} 
		
/* START - videos animation */
		  jQuery("#youtube").css("top","433px");

		
		jQuery("#youtube").hover(function () {
			jQuery("#youtube").stop().animate({top: '339px'}, 1200);
		},
		function () {
			jQuery("#youtube").stop().animate({top: '433px'}, 1200);
		});	
	
/* END - videos animation */


/* START - accordion animation */
		jQuery('#mod_pukkaReviews .moduleBody').accordion({
		active: 0,
		header: 'h3',
		event: 'click',
		animated: 'slide',
		autoHeight: false
		});		
/* END - accordion animation */
		
				jQuery("#bookingMask .go").click(function() {
					if ( jQuery('.corporateId #corporateId').val() == '' ){	
						jQuery('.corporateId').remove();
					}
				});
				
				jQuery("#youtube a").fancybox({ 
					'zoomSpeedIn': 500,
					'zoomSpeedOut': 500,
					'zoomOpacity':true
				});
			
			
			/*FADE EFFECTS FOR LOGO LANG FLAGS*/
			jQuery("#language-navigation ul li img").hover(function(){
				var a = jQuery(this);
				a.stop().animate({
					"opacity":.5
				},200);
			},function(){
				var a = jQuery(this);
				a.stop().animate({
					"opacity":1
				},200);
			});
					
			
			jQuery('#language-navigation ul').hover(
					function() {
						if (this.hoverOff_timeout) {
							clearTimeout(this.hoverOff_timeout);
							this.hoverOff_timeout = null;
						}
						jQuery(this).addClass('hover')
					}, 
					function() {
						if (this.hoverOff_timeout) {
							clearTimeout(this.hoverOff_timeout);
							this.hoverOff_timeout = null;
						}
						var thiselem = this;
						this.hoverOff_timeout = setTimeout(function(){
							jQuery(thiselem).removeClass('hover')
						}, 1000);
					}
				);			
			
			
			
			//Instantiate the address plugin and create the hashes per link
			jQuery("#main-menu a").address(function(){		 
				var hash = jQuery(this).attr('href').replace(/^#/, ''); 
				hash = hash.replace(condor.siteBaseHREF, ''); 
				return hash;
				
				
			});

			//When the address changes or someone comes from a linked uri do this
			jQuery.address.change(function(event) { 

				//If there is a value for the change we simulate a click on the menu 
				value = event.value.replace("/", '');
				if(value != '') 
				{
					//Simulate a click event on the menu item
					jQuery("#main-menu a").each(function() {
						
						//Do some  matching and click the correct link
						if(this.href.indexOf(value) != -1) jQuery(this).live();
						});
				}

				
			}); 
			
			jQuery('#main-menu li a').click(function(){		 
				var link = this;
				jQuery('.currentMenuItem').removeClass('currentMenuItem');
				
				var clickedAnchor = jQuery(this);
				
				clickedAnchor.addClass('currentMenuItem');
				setTimeout(function() { setContent(link.href)}, 10);
				
				//Check if we are a child item
				if(clickedAnchor.parent().hasClass('level2'))
				{
					//If the parent node is not active
					if(!clickedAnchor.parent().parent().parent().hasClass("active-under"))
					{
						hideSubMenus();
						showSubMenu(clickedAnchor.parent().parent());
					}	
				}	
				
				return false;
			})
			

			jQuery("#main-menu ul.shortcuts li.level1.has-submenu > a").click(function(){
				var clickedAnchor=jQuery(this); //this is the clicked anchor
				if(!clickedAnchor.parent().hasClass("active-under")){ //check if the clicked anochor's parent element is currently active or not
					hideSubMenus();
					showSubMenu(clickedAnchor.next());
				}
				return false;
			});
			
			function hideSubMenus()
			{
				jQuery("#main-menu ul.shortcuts li.level1 ul.menuLevel2:visible").slideUp(500,function(){//slide up any ul's that are visible
					jQuery(this).parent().removeClass("active-under active"); //remove active classes from its parent li
				});
			}
			
			function showSubMenu(subMenuNode)
			{
				// prepare the new element for animation
				subMenuNode.hide();
				subMenuNode.parent().addClass("active-under")
				subMenuNode.slideDown(500,function(){//slide down the ul that we want to show
					subMenuNode.parent().addClass("active"); //apply active styles to its parent element
				});
			}
			
			
			/*END MENU SLIDE EFFECTS*/
			
			jQuery('#language-navigation ul').hover(
					function() {
						if (this.hoverOff_timeout) {
							clearTimeout(this.hoverOff_timeout);
							this.hoverOff_timeout = null;
						}
						jQuery(this).addClass('hover');
					}, 
					function() {
						if (this.hoverOff_timeout) {
							clearTimeout(this.hoverOff_timeout);
							this.hoverOff_timeout = null;
						}
						var thiselem = this;
						this.hoverOff_timeout = setTimeout(function(){
							jQuery(thiselem).removeClass('hover');
						}, 500);
					}
				);	


		jQuery('#main-visual').hover(
					function() {
						if (this.hoverOff_timeout) {
							clearTimeout(this.hoverOff_timeout);
							this.hoverOff_timeout = null;
						}
						jQuery('#features').css({'opacity':'100'});
					}, 
					function() {
						if (this.hoverOff_timeout) {
							clearTimeout(this.hoverOff_timeout);
							this.hoverOff_timeout = null;
						}
						var thiselem = this;
						setTimeout('hideHomeMenu(true)', 4000);
						this.hoverOff_timeout = setTimeout(function(){
							jQuery('#features').animate({
								opacity: 100
							}, 'fast', function() {
							});
					});
					});
			
			/*						
			/*
			jQuery('#main-visual .quote_text').hover(
					function() {
						if (this.hoverOff_timeout) {
							clearTimeout(this.hoverOff_timeout);
							this.hoverOff_timeout = null;
						}
						jQuery('#features').css({'opacity':'100'});
					}, 
					function() {
						if (this.hoverOff_timeout) {
							clearTimeout(this.hoverOff_timeout);
							this.hoverOff_timeout = null;
						}
						var thiselem = this;
						this.hoverOff_timeout = setTimeout(function(){
							jQuery('#features').animate({
								opacity: 100
							}, 'fast', function() {
							});
					});
					});
					
				*/
			
			/* ACCORDIONS */

	
	
	
	/* var subMenu=jQuery(".photo-gallery-submenu");
		jQuery("a",subMenu).click(function(){
			var a=jQuery(this);
			var href=a.attr("href");
			href=href.replace(/#/,'');					
			jQuery("#main-content #mod_pukkaGalleries .moduleBody h3 a[name='"+href+"']").parent().click();
			}); */

/* END ACCORDIONS */

/* Rooms Read More Button - Start */
	/*  var ovcontentheight=jQuery('#overview-subpage .intro').height();						
	var intro=jQuery('#overview-subpage .intro');
	var overviewContent=jQuery('#overview-subpage .overview-content');
	var open = jQuery('#overview-subpage p.readMore');
	var close = jQuery('#overview-subpage p.readLess');
	if(ovcontentheight !=0){    //check - intro text is available
		overviewContent.hide();
		close.hide();
	}else{
		open.hide();   //hide more button and less button when no intro text
		close.hide();
	}
	open.click(function(){
		overviewContent.slideDown(800);
		open.hide();
		close.show();
	});
	
	close.click(function(){
		overviewContent.slideUp(800);
		close.hide();
		open.show();
	});  */
	
/* Rooms Read More Button - End */

/* Home Main Content Read More Button - Start */
	var maincontentheight=jQuery('#contentArea #main-content .intro').height();						
	var mainIntro=jQuery('#contentArea #main-content .intro');
	var mainContent=jQuery('#contentArea #main-content .mainContent');
	var openCon = jQuery('#contentArea #main-content p.readMore');
	var closeCon = jQuery('#contentArea #main-content p.readLess');

	//if(jQuery(document.body).attr('id')=="page_home"){  //run for only home page
		if(maincontentheight !=0){ 
			mainContent.hide();
			closeCon.hide();
		}else{
			openCon.hide(); 		//hide more button and less button when no intro text
			closeCon.hide();
		}
	
		openCon.click(function(){
			mainContent.slideDown(800);
			openCon.hide();
			closeCon.show();
		});
		
		closeCon.click(function(){
			mainContent.slideUp(800);
			closeCon.hide();
			openCon.show();
		});
	
	//} temporally comments
	
/* Home Main Content Read More Button - End */

/* Home Activities Read More Button - Start */
	var actcontentheight=jQuery('#contentArea #activities .intro').height();	
	//alert(actcontentheight);
	
	var activityIntro=jQuery('#contentArea #activities .intro');
	var activityContent=jQuery('#contentArea #activities .activitiesContent');
	var openAct = jQuery('#contentArea #activities p.readMore');
	var closeAct = jQuery('#contentArea #activities p.readLess');
	
	if(actcontentheight !=0){      //check - intro text is available
		activityContent.hide();
		closeAct.hide();
		
	}else{
		openAct.hide(); 		//hide more button and less button when no intro text
		closeAct.hide();
	}
	openAct.click(function(){
		activityContent.slideDown(800);
		openAct.hide();
		closeAct.show();
	});
	
	closeAct.click(function(){
		activityContent.slideUp(800);
		closeAct.hide();
		openAct.show();
	});
	
/* Home Activities Read More Button - End */

/* subpage Main Content Read More Button - Start */
	/* var maincontentheight=jQuery('#contentArea #main-content .intro').height();						
	var mainIntro=jQuery('#contentArea #main-content .intro');
	var mainContent=jQuery('#contentArea #main-content .mainContent');
	var openCon = jQuery('#contentArea #main-content p.readMore');
	var closeCon = jQuery('#contentArea #main-content p.readLess');

	if(jQuery(document.body).attr('id')!="page_home"){  //run for only sub page
		if(maincontentheight !=0){ 
			mainContent.hide();
			closeCon.hide();
		}else{
			openCon.hide(); 		//hide more button and less button when no intro text
			closeCon.hide();
		}
	
		openCon.click(function(){
			mainContent.slideDown(800);
			openCon.hide();
			closeCon.show();
		});
		
		closeCon.click(function(){
			mainContent.slideUp(800);
			closeCon.hide();
			openCon.show();
		});
	
	}  */
	
/* subpage Main Content Read More Button - End */

//	auto clear "Join mailing our list" type messages. requires the autoClear plugin.
	if(jQuery().autoClear){
		jQuery('#email-address, #flexForm_element_email').autoClear();
	}

/* Newsletter Sign up - Start */

	
	/* var timeout;
	var changed=false;
	jQuery('div#newsletter').mouseenter(function() {
		clearTimeout(timeout);
		changed=false;
		jQuery('.header', this).fadeOut();
		jQuery('div#newsletter form#newsletterForm').css('display', 'block');

	}).mouseleave(function() {
			
			timeout=setTimeout(function(){
				jQuery('div#newsletter .header').fadeIn();		
				jQuery('div#newsletter form#newsletterForm').css('display', 'none');			
			},3000);
	});
	jQuery('input#email-address, button.go').bind('change',function(){
		changed=true;
	}); */
	

/* Newsletter Sign up - End */	


/*  Footer Boxes - Start */

	if(jQuery().jCarouselLite){
		var thumbNavMarkup=jQuery('<div class="nav"><div class="prev"><img src="/templates/main/images/arrow_left.gif" alt="" /></div><div class="next"><img src="/templates/main/images/arrow_right.gif" alt="" /></div></div>').insertBefore('.footer-boxes');

		jQuery("#footerArea-boxes").jCarouselLite({
			btnNext: "#footerArea-boxes .nav .next",
			btnPrev: "#footerArea-boxes .nav .prev",
			circular:1,
			visible:4,
			speed:5000,
			auto:1
		});
	}

/*  Footer Boxes - End */



/* News Slider Button - Start */
if(jQuery().cycle){					
				jQuery(window).load(function(){
					jQuery('#news #newsContent').cycle('destroy');
					jQuery('#news #newsContent').cycle({
						fx: 'fade',
						speed: 2500,
						timeout: 2000,
						pause: 0,
						cleartype: 1,
						cleartypeNoBg:true
					});
	});
	}

/*	if(jQuery().cycle){

	jQuery('#news-homeTest #newsContent .nojs').removeClass("nojs");
	jQuery('#news-homeTest #newsContent').cycle({
			fx:     'slideDown', 
			speed:  'slow', 
			timeout: 5000,
			pause:   1,
			cleartypeNoBg:true

		});
	}
*/

/* News Slider Button - End */
			
		});
}catch(error){

}


//Use ajax to update the main content to a new URI
function setContent(uri)
{
 jQuery('#contentArea').html('');
 showWaitImage();
 
 setTimeout(function() { 
 	// Disable ajax loading for specific pages
	if(uri == "http://www.nobishotel.se/jobs-en.html"){ document.location.href = 'http://www.nobishotel.se/jobs-en.html'; return false; }
	if(uri == "http://www.nobishotel.se/jobs-sv.html"){ document.location.href = 'http://www.nobishotel.se/jobs-sv.html'; return false; }
	if(uri == "http://www.nobishotel.se/map-en.html"){ document.location.href = 'http://www.nobishotel.se/map-en.html'; return false; }
	if(uri == "http://www.nobishotel.se/map-sv.html"){ document.location.href = 'http://www.nobishotel.se/map-sv.html'; return false; }
	 jQuery.get(uri, {contentOnly : 1},
    function (data) {
		 jQuery('#contentArea').html("");
		var div = document.createElement('DIV');
		div.innerHTML = data;
		document.getElementById('contentArea').appendChild(div);
		/*start pagekeys to change accordingly*/
		urlArr = uri.split('/');
		pageKey = (urlArr[(urlArr.length)-1].split('-'))[0];
		jQuery('body').attr('id','page_'+pageKey);
		/*end pagekeys to change accordingly*/
		
		//jQuery('#contentArea').html(data);

		//Cufon.replace('#contentArea h2', { fontFamily: 'MercuryTextG1Roman' });
		/*
			if(jQuery.browser.msie){
				jQuery('#main-visual-home').css({display: 'block'});
				jQuery('#main-visual-subpage').css({display: 'block'});
				jQuery('#main-content-home').css({display: 'block'});
				jQuery('#main-content-subpage').css({display: 'block'});
			}
		*/	
			 
		jQuery('#contentArea').fadeIn(function(){
				hideWaitImage();
				if(jQuery.browser.msie){
					this.style.removeAttribute("filter");
				}
			});			

   });
  },
 500);
} 


function showWaitImage()
{
 jQuery('div#loaderImg').css("display","block");
 jQuery('div#loaderImg').css("z-index","100");
}

function hideWaitImage()
{
 jQuery('div#loaderImg').css("display","none");
 jQuery('div#loaderImg').css("z-index","-1");
}

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/preview/libs/player.swf", "videoHolder", "424", "350", "9.0.115", false, flashvars, params, attributes);
}






