var Video = {
		uri : "http://helpdeskvideo.domenca.com/",
		
		Play: function (videoName) {
			Video.createOverlay();
			
			$$('#overlay , #overlayClick').each(function(item) {
				item.addEvent('click', function() {
					$('overlayBg').dispose();
					$('outerVideo').dispose();
				});
			});
			document.addEvent('keydown', function(event) {
				if (event.code == 27) {
					$('overlayBg').dispose();
					$('outerVideo').dispose();
				}
			});
			
			var req = swfobject.hasFlashPlayerVersion("9.0.115");
			if (req) {
				swfobject.embedSWF(Video.uri + "Video_controller.swf", "videoContainer", "800", "589", "9.0.115", null, 
					{
						csConfigFile: Video.uri + videoName + "_config.xml", 
						csColor: "FFFFFF", 
						csPreloader: Video.uri + "Video_preload.swf", 
					},
					{
						bgcolor: "FFFFFF", 
						quality: "best", 
						allowscriptaccess: "always",
					});
			}
		},
		
		createOverlay: function () {
			var o = {
				'overlayBg' : new Element('div', {
				'id': 'overlayBg',
				'styles': {
					'background-color':'#000000',
					'top':0,
					'left':0,
					'width':'100%',
					'height':$(window).getScrollSize().y,
					'position':'absolute',
					'z-index':100000,
					'opacity':0.7
				}
				}),
				'outerVideo' : new Element('div', {
				'id': 'outerVideo',
				'styles': {
					'color':'#FFFFFF',
					'background-color':'#000000',
					'top': Math.max($(window).getScroll().y + Math.round($(window).getCoordinates().height / 2) - 320, 10),
					'left': Math.max(Math.round($(window).getScrollSize().x / 2) - 450, 0),
					'width': 810,
					'height': 625,
					'position':'absolute',
					'z-index':100001,
					'opacity':1
				}
				}),
				'innerVideo' : new Element('div', {
				'id': 'innerVideo',
				'styles': {
					'color':'#FFFFFF',
					'font-size':'16px',
					'font-weight':'bold',
					'top': '29px',
					'left': '5px',
					'position':'absolute',
					'z-index':100002,
				}
				}),
				'videoContainer' : new Element('div', {
				'id': 'videoContainer'
				}),
				'videoText' : new Element('div', {
				'id': 'videoText',
				'styles': {
					'color':'#FFFFFF',
					'font-size':'16px',
					'font-weight':'bold',
					'float':'right',
					'margin-right':'10px',
					'margin-bottom':'5px',
					'margin-top':'5px',
					'margin':'0 0 10 10',
					'z-index':100003
				}
				})
			}
			
			o.overlayBg.inject(document.body, 'top');
			o.outerVideo.inject(document.body, 'top');
			o.innerVideo.inject($('outerVideo'), 'top');
			o.videoContainer.inject($('innerVideo'), 'top');
			
			o.videoText.innerHTML = '<a href="#" id="overlayClick" style="color:white; font-weight:bold;">ZAPRI</a>';
			o.videoText.inject($('outerVideo'), 'top');
		}

}
