
		$(document).ready(function(){

			$('#page').css({opacity:0});


			if ($('#pager a').size() <= 1) {
				$('#pager').css('display', 'none');
				return;
			}
		
			var index = 0;
			var selected = null;
			var width = 900;
			
			$('#pager a').each(function(i){
				if (i == 0) {
					selected = $(this);
					selected.addClass('active');
				}
				
				$(this).click(function(){
					index = i;
					selected.removeClass('active');
					selected = $(this);
					selected.addClass('active');
					$('#pages').animate({left:-(width * i)}, 700, 'easeOutQuad');
					return false;
				});
			});

	

// next button
//			$('#pages').wrapInner('<a href="#" id="next"></a>');
//			$('#next').click(function(){
//				var a = $('#pager a').get(index + 1);
//				if (!a) a = $('#pager a').get(0);
//				$(a).click();
//				return false;
//			});
	

	$(window).load(
	    function() {
			$('#loading').css('display', 'none');
			$('#page').animate({opacity: 1}, 700, function() {
			    // Animation complete.
			  });
			// this next line fixes IE7 background bug, dont have time to debug
			$('#pages').css('background', 'url(../images/bg.jpg);');			
			/*$('#page').animate({left:(0)}, 700, 'easeOutQuad');*/
			$('#home').cycle({
				fx: 'scrollHorz',
		    	speed:  500,
		    	easing:  'easeOutQuad',
		    	timeout: 8000
			});	
			/* $('#soundeffects').flash({swf: 'sound/soundeffects.swf', width:1, height:1});*/    		
	    }
	);
	
	$('.page a').each(function(){
		var $width = $(this).width(); 
		var $height = $(this).height(); 
		$(this).append('<img class="spacer" src="images/spacer.gif"/>');
		$(this).children('.spacer').css('width',$width+'px');
		$(this).children('.spacer').css('height',$height+'px');
		$(this).children('.spacer').css('border',0);

	});
	
});





