$(document).ready(function(){
	//target blank
	$("a[href^='http://']").attr('target','_blank');
	$("a[href^='http://']").addClass('extern');
	
	
	$("a[href$=.pdf]").addClass('pdf');
	$("a[href$=.doc]").addClass('doc');
	$("a[href$=.xls]").addClass('xls');
	$("a[href$=.docx]").addClass('docx');
	$("a[href^=mailto]").addClass('mailto');
	
	$("ul li:first-child").addClass('first');
	$("ul li:last-child").addClass('last');


	//for special effects in the navi
	$('#navigation ul ul').parent().addClass('sub');
	
	//fix the corner for hovers
	$('#navigation ul ul').parent().mouseover(function(){
		$(this).children('a').addClass('corner');
	});
	$('#navigation ul ul').parent().mouseout(function(){
		$(this).children('a').removeClass('corner');
	});
		
	
	$('#navigation li.sub').mouseover(function(){
		$(this).addClass('hover');
	});
	
	$('#navigation li.sub').mouseout(function(){
		$(this).removeClass('hover');
	});




	if (document.attachEvent)
	{
		// Suckerfish Hovers
		// Hinweis: Wenn es im html kein Element mit id="navigation" gibt, getElementById("navigation") loeschen oder austauschen
		var sfEls = document.getElementById("navigation").getElementsByTagName("UL")[0].getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}


	// Teasermodul - Klasse fuer jedes zweite Element
	$("div.teaserbox:nth-child(even)").addClass("first-teaser");

	// Teasermodul Mouseover
	
	 $("div.teaserbox").hover(
      function () {
        $(this).find('img.pic1').animate({ opacity: 0 }, 500 );
      }, 
      function () {
        $(this).find('img.pic1').animate({ opacity: 1 }, 500 );
      }
    );

	$("img[src$='png']").addClass('soh');
	
	
	// Untermenue umbrueche
	
	$("#subnavi ul li").css('white-space','nowrap');
	
	$("#subnavi ul li:nth-child(6)").after('<br />');
	$("#subnavi ul li:nth-child(12)").after('<br />');
	$("#subnavi ul li:nth-child(18)").after('<br />');
	$("#subnavi ul li:nth-child(24)").after('<br />');
	$("#subnavi ul li:nth-child(24)").after('<br />');
	$("#subnavi ul li:nth-child(30)").after('<br />');
	$("#subnavi ul li:nth-child(36)").after('<br />');
	$("#subnavi ul li:nth-child(42)").after('<br />');
	
	$("#subnavi ul li:nth-child(6)").addClass('last');
	$("#subnavi ul li:nth-child(12)").addClass('last');
	$("#subnavi ul li:nth-child(18)").addClass('last');
	$("#subnavi ul li:nth-child(24)").addClass('last');
	$("#subnavi ul li:nth-child(30)").addClass('last');
	$("#subnavi ul li:nth-child(36)").addClass('last');
	$("#subnavi ul li:nth-child(42)").addClass('last');
	
	
	// anker scroll
	
	$('ul.anchorlist a').click(function(){
		var anchorsrc = $(this).attr('href');
		var anchor = anchorsrc.split('#');
		var anchor = '#'+anchor[1];
		
		$.scrollTo(anchor, 2500, {
			offset: { top:-10, left:0 }
		});
		
		$(this).trigger('blur');
		return false;
	});
	
	$('p.toplink a').click(function(){
		
		$.scrollTo('#branding', 2500);
		
		$(this).trigger('blur');
		return false;
	});
	
	
	
	
});