	//Layout Resize
function resize(){
	$('#holder').css({height:'auto'});
	if($('#holder').height()<$(window).height()){
		$('#holder').css({height:$(window).height()});	
	}	
}
$(document).ready(resize);
$(window).resize(resize);

//Navi Hovers
$(document).ready(function(){
	if(jQuery.browser.msie){
		$('.navigation li a div').css({visibility:'hidden'});
	} else {
		$('.navigation li a div').css({opacity:0});
	}
	$('#root:not(.home) .navigation li a:not(.active)').mouseover(function(){
		if(jQuery.browser.msie){
			$(this).children('div').css({visibility:'visible'});
		} else {
			$(this).children('div').css({visibility: 'visible'}).animate({opacity:1},{queue:false});
		}
	});	
	$('#root:not(.home) .navigation li a').mouseout(function(){
		if(jQuery.browser.msie){
			$(this).children('div').css({visibility:'hidden'});
		} else {
			$(this).children('div').animate({opacity:0},{queue:false});
		}
	});
	
});
//START
$(document).ready(function(){
	if(!jQuery.browser.msie) $('#startheader ul li').css({opacity:0});
	else $('#startheader ul li').css({visibility:'hidden'});
	
	$('#startheader ul li:first').addClass('first');
	$('#root.home .navigation li a').each(function(i,e){
		$(e).mouseover(function(){
			if(i==0){
				if(!jQuery.browser.msie) $('#startheader .slogan').animate({opacity:0},{queue:false});
				else $('#startheader .slogan').css({visibility:'hidden'});
			}
			if(!jQuery.browser.msie) $('#startheader ul li:nth-child('+(i+1)+')').animate({opacity:1},{queue:false});
			else $('#startheader ul li:nth-child('+(i+1)+')').css({visibility:'visible'});
		});
		$(e).mouseout(function(){
			if(!jQuery.browser.msie) {
				$('#startheader .slogan').animate({opacity:1},{queue:false});
				$('#startheader ul li:nth-child('+(i+1)+')').animate({opacity:0},{queue:false});
			} else {
				$('#startheader .slogan').css({visibility:'visible'});
				$('#startheader ul li:nth-child('+(i+1)+')').css({visibility:'hidden'});
			}
		});
	});
	
	$('#startheader ul li').mouseover(function(){
		if($(this).hasClass('first')){
			if(!jQuery.browser.msie) $('#startheader .slogan').animate({opacity:0},{queue:false});
			else $('#startheader .slogan').css({visibility:'hidden'});
		}
		if(!jQuery.browser.msie) $(this).animate({opacity:1},{queue:false});
		else $(this).css({visibility:'visible'});
	});
	$('#startheader ul li').mouseout(function(){
		if(!jQuery.browser.msie) {
			$('#startheader .slogan').animate({opacity:1},{queue:false});
			$(this).animate({opacity:0},{queue:false});
		} else {
			$('#startheader .slogan').css({visibility:'visible'});
			$(this).css({visibility:'hidden'});
		}
	});
});
//smallgal

$(document).ready(function(){
	var allpics = [];
	var currentpic = 0;
	
	$('.left.detailpic img').removeAttr( 'height' );
	$('#col2 .right.gallery .gal li a').each(function(i,e){
		allpics[i] = ($(e).attr('href').split(',')[0]+'.'+$(e).attr('href').split('.')[1]);
		$(e).data('id',i);
	});	
	function showPic(id){
		if(allpics[id]!=bigIm.attr('src')){
			if(id==allpics.length) id=0;
			if(id==-1) id=allpics.length-1;
			bigIm.hide().attr({src:allpics[id]});
			currentpic = id;
			panel.find('#count').html('Bild '+(id+1)+' von '+allpics.length);
		}
			overlay.fadeIn();
			$('#imholder').fadeIn();
	}
	
	var panel = $('<div id="panel"><a href="#" id="close">schlie&szlig;en</a> <a id="count" style="margin-left:70px;"></a> <div id="rtpan"><span id="prev"><< zur&uuml;ck&nbsp; </span> <span id="next">&nbsp;&nbsp;&nbsp;vor >></span></div></div>');
		panel.css({'position':'absolute','bottom':-35})
		panel.hide();
	panel.find('#next').click(function(){
		showPic(currentpic+1);	
		return false;
	});
	panel.find('#prev').click(function(){
		showPic(currentpic-1);
		return false;	
	});
	panel.find('#close').click(function(){
		$('#imholder').hide();
		$('#overlayer').hide();
		return false;
	});
	
	var overlay = $('<div />')
		.attr('id','overlayer')
		.css({
			position: 'fixed',
			width: '960px',
			height:'100%',
			zIndex: 100,
			opacity: .9
			
		})
		.hide()
		.click(function(){
			$('#imholder').hide();
			$('#overlayer').hide();	
		});
		var bigIm = $('<img />').load(function(){
			$(this).css({width:'auto',height:'auto'});
			var iw = $(this).width();
			var ih = $(this).height();
			
			if(ih>$('#overlayer').height()-100){
				var scale = ($('#overlayer').height()-100)/ih;
				ih = $('#overlayer').height()-100;	
				iw = (iw-100)*scale;
			}
			
			$(this).css({width:iw,height:ih});
			
			$(this).parent().animate({
				left: parseInt(($('body').width()*.5)-(iw*.5)),
				top: parseInt(($('#overlayer').height()*.5)-((ih+panel.height())*.5)),
				width:iw,
				height:ih
			},{
				complete:function(){
					bigIm.fadeIn();	
					panel.css({width:iw}).fadeIn();
				}	
			});
		})
		.click(function(){
			$('#imholder').hide();
			$('#overlayer').hide();	
		});
	
		$('#holder').prepend($('<div />')
		.attr('id','imholder')
		.css({
			position: 'fixed',
			zIndex: 101,
			width:100,
			height:100,
			left: parseInt(($('body').width()*.5)-50),
			top: parseInt(($('body').height()*.5)-50)
		})
		.hide()
		.append(bigIm)
		.append(panel));
		
		$('#root').prepend(overlay)
	
	if($('#col2 .right.gallery .gal li a img').length>0){		
		$('#col2 .left.detailpic a').click(function(){
			showPic(currentpic);
			return false;	
		});
		
		$('#col2 .right.gallery .gal li:first a img').animate({opacity:.7},{queue:false});
		$('.left.detailpic').addClass('loading');
		$('.left.detailpic img')
			.load(function(){
				$('.left.detailpic').removeClass('loading');
				$(this).fadeIn();	
			});
		$('#col2 .right.gallery .gal li a').click(function(){
			$('#col2 .right.gallery .gal li a img').animate({opacity:1},{queue:false});
			$(this).children('img').animate({opacity:.7},{queue:false});
			if($(this).attr('href')!=$('.left.detailpic img').attr('src')){
				$('.left.detailpic img').hide();
				$('.left.detailpic img').attr({src:$(this).attr('href')});
			}else{
				$('.left.detailpic img').hide().fadeIn();
			}
			currentpic = $(this).data('id');
			return false;	
		});
	}
	
	$.getScript('http://www.google-analytics.com/ga.js',
		function() {
		var pageTracker = _gat._getTracker("UA-16014664-1");
		pageTracker._setDomainName("none");
		pageTracker._setAllowLinker(true);
		pageTracker._trackPageview();
	});
});
