var images=new Array();
function parseUri (str) {
	var	o   = parseUri.options,
		m   = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
		uri = {},
		i   = 14;

	while (i--) uri[o.key[i]] = m[i] || "";

	uri[o.q.name] = {};
	uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
		if ($1) uri[o.q.name][$1] = $2;
	});

	return uri;
};

parseUri.options = {
	strictMode: false,
	key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
	q:   {
		name:   "queryKey",
		parser: /(?:^|&)([^&=]*)=?([^&]*)/g
	},
	parser: {
		strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
		loose:  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
	}
};


function video(sid)
{
  this.id=images.length;
  images[this.id]=this;
  this.sid=sid;
  this.parent=modules[sid];
  
	this.draw=function()
	{		this.parent.data.marginTop=0;
	var url = parseUri(this.parent.data['SOption'].src);
	var path='';
	if(this.parent.data['SOption'].src) 
	{
	  
		var host=url['host'].match(/(.*)\./);
		
	 if(host)
	 {

		switch(host[1].substr(host[1].indexOf('.')+1))
		{
		  case 'youtube':
			if(url['path'] != '/watch'){
				path = 'http://www.youtube.com'+url['path'];
			}else{
				path = 'http://www.youtube.com/v/'+url['query'].substr(2);
			}
			break;
		  case 'sevenload':
			var e = url['path'].split('/');
			if(e[1] == 'pl'){
				path = 'http://de.sevenload.com'+url['path'];
			}else{
				path = 'http://de.sevenload.com/pl/'+e[2]+'/425x350/swf';
			}
			break;
		  case 'clipfish':
			path = 'http://www.clipfish.de/videoplayer+swf?'+url['query'];
			break;
		  case 'joinr':
			var e = url['path'].split('/');
			path = 'http://www.myvideo.de/movie/'+e[3];
			break;
		  case 'myvideo':
			var e = url['path'].split('/');
			if(e[1] == 'movie'){
				path = 'http://www.myvideo.de'+url['path'];
			}else{
				path = 'http://www.myvideo.de/movie/'+e[2];
			}
			break;
		  case 'metacafe':
			var e = url['path'].split('/');
			if(e[1] == 'fplayer'){
				path = 'http://metacafe.com'+url['path'];
			}else{
				path = 'http://metacafe.com/fplayer/'+e[2]+'/'+e[3]+'+swf';
			}
			break;
		  default:
			path='';
			return;
		}
	 }
	 }
//	 console.info('path',path);
		this.parent.data.path=path;	
		
		this.parent.data.tableMode=this.parent.data['tab'].tableMode;				
		this.parent.data.width=this.parent.ob.offsetWidth-4;		
		this.parent.data.height=(this.parent.ob.offsetWidth-4)*(340/560);		
	}
}


