
var imgArray = ['imgs/gallery/zbgallery_9.jpg',
                'imgs/gallery/zbgallery_11.jpg',
                'imgs/gallery/zbgallery_7.jpg',	
                'imgs/gallery/zbgallery_10.jpg',
                'imgs/gallery/zbgallery_13.jpg',
                'imgs/gallery/zbgallery_14.jpg',
                'imgs/gallery/zbgallery_15.jpg',
                'imgs/gallery/zbgallery_16.jpg',
                'imgs/gallery/zbgallery_17.jpg',
                'imgs/gallery/zbgallery_18.jpg',
                'imgs/gallery/zbgallery_19.jpg',
                'imgs/gallery/zbgallery_20.jpg',
                'imgs/gallery/zbgallery_21.jpg',
                'imgs/gallery/zbgallery_22.jpg'];

var imgIndex = 0;
var theWidth = 0;
var scrollPos = -114;
var scrollIndex = 0;


$(document).ready(function(){
	
	$('#pressNav').click(function(){alert('The Press Page is Coming Soon!');return false;});
	
	
	$('#hhFoodLink').click(function(){$('#happyHourSlideInner').stop().animate({marginLeft:'-176px'});return false;});
	$('#hhDrinkLink').click(function(){$('#happyHourSlideInner').stop().animate({marginLeft:'0px'});return false;});
	
	//set beer width
	$('#beerList ul li').each(function(){
		theWidth += $(this).outerWidth(true);
	});
	
	$('#beerList ul').width(theWidth);
	
	//start beer scrolling
	setInterval("beerScroll()", 5000);
	
	//start slideshow
	slidesGo();
	setInterval("slidesGo()", 4000);
	
	//start sign glow
	//signFade();	

	//nav hover fade
	$('ul#mainNav li a').each(function(){
		$(this).hover(
			function(){
				$('span', this).fadeIn(200);
			},
			function(){
				$('span', this).fadeOut(200);
			}
		);
	});//end nav hover fade
	
	//networking hover
	$('ul#networkingLinks li').each(function(){
		$(this).hover(
			function(){
				$('span', this).stop().animate({'top': '-80px', 'opacity':'1', 'filter': 'alpha(opacity=100)'});
			},
			function(){
				$('span', this).stop().animate({'top': '-60px', 'opacity':'0', 'filter': 'alpha(opacity=0)'});
			}
		);
	});//end networking links
	
	
});//end document ready

function slidesGo(){
	var currImg = $("#slideShow").children()[0];
	var newImg = document.createElement('img');
	$(newImg).attr('src', imgArray[imgIndex]);
	$(newImg).attr('alt', 'Zayda Buddys');
	$(newImg).hide();
	
	$("#slideShow").append(newImg);
	$(newImg).fadeIn(200, function(){
		//$(currImg).remove();
	});
	
	imgIndex++;
	
	if(imgIndex >= imgArray.length){
		imgIndex = 0;
	}
};//end slidesGo

function signFade(){
	$('#zbSign span').fadeOut(3000, function(){$('#zbSign span').fadeIn(1000, function(){signFade()})});
}


function beerScroll(){
	$('#beerList ul').animate({'left': scrollPos + 'px'}, 700);
	
	if(scrollIndex < 5){
		scrollPos += -114;
		scrollIndex++;
	}else{
		scrollPos = 0;
		scrollIndex = -1;
	}
}



