
function msieNavHandlers(){
	if(!(document.all&&document.getElementById)) 
		return;
	var node, navRoot=document.getElementById("nav");
	for(var i=0;i<navRoot.childNodes.length;i++) {
		node=navRoot.childNodes[i];
		if(node.nodeName=="LI") {
			node.onmouseover=function() {
				this.className+=" over";
			}
			node.onmouseout=function() {
				this.className=this.className.replace(" over", "");
			}
		}
	}
}


$().ready( function() {
	//msieNavHandlers();
	if($('#bilderleiste div').not(':first,:last').length > 1) {
		$('#bilderleiste div').not(':first,:last').wrapAll('<ul class="img-rotation" />').wrap('<li />');
		$('ul.img-rotation').wrap('<div />').css({ width: '604px', position: 'relative', left: '0px', top: '0px', padding: 0 }).find('li').css({ margin: 0, listStyle: 'none', position: 'absolute', left: '0px', top: '0px' }).hide().find('div').css({ display: 'block' });
		$('ul.img-rotation li:first').addClass('current').show();
		setTimeout(imgRotate, 5000);
	}
	nlRegForm();
});

function imgRotate() {
	if($('ul.img-rotation li.current').next().length)
		$('ul.img-rotation li.current').css({ zIndex: 0 }).next().css({ zIndex: 1 }).fadeIn('slow',function(){
			$('ul.img-rotation li.current').hide().removeClass('current').next().addClass('current');
		});
	else
		$('ul.img-rotation li.current').css({ zIndex: 0 }).parent().find(':first').css({ zIndex: 1 }).fadeIn('slow',function(){
			$('ul.img-rotation li.current').hide().removeClass('current').parent().find(':first').addClass('current');
		});
	setTimeout(imgRotate, 5000);
}

function nlRegForm() {
	$('form.newsletter div.nl-head').not('.static').before('<div class="anim-bg bg1">&nbsp;</div><div class="anim-bg bg2">&nbsp;</div>').click(function(){ $(this).parent().find('.anim-bg').stop().toggle(); $(this).next().slideToggle(); });
	fadeToggle();
}

function fadeToggle() {
	$('div.anim-bg.bg2').fadeOut(1000,function(){ 
		$(this).fadeIn(1000,function(){ 
			fadeToggle();
		});
	});
}


