jQuery(function($) {
  
  //Print-Link
  $('#footernav-2 li.nav-top').after(' <li class=\"nav-print\"><a href=\"javascript:window.print();\">Seite drucken</a></li>');
  
  //Dropdown-Menü
  $("form.navForm").dropdownmenu();
  
  //Zebrastreifen
  $('.spotlight li:nth-child(odd)').addClass('odd');
  
  
  //Abgerudnete Ecken
  $('.outline-box, #box-col, .fotogalerie a, .teaser-box').append('<span class="i"></span><span class="ii"></span><span class="iii"></span><span class="iiii"></span>');
  
  //Fotogalerie-Lightbox
  $('.fotogalerie a').lightBox();  
  
  //Wrapper für Pseudospalte
  $('#box-col').wrap('<div class="boxcolwrap"></div>');

  //Suche
  searchterm = $('#suche').attr('value');
  $('#suche').focus(function(){
	  $(this).attr('value','');
  }).blur(function(){
	if ($(this).attr('value') == "") {
		$(this).attr('value',searchterm);
	} else {
		searchterm = $(this).attr('value');
	}
  });


  //Focus/Hover on Main navigation
  $('#nav-main a').hover(function(){
	  $(this).parent().addClass('hover');
  }, function(){
	  $(this).parent().removeClass('hover');
  });
  $('#nav-main a').focus(function(){
	  $(this).parent().addClass('hover');
  });
  $('#nav-main a').blur(function(){
	  $(this).parent().removeClass('hover');
  });
  $('#nav-main a').click(function(){
	  $(this).parent().addClass('hover');
  });
  
  $('.open01.active').addClass('open01active');
  $('.open02.active').addClass('open02active');

  //Simulate min-max-width on IE6
	if ($.browser.msie && (parseInt($.browser.version) == 6)) {
		fixMinMax();
		$(window).bind('resize', fixMinMax);
		(function(){
			var  m = document.uniqueID && document.execCommand;
			try {
				if (!!m) {
					m("BackgroundImageCache", false, true);
				}
			} catch(oh){};
		})();
		
	}

});

fixMinMax = function() {
	var current = $('#page').width();
	var maxwidth = 1600 * (parseInt(document.body.currentStyle.fontSize) / 100);
	if (current <= 740) { 
		$('#page').css('width','740px'); 
	} else {	
		if (current >= maxwidth) { 
			$('#page').css('width', maxwidth+"px"); 
		}
	}
}