$(document).ready(function() {
/*
    $("#navi-main li a").hover(function () {
        $(this).show("drop", { direction: "up" }, 1000);
    });
    $("#navi-main li a").hover(function () {
        $(this).before('<div class="nav-' + myClass + '"></div>');
        $("div.nav-" + myClass).css({display:"none"}).fadeIn(200);
    }).mouseout(function() {
        $("div.nav-" + myClass).fadeOut(200, function() {
            $(this).remove();
        });
    }).mousedown(function() {
        $("div.nav-" + myClass).attr("class", "nav-" + myClass + "-click");
    }).mouseup(function() {
        $("div.nav-" + myClass + "-click").attr("class", "nav-" + myClass);
    });
    */
    

   /* var myClass = "test";
    
    $("#navi-main li a").hover(function () {
        $(this).before('<div class="nav-' + myClass + '"></div>');
    });
    */

    /*
    $('#head').cycle({ slideExpr: 'span.slideshowimage' });
    

    // Suchfeld leeren
    $('#search-input').focus(function () {
        $(this).attr('value','');
    });

    $('#quicklinks .loginlist').hide();

    if ( $("a.extranet").parent().next('li:hidden').hasClass('loginlist') ) {
        $("a.extranet").bind("click", function(ev){
                ev.preventDefault();
                $('#quicklinks .loginlist').toggle();
            }
        );
    };

    // Aufklappliste / Akkordion
    $('#content .slide .csc-header').not('.csc-header-n1').css({cursor: "pointer"}).addClass('hidden');
    $('#content .slide .csc-header').not('.csc-header-n1').next('div').hide();
    $('#content .slide .csc-header').not('.csc-header-n1').click(
        function(){
            if($(this).next().css("display")=="none" ){
                $(this).addClass('shown').removeClass('hidden');
                $(this).next('div').slideDown("fast");
            }else{
                $(this).addClass('hidden').removeClass('shown');
                $(this).next('div').slideUp("fast");
            }
        }
    );
    
    
    // Rückrufservice: labels verstecken und value setzen 
    $('#content #navi-sidebar ol.mailform li:nth-child(1)').attr({ 
        id: "callback-name"
    });
    $('#content #navi-sidebar ol.mailform li:nth-child(2)').attr({ 
        id: "callback-email"
    });
    $('#content #navi-sidebar ol input.submit').attr({ 
        id: "callback-submit-input"
    });
    
    $('#callback-name label').hide();
    $('#callback-name input').attr('value','Name ...');
    $('#callback-name input').focus(function () {
        $(this).attr('value','');
    });

    $('#callback-email label').hide();
    $('#callback-email input').attr('value','Tel.-Nr. ...');
    $('#callback-email input').focus(function () {
        $(this).attr('value','');
    });
    */
});

// apply same height to all blocks (co-block) of the same block row (co-block-row)
function align_block_heights () {
   $('#column-bottom').each(function(){
      var children = $(this).find('.box-content');

      // skip rows which only contain a single block
      if (children.length == 1) {
         return true; // this is in each() like a continue
      }

      // determine height of highest block in current row
      var maxHeight = false;
      var highestBlock = false;
      children.each(function(){
         var currentHeight = $(this).height();
     if ((maxHeight === false) || (currentHeight > maxHeight))
     {
        maxHeight = currentHeight;
        highestBlock = this;
     }
      });

      // set max height for each block in current row (except for the highest block, small optimization)
      children.each(function(){
         if (this === highestBlock) {
        return true; // this is in each() like a continue
     }
     $(this).height(maxHeight);
      });
   });
}

$(window).bind('load', function(){
   align_block_heights();
});

