function w_bind_links()
{
	var ar = document.getElementsByTagName("a");
	
	if (!ar)
	{
		return;
	}
	
	var bt = new Blacktouch();
	
	bt.onAppearComplete = function()
	{		
		bt._video = document.createElement('div');
		
		bt._video.id = 'video';

		var html = "";
			
		html += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="640" height="520" title="' + bt._link.title + '">';
			
		html += '<param name="movie" value="' + bt._link.href + '" />';
		html += '<param name="quality" value="high" />';
		html += '<embed src="' + bt._link.href + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="640" height="520"></embed>';

		bt._video.innerHTML = html;
		
		document.body.appendChild(bt._video);
	};
	
	bt.onTouch = function()
	{
		document.body.removeChild(bt._video);
		
		delete bt._video;
		
		bt.hide();
	};
	
	for (var i = 0 ; i < ar.length ; i++)
	{
		var a = ar[i];
		
		if (a.rel != "video")
		{
			continue;
		}

		var img = a.firstChild;
		
		img._fx = new Fx.Style(img, 'opacity', { duration: 125, wait: false });
		
		$(img).onmouseover = function()
		{
			this._fx.start(0.6);
		};
		
		$(img).onmouseout = function()
		{
			this._fx.start(1);
		};
		
		a.onclick = function()
		{
			bt.show();
			bt._link = this;
			
			return false;
		};
	}
}

function media_init()
{
	new Asset.image('overlay.gif');
	
	w_bind_links();
}

window.addEvent('domready', media_init);