			$(function() {  
				
				//set background depending on time of day
				var currentTime = new Date()
				var hours = currentTime.getHours()
				if(hours > 16) {
					$("div#background").css("background-image", "url(/brickhouse/images/bg-dinner.jpg)");
				} 
				else if (hours > 11) {
					$("div#background").css("background-image", "url(/brickhouse/images/bg-lunch.jpg)");
				}
				else if (hours > 4) {
					$("div#background").css("background-image", "url(/brickhouse/images/bg-breakfast.jpg)");
				}
				else if (hours > 1) {
					$("div#background").css("background-image", "url(/brickhouse/images/bg-dinner.jpg)");
				}


					
				//keep track of the position of the top of the content box
				topposition = 0;
				
				//calculate area heights
				cropheight = $("#croparea").height();
				contentheight = $("#contentarea").height();
				
				//keep track of what's hidden
				totaloverflow = contentheight - cropheight;
				topoverflow = 0;
				bottomoverflow = totaloverflow;
							
				//if the content is shorter than the container, we have no need to scroll
				if(totaloverflow <= 0){
					totaloverflow = 0;
				}
				
				
				//Make the buttons active
				if(totaloverflow > 0){
					
					$("#upbutton").click(function(event){
						slideit('up');
					});
					$("#downbutton").click(function(event){
						slideit('down');
						//alert(nextdown);
					});
					
				}
				//set the buttons to LOOK active/inactive
				if(bottomoverflow > 0){
					$("#downbutton").css("opacity", "1");
					$("#downbutton").css("filter", "alpha(opacity=100)");
					$("#downbutton").css("-moz-opacity", "1");
					$("#downbutton").css("cursor", "pointer");
				}
				else{
					$("#downbutton").css("opacity", ".5");
					$("#downbutton").css("filter", "alpha(opacity=50)");
					$("#downbutton").css("-moz-opacity", ".5");
					$("#downbutton").css("cursor", "default");
				}
				if(topoverflow > 0){
					$("#upbutton").css("opacity", "1");
					$("#upbutton").css("filter", "alpha(opacity=100)");
					$("#upbutton").css("-moz-opacity", "1");
					$("#upbutton").css("cursor", "pointer");
				}
				else{
					$("#upbutton").css("opacity", ".5");
					$("#upbutton").css("filter", "alpha(opacity=50)");
					$("#upbutton").css("-moz-opacity", ".5");
					$("#upbutton").css("cursor", "default");
				}
				
			});
			function slideit(direction){
			
				//calculate next down and up scroll distances
				if(bottomoverflow > cropheight){
					nextdown = cropheight;
				}
				else{
					nextdown = bottomoverflow;
				}
				if(topoverflow > cropheight){
					nextup = cropheight;
				}
				else{
					nextup = topoverflow;
				}
				
				//set scroll-to (css) value
				if(direction == 'up'){
					newtoppos = topposition + nextup;
				}
				else if (direction == 'down'){
					newtoppos = topposition - nextdown
				}
				
				//and get to it
				$("#contentarea").animate({ 
					top: newtoppos
				}, 500 );
				
				//update values for the next time around
				topposition = newtoppos;
				topoverflow = 0 - topposition;
				//alert('topoverflow: ' + topoverflow);
				bottomoverflow = totaloverflow - topoverflow;
				//alert('bottomoverflow: ' + bottomoverflow);
				
				//set the buttons to LOOK active/inactive
				if(bottomoverflow > 0){
					$("#downbutton").css("opacity", "1");
					$("#downbutton").css("filter", "alpha(opacity=100)");
					$("#downbutton").css("-moz-opacity", "1");	
					$("#downbutton").css("cursor", "pointer");
				}
				else{
					$("#downbutton").css("opacity", ".5");
					$("#downbutton").css("filter", "alpha(opacity=50)");
					$("#downbutton").css("-moz-opacity", ".5");
					$("#downbutton").css("cursor", "default");
				}
				if(topoverflow > 0){
					$("#upbutton").css("opacity", "1");
					$("#upbutton").css("filter", "alpha(opacity=100)");
					$("#upbutton").css("-moz-opacity", "1");
					$("#upbutton").css("cursor", "pointer");
				}
				else{
					$("#upbutton").css("opacity", ".5");
					$("#upbutton").css("filter", "alpha(opacity=50)");
					$("#upbutton").css("-moz-opacity", ".5");
					$("#upbutton").css("cursor", "default");
				}
			  
			}

