	var active;
	if(ie6 == undefined) var ie6 = false;

	var options = {
		duration:2400,
		axis:'x' 
	};

	function scroll( e, link, settings ){
		var id = link.hash.slice(1),
			elem = document.getElementById(id) || document.getElementsByName(id)[0];
		if ( elem ){
			e && e.preventDefault();
			//var $target = $( $.scrollTo.window() );
			var $target = (ie6)? $( $.scrollTo.window() ) : $('#viewport');
			//var offsetLeft = -(($(window).width() - 900) /2);

			//var settings = $.extend( options, { offset: offsetLeft } );
			$(window).trigger('scrollIsStartingNao');
			var settings = $.extend( options, {});
			$target.queue('fx',[]).stop();
			$target.scrollTo( elem, options );
			active = link;

			$target.queue(function(){
				$(window).trigger('scrollIsDoneNao');
				//location = link.hash;
				$(this).dequeue();
			});
		}
	};

var Specials = {
	show: function(){
		$('#specials').animate({
			height: '30px'
			//bottom: '110px'
		}, 400, 'linear', function(){$('#specials .up, #specials .down').show();}).attr('class', 'visible');
	},
	hide: function(){
		$('#specials').animate({
			height: '0px'
			//bottom: '0px'
		}, 400, 'linear', function(){ $('#specials .up').show(); $('#specials .down').hide();}).attr('class', 'hidden');
	},
	open: function(){
		$('#specials').animate({
			height: '95px'
			//bottom: '110px'
		}, 400, 'linear', function(){ $('#specials .up').hide(); $('#specials .down').show();}).attr('class', 'open');
	},
	close: function(){
		$('#specials').animate({
			height: '30px'
			//bottom: '110px'
		}, 400, 'linear', function(){$('#specials .up, #specials .down').show();}).attr('class', 'visible');
	}
}


function dealWithHeights() {
	var h = (typeof window.innerHeight != 'undefined' ? window.innerHeight : document.body.offsetHeight),
		w = (typeof window.innerWidth != 'undefined' ? window.innerWidth : document.documentElement.clientWidth),
		el = $('#viewport');

	if(h < 655) {
		el.css({ 'overflow-y': 'scroll', 'width': w + 'px' });	
	} else {
		el.css({ 'overflow-y': 'hidden', 'width': w + 'px' });	
	}
}

var now = new Date();
var banners = [
	{title: 'Buck a ball', description: 'Come in and enjoy our famous housemade meatballs in our signature sauce finished with fresh basil and parmesan...Our meatballs speak for themselves'},
	{title: 'Monday is Date Night', description: 'Three course spaghetti dinner for two <span class="price">$29</span>'},
	{title: 'Tuesday is Pizza Night', description: 'All our artisan pizzas on special for <span class="price">$12</span>'},
	{title: 'Wednesday: Risotto', description: 'Delicious risottos starting at <span class="price">$15</span>'},
	{title: 'Lasagna Thursday', description: 'Lasagna Thursday - Lasagnas starting at $15'},
	{title: 'Friday is friends with benefits night', description: 'Appy hour: from 4pm-6pm get 2 for 1 appetizers.'},
	{title: 'Wine Sundays', description: 'Come drink some wine with Lee, wine features just above cost'}
	
];

var activeBanner = Math.floor(Math.random() * banners.length);

function rotateBanner() {
    activeBanner = (activeBanner+1 == banners.length)? 0 : activeBanner +1;
    $('#specials h3 em').html(banners[activeBanner].title);
    $('#specials p').html(banners[activeBanner].description);
}

    window.onkeydown = function(e){
        if(e.keyCode==32)
            return false;  
    }; 

$().ready(function(){
	$('html, body').css({overflow: 'hidden'});

	$(window).resize(function(){ dealWithHeights(); });

    $('#specials img').bind('load', function(){$(this).fadeIn(500)});
    rotateBanner();
    setInterval(rotateBanner, 30000);

	$('#nav a').click(function(e){
		scroll(e, this, options);
		var moveTo =  ($(this).position().left) + ($(this).width() /2) - 5;
		$('#navPointer').animate({ left: moveTo+'px'}, options.duration);
	});

	$('#ribbon a').click(function(){ $('#nav a.page7').click(); return false; });

	$(".thumbnails a").fancybox(); 
	/*
	$(window).bind('scrollIsDoneNao', function() {
	});
	*/	

	setTimeout('Specials.show()', 5400);

	$('#specials .up, #specials h3').click(function(){
		switch($('#specials').attr('class')) {
			case 'visible':
				Specials.open();
				break;
			case 'open':
			case 'hidden':
				Specials.close();
				break;
		}
	});
	$('#specials .down').click(function(){
		switch($('#specials').attr('class')){
			case 'visible':
				Specials.hide();
				break;
			case 'open':
				Specials.close();
				break;
		}
	});

	$('#location-info a.xit').click(function(){ $('#location-info').fadeOut(); return false; });

	dealWithHeights();
});

