 $(document).ready(function() { 
        $('#menu').superfish({autoArrows:  false, hoverClass:  'menuHover'});
        
        //$('#gallery a').lightBox({fixedNavigation:true});
        
        //headlines script
        $('#header .row:first .grid_9 ul li.hidden').css('opacity', 0).show();
        setInterval (changeheadlines, 5010);
        function changeheadlines ()
        {
          timeint = 5000;
          toshow = $('#header .row:first .grid_9 ul li.current').next();
          if (toshow.length == 0) toshow = $('#header .row:first .grid_9 ul li:first');
          $('#header .row:first .grid_9 ul li.current').animate({opacity: 0}, timeint).removeClass('current');
          $(toshow).animate({opacity: 1}, timeint).addClass('current');
        }
       
        //testimonials sliding script
        $('#testimonials').prepend('<a href="#" id="prev">&lt;</a><a href="#" id="next">&gt;</a>');
        a = 1;
        total = $('#testimonials ul').children().length;
        ulwidth = total * 260;
        $('#testimonials ul').css('width', ulwidth+'px');
        $('#testimonials ul li').show();
        
        $('#next, #prev').one ( 'click', function() {movet($(this).attr('id')); setTimeout(retrivelinks, 1005); return false;} );
                
        function movet (dir)
        {
          $('#next, #prev').unbind();
          
          mar = Number ($('#testimonials ul').css('marginLeft').split('px')[0]);
          
          switch (dir)
          {
            case 'next':
              a += 1;
              if (a > total)
              {
                newmar = Number(mar+260);
                mar = newmar;
                newmar += 'px';
                $('#testimonials ul').append($('#testimonials ul li:first')).css('marginLeft', newmar);
                a = total;
              }
              newmar = Number(mar-260);
              newmar += 'px';
            break;
            case 'prev':
              a -= 1;
              if (a < 1)
              {
                newmar = Number(mar-260);
                mar = newmar;
                newmar += 'px';
                $('#testimonials ul').prepend($('#testimonials ul li:last')).css('marginLeft', newmar);
                a = 1;
              }
              newmar = Number(mar+260);
              newmar += 'px';
            break;
          }

          $('#testimonials ul').animate({marginLeft: newmar}, 1000);
          }
        
        function retrivelinks ()
        {
          $('#next, #prev').one ( 'click', function() {movet($(this).attr('id')); setTimeout(retrivelinks, 1005); return false;} );
        }
    });
