function mycarousel_initCallback(carousel) {
	jQuery('.gal-next').bind('click', function() {
		carousel.next();
		return false;
	});

	jQuery('.gal-prev').bind('click', function() {
		carousel.prev();
		return false;
	});
};

$(document).ready(function(){
	$("a.fancybox").fancybox({
		'padding' : 0
	});




	$(".gallery").jcarousel({
		scroll: 1,
		initCallback: mycarousel_initCallback,
		buttonNextHTML: null,
		buttonPrevHTML: null,
		buttonNextCallback: function (carousel, button, enabled){
			if(enabled){
				jQuery('.gal-next').animate({opacity: 0.9}).css('cursor', 'pointer')

			} else {
				jQuery('.gal-next').animate({opacity: 0.2}).css('cursor', 'default')
			}
		},
		buttonPrevCallback: function (carousel, button, enabled){
			if(enabled){
				jQuery('.gal-prev').animate({opacity: 0.9}).css('cursor', 'pointer')
			} else {
				jQuery('.gal-prev').animate({opacity: 0.2}).css('cursor', 'default')
			}
		}

	});

	Cufon.replace('.nav a,h2,h3,.quote,.telephone-bar span, .telephone-bar a,.promotions p,.welcome-text,.menu-table .dish-desc, .menu-table .dish-name, .menu-table span, .localization,.contact-page p');
	
	/* FACEBOOK SLIDE */
	p3_sidebar_drawers();

/* instrument the animations for the sidebar tabs */
	function p3_sidebar_drawers() {
		var drawer_padding = 0;

		// set initial opacity and height of drawers
		jQuery('.drawer_content, .tab').css('opacity', 1);
		jQuery('.drawer_content').css('height', (jQuery(window).height() - 0) + 'px' ); 

		// function-scoped timeout var object
		var p3_close_drawer_timeout = new Object();

		// instrument each drawer
		jQuery('.drawer').each(function(){
			var drawer = jQuery(this);
			var id     = drawer.attr('id');
			var tab    = jQuery('.tab', this);
			var width  = parseInt( jQuery('.drawer_content', drawer).css( 'width' ) ) + 0;
			var speed  = parseInt( width * 0.75 );

			// show the drawer on tab mouseover
			tab.mouseover(function(){
				drawer
					.css( 'z-index', '10000' )
					.animate( { right:'0px' }, speed, 'swing' )
					.addClass( 'open' );
			});

		

			// set the timeout to close drawer on mouseleave
			drawer.mouseleave(function(){
				var delay = 100;
				clearTimeout( p3_close_drawer_timeout[id] );
				p3_close_drawer_timeout[id] = setTimeout( function(){
					drawer.animate( { right:'-' + width + 'px' }, speed, 'swing', function(){
						drawer.css( 'z-index', '5000' ).removeClass('open');
					} );
				}, delay );
			});

			// restart the close drawer timout on mouseenter
			drawer.mouseenter(function(){
				clearTimeout( p3_close_drawer_timeout[id] );
			});
		});	
	}
	
	
})
