

    
    
var showQuizFlash = function(){
  
  window.addEvent('domready', function() {
  
        
        var topLayerImg = 'img/toplayer.jpg';
        var closeImg = 'img/toplayer-close-btn.png';
        
        var flashWidth = 680;
        var flashHeight = 345;
    
        var screenSize = window.getSize();
        var screenPosition = document.getScroll();
        var scroll = window.getScrollSize();
    
    
    
        var topLayerWrapper = new Element('div',{
            'id' : 'quiz-flash-box-wrapper',
            'styles': {
              'position' : 'absolute',
              'z-index' : '100000',
              'background' : 'transparent url(img/overlay.png)',
              'width' : '100%',
              'height' : '' + scroll.y + 'px',
              'left' : '0',
              'top' : '0'
            }
        });
        
    
        var topLayer = new Element('div',{
            'id' : 'quiz-flash-box',
            'styles': {
              'position' : 'absolute',
              'z-index' : '100000',
              'width' : flashWidth + 'px',
              'height' : flashHeight + 'px'
            }
        });
        
        var topLayerFlash = new Element('div',{
            'id' : 'quiz-flash-file',
            'styles': {
              'position' : 'absolute',
              'z-index' : '1000000',
              'top' : '20px',
              'left' : '0',
              'background' : 'transparent url(' + topLayerImg + ')',
              'width' : '651px',
              'height' : '321px'
            }
        });
        
        var topLayerAnchor = new Element('a',{
            'id' : 'top-layer-anchor',
            'href' : 'http://www.kociolekdosyta.pl/nowe/',
            'styles': {
                'display' : 'block',
                'width' : '651px',
                'height' : '321px',
                'background' : 'transparent url(img/pix.gif)'
            },
            'target' : '_blank'
        });

        var closeBtnBox = new Element('div',{
            'id' : 'close-btn',
            'styles': {
              'position' : 'absolute',
              'top' : '0',
              'right' : '0',
              'z-index' : '1000000',
              'width': '20px',
              'height' : '20px',
              'background' : 'transparent url(' + closeImg + ')',
              'cursor' : 'pointer'
            },
            'events': {
                'click' : function(){
                    closeQuiz();
                }
            }
        });
    
    
        var topLayerTop = screenPosition.y + ((screenSize.y - flashHeight)/2);
        var topLayerLeft = ((screenSize.x - flashWidth)/2);
        
    
        topLayer.setStyles({
            'top' : -topLayerTop,
            'left' : topLayerLeft
        });
    
    
        topLayer.inject(document.body,'top');
        topLayerWrapper.inject(document.body,'top');
        
        closeBtnBox.inject(topLayer);
        topLayerFlash.inject(topLayer);
        topLayerAnchor.inject(topLayerFlash);
    
        
        /*
      	var flashvars = {};
      	var params = { wmode: "transparent" };
      	var attributes = {};
        
        
        swfobject.embedSWF("flash/quiz.swf", "quiz-flash-file", flashWidth, flashHeight, "9.0.0", false, flashvars, params, attributes);
        */
        
        
        topLayer.tween('top', topLayerTop);
    
         
    
        window.addEvent('scroll', function() {
        	if (topLayer) {
            var screenSize = window.getSize();
            var screenPosition = document.getScroll();
            var topLayerTop = screenPosition.y + ((screenSize.y - flashHeight )/2);
        		topLayer.tween('top', topLayerTop);
        	}
        });

  });
    
}



var closeQuiz = function() {
  $('quiz-flash-box-wrapper').destroy();
  $('quiz-flash-box').destroy();
};
    
    
    //showQuizFlash();


