function resize(){

	var windowheight = $(window).height();
  	var containerheight = $('#cntnr').height();
  			  		
	if(windowheight > containerheight){
		jQuery('body').height(windowheight);
	} else {
		jQuery('body').height(containerheight);
	}

}

function resizeIE7(containerheight){
	
	var windowheight = $(window).height();
	var newcontainerheight = $('#cntnr').height();
	
	if(windowheight > containerheight){ jQuery('#cntnr2').height(windowheight); }
	else { jQuery('#cntnr2').height(newcontainerheight); }
	
}

$(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"), "");
			}
		}
	}

	
	/* Toggle DIVS (Accordeon) */
	$('.accordeon .accordeon-body').hide();	
	$('.accordeon h3').click(function(){		
		if ($(this).parent().find('.accordeon-body').is(":hidden")) {
			$('.accordeon h3').removeClass('active');
			$(this).addClass('active');
			$('.accordeon .accordeon-body').slideUp('slow');
			$(this).parent().find('.accordeon-body').slideDown('slow');
		}
		else {
			$(this).removeClass('active');
			$('.accordeon .accordeon-body').slideUp('slow');
		}
	});
	$('.accordeon-head a').click(function(){
		$(this).trigger('blur');
		h3 = $(this).parent();
		$(h3).trigger('click');
	    return false;
	});
	// open up the first toggle div
	$('.accordeon:eq(0) h3:eq(0)').trigger('click');
	
	/* end Toggle DIVS (Accordeon) */
	
	$('input.searchtext').click(function(){
	
		$(this).attr('value','');
		
	});
	
	
	/* RIGHT CLICK FIX */
	
	/*$('img').mousedown(function(e){
		if (e.which === 3) {
		
			alert('rightclick');
			return false;
		}
	});*/
	
	$("img").noContext();
	
	
	/* FOOTER FIX */
	
	/*if(jQuery.browser.mozilla == true){
		jQuery('body').addClass('browser-firefox');
	}
	*/
	
	if(jQuery.browser.msie == true && jQuery.browser.version == '7.0'){
		var containerheight = $('#cntnr').height();
		
		setInterval('resizeIE7('+containerheight+')', 250);
	}
	
	if(jQuery.browser.webkit == true){
		
		setInterval("resize()", 250);
		
		/*$(window).resize(function() {
	  		var windowheight = $(window).height();
	  		var containerheight = $('#cntnr').height();
	  		
	  		if(windowheight > containerheight){
	  			jQuery('body').height(windowheight);
	  		} else {
  				jQuery('body').height(containerheight);
  			}	
		});*/

	}
	
	
	
	
});
