var href = "";
var o = "";
var currentURL = '';

dlhooks.push(function() {

	youtube = new Array();
	youtube = $$('.youtube');
	
	if (youtube) {
	
		var base='./typo3conf/ext/ig_videoloader/res/js/';
		var swfObject = new Asset.javascript(base+'swfobject.js');
		var videoloader_multiboxJS = new Asset.javascript(base+'/videoloader_multibox.js');
		var overlayJS = new Asset.javascript('./fileadmin/system/js/overlay.js');
		var multiboxCSS = new Asset.css(base+'../css/multibox.css');	
	
		for(var i = 0, y; y = youtube[i]; i++)
		{
			//y.set('rel',y.href);
			y.addEvent('click', function(){	getYoutube(this.rel); });			
			//y.href="javascript:void(0);";
			//y.target = '';
		}
	}
	
});


function getYoutube(href) {

	var flash = true;
	var hRef = href;
	var videoId = hRef.split('=');
	var videoID = videoId[1];

	var optionen = hRef.split('&');
	
	var widthtemp = optionen[optionen.length-2].split('=');
	var flashwidth = widthtemp[1];
	
	var heighttemp = optionen[optionen.length-1].split('=');
	var flashheight = heighttemp[1];
	
	var jobj = new Object;
	jobj.width = flashwidth;
	jobj.height = flashheight;
	jobj.name = 'flvvideo';
	jobj.id = videoID;
	jobj.swf = 'http://www.youtube.com/v/'+videoID+'&hl=de_DE&fs=1&';
	
	new st_flashplayerMultiBox({
			obj: jobj,
			player: 'youtube'	
	});
}

