		jQuery(function( $ ){
			//borrowed from jQuery easing plugin
			//http://gsgd.co.uk/sandbox/jquery.easing.php
			$.easing.elasout = function(x, t, b, c, d) {
				var s=1.70158;var p=0;var a=c;
				if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
				if (a < Math.abs(c)) { a=c; var s=p/4; }
				else var s = p/(2*Math.PI) * Math.asin (c/a);
				return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
			};
	
			var $paneOptions = $('#content');
			var $active_section='#section2';
			var $speed = 1600;
			//by default, the scroll is only done vertically ('y'), change it to both.
			$.scrollTo.defaults.axis = 'xy'; 			
			
			//this one is important, many browsers don't reset scroll on refreshes
			$paneOptions.scrollTo( 0 );//reset all scrollable panes to (0,0)
			$.scrollTo( 0 );//reset the screen to (0,0)			
			
						
			function reset_scroll(){//before each animation, reset to (0,0), skip this. 
				$paneOptions.stop().stop();
			};			
			reset_scroll(); $paneOptions.scrollTo($active_section, $speed, { easing:'elasout' });			
			$('#menu li:eq(0) a').click(function(){	
					$active_section = '#section1';				
					reset_scroll(); $paneOptions.scrollTo($active_section, $speed, {queue:true});		
					
			});
			$('#menu li:eq(1) a').click(function(){
					$active_section = '#section2';
					reset_scroll(); $paneOptions.scrollTo($active_section, $speed, {queue:true});				
			});
			$('#menu li:eq(2) a').click(function(){
					$active_section = '#section3';				
					reset_scroll(); $paneOptions.scrollTo($active_section, $speed, {queue:true});				
			});	
			$('#menu li:eq(3) a').click(function(){
					$active_section = '#section4';
					reset_scroll(); $paneOptions.scrollTo($active_section, $speed, {queue:true});				
			});	
			$('#menu li:eq(4) a').click(function(){
					$active_section = '#section5';				
					reset_scroll(); $paneOptions.scrollTo($active_section, $speed, {queue:true});				
			});									
			$('.back').click(function(){
					$active_section = '#section1';
					reset_scroll(); $paneOptions.scrollTo($active_section, $speed, {queue:true});	
					//return false;
			});					
			$('#extra3 a').click(function(){
					$active_section = '#section4';				
					reset_scroll(); $paneOptions.scrollTo($active_section, $speed, {queue:true});				
			});
			$('#menu_alter li:eq(0) a').click(function(){
					var $id = $active_section.substr(8);
					if($id-1 > 0){						
						$active_section = '#section'+($id-1);		
						reset_scroll(); $paneOptions.scrollTo( $active_section, $speed, {queue:true});		
					}
			});			
			$('#menu_alter li:eq(1) a').click(function(){
					var $id = $active_section.substr(8);
					if(parseInt($id)+1 <= $('div.sections').size()){
						$active_section = '#section'+((parseInt($id)+1));						
						reset_scroll(); $paneOptions.scrollTo( $active_section, $speed, {queue:true});		
					}
			});					
			
			$('.image_pop').mouseover( function() { 
				//$('img',this).show();	
				srce_arr = $(this).attr('src').split('.');
				srce = srce_arr[0]+'_lrg.jpg';
				//alert(srce);
				$('#extra2').css('display','block');					
				$('#extra2').append('<img src="'+srce+'" width="250" height="250"/>');
				//alert('ir');
			});
			$('.image_pop').mouseout( function() { 
				$('#extra2').css('display','none');
				$('#extra2').empty();
			});
			
		}); 

