var nav = function(){
	return {
		init:function(){
			$(".nBTN").animate({opacity:.5});
			
			$(".nBTN").hover(
				function(){
					$(this).stop().animate({opacity:1});
				},
				function(){
					$(this).stop().animate({opacity:.5});
				}
			);
			$(".nBTN").click(function(){
				$("#content").fadeOut('slow');
			});
		}
	}
}();
var workNav = function() {
	return {
		init:function(){
			//$(".wBTN").animate({opacity:.5});
			
			$(".wBTN").hover(
				function(){
					//$(this).stop().animate({opacity:1});
					$(this).css('background','#222222');
					$(this).css('color','#ffffff');
				},
				function(){
					//$(this).stop().animate({opacity:.5});
					$(this).css('background','none');
					$(this).css('color','#222222');
				}
			);
			
		}
	}
}();

/*var home = function() {
	var count = 0;
	var i = 0;
	return {
		init:function() {
			count = $("#whatwhat").find('.jiggaWhat').size()-1;
			$(".jiggaWhat:eq("+i+")").animate({opacity:1});
			$("#rly").click(function(){
				if(i < count){
					$(".jiggaWhat:eq("+i+")").animate({opacity:0});
					i = i+1;
					$(".jiggaWhat:eq("+i+")").animate({opacity:1});
				}
				else {
					$(".jiggaWhat:eq("+i+")").animate({opacity:0});
					i = 0;
					$(".jiggaWhat:eq("+i+")").animate({opacity:1});
				}
			});
		}
	}
}();*/

var home = function() {
	var count = 0;
	var i = 0;
	return {
		init:function() {
			$("#header").animate({top:-95},0);
			$("#background").animate({opacity:0},0);
			
			setTimeout("$('#background').animate({opacity:1})",250);
			setTimeout("$('#header').animate({top:0},'slow')",950);
		}
	}
}();
var page = function() {
	var count = 0;
	var i = 0;
	var _max = 0;
	var h = window.outerHeight;
	return {
		init:function() {
			
			$("#background").animate({opacity:0},0);
			setTimeout("$('#background').animate({opacity:1},'slow')",250);
			
			
		}
	}
}();
var workPage = function() {
	var count = 0;
	var i = 0;
	var _max = 0;
	var h = window.outerHeight;
	var time = 2700;
	var delay = 3700;
	return {
		init:function() {
			
			//$("#background img").animate({top:-h},0);
			//$("#background").children("img:eq("+count+")").animate({top:0},time);
			$("#background").animate({opacity:0},0);
			setTimeout("$('#background').animate({opacity:1},'slow')",250);
			
			//this.startCycle();
		},
		startCycle:function(){
			for(var i=0; i<$("#background").children().length; i++){
				_max = _max+1;	
			}
			if(_max >0){
				//setTimeout("workPage.cycle()",delay);
			}
		},
		cycle:function(){
			
			if(count < _max-1){
				$("#background").children("img:eq("+count+")").animate({top:h},time,function(){
					$(this).animate({top:-h},0)	
				});
				count = count+1;
				$("#background").children("img:eq("+count+")").animate({top:0},time);
			}
			else {
				
				$("#background").children("img:eq("+count+")").animate({top:h},time);
				count = 0;
				$("#background").children("img:eq("+count+")").animate({top:0},time);
			}
			setTimeout("workPage.cycle()",delay);
		}
	}
}();

$(function() {
	nav.init();
});
