Cufon.replace('#navmain a b, #navsub a b, #navsubsub a b' , {fontFamily: 'DINOT-Medium'});
Cufon.replace('#navmain a span, #navsub a span, #navsubsub a span' , {fontFamily: 'DINOT-Light'});
Cufon.replace('#textright' , {color: '#000', fontFamily: 'DINOT-Light'});
Cufon.replace('#textright .boldblack' , {color: '#000', fontFamily: 'DINOT-Medium'});
Cufon.replace('#textright .boldwhite' , {color: '#fff', fontFamily: 'DINOT-Medium'});
Cufon.replace('#textright .white' , {color: '#fff', fontFamily: 'DINOT-Light'});
Cufon.replace('#contleft a .large' , {color: '#57574f', fontFamily: 'DINOT-Medium'});
Cufon.replace('#contleftscroller a.on span.large' , {color: '#000', fontFamily: 'DINOT-Medium'});

$(function() {
  $('#navmain a').hover(
    function () {
      Cufon.replace($(this).find('b') , {color: '#000'}).replace($(this).find('span'), {color: '#000', fontFamily: 'DINOT-Light'})
      $('#' + $(this).attr('id').replace(/^h/,'i')).fadeIn(200)
    },
    function () {
      Cufon.replace($(this).find('b') , {color: '#57574f'}).replace($(this).find('span'), {color: '#57574f', fontFamily: 'DINOT-Light'})
      $('#' + $(this).attr('id').replace(/^h/,'i')).fadeOut(200)
    }
  );

  $('#navsub a[class!=on], #navsubsub a[class!=on] ').hover(
    function () {
      Cufon.replace($(this).find('b') , {color: '#000'}).replace($(this).find('span'), {color: '#000', fontFamily: 'DINOT-Light'})
    },
    function () {
      Cufon.replace($(this).find('b') , {color: '#57574f'}).replace($(this).find('span'), {color: '#57574f', fontFamily: 'DINOT-Light'})
    }
  );

  $('#contleft a[class!=on]').hover(
    function () {
      Cufon.replace($(this).find('.large') , {color: '#000'});
    },
    function () {
      Cufon.replace($(this).find('.large') , {color: '#57574f'});
    }
  );

  $('#navsubsub a').click(function () {
    var top = parseInt($('#contleftscroller').css('top'));
    if(top) this.href = this.href + '?pos=' + top;
  });

  $('.aktionsflaeche').hover(
    function () {
      $('#' + $(this).attr('id').replace(/^a/,'i')).fadeIn(200)
    },
    function () {
      $('#' + $(this).attr('id').replace(/^a/,'i')).fadeOut(200)
    }
  );

  $('#pfeil_oben').click(
    function () {
      var y = Math.min(0, parseInt($('#contleftscroller').css('top')) + $('#contleftclip').outerHeight());
      $('#contleftscroller').animate({ top : y + 'px'}, 800);
      $('#pfeil_unten').show();
      if (!y) {
        $('#pfeil_oben').hide();
      }
      return false;
    }
  );

  $('#pfeil_unten').click(
    function () {
      var y = Math.max($('#contleftclip').outerHeight() - $('#contleftscroller').outerHeight(), parseInt($('#contleftscroller').css('top')) - $('#contleftclip').outerHeight());
      $('#contleftscroller').animate({ top : y + 'px'}, 800);
      $('#pfeil_oben').show();
      if (y <= - $('#contleftscroller').outerHeight() + $('#contleftclip').outerHeight() + 12) {
        $('#pfeil_unten').hide();
      } 
      return false;
    }
  );

  $('#back').hover(
    function () {
      Cufon.replace($('#hhome'), {color: '#000'});
    },
    function () {
      Cufon.replace($('#hhome'), {color: '#57574f'});
    }

  );

  $('#contleftscroller div.galthumb').click(function () {
    $('#orig').attr('src', $(this).find('img').attr('src').replace(/galthumb/,'orig'));
  });


  if (typeof gm_load == 'function') gm_load();
});

$(window).load(function() {
  if ($('#contleftscroller').outerHeight() > $('#contleftclip').outerHeight()) {
    $('#pfeil_unten').show();
  }
});


