var animating = false;
$(function() {
    
    $('.home').click(function() {
	    $('#slide-content').stop().animate({"left" : "0px"}, {"duration" : "slow" , "easing": "easeInOutExpo"});
    });
    
    $('.our-story').click(function() {
	    $('#slide-content').stop().animate({"left" : "-720px"}, {"duration" : "slow" , "easing": "easeInOutExpo"});
    });
    
    $('.drinks').click(function() {
	    $('#slide-content').stop().animate({"left" : "-1440px"}, {"duration" : "slow" , "easing": "easeInOutExpo"});
    });
    
    $('.natural').click(function() {
	   $('#slide-content').stop().animate({"left" : "-2160px"}, {"duration" : "slow" , "easing": "easeInOutExpo"});
    });
    
    $('.where').click(function() {
	   $('#slide-content').stop().animate({"left" : '-2880px'}, {"duration" : "slow" , "easing": "easeInOutExpo"});
    });
    
    $('.naturally-spirited').click(function() {
	   $('#slide-content').stop().animate({"left" : '-3600px'}, {"duration" : "slow" , "easing": "easeInOutExpo"});
    });
    
    $('.blogs').click(function() {
	   $('#slide-content').stop().animate({"left" : '-4320px'}, {"duration" : "slow" , "easing": "easeInOutExpo"});
    });
		
	$('.right-button').click(function() {
		if(!animating) { 
			animating = true;
	        	$('#drinks-content').stop().animate({"left" : '-=720px'}, {"duration" : "fast" , "easing": "easeInOutExpo", complete: function() { animating = false; }});
		}
	});
	
	$('.left-button').click(function() {
		if(!animating) { 
			animating = true;
	        	$('#drinks-content').stop().animate({"left" : '+=720px'}, {"duration" : "fast" , "easing": "easeInOutExpo", complete: function() { animating = false; }});
		}
	});
    
    $('.passionfruit').click(function() {
	    $('#drinks-content').stop().css({"left" : "0px"});
    });
    
    $('.strawberry').click(function() {
	    $('#drinks-content').stop().css({"left" : "-720px"});
    });
    
    $('.margarita').click(function() {
	    $('#drinks-content').stop().css({"left" : "-1440px"});
    });
    
    $('.mango').click(function() {
	   $('#drinks-content').stop().css({"left" : "-2160px"});
    });
    
    $('.banana').click(function() {
	   $('#drinks-content').stop().css({"left" : '-2880px'});
    });
    
    $('.pom').click(function() {
	   $('#drinks-content').stop().css({"left" : '-3600px'});
    });
    
    $('.vodka').click(function() {
	   $('#drinks-content').stop().css({"left" : '-4320px'});
    });
    
    $('.feijoa').click(function() {
	   $('#drinks-content').stop().css({"left" : '-5040px'});
    });
    
    $('.mai-tai').click(function() {
	   $('#drinks-content').stop().css({"left" : '-5760px'});
    });
    
    $('.zoom').mouseover(function() {
      $(this).delay(300).animate({"height":"404px", "width":"96px", "margin-top":"-70px", "margin-left":"-15px"});
    }).mouseout(function(){
          $(this).clearQueue().animate({"height":"261px", "width":"62px", "margin-top":"0px", "margin-left":"0px"});
        });

    	$(".drink").mouseover(function() {
    		$(this).addClass("drink-above");
    	}).bind('mouseout click', function() {
        	$(this).removeClass("drink-above");
	});
	
	$("a.nav").click(function() {
		$("a.nav").removeClass("active");
		$(this).addClass("active");
	});
	
	$(".drink").click(function() {
	    $('#drinks_window').show();
		$('#button-wrapper').show();
		$('.link-wrap').show();
		$('.bottom').hide();
	});
	
	$(".back-to-range, .awards, .legal, .nav").click(function() {
	    $('#drinks_window').hide();
		$('#button-wrapper').hide();
		$('.link-wrap').hide();
		$('.bottom').show();
	});
	
	$(".right-button").click(function() {
	if ($('#drinks-content').css('left') === '-5040px') {
	    $('.right-button').hide();
		}
	});
	
	$(".left-button").click(function() {
	if ($('#drinks-content').css('left') === '-5760px') {
	    $('.right-button').show();
		}
	});
	
	$(".left-button").click(function() {
	if ($('#drinks-content').css('left') === '-720px') {
	    $('.left-button').hide();
		}
	});
	
	$(".right-button").click(function() {
	if ($('#drinks-content').css('left') === '0px') {
	    $('.left-button').show();
		}
	});
	
	$(".first-drink").click(function() {
	    $('.left-button').hide();
	});
	
	$(".last-drink").click(function() {
	    $('.right-button').hide();
	});
	
	$(".back-to-range").click(function() {
	    $('.left-button').show();
		$('.right-button').show();
	});
	
	$(".awards").click(function() {
	    $('#slide-content').hide();
		$('#legal_window').hide();
		$('#trophy_window').show();
	});

	$(".awards-back, .site-nav, .logo").click(function() {
	    $('#trophy_window').hide();
		$('#slide-content').show();
	});

	$(".legal").click(function() {
	    $('#slide-content').hide();
		$('#trophy_window').hide();
		$('#legal_window').show();
	});

	$(".legal-back, .site-nav, .logo").click(function() {
	    $('#legal_window').hide();
		$('#slide-content').show();
	});
	
	$("div.naturally").click(function() {
	   $('div#slide-content').stop().animate({"left" : '-3600px'}, {"duration" : "slow" , "easing": "easeInOutExpo"});
	   $('a.naturally-spirited').addClass("active");
        return false;
	});
	
	$("div.blogs-home").click(function() {
	   $('div#slide-content').stop().animate({"left" : '-4320px'}, {"duration" : "slow" , "easing": "easeInOutExpo"});
	   $('a.blogs').addClass("active");
	   return false;
	});

	$("div.clickable").click(function() {
	    window.location = $("a.clickable").attr('href');
	    return false;
	});
	
	$("div.click-facebook").click(function() {
		window.open('https://www.facebook.com/VnCCocktailsNZ');
		window.open('http://twitter.com/vnccocktails');
	    return false;
	});
	
	$('area.america').mouseover(function() {
	    $('#Image-Maps_8201107272024304').attr('src', 'images/america-map.png' );
	});
	
	$('area.america').mouseout(function() {
	    $('#Image-Maps_8201107272024304').attr('src', 'images/map.png' );
	});
	
	$('area.nordic').mouseover(function() {
	    $('#Image-Maps_8201107272024304').attr('src', 'images/nordic-map.png' );
	});
	
	$('area.nordic').mouseout(function() {
	    $('#Image-Maps_8201107272024304').attr('src', 'images/map.png' );
	});
	
	$('area.europe').mouseover(function() {
	    $('#Image-Maps_8201107272024304').attr('src', 'images/europe-map.png' );
	});
	
	$('area.europe').mouseout(function() {
	    $('#Image-Maps_8201107272024304').attr('src', 'images/map.png' );
	});
	
	$('area.uk').mouseover(function() {
	    $('#Image-Maps_8201107272024304').attr('src', 'images/uk-map.png' );
	});
	
	$('area.uk').mouseout(function() {
	    $('#Image-Maps_8201107272024304').attr('src', 'images/map.png' );
	});
	
	$('area.middleeast').mouseover(function() {
	    $('#Image-Maps_8201107272024304').attr('src', 'images/middleeast-map.png' );
	});
	
	$('area.middleeast').mouseout(function() {
	    $('#Image-Maps_8201107272024304').attr('src', 'images/map.png' );
	});
	
	$('area.asia').mouseover(function() {
	    $('#Image-Maps_8201107272024304').attr('src', 'images/asia-map.png' );
	});
	
	$('area.asia').mouseout(function() {
	    $('#Image-Maps_8201107272024304').attr('src', 'images/map.png' );
	});
	
	$('area.pacific').mouseover(function() {
	    $('#Image-Maps_8201107272024304').attr('src', 'images/pacific-map.png' );
	});
	
	$('area.pacific').mouseout(function() {
	    $('#Image-Maps_8201107272024304').attr('src', 'images/map.png' );
	});
	
	$(document).ready(function() {
	    var pathname = window.location.hash;
	
		if (pathname == "#OurStory") {
			$('#slide-content').css({"left" : '-720px'});
			$("a.nav").removeClass("active");
			$(".our-story").addClass("active");
		}
		
		if (pathname == "#Drinks") {
			$('#slide-content').css({"left" : '-1440px'});
			$("a.nav").removeClass("active");
			$(".drinks").addClass("active");
		}
		
		if (pathname == "#Natural") {
			$('#slide-content').css({"left" : '-2160px'});
			$("a.nav").removeClass("active");
			$(".natural").addClass("active");
		}
		
		
		if (pathname == "#Where") {
			$('#slide-content').css({"left" : '-2880px'});
			$("a.nav").removeClass("active");
			$(".where").addClass("active");
		}
		
		if (pathname == "#NaturallySpirited") {
			$('#slide-content').css({"left" : '-3600px'});
			$("a.nav").removeClass("active");
			$(".naturally-spirited").addClass("active");
		}
		
		if (pathname == "#Blogs") {
			$('#slide-content').css({"left" : '-4320px'});
			$("a.nav").removeClass("active");
			$(".blogs").addClass("active");
		}
		
		window.onscroll = function() {
		  document.getElementById('footer').style.top =
		     (window.pageYOffset + window.innerHeight - 25) + 'px';
		};
		
	});

});
