
   var numer = 1;
   var oldnumer = 3;
   var max_numer = 3;
   var navitime = 7000;
   var hn_width = 414;
   
   var navitimer = null;

   function navichange(nr){
   
   	if (nr != numer){
	      oldnumer = numer;
   	   numer = nr;
      
	      $('#bn-hn-navi span').removeClass('selected');
   	   $('#bn-hn-navi-'+numer).addClass('selected');
      
      
         if (jQuery.browser.msie) {
            $('#bn-hn-in-'+oldnumer).hide();
   	      $('#bn-hn-in-'+numer).show();
         } else {
	         $('#bn-hn-in-'+oldnumer).fadeOut();
   	      $('#bn-hn-in-'+numer).fadeIn();
         }
      }
      
   }
   
   function navinext(){
   clearTimeout(navitimer);      
      new_numer = numer + 1
       if (new_numer > max_numer) { new_numer = 1};
      navichange(new_numer);
      navitimer = setTimeout('navinext()', navitime);      
   }

   $(document).ready(function(){
      
      // ustawienie przezroczystosci wszystkich elementow z atrybutem opacity
      
      hn_width = $('#bn-hn-in-1').width();
      
      $("[opacity]").each(
         function(nr){
            elementOpacity = 0.5;
            if (typeof $(this).attr('opacity') != 'undefined'){
               elementOpacity = $(this).attr('opacity');
               $(this).fadeTo(0,elementOpacity);
            } 
         }
      );
      
      // ustawienie wysokosci tytulow i leadów we wszystkich boksach
      
      $(".bn-hn-title").each(function(nr){
            $('#bn-hn-in-' + (nr+1) + ' div.bn-hn-top-fade').css({ height: ($(this).height() + 'px')})
      });
      
       $(".bn-hn-bottom").each(function(nr){
               $('#bn-hn-in-' + (nr+1) + ' div.bn-hn-bottom-fade').css({ height: ($(this).height() + 'px')})
         });
         
   
   // po rozliczeniu wszystkiego ustawiamy visibility i display
   
   $('.bn-hn-in:not(#bn-hn-in-1)').css({display: "none", visibility: "visible"});
   
   // bindowanie animacji na przelaczniki
   
   $('#bn-hn-navi span').click(function(){
      clearTimeout(navitimer);
      nr = parseInt($(this).attr('numer'));
      navichange(nr);
      
   });
   
   $('#bn-hn').mouseover(function(){
      clearTimeout(navitimer);
   });

   $('#bn-hn').mouseout(function(){
      navitimer = setTimeout('navinext()', navitime);
   });
   
   
   navitimer = setTimeout('navinext()', navitime);
   
   
      
});
   


