        function loadImage() {
                var now = new Date();

				$.get('/header_images/getRandom/' + now.getTime(), null, function(data){
					var i = new Image();
					i.src = data;

					if (i.complete) {
							if ($('#headerpic img').length) {
								$('#headerpic img').fadeOut('1000', function(){
									$('#headerpic img').remove();
									appendImage(i);
								});
							}else{
								appendImage(i);	
							}
					}else{
						i.onload = function() {
	
	
							var j = this;
							if ($('#headerpic img').length) {
								$('#headerpic img').fadeOut('1000', function(){
									$('#headerpic img').remove();
									appendImage(j);
								});
							}else{
								appendImage(j);	
							}
						}
					}
				});
        }
        
		function appendImage(i) {
			$('#headerpic').append(i);
			$('#headerpic img').hide();
        	$('#headerpic img').fadeIn(1000, function(){
        		setTimeout("loadImage()", 5000);
        	});							
		}

        function startSlideshow() {
        	loadImage();
        }

        $(document).ready(function(){
			var hp = new SWFObject("/files/swf/randomheader.swf", "mainNavi", "900", "200", "7", "#000000", "1");
			setTimeout(
				function(){
					hp.write("headerpic");
				}, 500);
        });