jQuery.noConflict();
jQuery(document).ready(function() {

	// navi-tweaking
	var preloadHover = new Image();
	preloadHover.src="wp-content/themes/API/images/navi_hover.png";
	jQuery('ul#navi li:first').css({'padding-left': '12px', 'background-position': 'left bottom'});
	jQuery('ul#navi li:last').css({'padding-right': '12px', 'background-position': 'right bottom'});
	jQuery('ul#navi li:last a').css({'border-right': 'none'});
	jQuery('ul.submenu li:last').css({'border-right': 'none'});
	jQuery('a img').parent().css('border', 'none');
	
	// subsub-texthöhen-tweaking
	jQuery('.twoColMenu .twoCol p:first').css('margin-top', '-5px');
	
	//submenu linie weg, wenn nur ein eintrag
	var subentrycount = 0;
	jQuery('ul.submenu li').each(function() { subentrycount++; });
	if (subentrycount == 1) {
		//jQuery('ul.submenu').css('border', 'none');
		//jQuery('ul.submenu li a').wrap('<h1 />');
	}
	
	// browserfenster-resize
	jQuery(window).unbind("resize");
	jQuery(window).bind("resize", setContentSize);
	
	function setContentSize() {
		var sidebarHeight = jQuery('div#sidebar_frame').height() + jQuery('div#sidebar_top').height() + jQuery('div#sidebar_bottom').height();
		var contentHeight = jQuery('div#main_content_frame').height() + jQuery('div#content_top').height() + jQuery('div#content_bottom').height();
		jQuery('div#mainframe').height(Math.max(contentHeight, sidebarHeight)+45);
		var frameHeight = jQuery('div#mainframe').height() + jQuery('div#footer').innerHeight() + jQuery('div#header').innerHeight();
		
	    var tempContentHeight = jQuery(window).height();	    				
	    var newContentHeight = Math.max(tempContentHeight, frameHeight);

		jQuery('div#frame').height(newContentHeight);
		jQuery('div#mainframe').height(jQuery('div#frame').height() - jQuery('div#footer').innerHeight() - jQuery('div#header').innerHeight());
		jQuery('div#main_content').height(jQuery('div#mainframe').height() - jQuery('div#content_top').height() - jQuery('div#content_bottom').height());
		jQuery('div#sidebar').height(jQuery('div#mainframe').innerHeight() - jQuery('div#sidebar_top').height() - jQuery('div#sidebar_bottom').height());
	}

	// Funktion beim ersten Start ausführen
	jQuery(function() {
    	setContentSize();
	});
	
	// PNG-Fix
	//jQuery(document).pngFix();
	
});

