Cufon.replace('#topbar h1', {fontFamily:'Arial,Helvetica,sans-serif'});
Cufon.replace('.login, div#main h1,.slogan span, #footer p, .tabs a, .artikel a, .table_top_right div b, .seminartitel, .seminarinfos b, .anbieterinfos, .infoblock b, .ortInfo b, .cufonText', { fontFamily: 'Myriad Pro', hover: true });
Cufon.replace('.menu a, h2, .fakehead, #footer span', { fontFamily: 'Myriad Pro Cons', hover: true });
Cufon.replace('h1 strong, a.link1', { fontFamily: 'Swis721 BT', textShadow: '#5fa817 1px 1px'});
Cufon.replace('#header .nav li a', { fontFamily: 'Swis721 BT', textShadow: '#111 1px 1px', hover: true });
Cufon.replace('.slogan, a.link2', { fontFamily: 'Swis721 BT', textShadow: '#fd533c 1px 1px', hover: true });
Cufon.replace('h3', { fontFamily: 'Swis721 BT' });

$(document).ready(function ($) {
      $('#keyword').keypress(
            function (e) {
              if (e.which == '13') {
                e.preventDefault();
                e.stopPropagation();
                $('#QuickSearchForm').submit()
              }
            }
      );

      $('#town').keypress(
            function (e) {
              if (e.which == '13') {
                e.preventDefault();
                e.stopPropagation();
                $('#QuickSearchForm').submit()
              }
            }
      );

      Cufon.now();

      $('a.blank').attr('target','_blank');

      if ($('.newsticker').length > 0) {
        $(".newsticker").jCarouselLite({
          visible: 7
        });
      }

      if ($('#seminarteaser').length > 0) {
            initCycle ('#seminarteaser');
      }

      if ($('#logoliste').length > 0) {
            jQuery('#logoliste').jcarousel({visible:5,auto:5,wrap:'last', initCallback: mycarousel_initCallback});
      }


      if ($('ul.seminarliste li').length > 0) {
        $('ul.seminarliste li .detail_more').each(function (index, elem) {
            $(elem).show();
            $(elem).parent().addClass('hidden');
            $(elem).click(function () {
                var parent = $(elem).parent();
                if (parent.hasClass("hidden")) {
                    parent.toggleClass("hidden shown");
                    $(elem).text("schließen");
                } else {
                    parent.toggleClass("hidden shown");
                    $(elem).text("öffnen");
                }
            });
        });
        if (window.location.hash.length > 2) {
            var selector = '#s'+window.location.hash.substr(2)+' .detail_more';
            $(selector).click();
            $('html,body').scrollTop($(selector).offset().top-5);
        }
      }

});

var elementlist, nbrShown = 5, nextElem = 6;
function initCycle(selector) {
            elementlist = $(selector+" li").clone();
            var nextToShow = 0, maxheight = 0;
            $(selector+" li").each( function (index,elem) {
                height = $(elem).height();
                if (maxheight < height) maxheight = height;
                if (index >= nbrShown) $(elem).hide();
            });
            $(selector+" li").each( function (index,elem) {
                $(elem).height(maxheight);
            });
            elementlist.each(function (index, elem) {
                $(elem).hide();
                $(elem).height(maxheight);
            });
            replace(6);
}
function replace(index) {
    if (index > nbrShown) {
      window.setTimeout("replace(1)", 1000*5);
      return;
    }
    if (nextElem >= elementlist.length) nextElem = 0;
    jQuery('#t'+index+' .inner').fadeOut(1000, function () {
        jQuery('#t'+index+' .inner').html($(elementlist[nextElem]).children(":first").html());
        Cufon.refresh();
        nextElem++;
        jQuery('#t'+index+' .inner').fadeIn(1000, replace(++index));
    });
}

function mycarousel_initCallback(carousel)
{
    carousel.buttonNext.bind('click', function() { carousel.startAuto(0); });
    carousel.buttonPrev.bind('click', function() { carousel.startAuto(0); });
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

function mailto(id, aid) {
    if (id != 0) {
    $.post("/getMailLink.php", {id:id}, function (data) {
        if (data.substr(0,6) == "mailto")
            location.href=data;
    });
    } else {
    $.post("/getMailLink.php", {aid:aid}, function (data) {
        if (data.substr(0,6) == "mailto")
            location.href=data;
    });
    }
}



