/**
 * @author      Dipl.-Ing. (FH) André Fiedler / ö_konzept Zwickau <a.fiedler@oe-konzept.de>
 * @version     1.0
 * @link        http://www.oe-konzept.de
 */

window.addEvent('domready', function()
{
	$$('img[rel^=popup], img[data-popup]').each(function(img)
	{
        if(!img.get('rel') && !img.get('data-popup')) return;
        
		img.setStyle('cursor', 'pointer');
		
		img.addEvent('click', function(e)
		{
			e.stop();
			
			var xxl = (this.get('rel') || this.get('data-popup')).replace(/^popup\(/, '').replace(/\)$/, '');
			
			window.open(xxl, '_blank', 'left=0,top=0,width=720,height=520,status=yes,scrollbars=yes,resizable=yes');
		});
	});
});

// FLV-Player laden
//-------------------------------------------------------
FlvPlayer = {};
FlvPlayer.scanPage = function() {
    
    var swf_file = 'swf/FLVPlayer.swf';
                
    if(Browser.Plugins.Flash.version < 9)
    {
        swf_file = 'swf/expressInstall.swf';
    }
    
    videos = $$('div.template-video span');
    
    videos.each(function(span){
        
        var flv = span.get('data-flv-src') || span.get('rel');
        if(!flv.test(/^http.*$/))
            flv = $(document.head).getElement('base').get('href') + flv;
        var container = span.getParent();
        
        if (Browser.Plugins.Flash.version < 8) {
            container.empty().setStyles({
                'width': 470,
                'height': 288,
                'background': '#BCC1BD',
                'border': '#BCC1BD 1px solid',
                'color': '#fff',
                'text-align': 'center',
                'line-height': 20
            }).set('html', 'Um das Video anzusehen, müssen Sie das Flash Player Plugin installiert haben!');
            return;
        }
        
        container.empty().setStyles({
            'width': 470,
            'height': 288,
            'background': '#d6d6d6',
            'border': '#BCC1BD 1px solid'
        });
        
        new Swiff(swf_file, {
            'container': container,
            'width': 470,
            'height': 288,
            'params': {
                'bgcolor': '#d6d6d6',
                'allowFullScreen': 'true'
            },
            'vars': {
                'src': flv
            }
        });
    });
};
window.addEvent('domready', FlvPlayer.scanPage);
//-------------------------------------------------------
