/*
	multi-single page controls
	(c) Jeremiah Boyd <http://workworkplay.com>
	updated 2010.03.11
*/

(function() {
	window.addEvent('domready', function() {
		// make a controller								 
		wwp.controls.scroller = new Fx.Scroll(window);
		
		// grab all our .menu and turn them into buttons!
		var menu = {buttons:$$('.menu a, .switch')};
		menu.buttons.addEvent('click', function(e){
			e.preventDefault();
			if(!e.target.hasClass('switch')){
				wwp.current = $( e.target.href.substr( e.target.href.indexOf("#") + 1 ) ) || window;
				if(wwp.current.id !== 'about'){
					wwp.controls.scroller.toElement(wwp.current);
				}
				else{ wwp.controls.scroller.toTop();}
			}
		});
		
		// now make them do something fantastic! :3		
		menu.buttons.addEvent('mouseover', function(e){
			$(e.target).set('tween', {'duration' : 'short', 'transition':'elastic:out'});
			$(e.target).store('mt', $(e.target).getStyle('margin-top'));
			$(e.target).tween('margin-top','3px');
		});
		menu.buttons.addEvent('mouseout', function(e){
			$(e.target).tween('margin-top', 0);
		});
	});
})();


