function initCufon() {
	Cufon.replace('#nav a.font', { fontFamily: 'Century_Gothic_Bold', hover: true });
	Cufon.replace('#footer h3', { fontFamily: 'Century_Gothic_Bold' });
	Cufon.replace('#sidebar .heading h3', { textShadow: '#4b7d37 1px 1px', fontFamily: 'Hand Of Sean' });
	Cufon.replace('.book-today .heading h3', { textShadow: '#4b7d37 1px 1px', fontFamily: 'Hand Of Sean' });
	Cufon.replace('#content .heading h1', { fontFamily: 'Hand Of Sean' });
	Cufon.replace('.visual .txt strong', { textShadow: '#252227 2px 2px', fontFamily: 'Hand Of Sean' });
	Cufon.replace('.visual .txt span', { textShadow: '#252227 2px 2px', fontFamily: 'Hand Of Sean' });
	Cufon.replace('.entry h1', { fontFamily: 'Hand Of Sean' });
	Cufon.replace('.main-content h2', { fontFamily: 'Century_Gothic_Bold' });
	Cufon.replace('.popup p', { fontFamily: 'Hand Of Sean' });
    Cufon.replace('#fancybox-inner h1', { fontFamily: 'Hand Of Sean' });
}

(function($) {
	$.fn.simplebox = function(options) {
		return new Simplebox(this, options);
	};

	function Simplebox(context, options) { this.init(context, options); };

	Simplebox.prototype = {
		options:{},
		init: function (context, options){
			this.options = $.extend({
				duration: 0,
				linkClose: 'a.close, a.btn-close',
				divFader: 'fader',
				faderColor: 'black',
				opacity: 0.7,
				wrapper: '.w1',
				linkPopap: '.link-submit'
			}, options || {});
			this.btn = $(context);
			this.select = $(this.options.wrapper).find('select');
			this.initFader();
			this.btnEvent(this, this.btn);
		},
		btnEvent: function($this, el){
			el.click(function(){
                                
                                    if ($(this).attr('href')) $this.toPrepare($(this).attr('href'));
                                    else $this.toPrepare($(this).attr('title'));
                                    return false;
                                
			});
		},
		calcWinWidth: function(){
			this.winWidth = $('body').width();
			if ($(this.options.wrapper).width() > this.winWidth) this.winWidth = $(this.options.wrapper).width();
		},
		toPrepare: function(obj){
			this.popup = $(obj);
			this.btnClose = this.popup.find(this.options.linkClose);
			this.submitBtn = this.popup.find(this.options.linkPopap);

			if ($.browser.msie) this.select.css({visibility: 'hidden'});
			this.calcWinWidth();
			this.winHeight = $(window).height();
			this.winScroll = $(window).scrollTop();

			this.popupTop = this.winScroll + (this.winHeight/2) - this.popup.outerHeight(true)/2;
			if (this.popupTop < 0) this.popupTop = 0;
			this.faderHeight = $(this.options.wrapper).outerHeight();
			if ($(window).height() > this.faderHeight) this.faderHeight = $(window).height();

			this.popup.css({
				top: this.popupTop,
				left: this.winWidth/2 - this.popup.outerWidth(true)/2
			}).hide();
			this.fader.css({
				width: this.winWidth,
				height: this.faderHeight
			});
			this.initAnimate(this);
			this.initCloseEvent(this, this.btnClose, true);
			this.initCloseEvent(this, this.submitBtn, false);
			this.initCloseEvent(this, this.fader, true);
		},
		initCloseEvent: function($this, el, flag){
			el.click(function(){
				$this.popup.fadeOut($this.options.duration, function(){
					$this.popup.css({left: '-9999px'}).show();
					if ($.browser.msie) $this.select.css({visibility: 'visible'});
					$this.submitBtn.unbind('click');
					$this.fader.unbind('click');
					$this.btnClose.unbind('click');
					$(window).unbind('resize');
					if (flag) $this.fader.fadeOut($this.options.duration);
					else {
						if ($this.submitBtn.attr('href')) $this.toPrepare($this.submitBtn.attr('href'));
						else $this.toPrepare($this.submitBtn.attr('title'));
					}
				});
				return false;
			});
		},
		initAnimate:function ($this){
			$this.fader.fadeIn($this.options.duration, function(){
				$this.popup.fadeIn($this.options.duration);
			});
			$(window).resize(function(){
				$this.calcWinWidth();
				$this.popup.animate({
					left: $this.winWidth/2 - $this.popup.outerWidth(true)/2
				}, {queue:false, duration: $this.options.duration});
				$this.fader.css({width: $this.winWidth});
			});
		},
		initFader: function(){
			if ($('div.'+this.options.divFader).length > 0) this.fader = $('div.'+this.options.divFader);
			else{
				this.fader = $('<div class="'+this.options.divFader+'"></div>');
				$('body').append(this.fader);
				this.fader.css({
					position: 'absolute',
					zIndex: 999,
					left:0,
					top:0,
					background: this.options.faderColor,
					opacity: this.options.opacity
				}).hide();
			}
		}
	}
}(jQuery));

$(document).ready(function(){
	initCufon();
	if ($("#tabs").length) $("#tabs").tabs();
//	if ($( "#datepicker" ).length) $( "#datepicker" ).datepicker({
//			showOtherMonths: true,
//			selectOtherMonths: true,
//			dayNamesMin: ['S', 'M', 'T', 'W', 'T', 'F', 'S']
//		});

	$('.clicker').simplebox();

	$('#nav > li').hover(function(){
		$(this).addClass('hover');
	}, function(){
		$(this).removeClass('hover');
		setTimeout(function(){
			Cufon.refresh('#nav a.font');
		}, 100);
	})

});
