		var ssViewer = new Class({

			Implements:Options,
			
			options:{
				overlayOpacity: 	0.7,
				initialWidth: 		640,
				initialHeight:		379,
				resizeDuration:		500,
				resizeTransition: Fx.Transitions.Sine.easeOut,
				autoPlay:					false,
				autoPlayDelay:		7
			},
			
			initialize: function(options){
				
				this.opened = false;
				
				this.initHTML();
				this.initEvents();
				this.player = false;
				var move = function() {
					this.box.morph.cancel();
					this.box.morph.start({
				    'top': ((($(window).getSize().y - 40) / 2) - this.options.initialHeight / 2) + $(window).getScroll().y,
				    'left': ((($(window).getSize().x - 40) / 2) - this.options.initialWidth / 2) + $(window).getScroll().x
					});
					this.overlay.morph.cancel();
					this.overlay.morph.start({
				    'top': -$(window).getScroll().y,
				    'height': $(window).getScrollSize().y + $(window).getScroll().y
					});
				}.bindWithEvent(this);
				
				window.addEvents({
			    'resize': move,
			    'keyup': move,
			    'keydown': move,
			    'mousewheel': move
				});

			},
			initHTML: function() {
				this.overlay = new Element('div', {'styles':{'display':'none'}}).inject($(document.body));
				this.overlay.addClass('ssbOverlay');
				this.overlay.setStyles({
			    'top': -$(window).getScroll().y,
			    'height': $(window).getScrollSize().y + $(window).getScroll().y
			  });
				this.box = new Element('div', {'id': 'ssbMain', 'styles':{'display':'none'}}).inject($(document.body));
				this.box.addClass('ssbMain');
				this.box.setStyles({
			    'height': this.options.initialHeight,
			    'width': this.options.initialWidth,
			    'top': ((($(window).getSize().y - 40) / 2) - this.options.initialHeight / 2) + $(window).getScroll().y,
			    'left': ((($(window).getSize().x - 40) / 2) - this.options.initialWidth / 2) + $(window).getScroll().x
			  });
			  this.boxvideo = new Element('div', {'id': 'ssbVideo'}).inject($("ssbMain"));
			},
			initEvents: function() {
				this.overlay.morph = new Fx.Morph(this.overlay, {duration: 'normal', transition: Fx.Transitions.Sine.easeOut});
				this.box.morph = new Fx.Morph(this.box, {duration: 'normal', transition: Fx.Transitions.Sine.easeOut});
				this.overlay.addEvent("click", function() {
					this.hide();
				}.bindWithEvent(this));
				$$('a').each(function(a){
					if(a.rel && a.rel.test(/^ssviewer/i) && a.href.test(/\.(flv)$/i)){
						a.addEvent("click", function(e) {
							e.stop();
							this.adopt({
								href: a.href
							});
						}.bindWithEvent(this));
					}
				},this);
			},
			show: function() {
				if (this.opened == true) {return ;}
				this.opened = true;
				this.overlay.setStyle('display', 'block');
				this.box.setStyles({
					'display': 'block',
			    'top': ((($(window).getSize().y - 40) / 2) - this.options.initialHeight / 2) + $(window).getScroll().y,
			    'left': ((($(window).getSize().x - 40) / 2) - this.options.initialWidth / 2) + $(window).getScroll().x
		    });
				this.overlay.setStyles({
			    'top': -$(window).getScroll().y,
			    'height': $(window).getScrollSize().y + $(window).getScroll().y
			  });
				this.overlay.morph.cancel();
				this.overlay.morph.start({
					'opacity': this.options.overlayOpacity
				});
			},
			adopt: function(obj) {
				this.show();
	   		this.player = new swfobject.embedSWF("http://data.andrexen.com/swf/player.swf", "ssbVideo", "640", "379", "9.0.0", {}, {
	   			"autostart":"true",
	   			"file": obj.href
	   		}, {
	   			"allowscriptaccess":"always",
	   			"allowfullscreen":"true"
	   		}, {});
			},
			hide: function() {
				/*$('mymovie').sendEvent('STOP'); */
				if (this.opened == false) {return ;}
				this.box.setStyle('display', 'none');
				this.opened = false;
				this.overlay.morph.cancel();
				this.overlay.morph.start({
					'opacity': 0
				});
			}
		});
		
		window.addEvent("domready", function() {
			
			ssw = new ssViewer();
			
		});