;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);

function do_checkbox_click(e)
{
	if(e)
	{
		if(e.type == 'click')
		{
			if(e.target.tagName == 'INPUT')
			{
				$(".news_filter").find("input").attr("checked", false);
				
				$(".jquery-safari-checkbox").removeClass("jquery-safari-checkbox-checked");
				
				$(e.target).attr("checked", true);
				$(e.target).parent().children(".jquery-safari-checkbox").addClass("jquery-safari-checkbox-checked");
				
				bold_out_selected_checkbox_parent_spans();				
				
				e.stopPropagation();
			}
		}		
	}
}

// Special Checkboxes
//shiri
(function($) { var i = function(e) { if (!e) var e = window.event; e.cancelBubble = true; if (e.stopPropagation) {}e.stopPropagation(); do_checkbox_click(e);}; $.fn.checkbox = function(f) { try { document.execCommand('BackgroundImageCache', false, true) } catch (e) { } var g = { cls: 'jquery-checkbox', empty: 'empty.png' }; g = $.extend(g, f || {}); var h = function(a) { var b = a.checked; var c = a.disabled; var d = $(a); if (a.stateInterval) clearInterval(a.stateInterval); a.stateInterval = setInterval(function() { if (a.disabled != c) d.trigger((c = !!a.disabled) ? 'disable' : 'enable'); if (a.checked != b) d.trigger((b = !!a.checked) ? 'check' : 'uncheck') }, 10); return d }; return this.each(function() { var a = this; var b = h(a); if (a.wrapper) a.wrapper.remove(); a.wrapper = $('<span class="' + g.cls + '"><span class="mark"><img src="' + g.empty + '" /></span></span>'); a.wrapperInner = a.wrapper.children('span:eq(0)'); a.wrapper.hover(function(e) { a.wrapperInner.addClass(g.cls + '-hover'); i(e) }, function(e) { a.wrapperInner.removeClass(g.cls + '-hover'); i(e) }); b.css({ position: 'absolute', zIndex: -1, visibility: 'hidden' }).after(a.wrapper); var c = false; if (b.attr('id')) { c = $('label[for=' + b.attr('id') + ']'); if (!c.length) c = false } if (!c) { c = b.closest ? b.closest('label') : b.parents('label:eq(0)'); if (!c.length) c = false } if (c) { c.hover(function(e) { a.wrapper.trigger('mouseover', [e]) }, function(e) { a.wrapper.trigger('mouseout', [e]) }); c.click(function(e) { b.trigger('click', [e]); i(e); return false }) } a.wrapper.click(function(e) { b.trigger('click', [e]); i(e); return false }); b.click(function(e) { i(e) }); b.bind('disable', function() { a.wrapperInner.addClass(g.cls + '-disabled') }).bind('enable', function() { a.wrapperInner.removeClass(g.cls + '-disabled') }); b.bind('check', function() { a.wrapper.addClass(g.cls + '-checked') }).bind('uncheck', function() { a.wrapper.removeClass(g.cls + '-checked') }); $('img', a.wrapper).bind('dragstart', function() { return false }).bind('mousedown', function() { return false }); if (window.getSelection) a.wrapper.css('MozUserSelect', 'none'); if (a.checked) a.wrapper.addClass(g.cls + '-checked'); if (a.disabled) a.wrapperInner.addClass(g.cls + '-disabled') }) } })(jQuery);

var cal1;

(function() {
    function IntervalCalendar(container, cfg) {
        this._iState = 0;

        // Must be a multi-select CalendarGroup
        cfg = cfg || {};
        cfg.multi_select = true;

        // Call parent constructor
        IntervalCalendar.superclass.constructor.call(this, container, cfg);

        // Subscribe internal event handlers
        this.beforeSelectEvent.subscribe(this._intervalOnBeforeSelect, this, true);
        this.selectEvent.subscribe(this._intervalOnSelect, this, true);
        this.beforeDeselectEvent.subscribe(this._intervalOnBeforeDeselect, this, true);
        this.deselectEvent.subscribe(this._intervalOnDeselect, this, true);
		this.changePageEvent.subscribe(this._changePage, this, true);
		this.renderEvent.subscribe(this._render, this, true);
    }
    IntervalCalendar._DEFAULT_CONFIG = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG;

    YAHOO.lang.extend(IntervalCalendar, YAHOO.widget.CalendarGroup, {
        _dateString : function(d) {
            var a = [];
            a[this.cfg.getProperty(IntervalCalendar._DEFAULT_CONFIG.MDY_MONTH_POSITION.key)-1] = (d.getMonth() + 1);
            a[this.cfg.getProperty(IntervalCalendar._DEFAULT_CONFIG.MDY_DAY_POSITION.key)-1] = d.getDate();
            a[this.cfg.getProperty(IntervalCalendar._DEFAULT_CONFIG.MDY_YEAR_POSITION.key)-1] = d.getFullYear();
            var s = this.cfg.getProperty(IntervalCalendar._DEFAULT_CONFIG.DATE_FIELD_DELIMITER.key);
            return a.join(s);
        },
        _dateIntervalString : function(l, u) {
            var s = this.cfg.getProperty(IntervalCalendar._DEFAULT_CONFIG.DATE_RANGE_DELIMITER.key);
            return (this._dateString(l)
                    + s + this._dateString(u));
        },
        getInterval : function() {
            // Get selected dates
            var dates = this.getSelectedDates();
            if(dates.length > 0) {
                // Return lower and upper date in array
                var l = dates[0];
                var u = dates[dates.length - 1];

                return [l, u];
            }
            else {
                // No dates selected, return empty array
                return [];
            }
        },
        setInterval : function(d1, d2) {
            // Determine lower and upper dates
            var b = (d1 <= d2);
            var l = b ? d1 : d2;
            var u = b ? d2 : d1;
            // Update configuration

            this.cfg.setProperty('selected', this._dateIntervalString(l, u), false);
            this._iState = 2;

        },
        _intervalOnBeforeSelect : function(t,a,o) {
            // Update interval state
            this._iState = (this._iState + 1) % 3;
            if(this._iState == 0) {
                // If starting over with upcoming selection, first deselect all
                this.deselectAll();
                this._iState++;
            }
        },
        _intervalOnSelect : function(t,a,o) {
	

            // Get selected dates
            var dates = this.getSelectedDates();

			var l = dates[0];
            var u = dates[dates.length - 1];

			if(check_in_input)	
			{
				check_in_input.val( this._dateString(l) );
				check_out_input.val('');				
			}
			if($(".span_checkIn"))
			{
				$(".span_checkIn").html( this._dateString(l) );			
				$(".extra_text").show();	
			}
			if($(".span_checkOut"))
			{
				$(".span_checkOut").html('');				
			}
			if($(".selected_dates"))
			{
				$(".selected_dates").html(''); 				
			}

			if(dates.length > 1) 
			{
				if(check_in_input)
				{
					check_out_input.val( this._dateString(u) );		
								
					if($(".date-input-button").length > 0)
					{
						$("#calendar-container-checkin").hide();						
						$(".date-input-button").attr("src", calendar_closed_image_source);
					}
				}
				
				if($(".span_checkOut"))
				{
					$(".span_checkOut").html( this._dateString(u) );					
				}

                this.cfg.setProperty('selected', this._dateIntervalString(l, u), false);

				if($(".selected_dates"))
				{
					$(".selected_dates").html( this._dateString(l) + " - " + this._dateString(u) );					
				}
            }

            // Render changes
            this.render();
			$(".tipsy").remove();			

			if(dates.length == 1)	{
				bind_calendar_links("check-out");	
			}	else	{
				bind_calendar_links("check-in");	
			}
			
			mark_selected_dates_in_calendar();
        },
        _intervalOnBeforeDeselect : function(t,a,o) {
            if(this._iState != 0) {
                return false;
            }
        },
        _intervalOnDeselect : function(t,a,o) {
            if(this._iState != 0) {
                this._iState = 0;
                this.deselectAll();

                var d = a[0][0];
                var date = YAHOO.widget.DateMath.getDate(d[0], d[1] - 1, d[2]);
                var page = this.getCalendarPage(date);
                if(page) 
				{
                    // Now (re)select the individual date
                    page.beforeSelectEvent.fire();
                    this.cfg.setProperty('selected', this._dateString(date), false);
                    page.selectEvent.fire([d]);
                }

				mark_selected_dates_in_calendar();
                // Swallow up since we called deselectAll above
                return false;
            }
        },
		_changePage : function (t, a, o)
		{
            var dates = this.getSelectedDates();

			if(dates.length == 1)	
			{
				bind_calendar_links("check-out");	
			}	
			else	
			{
				bind_calendar_links("check-in");	
			}
			
			mark_selected_dates_in_calendar();
		},
		_render : function(t, a, o)
		{
			
		}
    });

    YAHOO.namespace("dan_hotels.calendar");
    YAHOO.dan_hotels.calendar.IntervalCalendar = IntervalCalendar;
})();

$(document).ready(function()
{
//shiri
//	$("select.special_selectbox").sSelect();

	$(".date-input-container").each(function()
	{
		var outerHeight = $(this).outerHeight();
		$(this).parent("li").css({height: outerHeight});
	});

	add_inner_fade_to_images_in_main_header();
	
	bind_images_as_slider_in_homepage();
	
	bind_slider_links();
	
	setup_calendar_position();
	
	mark_selected_dates_in_calendar();
	
	bind_clear_dates_button();
	
	add_pixles_to_small_selecboxes();
	
	adjust_footer_links_widths();
	
	bind_roomnumber_change();
	
	//bind_sharing_links_change_source();
	
	add_style_and_function_to_checkbox();
	
	bind_date_inputs_focus();
	
	bind_tooltips_on_form();
	
	team_member_text_in_middle();
	
	//bind_modal_dialog();
	
	//bind_tabs_links();
	
	//bind_gallery_links_and_white_borders();
	
	bind_customer_services_tooltip();
	
	bind_local_attractions_gallery();
	
	bind_open_room_details();
	
	bind_qa_div_hrefs();
	
	bind_language_dropdown();
	
	bind_positions_list();
	
	bind_apply_for_job_link();
	
	//add_class_to_lounge_image();
	
	bind_halls_types_popup();
	
	iterate_and_open_rooms();
	
	bind_error_message();
	
//	createCustomSelects();

	check_edan_content_height();
	
	add_seo_links();
	
	new_halls_confrences();
});

function bind_apply_for_job_link()
{
	//func: apply_for_job_click
	/*
	$("a.apply_for_job").click(function()
	{
		$(".job_more_details").show();		
	});
*/
	$('.apply_for_job').colorbox({
		inline:true, 
		href:'.job_more_details', 
		opacity: '0.2',
		transition: 'elastic'
	});
	
	$(document).bind('cbox_cleanup', function()
	{
		$(".job_more_details").hide();
	});
	
	//func:job_more_details_close_click
	/*
	$(".job_more_details .close_button").click(function(e)
	{
		$.fn.colorbox.close();
	});
	*/
}

function bind_positions_list()
{
	//func:open_positions_click
	/*
	$("ul.openPositions li").click(function(e)
	{
		if($(this).attr("class").indexOf("open") > -1)
		{
			$("ul.openPositions li").removeClass("open");			
		}
		else
		{
			$("ul.openPositions li").removeClass("open");
			$(this).addClass("open");			
		}
	});
	*/
}

function bind_language_dropdown()
{
	//drop_down_click
	/*
	$("li.drop_down").click(function()
	{
		$(this).children("div.lang_dropdown").slideToggle("slow");
	});
	*/
}

function bind_qa_div_hrefs()
{
	//qa_div_link_click
	/*
	$(".qa_div").children("a").click(function(e)
	{
		$(this).parent().children("a").removeClass("showAnswer");
	
		$(this).addClass("showAnswer");
		e.preventDefault();
	});
	*/
}

function bind_soldout_popup()
{
	$("#soldout_container").hide();
	
	//soldout_close_click
	$("#soldout_container").children("a.close_button").click(function(e){
		$.fn.colorbox.close();
		e.preventDefault();		
	});
	
	$.fn.colorbox({
		inline:true, 
		href:'#soldout_container', 
		innerWidth:'610px', 
		innerHeight:'355px',
		opacity: '0.2',
		transition: 'elastic'
	});

	$(document).unbind('cbox_complete', function(){
		$(".order_form").hide();
		$("#colorbox").css({top: '105px'});
		$("#multimediaObject").show();
		$(".job_more_details").show();
	});	
	
	$(document).bind('cbox_cleanup', function()
	{
		$(".order_form").show();		
		$("#multimediaObject").hide();
		$(".job_more_details").hide();
	});
}

function bind_open_room_details()
{
	var img;
	var image_source;
	var me;
	var className;
	
	//$("div.room").children(".rates_and_booking").children("a.rates_button").click(function(e)
	$("div.room").children("div.rates_and_booking").children("a.rates_button").click(function(e)
	{
		e.preventDefault();
		me = $(this);
		img = $(this).children("img");
		image_source = img.attr("src").toString();
		
		className = me.parent().attr("class");	
		
		if(image_source.indexOf("open") > -1)
		{
			me.parent().stop().animate( {width:"473px", backgroundColor:'#ececec'}, {duration: 500, complete:function()
				{
					$(this).removeClass("closed").addClass("open");
					$(this).css({backgroundColor:'#FFFFFF'})

					image_source = img.attr("src");
					image_source = image_source.replace("open", "close");

					img.attr("src", image_source);
					img.attr("src", image_source);
					
					if(className.toString().indexOf('rates_and_booking_big') > -1)
					{
						calculateHeightOfRoom($(this));
					}else{
						calculateHeightOfRoom($(this));
					}
				}});
		}
		else
		{
			$(this).parent().stop().animate({height: '24px'}, {duration:1000, complete: function()
				{
					$(this).css({backgroundColor: '#ececec'}).removeClass("open");
					
					$(this).animate({width:'245px', backgroundColor:'#464646'}, {duration:500, complete: function(){
						$(this).removeClass("open").removeClass("openBig").addClass("closed");

						image_source = img.attr("src");
						image_source = image_source.replace("close", "open");

						img.attr("src", image_source);
						img.attr("src", image_source);						
					}});
				}});	
		}
	});
}

function calculateHeightOfRoom(room)
{
	var rightSideHeight;
	var leftSideHeight;
	
	var maxHeight;

	rightSideHeight = room.children(".right_side_booking").outerHeight() + 115;
	leftSideHeight = room.children(".inner_form").outerHeight() + 115;
	
	maxHeight = (rightSideHeight > leftSideHeight) ? rightSideHeight : leftSideHeight;
	
	
	room.animate({height:maxHeight+'px', width: '473px'}, {duration:1000});
}


function bind_local_attractions_gallery(){
	var paging;
	var ul;
	var index;
	var total;
	var image_name;
	var children_count;
	
	//job_more_details_close_click
	$(".job_more_details .close_button").click(function(e)
	{
		$.fn.colorbox.close();
	});
	
	//func:room_chart_close_click
	/*
	$("#room_chart_popup .close_button").click(function(e)
	{
		$.fn.colorbox.close();	
	})
	*/
	
	//func: room_chart_link_click
	/*
	$("a.room_chart_link").click(function(e)
	{
		e.preventDefault();
		
		var link_title = $(this).attr("title");
		var link_href = $(this).attr("href");
		var link_info = $(this).nextAll(".room_chart_info").html();
		
		$("#lightbox-image-room-chart").attr("src", link_href);
		$("#room_chart_info").html( link_info );

		var divWidth = $("#room_chart_popup").outerWidth();
		var divHeight = $("#room_chart_popup").outerHeight();
		
		$.fn.colorbox({
			inline:true, 
			href:'#room_chart_popup', 
			opacity: '0.2',
			transition: 'elastic',
			width: divWidth,
			height: divHeight
		});

		$(document).bind('cbox_complete', function(){
			$("#room_chart_popup").show();
		});

		$(document).bind('cbox_cleanup', function()
		{
			$("#room_chart_popup").hide();
		});
	});
	*/
	
	//$(".attraction_gallery, div.hallGallery").each(function()
	$("div.attraction_gallery, div.hallGallery").each(function()
	{
		var contTitle = $(this).children("span:first").html();
		$(this).children("ul").children("li").children("a").lightBox({
			fixedNavigation:true,
			txtOf: '/',
			imageBtnClose: '/cs/groups/public/documents/is1siteelements/is1_img_close.png',
			containerMarginTop: 30,
			containerTitle: contTitle,
			imageBtnPrev: '/cs/groups/public/documents/is1siteelements/is1_img_lightbox-btn-prev.gif',
			imageBtnNext: '/cs/groups/public/documents/is1siteelements/is1_img_lightbox-btn-next.gif'
			
		});
		
		$(this).children("ul").children("li").children("a").click(function(e)
		{
			var img = $(this).children("img");
			var title = img.attr("title");
			
			$("#lightbox-container-image-box").children("b").html(title);
		});
		
		$(this).children("a.open_button").click(function(e)
		{
			e.preventDefault();
			$(this).parent().find("li.current").children("a").click();
		});
		
		
		index = 1;
		paging = $(this).children(".image_paging");

		ul = $(this).children("ul");
		ul.children("li:eq(0)").addClass("current");
		children_count = ul.children("li").length;
		
		paging.children("a.next").click(function(e)
		{
			e.preventDefault();
			index += 1;
			
			ul = $(this).parent().parent().children("ul");
			children_count = ul.children("li").length;
			
			paging = $(this).parent();
			
			if((index-1) >= children_count)
			{
				index = 1;
			}
		
			ul.children("li").removeClass("current");		
			ul.children("li:eq("+(index-1)+")").addClass("current");
			
			total = ul.children("li").length;

			paging.children("span.image_position").html(index+' <i class="line_seperator">/</i> '+total)
			image_name = ul.children("li.current").children("a").attr("title");
			paging.children("span.image_name").html(image_name);			
		});
		paging.children("a.prev").click(function(e)
		{
			e.preventDefault();
			index -= 1;		
			
			ul = $(this).parent().parent().children("ul");				
			paging = $(this).parent();
			
			if((index-1) < 0)
			{
				index = children_count;
			}			

			ul.children("li").removeClass("current");			
			ul.children("li:eq("+(index-1)+")").addClass("current");						
			
			total = ul.children("li").length;

			paging.children("span.image_position").html(index+' <i class="line_seperator">/</i> '+total)
			image_name = ul.children("li.current").children("a").attr("title");
			paging.children("span.image_name").html(image_name);			
		});	
		
		total = ul.children("li").length;

		paging.children("span.image_position").html(index+' <i class="line_seperator">/</i> '+total)
		image_name = ul.children("li.current").children("a").attr("title");
		paging.children("span.image_name").html(image_name);
	});
}

function bind_customer_services_tooltip()
{
	$("div.edan_tooltip").hide();
	$("div.customer_service_tooltip").hide();
	$("div.forgot_password_tooltip").hide();
	$("div.customer_service_tooltip_dial").hide();
	$("div.customer_service_tooltip_dial2").hide();
	$("div.send_password_tooltip").hide();
	
	var _top;
	var _left;
	var _width;
	var offset;	
		
	//func:customer_service_tooltip_close_click
	/*
	$(".customer_service_tooltip").children("a.close_button").click(function(e)
	{
		e.preventDefault();
		$(".customer_service_tooltip").slideUp();
	});
	*/
	
	//func:customer_service_dial_click
	/*
	$(".customer_service_tooltip").find(".dial").click(function()
	{
		$(this).attr("src", $(this).attr("src").replace("dial.jpg", "dialing.jpg"));
	});
	*/
	//func:customer_service_tooltip_close_click
	/*
	$(".customer_service_tooltip_dial").children("a.close_button").click(function(e)
	{
		e.preventDefault();
		$(".customer_service_tooltip_dial").slideUp();
	});
	*/
	//func:customer_serivce_tooltip_2_close_click
	$(".customer_service_tooltip_dial2").children("a.close_button").click(function(e)
	{
		e.preventDefault();
		$(".customer_service_tooltip_dial2").slideUp();
	});
	
	//func:edan_tooltip_close_click
	/*$(".edan_tooltip").children("a.close_button").click(function(e)
	{
		e.preventDefault();
		$(".edan_tooltip").slideUp();
	});
	*/
	//edan_tooltip_link_click
	/*
	$("a.edan_tooltip_link").click(function(e)
	{
		e.preventDefault();
		
		offset = $(this).offset();
		_top = offset.top;
		_left = offset.left;
		_width = $(this).outerWidth();

		_top += 15;
		_left = _left - (_width);
		
		$(".edan_tooltip").css({top: _top, left: _left});
		$(".edan_tooltip").slideToggle();
	});
	*/
	//func:forgot_password_link_click
	/*
	$("a.forgotPassword").click(function(e)
	{
		e.preventDefault();
		
		offset = $(this).offset();
		
		_top = offset.top;
		_left = offset.left;
		_width = $(".forgot_password_tooltip").outerWidth();
		_buttonWidth = $(this).outerWidth();
		
		_top += 15;
		_left = _left - (_width);

		$(".forgot_password_tooltip").css({top: _top, left: (_left + (_width / 2) + (_buttonWidth / 2))});
		$(".forgot_password_tooltip").slideToggle();
	});
	*/
	
	//func:send_password_link_click	
	/*
	$("a.sendPassword").click(function(e)
	{
		e.preventDefault();
		
		offset = $(this).offset();
		
		_top = offset.top;
		_left = offset.left;
		_width = $(".send_password_tooltip").outerWidth();
		_buttonWidth = $(this).outerWidth();
		
		_top += 15;
		_left = _left - (_width);

		$(".send_password_tooltip").css({top: _top, left: (_left + (_width / 2) + (_buttonWidth / 2))});
		$(".send_password_tooltip").slideToggle();
	});
	*/
	
	//func:forgot_password_close_click	
	/*
	$(".forgot_password_tooltip").children("a.close_button").click(function(e)
	{
		e.preventDefault();
		$(".forgot_password_tooltip").slideUp();
	});
	*/

	//func:send_password_close_click
	/*
	$("div.send_password_tooltip").children("a.close_button").click(function(e)
	{
		e.preventDefault();
		$(".send_password_tooltip").slideUp();
	})
	*/	
	$(window).resize(function() {
		$(".customer_service_tooltip").hide();
		$(".edan_tooltip").hide();
		$("forgot_password_tooltip").hide();
	});
	
	//live_person_link_click
	/*
	$("a.live_person").click(function(e)
	{
		e.preventDefault();
		
		offset = $(this).offset();
		_top = offset.top;
		_left = offset.left;
		_width = $(this).outerWidth();

		_top += 15;
		_left = _left - (_width) + (_width / 4);
		
		$(".customer_service_tooltip").css({top: _top, left: _left});
		$(".customer_service_tooltip").slideToggle();
		
		var imageSource = $(".customer_service_tooltip").find(".dial").attr("src");
		
		$(".customer_service_tooltip").find(".dial").attr("src", imageSource.replace("dialing", "dial"));		
	});
	*/
	//func:hotel_overview_links_first_click
	/*
	$(".hotel_overview_links").children("a:first").click(function(e)
	{
		e.preventDefault();
		
		offset = $(this).offset();
		_top = offset.top;
		_left = offset.left;
		_width = $(this).outerWidth();

		_top += 15;
		_left = _left - (_width) + (_width / 4);
		
		$(".customer_service_tooltip").css({top: _top, left: _left});
		$(".customer_service_tooltip").slideToggle();
	});
	*/
}

function team_member_text_in_middle()
{
	var _height;
	var _totalHeight;
	var _marginTop;
	var _h3;
	
	$("li.team_member").each(function()
	{
		_height = 0;
		_h3 = $(this).children("h3");
		_height += Math.round(_h3.outerHeight());
		_height += Math.round($(this).children("p").outerHeight());
		
		_totalHeight = Math.round($(this).outerHeight());
		
		_marginTop = Math.round(((_totalHeight -  _height) / 2));
		
		_h3.css('padding-top', _marginTop);
	});
}

function bind_tooltips_on_form()
{
	$(".tooltip").tipsy({gravity: 's'});
}

function bind_date_inputs_focus()
{
	$(".form-checkInDate").focus(function()
	{
		$(this).next("img").click();
	});
	$(".form-checkOutDate").focus(function()
	{
		$(this).next("img").click();
	});	
	
	$(".form-checkOutDate").keydown(function(e)
	{
		e.preventDefault();
	});
	$(".form-checkOutDate").click(function(e)
	{
		e.preventDefault();
	});
	
	$(".form-checkInDate").keydown(function(e)
	{
		e.preventDefault();
	});
	$(".form-checkInDate").click(function(e)
	{
		e.preventDefault();
	});
}

function add_style_and_function_to_checkbox()
{
	$('input.special_checkbox').checkbox({
        cls: 'jquery-safari-checkbox',
        empty: blank_image_file_checkbox
    });

	$(".menuOurHotel").find("input").checkbox({
        cls: 'jquery-safari-checkbox',
        empty: blank_image_file_checkbox
    });

	$("input.special_checkbox").change(function()
	{
		$("ul.news_filter").children("li").removeClass("selected");
		bold_out_selected_checkbox_parent_spans();
	});
	
	bold_out_selected_checkbox_parent_spans();
}

function bold_out_selected_checkbox_parent_spans()
{
	$("input.special_checkbox").each(function(i)
	{
		if($(this).is(':checked'))
		{
			$(this).parent().addClass("selected");
		}
		else
		{
			$(this).parent().removeClass("selected");			
		}
	});	
}


//function bind_sharing_links_change_source()
/*{
	var href = '';
	
	$(".sharing-links").find("img").mouseenter(function()
	{
		href = $(this).attr("src");
		href = href.replace('.png', '');
		
		href = href + '_over';
		href = href + '.png';
		
		$(this).attr("src", href);		
	}).mouseleave(function()
	{
		href = $(this).attr("src");
		
		href = href.replace('.png', '');
		href = href.replace('_over', '');			
		
		href = href + '.png';
		
		$(this).attr("src", href);		
	});
}*/

function bind_roomnumber_change()
{
	$("div.promo-squares").css({zIndex: '100'});
	
	$("#form-hotel_name").change(function(e)	
	{
		var selectedValue = $(this).val();
		var new_hotel_name = $(this).children("option[value='"+selectedValue+"']").text();
		$(".hotel-name-input").val( new_hotel_name );
	});
	
	$(".room_number").find("select").change(function()
	{
		change_room_number($(this), $(this).val());
	});
	
	$(".room_number_select").change(function()
	{
		change_room_number($(this), $(this).val());		
	});
}

function add_pixles_to_small_selecboxes()
{
	$("li.item").find(".selectbox").css({paddingRight: '6px'});
	$("div.floatRightWidthPadding").children(".selectbox").css({paddingRight: '6px'});
}

function bind_clear_dates_button()
{
	//func:clear_dates_click
	/*
	$("a.clear-dates").click(function(e)
	{
		if(cal1)	
		{
			cal1.clear();
		}
		
		$(".date-input").val('');
		$('.total-nights-number').html('0');
		$('.total-nights-number-input').val('');
		$('.span_checkIn').html('');
		$('.span_checkOut').html('');
		$('.extra_text').hide();
		
		e.preventDefault();
	});
	*/
}

function convert_date_to_locale_string(dt, cal) {
        var wStr = cal.cfg.getProperty("WEEKDAYS_SHORT")[dt.getDay()];
        var dStr = dt.getDate();
        var mStr = cal.cfg.getProperty("MONTHS_SHORT")[dt.getMonth()];
        var yStr = dt.getFullYear();

        return (dStr + "/" + mStr + "/" + yStr);
}

function adjust_footer_links_widths()
{
	var pitch = 5;
	var _width = Math.ceil(Number($(".inner-black-links").outerWidth()));

	_width += pitch;

	$(".credits-and-sharing").css({width: _width});
	$(".bottom-footer-links").css({width: _width});
	$(".seo_extra_text").css({width: _width});
}

function cal1_changePage_Handler(type, arge, obj)
{
	bind_calendar_links("check-in");
}

function setup_calendar_position()
{
	var pos;

	cfg = {navigator:true, LOCALE_WEEKDAYS : "1char", PAGES: 2};
    cfg.multi_select = true;
	
	if($("#calendar_1").length <= 0)
	{
		var calContainer = $('<div id="calendar_1" style="display:none" />');
		$(document.body).append(calContainer);
	}
	
	cal1 = new YAHOO.dan_hotels.calendar.IntervalCalendar("calendar_1", cfg);
	cal1.cfg.setProperty("WEEKDAYS_1CHAR", ["S", "M", "T", "W", "T", "F", "S"]);
	cal1.cfg.setProperty("MONTHS_SHORT", ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]);	

	// this will set the constants param as the minimum selectable date
	//cal1.cfg.setProperty("mindate", minimum_date_configuration);	
	//This will set today as the minimum selectable date
	var myday = new Date();
	myday.setDate(myday.getDate()+1);

	cal1.cfg.setProperty("mindate", myday);	
	
	cal1.addWeekdayRenderer(1, day_of_month_renderer);
	cal1.addWeekdayRenderer(2, day_of_month_renderer);
	cal1.addWeekdayRenderer(3, day_of_month_renderer);
	cal1.addWeekdayRenderer(4, day_of_month_renderer);
	cal1.addWeekdayRenderer(5, day_of_month_renderer);
	cal1.addWeekdayRenderer(6, day_of_month_renderer);
	cal1.addWeekdayRenderer(7, day_of_month_renderer);	
	cal1.render();
	
	$("#calendar-container-checkin").hide();

	$("input.date-input").keydown(function(e)
	{
		$(this).val('');
		$(this).next("img").click();
	});
	
	$("img.date-input-button").click(function(e)
	{
		e.preventDefault();
		
		$(".date-input-button").attr("src", calendar_closed_image_source);
		
		var input_button = $(this);
		
		check_in_input = $(this).parent().parent().find("input.check_in_input");
		check_out_input = $(this).parent().parent().find("input.check_out_input");
		
		from_date_input = $(this).parent().parent().find("input.dealFromDate");
		to_date_input = $(this).parent().parent().find("input.dealToDate");
		
		total_nights_input = $(this).parent().parent().parent().find("span.total-nights-number");
		
		if(check_out_input.val() == "" && check_in_input.val() == "")
		{
			cal1.clear();
		}	
		else	
		{
			if(check_out_input.val() != "" && check_in_input.val() != "")
			{
				cal1.setInterval(new Date(check_in_input.val()), new Date(check_out_input.val()));				
			}
		}
		if(from_date_input != null && to_date_input != null)
		{
			setDatesRange( from_date_input.val(), to_date_input.val() );
		}
		else{
			setDatesRange();
		}
		cal1.removeRenderers(); 
		
		cal1.addWeekdayRenderer(1, day_of_month_renderer);
		cal1.addWeekdayRenderer(2, day_of_month_renderer);
		cal1.addWeekdayRenderer(3, day_of_month_renderer);
		cal1.addWeekdayRenderer(4, day_of_month_renderer);
		cal1.addWeekdayRenderer(5, day_of_month_renderer);
		cal1.addWeekdayRenderer(6, day_of_month_renderer);
		cal1.addWeekdayRenderer(7, day_of_month_renderer);
		
		cal1.render();
	
		$("#calendar-container-checkin").toggle();
		
		var multiCalendarWidth = Number($(".multi").outerWidth());
		var calendarContainerWidth = Number($("#calendar-container-checkin").outerWidth());
		var cal1Width = $("#calendar_1").outerWidth();
		
		var _width = cal1Width;

		if(_width <= 313)
			_width = 313;
//		var _width = ( (multiCalendarWidth > calendarContainerWidth) || (calendarContainerWidth > 500)) ? multiCalendarWidth : calendarContainerWidth;
				
		pos = $(this).offset();
		var _top;
		var _left;
		
		_top = Number(pos.top - $("#calendar-container-checkin").outerHeight());
		if(_top < 0)
		{
			_top = Number(pos.top - $("#calendar-container-checkin").outerHeight() + 18);
			_left = Number(pos.left - _width);				
		}
		else
		{
			_top = Number(pos.top - $("#calendar-container-checkin").outerHeight());
			_left = Number(pos.left - _width + 18);	
		}

		$("#calendar-container-checkin").css({
			left: _left,
			top: _top,
			width: _width
		});

		if($("#calendar-container-checkin").is(":hidden"))	{
			input_button.attr("src", calendar_closed_image_source);
			$("#page_container").unbind('click');
		}	else	{
			input_button.attr("src", calendar_open_image_source);			
			$("#page_container").bind('click', function(e)
			{
				if(e.target.className != "date-input-button")	{
					$("#calendar-container-checkin").hide();
					
					$("img.date-input-button").attr('src',calendar_closed_image_source);
					
				}
			});
		}
		
		//get the current month and year of the calendar
        var dates = cal1.getSelectedDates();
		if(dates.length > 0)
		{
			var l = dates[0];

		 	cal1.cfg.setProperty("pagedate", l);
		    cal1.render();
		
			mark_selected_dates_in_calendar();
		}	
		
		bind_calendar_links("check-in");
	});
	/*
	$(".close-button").click(function(e)
	{
		$(".date-input-button").attr("src", calendar_closed_image_source);
		
		$("#calendar-container-checkin").toggle();
		e.preventDefault();
	});
*/
	bind_calendar_links("check-in");
/*	
	$(".profile_link_edan").click(function()
	{
		var link = $(this);
		if($(this).attr("class").indexOf('active') > -1)
		{
			$(this).next("div").slideUp("slow", function()
			{
				link.removeClass("active");				
			});
		}else{
			$(this).next("div").slideDown("slow", function()
			{
				link.addClass("active");							
			});
		}
	});
*/	
}

function setCalendarImages()
{
	
}

function bind_calendar_links(state)
{
	if(state == "check-in")	
	{
		$("td.selectable").children("a").attr("Check In");
		
		$(".calcell").children("a").each(function()
		{
			$(this).attr("title", "Check in");
		});
		$(".calcell").children("a").tipsy({gravity: 's'});

		$(".last-of-type").find(".calweekdayrow").addClass("left-border-grey");
		$(".last-of-type").find("tbody").children("tr").each(function(i)
		{
			$(this).children("td:first").addClass("left-border-grey");
		});
	}
	else
	{
		var _table = $("td.selected").parents("table").parent();

		if(_table.attr("id").indexOf('1_1') > 0)
		{
			_table.prev().find("td.selectable").children("a").attr("title", "Check In");
		}else{
			_table.next().find("td.selectable").children("a").attr("title", "Check Out");			
		}
		
		$("td.selected").nextAll("td.selectable").each(function()
		{
			$(this).children("a").attr("title", "Check out");
		})
		$("td.selected").parent().nextAll("tr").children("td.selectable").each(function()
		{
			$(this).children("a").attr("title", "Check out");
		});
		$("td.selected").prevAll("td.selectable").each(function()
		{
			$(this).children("a").attr("title", "Check in");
		})
		$("td.selected").parent().prevAll("tr").children("td.selectable").each(function()
		{
			$(this).children("a").attr("title", "Check in");
		});
		
		$(".calcell").children("a").tipsy({gravity: 's'});

		$(".last-of-type").find(".calweekdayrow").addClass("left-border-grey");
		$(".last-of-type").find("tbody").children("tr").each(function(i)
		{
			$(this).children("td:first").addClass("left-border-grey");
		});		
	}
	
	$("td.selected").children("a").attr("title", "Check In");
}

function add_inner_fade_to_images_in_main_header()
{
	//sliding the images in the homepage only
	//the images should be inside a ul with the ID of ;images_slider;
	$('#images_slider').innerfade({
		speed: 1200,
		timeout: 5000,
		type: 'random',
		containerheight: '342px'
	});	
}

function bind_images_as_slider_in_homepage()
{
	$(".slider_items").slideView({toolTip: false, ttOpacity: 0.5});	
	$(".slider_items ul li").css({display:'block'});
	
	if($(".slider_items").find("li").length > 1)
	{	
		$(".stripTransmitter").prepend("<img src=\""+left_arrow_url+"\" class=\"prevButton\" />");
		$(".stripTransmitter").prepend("<img src=\""+right_arrow_url+"\" class=\"nextButton\" />");
		
		
		$(".stripTransmitter").children(".prevButton").click(function(e)
		{
			if( $(".stripTransmitter").children("a.current").prev() )
			{
				$(".stripTransmitter").children("a.current").prev().click();
			}
			e.preventDefault();
		});
		
		$(".stripTransmitter").children(".nextButton").click(function(e)
		{
			if( $(".stripTransmitter").children("a.current").next() )
			{
				$(".stripTransmitter").children("a.current").next().click();			
			}
	
			e.preventDefault();
		});	
	}
}

function mark_selected_dates_in_calendar()
{
	var minimum_nights = var_minumum_nights;
	var maximum_nights = var_maximum_nights;

	var _selected_cells = $(".yui-calendar").find("td.selected");
	var _selectedCellCount = _selected_cells.length;
	var _className = "between-selections"
	
	$("td.selected:first").addClass("firstSelected");
	$("td.selected:last").addClass("lastSelected");
	
	$("td.firstSelected").removeClass("between-selections");
	$("td.lastSelected").removeClass("between-selections");
	
	$(".yui-calendar").find("td.selected").each(function(i)
	{
		var _currentClassName = $(this).attr("class").toString();
		if(_currentClassName.indexOf('firstSelected') <= 0 && _currentClassName.indexOf('lastSelected') <= 0)	{
			$(this).addClass(_className);
		}
	});

	var dates = cal1.getSelectedDates();
	
    var l = dates[0];
    var u = dates[dates.length - 1];

	if(l && u && $("td.selected").length > 1)
	{
		var first_date = l.getDate();
		var last_date = u.getDate();
		
		var first_html_date = $("td.firstSelected").children("a").html();
		var last_html_date = $("td.lastSelected").children("a").html();
		
		if(first_html_date != first_date)	
		{
			$("td.firstSelected").addClass("between-selections").removeClass("selected").removeClass("firstSelected");
		}
		
		if(last_date != last_html_date)
		{
			$("td.lastSelected").addClass("between-selections").removeclass("lastSelected").removeClass("selected")
		}
	}

	//calculate the total nights.
	var totalNights = (dates.length > 0) ? dates.length - 1 : 0;

	//insert the total nights number into the appropriate place.
	if(total_nights_input)
	{
		total_nights_input.html( totalNights );		
	}

	if($(".total-nights-number-input"))
	{
		$(".total-nights-number-input").val( totalNights );		
	}
	if(dates.length == 1)
	{
		if(var_minumum_nights > 1)
		{
			$("td.selected:first ~ td").each(function(i)
			{
				if(i < var_minumum_nights - 1)
				{
					$(this).removeClass("selected").addClass("between-selections-not-allowed").children("a").attr("title", "Min "+var_minumum_nights+" nights");					
				}
			});
		}
	}
	//longer then max nights
	if (dates.length >= var_maximum_nights) 
	{
		var count = 1;
		$("td.selected").each(function(i)
		{
			if (count >= var_maximum_nights) 
			{
				$(this).addClass("between-selections-not-allowed").children("a").attr("title", "Max 14 Nights");;
			};
			count ++;
		});
		check_out_input.val('');
		$("#calendar-container-checkin").show();
	};
	
	if(dates.length == var_minumum_nights && !dates.length == 1)
	{
		$("td.selected").removeClass("selected").addClass("between-selections-not-allowed").children("a").attr("title", "Min 2 nights");
		
		check_out_input.val('');		
	};
		if (dates.length < (var_minumum_nights + 1) && dates.length > 1) 
	{
		$("td.selected").removeClass("selected").addClass("between-selections-not-allowed").children("a").attr("title", "Min "+var_minumum_nights+" nights");
		if(check_out_input)
		{
			check_out_input.val('');			
		}
		$("#calendar-container-checkin").show();
	};
}

//on clicking div.deals a.button, display div.ratesPopup
$(document).ready(function(){
/*
	$('div.dealBox a.button').click(function(){
		$(this).addClass('active');

		//If this is the first dealBox, relocate it farther from top:
		var thisRatesPopup = $(this).parent('p').siblings('div.ratesPopup');
		if ( $(this).parents('div.dealBox').prevAll().length > 1 ) {
			thisRatesPopup.css({display:'block'});
			thisRatesPopup.css({bottom: '60px'});
			thisRatesPopup.parent().css({zIndex: '1'});
		} else {
			thisRatesPopup.addClass("ratesPopupUpArrow").show();
			var height = thisRatesPopup.parent().outerHeight();
			height = (height - 20);
			thisRatesPopup.css({top: height});
			thisRatesPopup.parent().css({zIndex: '1'});
		}

		return false;
	});
*/	
	//in hotel_overview - show popup balloon on hover
	var balloonTemplate = $('#balloonTemplate').html();
	$('#balloonTemplate').remove();
	
	$('ul.highlights li').hover(function(){
		var img = $(this).children("img");
		var span = $(this).children("span");
		
		var backgroundImageUrl = img.attr("src");
		$(this).addClass('active').append(balloonTemplate);
		var balloonText = span.html();
		$(this).find('em').css({ backgroundImage: 'url("' + backgroundImageUrl + '")', backgroundPosition: "left 6px" });
		$(this).find('em').append(balloonText);
		$(this).find('i').css({ "top": 0 - $(this).find('i').height()-25});
	}, function(){
		$(this).removeClass('active');
		$(this).find('i').remove();
	});


	/*start multimedia scripts
	--------------------------*/
	/*
	$('#multimediaObject .tabs a').click(function(){
		
		var activeClassName;
		
		var linkClass = $(this).attr("class");
		if(linkClass == "gallery")
		{
			activeClassName = 'galleryWrapper';
		}
		if(linkClass == "tour") 
		{
			activeClassName = 'tourWrapper';
		}
		if(linkClass == "videos") 
		{
			activeClassName = 'videosWrapper';
			if(_hasLiveCamera)
			{
				$("span.tabs").children("a.videos").html(_liveCameraText);
				$("span.tabs").removeClass("tabs_small");
			}else{
				$("span.tabs").children("a.videos").html(_videoText);
				$("span.tabs").addClass("tabs_small");
			}
		}
		if(linkClass == "map") 
		{
			activeClassName = 'mapWrapper';
		}

		$(this).parents('#multimediaObject').removeAttr('class').addClass(activeClassName);

		return false;
	});
	*/
	/*
	$(".galleryContent").find("a").click(function(e)
	{
		var href = $(this).attr("href");
		$(".galleryBigImg").attr('src', href);
		$(".galleryBigImgCover").html( $(this).attr("title") );
		$(this).parent().children("a").removeClass("current");
		$(this).addClass("current");
		e.preventDefault();
	});
	
	$(".tourContent").children("a").click(function(e)
	{
		var href = $(this).attr("href");
		
		$(".tour_content_div span").hide();
		
		$(href).show();
		
		$(this).parent().children("a").removeClass("current");
		$(this).addClass("current");
		e.preventDefault();
	});
	
	$(".videosContent").children("a").click(function(e)
	{
		var href = $(this).attr("href");
		$(".videosContent").attr('src', href);
		$(this).parent().children("a").removeClass("current");
		$(this).addClass("current");
		e.preventDefault();
	});
	*/
	$("#multimediaObject").hide();
	
	$('.guestboox_more').colorbox({
		inline:true, 
		href:'.guestbook_more_details', 
		innerWidth:'630px', 
		innerHeight:'630px', 
		opacity: '0.2',
		transition: 'elastic'
	});
	/*
	$(".guestboox_more").click(function()
	{
		var name = $(this).html();
		var date = $(this).parent().parent().text();
		date = date.substring(date.indexOf('|') + 1);
		var longText = $(this).parent().parent().parent().find("p.long_text").html();
		var hotelName = $(this).parent().parent().parent().find("strong").html();
		
		$(".guestbook_more_details").find("h3").html(name);
		$(".guestbook_more_details").find("h4").html(date);
		$(".guestbook_more_details").find("h5").html(hotelName);
		
		$(".guestbook_more_details").find("p").html('');
		$(".guestbook_more_details").find("p").append('<span class="top_quote"></span>');
		$(".guestbook_more_details").find("p").append(longText);
		$(".guestbook_more_details").find("p").append('<span class="bottom_quote"></span>');
	});
	
	$(".guestbook_more_details .close_button").click(function(e)
	{
		$.fn.colorbox.close();
	});
	*/
	$(".guestbook_more_details").hide();

	$(document).bind('cbox_load', function()
	{
		$(".guestbook_more_details").show();		
	});
	
	
	$(document).bind('cbox_complete', function(){
		if($("#soldout_container").length <=0)
		{
			$(".order_form").hide();
			$("#colorbox").css({top: '105px'});
			$("#multimediaObject").show();			
		}else{
			$("#soldout_container").show();
		}
	});	
	
	$(document).bind('cbox_cleanup', function()
	{
		if($("#soldout_container").length <= 0)
		{
			$(".order_form").show();		
			$("#multimediaObject").hide();			
		}else{
			$("#soldout_container").hide();
		}
		
		$(".guestbook_more_details").hide();
	});
	
	/*end multimedia scripts
	----------------------*/
		

	/*start Menu Our Hotel scripts
	----------------------------*/
	
	$('div.main_logo a').click(function(){
		//slided the drop down --> down
		$('div.menuOurHotel').slideDown("slow", function()
		{
			$("div.main_order_form").hide();
			$(".forgot_password_tooltip").hide();
			$(".edan_tooltip").hide();
		});
		//select the first checkbox in the drop down
		$('div.menuOurHotel').find('input:first').click();
		//hided the logo and the order form
	 	$('div.main_logo').hide();
	});
	
	$("ul.ourHotelImages a").each(function(i)
	{

		$(this).parent('span').append('<strong style="display:none">&nbsp;</strong>');						
		
		var thisImage = $(this).children('img').attr('src');
		var splitImgName = thisImage.split('.');
		splitImgName[0] = splitImgName[0].replace(my_site_id + "_img_menuourhotel_", "is1_img_menuourhotel_");
		splitImgName[0] = splitImgName[0] + 'IMG';

		var hoveredImg = splitImgName.join('.');
		var ourHotelTitle = $(this).children('img').attr('alt');
		var ourHotelData = '<img class="hover" src="' + hoveredImg + '" /><i>' + ourHotelTitle + '</i>';
		$(this).append(ourHotelData);
	})

	$('ul.ourHotelImages a').hover(function(){
		$(this).children('img').eq(0).stop().animate({opacity:0, top:-79},1000);
		$(this).children('img').eq(1).stop().animate({opacity:1, top:0},1000);
		$(this).children('i').stop().css({opacity:0}).animate({opacity:1, bottom:0},1000);
	},function(){
		$(this).children('img').eq(0).stop().animate({opacity:1, top:0},1000);
		$(this).children('i').stop().animate({bottom:-30, opacity:0},1000);
		$(this).children('img').eq(1).stop().animate({opacity:0, top:79},1000,function(){
			$(this).siblings('img').removeAttr('style');
		});
	});
	
	$('div.menuOurHotel input').click(function(){
		var pickThisHotel = $(this).attr('value');

		if(pickThisHotel == "all")
		{
			$('ul.ourHotelImages li a').each(function()
			{
				if ( $(this).attr('title') != pickThisHotel )
				{
					$(this).parent('span').children("strong").fadeOut();
				}
			});
		}
		else
		{
			$('ul.ourHotelImages').find('strong').hide();
			
			$('ul.ourHotelImages li a').each(function()
			{
				if ( $(this).attr('title') != pickThisHotel )
				{
					$(this).parent('span').children("strong").fadeTo('slow', 0.9);
				}
			});
		}
	});	
	
	$('div.menuOurHotel a.closeBtn').click(function(){
		$("div.order_form").show();
		$('div.menuOurHotel').slideUp("slow", function()
		{
	 		$('div.main_logo').show();			
		});
	});
	$("div.menuOurHotel em").click(function()
	{
		$("div.order_form").show();
		$('div.menuOurHotel').slideUp("slow", function()
		{
	 		$('div.main_logo').show();			
		});
	})
	
	/*end Menu Our Hotel scripts
	--------------------------*/
	
	/*start halls_all_types*/
	/*
	$('a.moreInfo').click(function(e){
		e.preventDefault();
		$(this).parent().children('div').show('slow').parent().addClass('open');
	});
	
	$('div.conferenceRoom a.close').click(function(e){
		e.preventDefault();
		$(this).parent().hide('slow').parent().removeClass('open');
	});
	*/
	/*end halls_all_types*/
	
	bindMyReservationsTableFunc(); // init Table click/hover/bubble/balloonTip function
	$('#resTableHook td.col6').bind('click mouseover mouseout', bindMyReservationsTableFunc); // bind handler to the tableLinks/bubble/balloonTip click/hover events
});

// start 'my_reservations.html' Table click/hover/bubble/balloonTip function
function bindMyReservationsTableFunc(e)
{
	var $table 		= $('#resTableHook'),
		sender 		= (e && e.target) || (window.event && window.event.srcElement), // setup event delegation by creating the special "$sender" variable. make it cross-browser.
		$linksTD  	= $(sender).find('td.col6'),
		$sender 	= $(sender),
		detailsTimer;
	
	if(this === window)
	{ // if init
		if($table.length === 1)
		{
			$table.data().cancelBubble = $linksTD.find('span:first').clone().end().remove(); 
		} // only on the correct page: save the a clone of the bubble structure inside the data
	}
	
	if($sender.parent().hasClass('col6') && $sender.get(0).tagName === 'A' && e.type === 'mouseover'){ // if mouseover one of the main links
		clearTimeout(detailsTimer);
		detailsTimer = setTimeout(function(){ // prevent mouse-gliches
			var title = $sender.attr('title'); // get the bubble-text from the title 
			$sender
				.removeAttr('title') // remover the title attribute
				.html('<i/>').children('i') // add and select the bubble holder
				.html(title) // put the text inside the bubble
				.append('<b/>')
				.show(); // show bubble
		},200);
	}
	
	if($sender.parent().hasClass('col6') && $sender.get(0).tagName === 'A' && e.type === 'mouseout'){ // if mouseout of one of the main links
		clearTimeout(detailsTimer);
		detailsTimer = setTimeout(function(){ // prevent mouse-gliches
			$sender
				.attr('title', $sender.children('i').text()) // re-add the natural title attribute
				.children('i').remove(); // remove the 'i'
		},200);
	}
	
	if($sender.hasClass('cancel') && e.type === 'click'){ // if clicked on the main cancel link
		e.preventDefault(); // prevent click default
		
		
		if($sender.siblings('span').length != 1){ // if the bubble doesn't already exist
			$sender.after($table.data().cancelBubble); // append the saved bubble-structure clone
		}
		
		$sender.siblings('span').show(); // show it
	}
	
	if(($sender.hasClass('no') || $sender.hasClass('close')) && e.type === 'click'){ // if clicked inside the cancel-bubble on the upper X or on the "no" button
		e.preventDefault(); // prevent click default
		$sender.closest('span').hide(); // hide it
	}	
}//close bindMyReservationsTableFunc


function change_room_number(select, rooms)
{
	var parent_classname = select.parent().parent().parent().parent().attr("class");
	var topParent = select.parent().parent().parent().parent();
	var inner_form = topParent.find('.inner_form');
	var number_of_rooms = rooms
	
	if(number_of_rooms > 1)
	{	
		if(parent_classname.toString().indexOf('rates_and_booking') > -1)
		{
			topParent.addClass("rates_and_booking_big").addClass("openBig");
		}
		else
		{
			$(".order_form_transparent").addClass("big_order_form");
			$(".order_form_block").addClass("order-form-block-big");	

			$(".main_page_content").children(".right_side").addClass("topPaddingRightSide");				
		}
		
		inner_form.find(".room_unit").eq(1).show();	
		//$("div.promo-squares").css({zIndex: '1', top: '450px'});
		//$(".images-and-order-homepage").css('cssText', 'height: 605px !important');					
	}else{			
		if(parent_classname.indexOf('rates_and_booking') > -1)
		{
			topParent.removeClass("rates_and_booking_big");

		}else{
			$(".order_form_transparent").removeClass("big_order_form");		
			$(".order_form_block").removeClass("order-form-block-big");						

			$(".main_page_content").children(".right_side").removeClass("topPaddingRightSide");	
		}
		inner_form.find(".room_unit").eq(1).hide();				
		//$("div.promo-squares").css({zIndex: '100', top: '388px'});
		//$(".images-and-order-homepage").css('cssText', 'height: 535px!important');
	}
	
	if(parent_classname.indexOf('rates_and_booking') > 1)
	{
		topParent.css({height:inner_form.outerHeight() + 30});		
	}
	
	var room = inner_form.find(".room_unit").eq(0);
	var new_room = inner_form.find(".room_unit").eq(1);
	
	for(i = 0; i < number_of_rooms; i++)
	{
		bind_tooltips_on_form();
		add_pixles_to_small_selecboxes();
	}	
}

function show_calendar()
{
	$("#calendar-container-checkin").show();
	
	check_in_input = $("input.check_in_input");
	check_out_input = $("input.check_out_input");
	total_nights_input = $("span.total-nights-number");
	
	cal1.render();
	
	mark_selected_dates_in_calendar();
}
/*
function add_class_to_lounge_image()
{
	$(".lounge_content").children(".main_square").children("img:first").addClass("main_image");
}
*/
function bind_halls_types_popup()
{
	$(".capacity_and_dimensions").each(function()
	{
		$(this).colorbox(
			{
				html: $(this).parent().children("div.popup").html(),
				transition: 'elastic',
				opacity: 0.2,
				innerWidth:'770px', 
				innerHeight:'630px'
			}
		);
	});
	

	$(document).bind('cbox_complete', function(){
		var topPos = $(window).scrollTop();
		
		setTimeout(function(){
			$("#colorbox").css({top: topPos});
		}, 500 );
		
		$(".hall_types_popup").children("div.close_button").click(function(e)
		{
			$.fn.colorbox.close();
		});
	});	
}

function bind_multimedia_object()
{
	var _status = "";
	
	$(document).ready(function()
	{
		$('.multimedia_content_trigger').colorbox({
			inline:true, 
			href:'#multimediaObject', 
			innerWidth:'979px', 
			innerHeight:'312px',
			opacity: '0.2',
			transition: 'elastic'
		});
/*		
		$(".multimedia_content_trigger").click(function()
		{
			if( $(this).attr("class").indexOf('trigger_gallery') > -1 )
			{
				status = "gallery";
			}
			if( $(this).attr("class").indexOf('trigger_videos') > -1 )
			{
				status = "videos";
			}
			if( $(this).attr("class").indexOf('trigger_360') > -1 )
			{
				status = "360";
			}
			if( $(this).attr("class").indexOf('trigger_map') > -1 )
			{
				status = "map";
			}
		});

		$("#multimediaObject .closeBtn").click(function(e)
		{
			$.fn.colorbox.close();
			e.preventDefault();
		});		
*/		
		$(document).bind('cbox_complete', function()
		{
			setTimeout(function(){
				$("#colorbox").css({top: '105px'});
			}, 500 );
			
			//jQuery.scrollTo(".images-and-order");
			
			switch(status)
			{
				case "gallery":
					$("#multimediaObject").find("a.gallery").click();
				break;
				case "360":
					$("#multimediaObject").find("a.tour").click();
				break;
				case "videos":
					$("#multimediaObject").find("a.videos").click();
				break;
				case "map":
					$("#multimediaObject").find("a.map").click();
				break;
				
			}
		});
	});
}



function iterate_and_open_rooms()
{
	$(".rates_and_booking").each(function()
	{
		if($(this).attr("class").indexOf('open') > -1)
		{
			calculateHeightOfRoom($(this));
		}
	});
}

function bind_error_message()
{
/*
	$(".error_message").find(".close_button").click(function()
	{
		$.fn.colorbox.close();		
	});
*/	
}

function show_error_message(big_title, small_title)
{
	$(".error_message").find("h3").html(big_title);
	$(".error_message").find("h4").html(small_title);	
	
	$.fn.colorbox({
		inline:true, 
		href:'.error_message', 
		opacity: '0.2',
		transition: 'elastic'
	});
}


// start Custome Select
function createCustomSelects()
{
	var $allAselectors = $('a.select'); // minimize DOM access
	$allAselectors.click(triggerCustomSelectFunc);
	
	for(var i=0; i < $allAselectors.length; i++)
	{
		
		var $theRealSelect = $allAselectors.eq(i).prev(),
			activeOption = $theRealSelect.children('option:selected').prevAll().length,
			$customSelect = $('<a><em></em><b></b></a>'); //Wrap custom nodes in a jQuery object + The first <a> is the wrapper
		
		$customSelect.children('em').html($theRealSelect.children('option:selected').text()); // get active hotel text
		for(var j=0; j < $theRealSelect.children('option').length; j++){ // re-create the options in a new custom format
			$customSelect.children('b').append('<i>' + $theRealSelect.children('option').eq(j).html() + '</i>');
		}
		$customSelect.find('i').eq(activeOption).addClass('active');
		$allAselectors.eq(i).html($customSelect.html());		
	}
}

function triggerCustomSelectFunc(e){
	
	if($(this).children('b').is(':hidden')){
		
		if( $('#thisSelect').length == 1){ // if another select exists besides this one, hide it
			$('body').unbind('mouseup');// cleanup
			$('#thisSelect').children('b').animate({height:0, opacity:0},300,function(){ $(this).removeAttr('style').parent().removeAttr('id'); });// run close animation
		}
		
		var expamdedHeight = $(this).children('b').height(),
			selectHeight = $(this).outerHeight() - 2,
			selectWidth = $(this).width() - 4;
		$(this) // <a.select>
			.hover(function(){ $('body').data('overSelect', true);  }, // prevent double-toggle while not using a global variable
				   function(){ $('body').data('overSelect', false); })
			.attr('id','thisSelect') // set a unique ID: when clicking outside the current select = close it.
			.children('b').css({width:selectWidth, opacity:0, height:0, display:'block'}).animate({height:expamdedHeight, opacity:1, top:selectHeight})// run open animation
				.children('i').unbind('click').bind('click', function(e){
					var thisOption = $(this).prevAll().length;
					$(this).siblings('i').removeClass('active').end().addClass('active')
						.parent().prev('em').html( $(this).html() ); // update current <a.select><em>..html..<em></a> text based on <i>..html..</i>
					$('#thisSelect').prev('select').val(thisOption); // set the value of the real <option> tag
				});
		
		e.stopPropagation(); // prevent bubbling to body
		$('body').unbind('mouseup').bind('mouseup', function(){ // setup self-close on this custom select when clicking anywhere outside it
			if (!$('body').data('overSelect') && $('#thisSelect').length == 1){
				$('#thisSelect').trigger('click');
			}
		});
	} else {
		// cleanup:
		$('body').removeData('overSelect').unbind('mouseup');
		$(this).unbind('mouseenter mouseleave').children('b').animate({height:0, opacity:0},300,function(){ $(this).removeAttr('style').parent().removeAttr('id'); });// run close animation
	}
}

function setDatesRange(fromdate, todate)
{
	deal_from_date = fromdate;
	deal_to_date = todate;
	
	cal1.render();
}

day_of_month_renderer = function(workingDate, cell) 
{
	if(workingDate < new Date(deal_from_date) || workingDate > new Date(deal_to_date))
	{
		cell.innerHTML = workingDate.getDate();
		$(cell).addClass("oom");
	   	return YAHOO.widget.Calendar.STOP_RENDER;		
	}
}
function replaceSelect(select)
{
	select.next("div.newListSelected").remove();
	select.sSelect()
}

function setMinimumNightsForCalendar(minimumNights) 
{ 
	var_minumum_nights = minimumNights; 
	cal1.render(); 
} 
 
function setMinDateForCalendar(minDate)
{
	cal1.cfg.setProperty("pagedate", minDate);
	cal1.cfg.setProperty("selected", minDate);
		
	cal1.render();
}
function setDealsMinDateForCalendar(minDate)
{
	cal1.cfg.setProperty("mindate", minDate);
	cal1.cfg.setProperty("pagedate", minDate);
	cal1.cfg.setProperty("selected", minDate);
	
	cal1.render();
}
function bind_slider_links()
{
	$("div.slider_content").each(function()
	{
		$(this).click(function()
		{
			window.location = $(this).children("a").attr("href");
		});
	});
}

function setSelectedDatesRange(startDate, endDate)
{
	cal1.setInterval(startDate, endDate);
	cal1.cfg.setProperty("pagedate", startDate);	
	cal1.render();
	
	$(".order_extra_text").show();
	
	mark_selected_dates_in_calendar();	
}

function setTotalNights(totNights)
{
	if ($(".total-nights-number-input")) 
	{
		$(".total-nights-number-input").val( totNights );		
		$('.total-nights-number').html( totNights );
	}
}

function check_edan_content_height()
{	
	var commercials = $("div.right_side_commercials");
	var mainContent = $("div.main_content_region");
	
	if(commercials)
	{
		var side_height = commercials.outerHeight();
		var main_height = mainContent.outerHeight();
		
		if(side_height > main_height)
		{
			mainContent.css({height: side_height});
		}
	}
}

function add_seo_links()
{
	$(".seo_read_more").click(function(e)
	{
		e.preventDefault();
		$(this).parents(".promo_text").hide();
		$(this).parents(".seo_extra_text").children("div.main_text").show();
	});
	$(".seo_close").click(function(e)
	{
		e.preventDefault();
		$(this).parents(".main_text").hide();
		$(this).parents(".seo_extra_text").children("div.promo_text").show();
	});
}


function new_halls_confrences(){
    $(".cRoomFooter span").click(function() {
    	var ttl = $(this).attr("title");
    	var txt =$(this).text();
        if ($(this).hasClass("off")) {
            $(this).text(ttl).parent().siblings(".content").show(500);
            $(this).removeClass("off").addClass("on");
            $(this).parent().parent().css({ "borderBottomWidth": "6px" });
        } else {
            $(this).text(ttl).parent().siblings(".content").hide(500);
            $(this).removeClass("on").addClass("off");
            $(this).parent().parent().css({ "borderBottomWidth": "1px" });
        }
        $(this).attr("title",txt);
    });
}

