$(document).ready(function() {
		
	$("a.single_image").fancybox();
	
	$(function() {
		$(".reference").css("opacity","0.89");
		$(".reference").hover(function () {
			$(this).stop().animate({
				opacity: 1
				}, "fast");
		}, function () {
			$(this).stop().animate({
				opacity: 0.89
				}, "fast");
		});
	});

	$('div[itemid] div').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '0px'}, { queue:true, duration:0 }); 
	$('.hide').animate({opacity: 0.0});	//für IE>8 verstecken
	
	$("div[itemid]").click(function() {
		var relID = $(this).attr("itemid");	// rel-Attribut Rückgabewert
		var element = 'div ' + relID;
		$('a[itemid*="'+ relID +'"]').animate({opacity: 1});	//für IE>8 anzeigen - hide Button
		$(element).animate({opacity: 0.96, height: '148px'},300 );  
	});
	
	$(".hide").click(function(evt){
		evt.stopPropagation();
		var relID = $(this).attr("itemid");
		var element = 'div ' + relID;
		$('a[itemid*="'+ relID +'"]').animate({opacity: 0});	//für IE>8 anzeigen - hide Button
		$(element).animate({opacity: 0, height: 0}, 300);			
	});		
	

	var topLink = $('#top');
	topLink.animate({opacity: 0.75});

	$(window).scroll(function(){
		if( $(this).scrollTop() >= 100 && topLink.hasClass('topLinkDefault')){
			topLink.fadeOut('fast', function(){
				$(this).removeClass('topLinkDefault').addClass('topLink').fadeIn('fast');
			});
		} else if( $(this).scrollTop() <= 100 && topLink.hasClass('topLink')){
			topLink.fadeOut('fast', function(){
				$(this).removeClass('topLink').addClass('topLinkDefault').fadeIn('fast');
			});
		}
	});

	$('#top').hover(
		function(){ $(this).animate({opacity: 1}, 300); },
		function(){ $(this).animate({opacity: 0.75}, 300); }
	);
	
	$("#top").click(function(){
		$('html, body').animate({scrollTop:0}, 'slow');
		return false;
	});
	
});
