$(document).ready(function(){
/*	Hauptnavigation	  */
		$(".nav")
			.superfish({
				animation : { height:"show"}
			})
			.find(">li:has(ul)")
				.mouseover(function(){
					$("ul", this).bgIframe({opacity:false});
				})
				.find("a")
					.focus(function(){
						$("ul", $(".nav>li:has(ul)")).bgIframe({opacity:false});
					});
					

/*	Fade-In			*/

   $("#content").hide();
   $("#content").fadeIn(500);
   
   $("#header").hide();
   $("#header").fadeIn(500);


/*	 ScrollTo	*/			

	$.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;
			};
			
			
			//this one is important, many browsers don't reset scroll on refreshes
			$('#container').scrollTo( 0 );//reset all scrollable panes to (0,0)
			$.scrollTo( 0 );//reset the screen to (0,0)
			
			
			
			//Target examples bindings
			var $paneTarget = $('#container');			
			
			//just a shortcut, no need to read this
			function reset_t(){
				$paneTarget.stop();
			};
						
		
			$('#up').hover(function(){				
				reset_t(); $paneTarget.scrollTo( '#scrollstart', parseInt($(this).attr('rel')));
			},
			function(){				
				reset_t(); $paneTarget.stop();
			});
		
			$('#down').hover(function(){				
				reset_t(); $paneTarget.scrollTo( '#scrollend', parseInt($(this).attr('rel')));
			},
			function(){				
				reset_t(); $paneTarget.stop();
			});
});
