          // made by www.glushko.me

        
          document.getElementById('leftbird').style.background='url(img/leftbird.gif) no-repeat';
          document.getElementById('leftbird').style.cursor='pointer';
          document.getElementById('rightbird').style.background='url(img/rightbird.gif) no-repeat';
          document.getElementById('rightbird').style.cursor='pointer';
          document.getElementById('leftbird').style.zIndex=97;
          document.getElementById('rightbird').style.zIndex=97;
          
          document.getElementById('leftbird').onclick=function(){rotleft()};
          document.getElementById('rightbird').onclick=function(){rotright()};

          var firstpict=1;
          var pictwidth=202;// сюда будут вставляться через php значения ширины всех картинок
          
          var table=document.getElementById('t_photos');
          
          var margleft=0;
          
          var irotate;
        


          function rotleft() {
            if (irotate) {clearInterval(irotate);}
          
            if (firstpict==1) {firstpict=numofpict+1;}
            
            var i=firstpict;
            margleft=0;
            while (i>1) {
             margleft-=(pictwidth+7);
             i--;
            }
            table.style.marginLeft=margleft+'px';
            
            firstpict=firstpict-1;
            
            var i=firstpict;
            margleft1=0;
            while (i>1) {
             margleft1-=(pictwidth+7);
             i--;
            }
            
            function funcrotate() {
              margleft+=5;
              table.style.marginLeft=margleft+'px';
              if (margleft1<margleft) {clearInterval(irotate);}
            }
            irotate=setInterval(funcrotate, 5);
          }


          function rotright() {
            if (irotate) {clearInterval(irotate);}
          
            if (firstpict==(numofpict+1)) {firstpict=1;}
            
            var i=firstpict;
            margleft=0;
            while (i>1) {
             margleft-=(pictwidth+7);
             i--;
            }
            table.style.marginLeft=margleft+'px';
            
            firstpict=firstpict+1;
            
            var i=firstpict;
            margleft1=0;
            while (i>1) {
             margleft1-=(pictwidth+7);
             i--;
            }
            
            function funcrotate() {
              margleft-=5;
              table.style.marginLeft=margleft+'px';
              if (margleft1>margleft) {clearInterval(irotate);}
            }
            irotate=setInterval(funcrotate, 5);
          }