$(document).ready(function(){
	$("#sidebar .video .thumbnails li a").click(function(){
			
			var thumb = $(this).find('img').attr('src');
			var url = this.href;
			html = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553500" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/portada_swflash.cab#version=8,0,0,0" width="100%" height="100%" align="middle">';
			html = html + '<param name="flashVars" value="videourl='+url+'&amp;fotourl='+thumb+'"/>';
			html = html + '<param name="allowScriptAccess" value="sameDomain"/>';
			html = html + '<param name="allowFullScreen" value="true"/>';
			html = html + '<param name="movie" value="/resources/images/player.swf"/>';
			html = html + '<param name="quality" value="high"/>';
			html = html + '<param name="bgcolor" value="#000000"/>';
			html = html + '<param name="wmode" value="opaque"/>';
			html = html + '<embed src="/resources/images/player.swf" flashVars="videourl='+url+'&amp;fotourl='+thumb+'" quality="high" bgcolor="#000000" width="100%" height="100%" name="videoplayer" align="middle" wmode="opaque" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>';
			var obj = $(this).parent().parent().parent().find('object').replaceWith(html);
			return false;
	});
	
	$("#sidebar .audio .thumbnails li span").click(function(){
			
			var url = $(this).attr('class');
			
			html = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553500" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/portada_swflash.cab#version=8,0,0,0" width="336" height="250" align="middle">';
			html = html + '<param name="flashVars" value="url='+url+'"/>';
			html = html + '<param name="allowScriptAccess" value="sameDomain"/>';
			html = html + '<param name="allowFullScreen" value="true"/>';
			html = html + '<param name="movie" value="/resources/images/audio.swf"/>';
			html = html + '<param name="quality" value="high"/>';
			html = html + '<param name="bgcolor" value="#000000"/>';
			html = html + '<param name="wmode" value="opaque"/>';
			html = html + '<embed src="/resources/images/audio.swf" flashVars="url='+url+'" quality="high" bgcolor="#000000" width="100" height="67" name="videoplayer" align="middle" wmode="opaque" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>';
			var obj = $(this).parent().parent().parent().find('object').replaceWith(html);
	});
});


