$(document).ready(function () {

	$("img").lazyload();
	
	
	/* Scrollnavigation */

	$('#episodes').localScroll({duration:700, offset:-200});
	$('#toplink').localScroll();
	
	var wall = $('#folio_list li:first-child').offset().top;
	
	$(window).scroll(function(){ 
		var scroll = $(window).scrollTop() + 240;
		if (scroll >= wall) {
			$('#toplink').fadeIn();
		}
		else {
			$('#toplink').fadeOut();	
		}
	});
	
	
	/* slider im headerbereich */

	$('#maillink').hide();
	
	function selectNav() {
	  $(this)
	    .parents('div:first')
	      .find('a')
	        .removeClass('selected')
	      .end()
	    .end()
	    .addClass('selected');
	}

	$('#subhead_nav').find('a').click(selectNav);
	
	function switchContent(obj) {
	  obj.parents('ul:first')
	      .find('div')
	        .removeClass('selected').fadeOut()
	      .end()
	    .end()
	    .addClass('selected').fadeIn();
	}

	$('#nav_about').click(
		function(){
			switchContent($('#about'))
		});
		
	$('#nav_contact').click(
		function(){
			switchContent($('#maillink'));
		});
	
	
});

function mailMe(sDom, sUser){
  return("mail"+"to:"+sUser+"@"+sDom.replace(/%23/g,"."));
}

