// TimeSwap
function showHeader(){
	var now = new Date;
	var timeNow = now.getHours();
	var img = null;
	
	if (timeNow < 5 || timeNow > 22) {
	img = 'night.jpg';
	} 
		else if (timeNow < 11) {
		img = 'morning.jpg';
		}
		else if (timeNow < 18) {
		img = 'noon.jpg';
		}
	else {
	img = 'sunset.jpg';
	}
  document.write('<img src="\/media\/img\/'+img+'" width="930px" height="245px" alt="Versions" usemap="#beanstalk">');
}

// img src="/media/img/main_header.jpg" width="930px" height="257px" alt="Versions" usemap="#beanstalk"
// <script type="text/javascript">showHeader();</script>

// jquery image preload plugin
// http://www.mattfarina.com/2007/02/01/preloading_images_with_jquery
jQuery.preloadImages = function(){
	for(var i = 0; i<arguments.length; i++){
		jQuery("<img>").attr("src", arguments[i]);
}}
$(document).ready(function(){
	// download pop
	$("#download").click(function () {
		$("#dl").fadeIn(300);
		$("#dlpop").append("<iframe src=\"/download\" width=\"0px\" height=\"0px\" style=\"display:none;\"></iframe>");
	});
	$("#dlbutton, #backdrop").click(function () {
		$("#dl").fadeOut(50);
	});
	// zoomify hint
	$("#screenshots").hover(
		function () {$("#help").animate( { opacity:"1.0"}, "fast" );},
		function () {$("#help").animate( { opacity:"0.3"}, "fast" );});
	// images that need to be preloaded
	$.preloadImages("/media/img/dlpop_button.png", "/media/img/dlpop_back.png");
});
