// JavaScript Document

$(document).ready(function(){
													 $('#menu').css('left',$('#supersized').find('img').css('left'));
  $(".about").click(function(){
		$(this).fixContent();
		if($("#content").css('display') == 'none') {
			$("#content").slideDown();
		}
		$(".page").hide();
		$("#about").fadeIn();
  });
	$(".collections").click(function(){
		$(this).fixContent();
		if($("#content").css('display') == 'none') {
			$("#content").slideDown();
		}
		$(".page").hide();
		$("#collections").fadeIn();
  });
	$(".stockists").click(function(){
		$(this).fixContent();
		if($("#content").css('display') == 'none') {
			$("#content").slideDown();
		}
		$(".page").hide();
		$("#stockists").fadeIn();
  });
	$(".contact").click(function(){
		$(this).fixContent();
		if($("#content").css('display') == 'none') {
			$("#content").slideDown();
		}
		$(".page").hide();
		$("#contact").fadeIn();
  });
	$("#close").click(function(){
		$("#content").slideUp();
	});
	$(window).resize(function() {
		$(this).fixContent();
	});
	
	//var tempScrollTop, currentScrollTop = 0; 

	//$(window).scroll(function(){ 
	
	//currentScrollTop = $(window).scrollTop(); 
	
	//if (tempScrollTop < currentScrollTop ) {
	//scrolling down 
	//	$("#logo").hide();
	//}
	//else if (tempScrollTop > currentScrollTop ) {
	//scrolling up 
	//}
	//tempScrollTop = currentScrollTop; 
	//});
	
});

jQuery.fn.fixContent = function() {
	$('#menu').css('left',$('#supersized').find('img').css('left'));
	if($(window).height() < 750) {
		$("#content").css("top","140px");
		//$("#content").css("bottom","");
	} else {
		var tp = $(window).height()/2 - $("#content").outerHeight()/2 - 50;
		$("#content").css("top",tp);
		//$("#content").css("top","");
	}
	if($(window).width() > $('#supersized').find('img').width()) {
		var lft = $(window).width()/2 - $("#content").outerWidth()/2;
		$("#content").css("left",lft);
	} else {
		var lft = $(window).width()/2 - $("#content").outerWidth()/2;
		$("#content").css("left",lft);
	}
}

