window.addEvent('domready', function()
{
	/*
	 * Video Player
	 */
	if($('videotour_ansehen'))
	{
		var static_content;
		
		$('videotour_ansehen').addEvent('click', function(e)
		{
			e.stop();
			var el = this;
			
			if(Browser.Plugins.Flash.version < 8)
			{
				this.blur();
				if(confirm(
					'Um die Videotour anzusehen, müssen Sie das Flash Player Plugin installiert haben!' + "\n" + 
					'Klicken Sie auf »OK« um das Plugin jetzt zu installieren.'
				))
				{
					document.location = 'http://get.adobe.com/de/flashplayer/';
				}
				return;	
			}
			
			var stage_inner = $('stage');
			var size = stage_inner.getSize();
			static_content = stage_inner.getChildren().dispose();
			
			var wrapper = new Element('div', {'class': 'stage'}).setStyle('height', 430).inject(stage_inner);
			var fx = new Fx.Tween(wrapper);
			
			fx.addEvent('complete', function()
			{
				var uri = new URI(el.get('href').replace('#', ''));
				
				var swf_file = 'video/' + uri.get('file');
				
				if(Browser.Plugins.Flash.version < 9)
				{
					swf_file = 'swf/expressInstall.swf';
				}
				
				new Swiff(swf_file, {
					container: wrapper,
					width: 708,
					height: 430,
					params: {
						wmode: 'opaque',
						bgcolor: '#ffffff'
				    },
					vars: uri.get('data'),
					callBacks: {
						onComplete: function()
						{
							wrapper.destroy();
							static_content.inject(stage_inner);
							$('videotour_close_btn').fade('out');
						}
					}
				});	
			});
			
			new Fx.Scroll(window).toElement(stage_inner);
			fx.start('height', 430);
			
			$('videotour_close_btn').fade('hide').fade('in').addEvent('click', function(e)
			{
				e.stop();
				this.blur();
			
				wrapper.destroy();
				static_content.inject(stage_inner);
				this.fade('out');
			});
		});
	}
	
	/*
	smooth scrolling
	*/
	// new SmoothScroll({ duration:700 }, window);
});
