function slideSwitch() {
    var $active = $('#slideshow IMG.active-partner');

    if ( $active.length == 0 ) $active = $('#slideshow .last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow .first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active-partner')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active-partner last-active');
        });
}

    $(function() {  
        $('.faq-question').click(function (){
            if($(this).hasClass('open')){
              $(this).find('p').slideUp('fast');  
              $(this).removeClass('open'); 
            } else {
              $(this).find('p').slideDown('fast'); 
              $(this).addClass('open');   
            }   
        })        
        $('div.menu-item').mouseover(function (){
            if($(this).hasClass('active')){
            } else {
              $(this).addClass('hovered');   
            }   
        }) 
        $('div.menu-item').mouseout(function (){
            if($(this).hasClass('hovered')){
              $(this).removeClass('hovered');   
            }            
        
        }) 
        currentPanel = 1;
        numberOfPanels = $('.article-menu .menu-item').size();
        
        function showPanel(panel){
           $('#article-'+currentPanel+'').removeClass('active');  
           $('.article-'+currentPanel+'').hide();                   
           $('#article-'+panel+'').addClass('active');  
           $('.article-'+panel+'').fadeIn('1000');
           currentPanel = parseInt(panel);       
        }
        function getPanelNumber(name){
           var r = name.match(/[\d\.]+/g);
           return r[0];
        }
        
        function nextPanel(){
            if (currentPanel < numberOfPanels){
                showPanel(window.currentPanel+1);                       
            } else {
                showPanel(1);                 
            }
            
        }
        function prevPanel(){
            if (currentPanel <= numberOfPanels){
                if (currentPanel > 1){
                  showPanel(window.currentPanel-1); 
                } else  {
                showPanel(numberOfPanels);  
                }                                 
            }                      
        }
        
        
        
        $('div.menu-item').click(function (){                
            if($(this).hasClass('active')){
            } else {
              var klasa = "";
              $('.menu-item.active').removeClass('active');
              $(this).addClass('active'); 
              
              klasa = $(this).attr("id");
              panel = getPanelNumber(klasa)              
              showPanel(panel,currentPanel);                          
            }   
        })
        $('#prev-panel-button').click(function(){
              prevPanel();            
        })
        $('#next-panel-button').click(function(){
              nextPanel();            
        })     
  

        $('.form-focused input,.form-focused textarea').focus(function (){
            $(this).css("border-color","#a6c3d4");      
        })
        $('.form-focused input,.form-focused textarea').blur(function (){
            $(this).css("border-color","#d4d9e0");      
        })    

/*
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license
*/



$(function() {
    setInterval( "slideSwitch()", 4000 );
});



    });
    

