jQuery(document).ready(function($) {
				
				// We only want these styles applied when javascript is enabled
				$('div.navigation').css({'width' : '300px', 'float' : 'left'});
				$('div.content').css('display', 'block');

				// Initially set opacity on thumbs and add
				// additional styling for hover effect on thumbs
				var onMouseOutOpacity = 0.67;
				$('#thumbs ul.thumbs li').css('opacity', onMouseOutOpacity)
					.hover(
						function () {
							$(this).not('.selected').fadeTo('fast', 1.0);
						}, 
						function () {
							$(this).not('.selected').fadeTo('fast', onMouseOutOpacity);
						}
					);

				// Enable toggling of the caption
				var captionOpacity = 0.0;
				$('#captionToggle a').click(function(e) {
					var link = $(this);
					
					var isOff = link.hasClass('off');
					var removeClass = isOff ? 'off' : 'on';
					var addClass = isOff ? 'on' : 'off';
					var linkText = isOff ? 'Hide Caption' : 'Show Caption';
					captionOpacity = isOff ? 0.7 : 0.0;

					link.removeClass(removeClass).addClass(addClass).text(linkText).attr('title', linkText);
					$('#caption span.image-caption').fadeTo(1000, captionOpacity);
					
					e.preventDefault();
				});
				
				// Initialize Advanced Galleriffic Gallery
				var gallery = $('#gallery').galleriffic('#thumbs', {
					delay:                     4000,
					numThumbs:                 15,
					preloadAhead:              10,
					enableTopPager:            true,
					enableBottomPager:         true,
					imageContainerSel:         '#slideshow',
					controlsContainerSel:      '#controls',
					captionContainerSel:       '#caption',
					loadingContainerSel:       '#loading',
					renderSSControls:          true,
					renderNavControls:         true,
					playLinkText:              'Play Slideshow',
					pauseLinkText:             'Pause Slideshow',
					prevLinkText:              '&lsaquo; Previous Photo',
					nextLinkText:              'Next Photo &rsaquo;',
					nextPageLinkText:          'Next &rsaquo;',
					prevPageLinkText:          '&lsaquo; Prev',
					enableHistory:             true,
					autoStart:                 true,
					syncTransitions:           true,
					defaultTransitionDuration: 2000,
					onSlideChange:             function(prevIndex, nextIndex) {
						$('#thumbs ul.thumbs').children()
							.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
							.eq(nextIndex).fadeTo('fast', 1.0);
					},
					onTransitionOut:           function(slide, caption, isSync, callback) {
						slide.fadeTo(this.getDefaultTransitionDuration(isSync), 0.5, callback);
						caption.fadeTo(this.getDefaultTransitionDuration(isSync), 0.5);
					},
					onTransitionIn:            function(slide, caption, isSync) {
						var duration = this.getDefaultTransitionDuration(isSync);
						slide.fadeTo(duration, 1.0);
						
						// Position the caption at the bottom of the image and set its opacity
						var slideImage = slide.find('img');
						caption.width(slideImage.width())
							.css({
								'bottom' : Math.floor((slide.height() - slideImage.outerHeight()) / 2),
								'left' : Math.floor((slide.width() - slideImage.width()) / 2) + slideImage.outerWidth() - slideImage.width()
							})
							.fadeTo(duration, captionOpacity);
					},
					onPageTransitionOut:       function(callback) {
						$('#thumbs ul.thumbs').fadeTo('fast', 0.0, callback);
					},
					onPageTransitionIn:        function() {
						$('#thumbs ul.thumbs').fadeTo('fast', 1.0);
					}
				});

				// PageLoad function
				// This function is called when:
				// 1. after calling $.historyInit();
				// 2. after calling $.historyLoad();
				// 3. after pushing "Go Back" button of a browser
				function pageload(hash) {
					// alert("pageload: " + hash);
					// hash doesn't contain the first # character.
					if(hash) {
						$.galleriffic.goto(hash);
					} else {
						$.galleriffic.goto(0);
					}
				}

				

			});
//functions for menu

$(function(){
			$(".hotelMenu").buildMenu(
			{
				menuWidth:105,
				openOnRight:false,
				menuSelector: ".menuContainer",
				iconPath:"ico/",
				hasImages:false,
				fadeInTime:300,
				fadeOutTime:300,
				adjustLeft:0,
				minZindex:"auto",
				adjustTop:100,
				opacity:.75,
				shadow:false,
				closeOnMouseOut:true,
				closeAfter:1000
			});
		}
			);


		//this function get the id of the element that fires the context menu.	
		function testForContextMenu(el){
			alert("the ID of the element is:   "+$(el).attr("id"))
		}

//functions for calendar date

			$(document).ready(function() {
				$('#date-input-1').calendar({
					triggerElement: '#date-input-1-trigger'
				});
			});
//functions for calendar date2			
			$(document).ready(function() {
				$('#date-input-2').calendar({
					triggerElement: '#date-input-2-trigger'
				});
			});
//functions for offers

(function(a){a.fn.innerfade=function(b){return this.each(function(){a.innerfade(this,b)})};a.innerfade=function(b,c){var e={animationtype:"fade",speed:"normal",type:"sequence",timeout:2000,containerheight:"auto",runningclass:"innerfade",children:null};if(c){a.extend(e,c)}if(e.children===null){var g=a(b).children()}else{var g=a(b).children(e.children)}if(g.length>1){a(b).css("position","relative").css("height",e.containerheight).addClass(e.runningclass);for(var d=0;d<g.length;d++){a(g[d]).css("z-index",String(g.length-d)).css("position","absolute").hide()}if(e.type=="sequence"){setTimeout(function(){a.innerfade.next(g,e,1,0)},e.timeout);a(g[0]).show()}else{if(e.type=="random"){var f=Math.floor(Math.random()*(g.length));setTimeout(function(){do{h=Math.floor(Math.random()*(g.length))}while(f==h);a.innerfade.next(g,e,h,f)},e.timeout);a(g[f]).show()}else{if(e.type=="random_start"){e.type="sequence";var h=Math.floor(Math.random()*(g.length));setTimeout(function(){a.innerfade.next(g,e,(h+1)%g.length,h)},e.timeout);a(g[h]).show()}else{alert("Innerfade-Type must either be 'sequence', 'random' or 'random_start'")}}}}};a.innerfade.next=function(d,b,e,c){if(b.animationtype=="slide"){a(d[c]).slideUp(b.speed);a(d[e]).slideDown(b.speed)}else{if(b.animationtype=="fade"){a(d[c]).fadeOut(b.speed);a(d[e]).fadeIn(b.speed,function(){removeFilter(a(this)[0])})}else{alert("Innerfade-animationtype must either be 'slide' or 'fade'")}}if(b.type=="sequence"){if((e+1)<d.length){e=e+1;c=e-1}else{e=0;c=d.length-1}}else{if(b.type=="random"){c=e;while(e==c){e=Math.floor(Math.random()*d.length)}}else{alert("Innerfade-Type must either be 'sequence', 'random' or 'random_start'")}}setTimeout((function(){a.innerfade.next(d,b,e,c)}),b.timeout)}})(jQuery);function removeFilter(a){if(a.style.removeAttribute){a.style.removeAttribute("filter")}};

	   $(document).ready(
				function(){
					$('#offers').innerfade({
						animationtype: 'fade',
						speed: 3000,
						timeout: 4000,
						type: 'random',
						containerheight: '1em'
					});
			});
	   $(document).ready(
				function(){
					$('#tiempo').innerfade({
						animationtype: 'fade',
						speed: 3000,
						timeout: 6000,
						type: 'random',
						containerheight: '1em'
					});
			});
//mapa

//<![CDATA[

function loadMap() {
  if (GBrowserIsCompatible()) {
	var map = new GMap2(document.getElementById("slideshow"));
	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());	
	map.setCenter(new GLatLng(38.06073,-0.797276), 15);
	map.enableScrollWheelZoom();
	var latlng = new GLatLng(38.06073,-0.797276);
    map.addOverlay(new GMarker(latlng));
	map.setMapType(G_HYBRID_MAP);
	map.openInfoWindowHtml(map.getCenter(),"<h3 style='margin:0px;'>Hotel La Finca Golf &amp; Spa Resort</h3><br /> Ctra. Algorfa - Los Montesinos, Km3 <br />Algorfa<br /><br /> Tlf: 966 72 90 28");

  }
}
//]]>

	window.onload = setScreenClass; 
	window.onresize = setScreenClass;

	function setScreenClass(){
		var fmt = document.documentElement.clientWidth;
		var cls = (fmt<=900)?'thin':(fmt>900&&fmt<=1024)?'wide':(fmt>1024)?'wider':'wider';
		document.body.className=cls;
	};

/*
 * Metadata - jQuery plugin for parsing metadata from elements
 *
 * Copyright (c) 2006 John Resig, Yehuda Katz, J?örn Zaefferer, Paul McLanahan
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
*/
(function($) {

$.extend({
	metadata : {
		defaults : {
			type: 'class',
			name: 'metadata',
			cre: /({.*})/,
			single: 'metadata'
		},
		setType: function( type, name ){
			this.defaults.type = type;
			this.defaults.name = name;
		},
		get: function( elem, opts ){
			var settings = $.extend({},this.defaults,opts);
			// check for empty string in single property
			if ( !settings.single.length ) settings.single = 'metadata';
			
			var data = $.data(elem, settings.single);
			// returned cached data if it already exists
			if ( data ) return data;
			
			data = "{}";
			
			if ( settings.type == "class" ) {
				var m = settings.cre.exec( elem.className );
				if ( m )
					data = m[1];
			} else if ( settings.type == "elem" ) {
				if( !elem.getElementsByTagName )
					return undefined;
				var e = elem.getElementsByTagName(settings.name);
				if ( e.length )
					data = $.trim(e[0].innerHTML);
			} else if ( elem.getAttribute != undefined ) {
				var attr = elem.getAttribute( settings.name );
				if ( attr )
					data = attr;
			}
			
			if ( data.indexOf( '{' ) <0 )
			data = "{" + data + "}";
			
			data = eval("(" + data + ")");
			
			$.data( elem, settings.single, data );
			return data;
		}
	}
});

/**
 * Returns the metadata object for the first member of the jQuery object.
*/
$.fn.metadata = function( opts ){
	return $.metadata.get( this[0], opts );
};

})(jQuery);