function muestraFlash() {
	document.getElementById("capavideo").innerHTML = "";
	document.getElementById("capavideo").style.width = "0";
	document.getElementById("capavideo").style.height = "0";
	document.getElementById("capavideo").style.padding = "0px 0px 0px 0px";	
	document.getElementById("capavideo").style.visibility = "hidden";
	document.getElementById("holatvflash").style.width = "560px";
	document.getElementById("holatvflash").style.height = "560px";
	document.getElementById("holatvflash").style.visibility = "visible";
	document.getElementById("holatvflash").style.display = "block";
}
function muestraVideo(base,identificador,formato,calidad,ancho,alto) {
	var ancho = parseInt(ancho);
	var alto = parseInt(alto);
	document.getElementById("holatvflash").style.width = "0";
	document.getElementById("holatvflash").style.height = "0";
	document.getElementById("holatvflash").style.visibility = "hidden";
	document.getElementById("capavideo").style.width = "560px";
	document.getElementById("capavideo").style.height = "560px";
	document.getElementById("capavideo").style.padding = "120px 0px 0px " + (280 - (ancho / 2)) + "px";
	document.getElementById("capavideo").style.visibility = "visible";
	document.getElementById("holatvflash").style.display = "none";

	switch (formato) {
		case "wmv":
			document.getElementById("capavideo").innerHTML = '<a style="line-height: 150%; margin: 0 0 0px 20px; font-size: 80%; color: #666666; text-decoration: none;" href="javascript: muestraFlash();"><img src="../images/volver.gif" border="0"> Volver al listado</a><br /><a style="line-height: 150%; margin: 0 0 0px 20px; font-size: 80%; color: #666666; text-decoration: none;" href="' + base + identificador + '/' + formato + '/' + identificador + '_' + calidad + '.wmv"><img src="../images/descargar.gif" border="0"> Descargar vídeo</a><br /><object id="Player" width="' + ancho + '" height="' + (alto + 45) + '" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"><param name="autoStart" value="true"><param name="URL" value="' + base + identificador + '/' + formato + '/' + identificador + '_' + calidad + '.wmv"><embed type="video/x-ms-asf-plugin" pluginspage = "http://www.microsoft.com/Windows/MediaPlayer/" src="' + base + identificador + '/' + formato + '/' + identificador + '_' + calidad + '.wmv" width="' + ancho + '" height="' + (alto + 45) + '" name="MediaPlayer1" autostart=true></embed></object>';
		break;
		
		case "real":
			document.getElementById("capavideo").innerHTML = '<a style="line-height: 150%; margin: 0 0 0px 20px; font-size: 80%; color: #666666; text-decoration: none;" href="javascript: muestraFlash();"><img src="../images/volver.gif" border="0"> Volver al listado</a><br /><a style="line-height: 150%; margin: 0 0 0px 20px; font-size: 80%; color: #666666; text-decoration: none;" href="' + base + identificador + '/' + formato + '/' + identificador + '_' + calidad + '.rm"><img src="../images/descargar.gif" border="0"> Descargar vídeo</a><br /><embed width="' + ancho + '" height="' + (alto+40) + '" src="' + base + identificador + '/' + formato + '/' + identificador + '_' + calidad + '.rm" console="two" controls="All" nojava="true" autostart="true"></embed>';
		break;
	}
}
function escribeFlash(id, path, swf, w, h, colorFondo, flashVars) {
	
	if (typeof(colorFondo) == "undefined") { colorFondo = "FFFFFF"; }
	if (typeof(flashVars) == "undefined") { flashVars = ""; }
	
	swf = path + swf;

	// Crea la cadena del objeto flash
	sObjetoFlash = '<OBJECT classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
	sObjetoFlash += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ';
	sObjetoFlash += 'WIDTH="'+w+'" HEIGHT="'+h+'" id="'+id+'" ALIGN="">';
	sObjetoFlash += '<param name="allowScriptAccess" value="sameDomain" />';
	sObjetoFlash += '<PARAM NAME=movie VALUE="'+swf+'" />';
	sObjetoFlash += '<PARAM NAME=menu VALUE=false />';
	sObjetoFlash += '<PARAM NAME=scale VALUE=noscale />';
	sObjetoFlash += '<PARAM NAME=quality VALUE=high />';
	sObjetoFlash += '<PARAM NAME=bgcolor VALUE=#'+colorFondo+' />';
	sObjetoFlash += '<PARAM NAME=flashVars VALUE="'+flashVars+'" />';
	sObjetoFlash += '<EMBED src="'+swf+'" flashVars="'+flashVars+'" menu=false scale=noscale quality=high bgcolor=#'+colorFondo+' WIDTH="'+w+'" HEIGHT="'+h+'" name="'+id+'" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" />';
	sObjetoFlash += '</OBJECT>';
	
	document.write(sObjetoFlash);
}

