// JavaScript Document



function centre(){
	var bx = $('body').getSize().y;
	var wx = window.getSize().y;
	var m = (wx - bx) / 2;
	if(m > 100) m = 100;
	if(m < 0) m = 0;
	$('body').setStyle('margin-top', m);
}


function rollover(){
	$$('#nav li a img').each( function(img){
		img.addEvent('mouseover', function(){
			if( !this.src.contains('_on') ) this.src = this.src.replace('.gif', '_on.gif');
		});
		img.addEvent('mouseout', function(){
			this.src = this.src.replace('_on', '');
		});
	});
}


window.addEvent('domready', function(){
	
	rollover();
									 });
window.addEvent('resize', centre);


function aboutPage(){
	
	$$('.more').setOpacity(0);
	$('more-link').addEvent('click', function(){
		var p = this.getParent().getParent();
		p.tween('opacity', 0);
		p.getNext().tween.delay(1000, p.getNext(), ['opacity', 1] );
	});
	$('back-link').addEvent('click', function(){
		var p = this.getParent().getParent();
		p.tween('opacity', 0);
		p.getPrevious().tween.delay(1000, p.getPrevious(), ['opacity', 1] );
	});
}