function videoShowForLink(link,dontMove) {
	var i=link.href.lastIndexOf("?v=");
	var vname=link.href.substring(i+3);
//DBG	alert("vname='" + vname + "'");
	var t= link.innerHTML;
	var o="<object width=\"425\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/" + vname + "&amp;autoplay=1\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/"+vname+"&amp;autoplay=1\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"350\"></embed></object>";
	document.getElementById('videoPantalla').innerHTML= "<h2>"+t+"</h2>"+o;
	if (!dontMove) { window.location="#video"; }
	return false;
}

function videoSelectFirst() {
//DBG	alert("selecting first");
	var firstSelected= false;
	for (i=0; i<document.links.length; i++) {
//DBG		alert(i+" "+document.links[i].href); alert(i+" "+document.links[i].href.indexOf("youtube.com"));
		if (document.links[i].href.indexOf("youtube.com/watch")>-1) {
			if (!firstSelected) { videoShowForLink(document.links[i],true); firstSelected= true;}
			document.links[i].onclick= function () { return videoShowForLink(this); };
		}
	}
}

function esTangoInit() {
	if (document.getElementById("videoPantalla")!=null) { videoSelectFirst(); }
}
