
 function fullScreen() {
    var WMP7, realplayer, mediaplayer;
    if (window.navigator.appName != "Netscape") { WMP7 = new ActiveXObject('WMPlayer.OCX'); }

    if (document.getElementById("mPlayer")) { mediaplayer = document.getElementById("mPlayer"); }
    if (document.getElementById("rPlayer")) { realplayer = document.getElementById("rPlayer"); }

    if (mediaplayer) {
      if (!mediaplayer.playState) { alert('O Mozilla ou FireFox não suportam o modo de janela completa.\nPor favor tecle com o botao direito do rato em cima da janela do filme e escolha a opção, Ecram Completo ou em Ingles Full Screen.'); }
      if (WMP7) {
        if (mediaplayer.playState == 3) { mediaplayer.fullScreen = 'true'; } else {  alert('So pode mudar para modo de ecram completo quando estiver a ver um video.'); }
      } else { mediaplayer.DisplaySize = 3; }
    }
    if (realplayer) {
      realplayer.SetFullScreen();
    }
    if ((!mediaplayer) && (!realplayer)) { alert('So pode mudar para modo de ecram completo quando estiver a ver um video.'); }

    return false;
  }


  function clearScreen() {
    document.all['PlayerID'].innerHTML = '<OBJECT ID="mPlayer" width=480 height=424 classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902" type="application/x-oleobject"><PARAM NAME="URL" VALUE="testpattern.gif"><PARAM NAME="AutoStart" VALUE="true"><PARAM name="uiMode" value="full"><PARAM NAME="AnimationAtStart" VALUE="True"><PARAM NAME="stretchToFit" VALUE="True"><EMBED type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" SRC="testpattern.gif" name="MediaPlayer" width=480 height=424 ShowStatusbar="true" ShowControls="true" stretchToFit="true" AutoStart=1></EMBED></OBJECT>';
  }


function createParam(name, value) {
  var p = document.createElement("param");
  p.name=name;
  p.value=value;
  return p;
 }

function flash( url, parentId, width, height, color, flashvars, name) {

	var o, e;
	
	// object element
	o = document.createElement("object");
	o.codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
	o.width=width;
	o.height=height;
	o.id=name;
	document.getElementById(parentId).appendChild(o);
	
	// object's param element(s)
	o.appendChild(createParam("movie", url));
	o.appendChild(createParam("allowScriptAccess", "sameDomain"));
	o.appendChild(createParam("wmode", "opaque"));
	o.appendChild(createParam("menu", "false"));
	o.appendChild(createParam("bgcolor", color));
	o.appendChild(createParam("FlashVars", flashvars));

	// tentar fazer o setup dos elementos incorporados
	try {
		e = document.createElement("embed");
		e.setAttribute("src", url);
		e.setAttribute("width", width);
		e.setAttribute("height", height);
		e.setAttribute("type", "application/x-shockwave-flash");
		e.setAttribute("pluginspage", "http://www.macromedia.com/go/getflashplayer");
		e.setAttribute("FlashVars", flashvars);
		e.setAttribute("menu", "false");
		e.setAttribute("bgcolor", color);
		e.setAttribute("allowScriptAccess", "sameDomain");
		o.appendChild(e);
	} catch (e) {
	}

	o.classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"; 
}

function video( url, width, height ) {

document.write('<object id="mPlayer" width="'+width+'" height="'+height+'" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">\n');
document.write('<param name="FileName" value="'+url+'">\n');
document.write('<param name="uiMode" value="full">\n');
document.write('<param name="ShowStatusBar" value="False">\n');
document.write('<param name="ShowControls" value="True">\n');
document.write('<embed type="application/x-mplayer2" pluginspace="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" src="'+url+'" showcontrols="1" showstatusbar="0" autostart="1" width="'+width+'" height="'+height+'"></embed>\n');
document.write('</object>\n');
}
