    
    //var $j = jQuery.noConflict();
    var akceSel = 0;
    var shopSel = 0;
    var msgsFirstRun = true;
    
    var msgs    = Array();
        msgs[0] = Array('', '/userdata/topShow/top-img-1.jpg');
        msgs[1] = Array('Pravidelný dohled', '/userdata/topShow/top-img-4.jpg');
        msgs[2] = Array('Zásah do 3 hodin', '/userdata/topShow/top-img-2.jpg');
        msgs[3] = Array('Spolehlivý provoz IT', '/userdata/topShow/top-img-3.jpg');
    
    var msgsPos = 0;
    
    var imgPreload = Array('/skins/hdata/img/more-info-hover.png', '/userdata/topShow/top-img-1.jpg', '/userdata/topShow/top-img-2.jpg', '/userdata/topShow/top-img-3.jpg', '/userdata/topShow/top-img-4.jpg', '/userdata/topShow/top-img-5.jpg');
    
    for( i=0;i<imgPreload.length;i++ )
    { var imgTmp = new Image();
      imgTmp.src = imgPreload[i];
    }
    
    function claimMsgsRoll()
    { if( msgsPos+1 > msgs.length )
      { msgsPos = 0;
      }
      
      $('#claimMsg').fadeTo
      ( 400,0, 
        function() 
        { $(this).html(msgs[msgsPos][0]); 
          
          if( !msgsFirstRun && $('#topImg.OK').size() > 0 )
          { $('#topImg > img').fadeTo
            ( 400, 0, 
              function() 
              { $(this).attr('src', msgs[msgsPos][1]);
                $(this).fadeTo(400,1); 
              } 
            );
          }
          
          $(this).fadeTo
          ( 400,1, 
            function() 
            { msgsPos++; 
              msgsFirstRun = false;
            } 
          ); 
        }
      );
      
    }
    
    function akceRoll()
    { $('#akce > div.akce').css('display', 'none');
      $('#akce > div.akce').eq(akceSel).fadeTo(700, 1);
    }
    
    function shopRoll()
    { $('#shop > div.item').css('display', 'none');
      $('#shop > div.item').eq(shopSel).fadeTo(700, 1);
    }
    
    function checkMailFrm(frm)
    { var pat=/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/;
      
      allow = true;
      
      if( !pat.test(frm['e-mail'].value) )
      { allow = false;
        alert('Prosím zadejte platnou e-mailovou adresu');
      }
      
      return allow;
    }
    
    $(document).ready
    ( function()
      { 
        
        /* --- advertisement --- */
        
        if( $.cookie('__advert') != '1' )
        { 
          var sudata = $('.superakce').html();
          
          $.fancybox
          ( 
            sudata,
            { 
    		      'centerOnScroll' : true
            }
          );
          
          $.cookie('__advert', '1');
        }
        
       
        $('#breadcrumb > a:last').addClass('last');
        
        $('#container div.menu > ul > li > ul > li.last').each
        ( function() 
          { var h = $(this).parent().height();
            $(this).parent().css('height', (h-20) + 'px' );
          } 
        );
        
        $('div.menu > ul > li').mouseenter
        ( function() 
          { $(this).find('ul').eq(0).css('display', 'block');
          }
        );
        
        $('div.menu > ul > li').mouseleave
        ( function() 
          { $(this).find('ul').eq(0).css('display', 'none');
          }
        );
        
        if( $('#akce > div.akce').size() > 1 )
        { $('#akce').append('<a id="akcenext">zobrazit další</a>');
          
          $('#akcenext').click
          ( function()
            { 
              if( akceSel+1 >= $('#akce > div.akce').size() )
              { akceSel = 0;
              }
              else
              { akceSel++;
              }
              
              akceRoll();
            }
          );
          
          window.setInterval( function() { $('#akcenext').trigger('click'); }, 10000 );

          akceRoll();
          
        }
        
        $.ajax
        ( { url:  '/shop.php',
            type: 'GET',
            data: '',
            cache: false,
            success: function(data) 
            { $('#shop').html(data);
              $('#shop').trigger('dblclick');
            } 
          }
        );
        
        $('#shop').dblclick
        ( function()
          { 
            if( shopSel+1 >= $('#shop > div.item').size() )
            { shopSel = 0;
            }
            else
            { shopSel++;
            }
            
            shopRoll();
          }
        );
        
        shopRoll();
        window.setInterval( function() { $('#shop').trigger('dblclick'); }, 8000 );
        
        window.setInterval( function() { claimMsgsRoll(); }, 6000 );
        claimMsgsRoll();
        
      }
    );
