

$(document).ready(function() {
  $('select').change( function(){
    $('#filter').submit();
  });
  
  $(".accordion").accordion({
    collapsible: true,
    active: false 
  });
});

function resizeLeftColumn() {
  var height1 = $("#left").height();
  var height2 = $("#right").height();
  var calcHeight = Math.max( $(window).height(), Math.max(height1,height2));
  $("#left").height(calcHeight);
  $("#right").height(calcHeight);
}

$(document).ready(function() {
	$("ul.sf-menu").supersubs({
            minWidth:    12,   // minimum width of sub-menus in em units 
            maxWidth:    27,   // maximum width of sub-menus in em units 
            extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                               // due to slight rounding differences and font-family 
        }).superfish({
            speed:       'fast',
	    delay:       20,
	    // animation:   {}, 
	    dropShadows:  false // false führt eventuell zu unerwünschter Transparenz
        });  // call supersubs first, then superfish, so that subs are 
                         // not display:none when measuring. Call before initialising 
                         // containing tabs for same reason.
       
        $('<img src="/opencms/export/system/modules/de.quinscape.opencms.landkreis_pm.template/resources/82.aspx-Dateien/arrow_headline.gif" alt="" />').prependTo('div#right h1');

/*
  // Learning jQuery 218
  // replaced by the Modernizr.input.placeholder code below
  var searchLabel = $('#search label').remove().text();
  $('#search-text').addClass('placeholder').val(searchLabel).focus(function(){
    if( this.value == searchLabel){
      $(this).removeClass('placeholder').val('');
    };
  }).blur(function(){
    if( this.value == '') {
      $(this).addClass('placeholder').val(searchLabel);
    };
  });
*/

  // http://www.kamikazemusic.com/quick-tips/jquery-html5-placeholder-fix/
  if(false /* !Modernizr.input.placeholder*/ ){
    $("input").each(
      function(){
        if($(this).val()=="" && $(this).attr("placeholder")!=""){
          $(this).val($(this).attr("placeholder"));
          $(this).focus(function(){
            if($(this).val()==$(this).attr("placeholder"))
              $(this).val("");
          });
          $(this).blur(function(){
            if($(this).val()=="")
              $(this).val($(this).attr("placeholder"));
          });
        }
    });
  }


// http://www.kamikazemusic.com/quick-tips/jquery-html5-placeholder-fix/
// comment contains this improved version
if (!Modernizr.input.placeholder){

$("input[placeholder]").focus(function() {
if ($(this).hasClass("placeholder")) {
if ($(this).val() == $(this).attr("placeholder"))
$(this).val("");
$(this).removeClass("placeholder");
}
});

$("input[placeholder]").keypress(function() {
if ($(this).hasClass("placeholder")) {
if ($(this).val() == $(this).attr("placeholder"))
$(this).val("");
$(this).removeClass("placeholder");
}
});

$("input[placeholder]").blur(function() {
if ($(this).val() != "")
return;
$(this).addClass("placeholder");
$(this).val($(this).attr("placeholder"));
});

$("input[placeholder]").each(function() {
if ($(this).val() != "" && $(this).val() != $(this).attr("placeholder"))
return;
$(this).val($(this).attr("placeholder")).addClass("placeholder");
});

$("form").submit(function() {
$(this).find(".placeholder").each(function() {
$(this).removeClass("placeholder");
$(this).val("");
});
});
}


  if ( !Modernizr.inputtypes.date){
    // if no native support, use a datepicker script
    $.tools.dateinput.localize("de", {
      months: 'Januar,Februar,März,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember',
      shortMonths:  'Jan,Feb,Mär,Apr,Mai,Jun,Jul,Aug,Sep,Okt,Nov,Dez',
      days:         'Sonntag,Montag,Dienstag,Mittwoch,Donnerstag,Freitag,Samstag',
      shortDays:    'So,Mo,Di,Mi,Do,Fr,Sa'
    });
    $(":date").dateinput({
        lang: 'de',
	format: 'yyyy-mm-dd',	// the format displayed for the user
	selectors: 'true'
    });
  }
  
  resizeLeftColumn();
});

$(document).load(function() {
// needed for Chrome
// because ready-handler was called to early
    resizeLeftColumn();
});

$(window).resize(function(){
    resizeLeftColumn();
});

