jQuery(document).ready(function() {  
    
    jQuery('a[href^=#]').bind("click", function(event) {
        event.preventDefault();
        var ziel = jQuery(this).attr("href");

        jQuery('html,body').animate({
                scrollTop: jQuery(ziel).offset().top -100
        }, 400);
        return false;
    });
	
	jQuery('a[href^=#top]').bind("click", function(event) {
        event.preventDefault();
        var ziel = jQuery(this).attr("href");

        jQuery('html,body').animate({
                scrollTop: jQuery(ziel).offset().top
        }, 400);
        return false;
    });
    
    jQuery(window).scroll(function () {
    	if (jQuery(this).scrollTop() > 150) {
    		jQuery('.scrollhoch').animate({
    			bottom: '120',
    			opacity: 'show'
    		},500);		
    		
    	} else {		
    		jQuery('.scrollhoch').animate({
    			bottom: '-200',
    			opacity: 'hide'
    		},1000);	
    	}
    });
	
	// mit span class="nav next">runter</span> und span class="nav prev">hoch</span>

	className = ".folioItem"; // Name der Klasse Deiner anzusteuernden Ankerziele
	current = "#" + jQuery(className + ":first").attr("id"); // oberster Anker ist der Start.
	//console.log(current);
	jQuery("span.nav").click(function(event){
		event.preventDefault();
		if(jQuery(this).hasClass("next")){
			target = jQuery(current).next(className).attr("id");
			//console.log(target);
			if(!target) target = jQuery(className + ":first").attr("id"); // wenn am Ende
		}
		if(jQuery(this).hasClass("prev")){
			target = jQuery(current).prev(className).attr("id");
			if(!target) target = jQuery(className + ":last").attr("id"); // wenn "vor" dem Anfang springe zum Ende
		}	    	
		//console.log(current);
		current = "#"+target;
		jQuery('html,body').animate({
				scrollTop: jQuery(current).offset().top -100
		}, 400);
		return false;
	});
	
	jQuery('.showWeb').bind("click", function(event) {
        jQuery('.portfolioList .print').fadeOut(250);		
        jQuery('.portfolioList .web').fadeIn(1000);
    });
	
	jQuery('.showPrint').bind("click", function(event) {
        jQuery('.portfolioList .web').fadeOut(250);		
        jQuery('.portfolioList .print').fadeIn(1000);
    });
	
	jQuery('.showAll').bind("click", function(event) {
        jQuery('.portfolioList .web, .portfolioList .print').fadeIn(1000);
    });
    
    jQuery('#test').show(0).delay(750).fadeOut(750, function() {
    	jQuery("#me").css({'z-index' : '90'});	
    });
	
	
	jQuery('.show_2008').bind("click", function(event) {
        jQuery('body').find('li.2008').fadeIn(1000);
        jQuery('body').find('li.2009, li.2010, li.2011').fadeOut(100);
    });
    
    jQuery('.show_2009').bind("click", function(event) {
        jQuery('body').find('li.2009').fadeIn(1000);
        jQuery('body').find('li.2008, li.2010, li.2011').fadeOut(100);
    });
    
    jQuery('.show_2010').bind("click", function(event) {
        jQuery('body').find('li.2010').fadeIn(1000);
        jQuery('body').find('li.2008, li.2009, li.2011').fadeOut(100);
    });
    
    jQuery('.show_2011').bind("click", function(event) {
        jQuery('body').find('li.2011').fadeIn(1000);
        jQuery('body').find('li.2008, li.2009, li.2010').fadeOut(100);
    });
    
    jQuery('.show_all').bind("click", function(event) {
        jQuery('body').find('li.2008,li.2009,li.2010,li.2011').fadeIn(1000);
    });	
	 
	
	jQuery("a.dribbble,#dribbble_shots").hover(
	  function () {
        jQuery('body').find('#dribbble_shots').stop(true,true).animate({opacity: 'show', top: '-250'}, 150).animate({top: '-260'}, 250);
	  }, 
	  function () {
        jQuery('body').find('#dribbble_shots').delay(1000).animate({top: '-250'},250).animate({top: '-400', opacity: 'hide'},100);
	  }
	);
	
	jQuery(window).scroll(function () {
		if (jQuery(this).scrollTop() > 150) {
			jQuery('#searchHead').fadeOut(100);	
			jQuery('#navHead').animate({
				top: '0',
				opacity: 'show'
			},200);		
			
		} else {		
			jQuery('#navHead').animate({
				top: '-200',
				opacity: 'hide'
			},100);	
			jQuery('#searchHead').fadeIn(500);
		}
	});


// Show Filter
jQuery(".showcontact,.kontaktHide").click(function(e) {
	jQuery(".showcontact").toggleClass("aktiv");
	jQuery("#kontaktSeite").animate({
		opacity: 1,
		height: 'toggle'
	}, 500);	
	e.preventDefault();
});
	
// Show Filter
jQuery(".searchHide").toggle(function() {
	jQuery(".searchHide").text("hide");
	jQuery("#searchBox").animate({
		top: 0
	}, 500);	
	
	}, function () {
	  jQuery(".searchHide").text("search");
	  jQuery("#searchBox").animate({
	  	top: -90
	  }, 500);	
});
	
});
