$(document).ready(function() {
  $('a.top').before('<img src="fileadmin/html/images/ico_top.png" alt="" /> ').after(' <a id="print" href=\"javascript:window.print();\">Seite drucken</a>');
  $('.orderbox .hidebox').css('display','none').before('<p><a class="orderlink" href="#">hier bestellen</a></p>');
  $('.orderbox a.orderlink').click( function () {
      $(this).parent('p').next('div.hidebox').css('display','block');
      $(this).css('display','none');
      return false;
  });
  $('a.fancybox, .galerie a').fancybox({ 'zoomSpeedIn' : 220, 'zoomSpeedOut': 150 });


  // modded by Steffen Becker - Accordion-functionality for sortiment
  // only do this if we are on the sortiment-mainpage
  if ($('#c62').length) {
    // create an accordion-container to put stuff in
    var accordion = $('<div />', { 'id': 'accordion' });
    // everything between the dividers is gonna be accordionesque
    var hrOne = $('#col2_content .hr').parent().first().attr('id');
    var hrTwo = $('#col2_content .hr').parent().last().attr('id');
    // wrap the accordion-div around it
    $('#' + hrOne).append(accordion);

    // move everything between hrs into the accordion-div
    $('#' + hrOne).nextUntil('#' + hrTwo).each(function() {
      accordion.append($(this));
    });
    // and remove the surrounding divs
    accordion.children().children().unwrap();

    // ay. lets accordionify this stuff
    accordion.accordion({
      collapsible: true,
      active: false,
      header: 'h3'
    });
  }

  if ($('#c1').length) {
    $('#c1').append('<div id="slider" />');
    $('#c1 img').appendTo($('#slider'));
    $('#slider').cycle({
      timeout: 5000
    });
  }

});

