// Fade in Bottles on Wine Portfolio
$(document).ready(function(){
	
	// This is how long it takes to fade in
	var delay = 1250;
	
	// This is how long before the current bottle is finished when the next starts
	var overlap = 250;
	
	// Hide the bottles
	$('.home-bottles a img').fadeTo(0, 0);

	var i = 0;
	// Fade in the bottles
	$('.home-bottles').children().each(function(){
		$(this).find('img').delay(i).fadeTo(delay, 1);
		i += (delay - overlap);
	});
	
});

$(document).ready(function(){
		$('#footer').fadeIn(3000);
});


$(document).ready(function(){
	
    var slider = $('#slider1').bxSlider({
        auto: false,
        autoControls: false,
        autoHover: true,
		pager: false,
        controls: false
    });
    
    $('.prod_nav').click(function(){
    	    	
    	$('.prod_nav').removeClass('current');
    	$(this).addClass('prod_nav current');
    	    	
    	slider.goToSlide($('.prod_nav').index($(this)));
    	//return false;
    });
	
});


/* ScrollTo */
$(document).ready(function(){
	$(".scroll").click(function(event){
		//prevent the default action for the click event
		event.preventDefault();

		//get the full url - like mysitecom/index.htm#home
		var full_url = this.href;

		//split the url by # and get the anchor target name - home in mysitecom/index.htm#home
		var parts = full_url.split("#");
		var trgt = parts[1];

		//get the top offset of the target anchor
		var target_offset = $("#"+trgt).offset();
		var target_top = target_offset.top;

		//goto that anchor by setting the body scroll top to anchor top
		$('html, body').animate({scrollTop:target_top}, 500);
	});
});
