﻿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');
  
  //Fontsizer
  $('#col1-content').prepend('<div id=\"fontsize\"><strong>Schriftgrad verändern: </strong><a href=\"#\" onclick=\"$.FontSizer.DecreaseSize(); return false;\" class=\"fs-minus\" title=\"Schrift verkleinern\"><img src=\"/c1257473005532c7/files/btn_fs-minus.png/$file/btn_fs-minus.png\" alt=\"-\" /></a><img class=\"fs-minus1\" src=\"/c1257473005532c7/files/btn_fs-minus1.png/$file/btn_fs-minus1.png\" alt=\"-\" /><span class=\"hideme\">.</span><a href=\"#\" class=\"fs-plus\" onclick=\"$.FontSizer.IncreaseSize(); return false;\" title=\"Schrift vergrößern\"><img src=\"/c1257473005532c7/files/btn_fs-plus.png/$file/btn_fs-plus.png\" alt=\"+\" /></a><img class=\"fs-plus1\" src=\"/c1257473005532c7/files/btn_fs-plus1.png/$file/btn_fs-plus1.png\" alt=\"+\" /><span class=\"hideme\">.</span></div>');
    $.FontSizer.Init({ min: 0, max: 4});
  
  //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"); 
		}
	}
}
*/
fixMinMax = function() {
  var current = $('#page').width();
  var maxwidth = 1600 * (parseInt(document.body.currentStyle.fontSize) / 100);
  if (current <= 740) {
    if ($('#page-margins').width() > 800) {
        $('#page').css('width','auto');
    } else {
        $('#page').css('width','740px'); 
    }
  } else {
    if (current >= maxwidth) { $('#page').css('width', maxwidth+"px"); }
  }
}
