$(document).ready(function(){

    $('img.rollover').rollover();

    var inputActive = function () {
      if (!$(this).hasClass('active')) {
        $(this).attr('value','');
        $(this).addClass('active');
      }
    }

    $('input.search').bind('focus',inputActive);
    $('input.search').bind('click',inputActive);

    font.setup();
    
    if (font.isInstalled('Corbel') == false) { // wenn ja dann haben wir Arial
      $('body').css('font-size','12px');
      
      $('div#top div#navigation div#language-nav').css('font-size','13px');
      $('div#navigation div.nav1, div#navigation div.nav1-active').css('font-size','13px');
      $('div#navigation div.nav2').css('font-size','11px');
      

      $('div#content h1').css('font-size','15px');
      $('.footnote').css('font-size','11px');
      
      $('div#content input.text, div#content textarea, div#content select').css('font-size','12px');
      $('div#content table.form td.submit input').css('font-size','11px');

      $('body#start div#content div#right-column h3').css('font-size','13px');
      $('body#kontakt div#content div.pflicht').css('font-size','10px');
      $('body#start div#content div.box').css('font-size','12px');
      $('body#start div#content div.box h2').css('font-size','15px');

      $('div#content div.team p').css('font-size','10px');
    }

    /* kopiert aus dem jquery plugin */
    /**
     * hover
     */
    function rollover_hover (obj) {
      tmp=obj.attr('src');
      suffix=tmp.substring(tmp.lastIndexOf('.'));
      newsrc=tmp.substring(0,tmp.lastIndexOf('link'))+'hover'+suffix;
      if (newsrc=='hover'+suffix) return false;
      obj.attr('src', newsrc);
    }  

    /**
     * link
     */
    function rollover_link (obj) {
      tmp=obj.attr('src');
      suffix=tmp.substring(tmp.lastIndexOf('.'));
      newsrc=tmp.substring(0,tmp.lastIndexOf('hover'))+'link'+suffix;
      if (newsrc=='link'+suffix) return false;
      obj.attr('src', newsrc);
    }      

    /* spezielle hovers */

    /* startseite pfeile in den links */
    $('div#right-column a:has(img.rollover)').hover(
        function () {
          rollover_hover($('img.rollover',$(this)));
        },
        function () {
          rollover_link($('img.rollover',$(this)));
        });


    /* lagesterstellensuche */
    /* link */
    $('table.search td.link a').hover(function () {
        $(this).addClass('hover');
        rollover_hover($('td.arrow img.rollover',$(this).parents('tr')));
      },
      function () {
        $(this).removeClass('hover');
        rollover_link($('td.arrow img.rollover',$(this).parents('tr')));
      });
    
    /* pfeil */
    $('table.search td.arrow img.rollover').hover(function () {
        $('td.link a',$(this).parents('tr')).addClass('hover');
      },
      function () {
        $('td.link a',$(this).parents('tr')).removeClass('hover');
      });

    /* news */
    /* bild */
    $('div.news a img').hover(function () {
        $('div.right h3 a, div.right a.more', $(this).parents('div.news')).addClass('hover');
      },
      function () {
        $('div.right h3 a, div.right a.more', $(this).parents('div.news')).removeClass('hover');
      });
    /* more link / h3 link */
    $('div.right h3 a, div.right a.more').hover(function () {
        $('div.right h3 a, div.right a.more', $(this).parents('div.news')).addClass('hover');
      },
      function () {
        $('div.right h3 a, div.right a.more', $(this).parents('div.news')).removeClass('hover');
      });

    /* team */
    /* bild */
    $('div.team a img').hover(function () {
        $('div a.mail', $(this).parents('div.team')).addClass('hover');
      },
      function () {
        $('div a.mail', $(this).parents('div.team')).removeClass('hover');
      });

    $('div.team-button-container div.team-button h3 a, div.team-button-container a.more').hover(function() {
        $('a.more, h3 a', $(this).parents('div.team-button-container')).addClass('hover');
      }, 
      function () {
        $('a.more, h3 a', $(this).parents('div.team-button-container')).removeClass('hover');
      });
        
  });
