function getGreetingText() {
	var hours = (new Date()).getHours();
	if(hours < 6)
		return "Good night!";
	if(hours < 10)
		return "Good morning!";
	if(hours < 12)
		return "Good day!";
	if(hours < 16)
		return "Good afternoon!";
	if(hours < 24)
		return "Good evening!";
	else
		return "Good day!";
}

$(document).ready(function() {
// Skips loading of the scroller if we're not
// at the front page (set via wp is_home())
// --------------
if(page_loaded_is_home) { 
	
	document.getElementById('greeting_text').innerHTML = getGreetingText();
	if(!document.getElementById('portfolio')) return;
	
	// quick (&stupid) hack to get keyboard scrolling going
	var scroll_position = 1;
	
	var mask = document.getElementById('portfolio');
	var content = document.getElementById('items');
	var steps = 11; // document.body.clientWidth / 320;
	var portfolio_slider = new Dragdealer('myslider', {
		steps: steps,
		loose: true,
		yPrecision: content.offsetWidth,
		animationCallback: function(x,y) {
			//alert("OJ");
			var margin = x * (content.offsetWidth - mask.offsetWidth); // + (320 / (document.body.clientWidth / 10));
			content.style.marginLeft = String(-margin) + 'px';
		},
		callback: function() {
			//scroll_position++;
		}
	});

	var link1 = document.getElementById('link1');

	$(window).keydown(function(e) {
		if(e.keyCode == '39') {
			//alert("right");
			portfolio_slider.setStep(++scroll_position);
		} else if(e.keyCode == '37') {
			portfolio_slider.setStep(--scroll_position);
			//alert("left");
		}
	});
	
	$(window).scroll(function(e) {
		if(e.shiftKey) {
			alert("pressed shift");
		}
	});
	
} // end skip if not at front page
// -------------------

});
