function mediaWindowHtml(ctf) {
	var mediafile = "http://www.counterbalance.net/link/" + ctf;
	var cbf_streamsfx = "lg";
	var fullvid = "no";
	var localmedia = 0;
	var playerOptions = " autostart=true type=audio/x-pn-realaudio-plugin";
	var largeSize = " width=100% height=216 backgroundcolor=#ffffff maintainaspect=true";
	var smallSize = " width=144 height=108";

	if ( (!document.domain) || (document.domain == "localhost") ) localmedia = -1;

	if ( document.cookie.length > 0 && localmedia ) cbf_streamsfx = "lg";

	if ( document.cookie.length > 0 && document.cookie.indexOf("cbf_stream=") > -1 ) {
		var cbf_streamcookie = document.cookie.split("cbf_stream=");

		var cookievalue = cbf_streamcookie[1].split(";");
		var cbf_streamsfx = cookievalue[0];
		}

	if ( document.cookie.length > 0 && document.cookie.indexOf("fullvid=") > -1 ) {
		var fullvidcookie = document.cookie.split("fullvid=");
		var fullvidvalue = fullvidcookie[1].split(";");
		var fullvid = fullvidvalue[0];
		}

	if ( cbf_streamsfx == "dv") mediafile = mediafile + "-dv.rpm";
	else 
		if ( cbf_streamsfx == "lg") 
			mediafile = mediafile + "-lg.ram";
		else
			mediafile = mediafile + "-sm.ram";

	document.write('<div align="center"><embed src=' + mediafile);
	if ( cbf_streamsfx == "sm" )
		document.write(smallSize);
	else
		document.write(largeSize);
	document.write(' console=' + ctf + ' controls=ImageWindow ' + playerOptions + '><br>');
	document.write('<table><tr align="center"><td>');
	document.write('<embed src=' + mediafile);
	document.write(playerOptions + ' console=' + ctf + ' controls=ControlPanel height=30 width=142> ');
	document.write('<embed src=' + mediafile);
	document.write(playerOptions + ' console=' + ctf + ' controls=PositionField height=30 width=142> ');
	document.write('</td></tr><tr align="center"><td>Video: ');
	if ( fullvid == "yes" && navigator.platform.indexOf("Mac") == -1 ) { 
		document.write('<a href="javascript: setFull()">Full</a> | ');
		}
	document.write('<a href="javascript: setLarge()">Large</a> | ');
	document.write('<a href="javascript: setSmall()">Small</a> | ');
	document.write('<a href="../stdweb/rpinstall.html">Setup</a>');
	document.write('</td></tr></table></div>');
}

function audioWindowHtml(ctf) {
	var mediafile = "http://www.counterbalance.net/link/" + ctf + ".ram";
	var playerOptions = " autostart=true type=audio/x-pn-realaudio-plugin";
	document.write('<embed src=' + mediafile);
	document.write(playerOptions + ' console=' + ctf + ' controls=ControlPanel height=30 width=142> ');
	document.write('<embed src=' + mediafile);
	document.write(playerOptions + ' console=' + ctf + ' controls=PositionField height=30 width=142> ');
}

function setFull() {
	setcbf_Cookie("cbf_stream=dv");
	document.location.reload();
}

function setLarge() {
	setcbf_Cookie("cbf_stream=lg");
	document.location.reload();
}

function setSmall() {
	setcbf_Cookie("cbf_stream=sm");
	document.location.reload();
}

function EnableFullVideo() {
	setcbf_Cookie("fullvid=yes");
	alert("Full Screen Plaback Enabled");
}

function DisableFullVideo() {
	setcbf_Cookie("fullvid=no");
	alert("Full Screen Plaback Disabled");
}

function setcbf_Cookie(setting) {
	var expires = new Date();
	expires.setTime(expires.getTime() + 2 * 365 * 24 * 60 * 60 * 1000);
	var the_cookie_date = expires.toGMTString(); 
	document.cookie = setting + ";expires=" + the_cookie_date + ";path=/";
}

