jQuery(function($)
{
    jQuery('a.lightbox').fancybox(
    {
        zoomSpeedIn:   300,
        zoomSpeedOut:  300,
        overlayShow:   true,
        titlePosition: 'inside' // alternativen: 'over' (transparent), 'outside' (achtung: nur einzeiliger text moeglich)
    });

    $('ul.sf-menu').superfish();

    // slider
    $('body#p54 #content-bottom-col-right > div').wrap('<li></li>').parent().wrapAll('<div class="anythingSlider"><div class="wrapper"><ul></ul></div></div>');

    $('.anythingSlider').anythingSlider({
        easing: "swing",                // Anything other than "linear" or "swing" requires the easing plugin
        autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not
        startStopped: false,            // If autoPlay is on, this can force it to start stopped
        delay: 3000,                    // How long between slide transitions in AutoPlay mode
        animationTime: 600,             // How long the slide transition takes
        hashTags: true,                 // Should links change the hashtag in the URL?
        buildNavigation: false,          // If true, builds and list of anchor links to link to each slide
        pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
        startText: "Start",             // Start text
        stopText: "Stop",               // Stop text
        navigationFormatter: null       // Details at the top of the file on this use (advanced use)
    });
    
    // Download Sidebar
    $("#content-col-right .csc-default").addClass('js-csc-default').first().addClass('js-first');
    $("#content-col-right .csc-default").each(function() {
        var href = $(this).find("a[href$=.pdf]").attr('href');
        if (href.length > 0)
        {
            $(this).after("<a class='js-download' href='" + href + "'>Download now!</a>");
        }
        
    });
    
    //$('body#p54 #content-top-col-left-dropdown, body#p54 #content-top-col-left-dropdown div, #news-latest-anwenderbericht img').corner('3px');
    
    // PDF im neuen Fenster öffnen
    $('.content a').each(function() {
        var a = $(this);
        var href = a.attr('href');
        if (href)
        {
          // get the extension from the href
          var hrefArray = href.split('.');
          var extension = hrefArray[hrefArray.length - 1];
  
          if(extension == 'pdf') {
              a.attr( {target :'_blank' });
          }
        }
    });
    
});
