function LoadTestObjectAudio(divId, filename, embWidth, embHeight) {
	var d = document.getElementById(divId);
	d.innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ' +
		'width="' + embWidth + '" height="' + embHeight+ '" id="audio" align="middle">' +
		'<param name="allowScriptAccess" value="sameDomain" />' +
		'<param name="movie" value="' + fileName + '" />' +
		'<param name="quality" value="high" />' +
		'<param name="wmode" value="transparent" />' +
		'<embed src="' + fileName + '" quality="high" wmode="transparent" width="' + embWidth + 
		'" height="' + embHeight + '" name="audio" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';

}

function LoadTestObject(divId, filename, identity, embWidth, embHeight) {

	var d = document.getElementById(divId);
	d.innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ' +
		'width="' + embWidth + '" height="' + embHeight+ '" id="unitMenu" align="middle">' +
		'<param name="allowScriptAccess" value="sameDomain" />' +
		'<param name="movie" value="' + fileName + '" />' +
		'<param name="quality" value="high" />' +
		'<param name="wmode" value="transparent" />' +
		'<embed src="' + fileName + '" quality="high" wmode="transparent" width="' + embWidth + 
		'" height="' + embHeight + '" name="unitMenu" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
}
function LoadTestObjectA(divId, filename, embWidth, embHeight) {
	var d = document.getElementById(divId);
	d.innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ' +
		'width="' + embWidth + '" height="' + embHeight+ '" id="activity" align="middle">' +
		'<param name="allowScriptAccess" value="sameDomain" />' +
		'<param name="movie" value="' + fileName + '" />' +
		'<param name="quality" value="high" />' +
		'<param name="wmode" value="transparent" />' +
		'<embed src="' + fileName + '" quality="high" wmode="transparent" width="' + embWidth + 
		'" height="' + embHeight + '" name="activity" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';

}
function LoadTestObjectUnit(divId, filename, embWidth, embHeight) {
	// disabled anti cache
	var antiCache = 0;//new Date();
	var d = document.getElementById(divId);
	d.innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ' +
		'width="' + embWidth + '" height="' + embHeight+ '" id="unit">' +
		'<param name="allowScriptAccess" value="sameDomain" />' +
		'<param name="movie" value="' + fileName + '?'+antiCache+'" />' +
		'<param name="quality" value="high" />' +
		'<param name="wmode" value="transparent" />' +
		'<embed src="' + fileName + '?'+antiCache+'" quality="high" wmode="transparent" width="' + embWidth + 
		'" height="' + embHeight + '" name="unit" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
}
function LoadTestObjectUnitPage(divId, filename, embWidth, embHeight,page) {
	// disabled anti cache
	var antiCache = 0;//new Date();
	var d = document.getElementById(divId);
	d.innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ' +
		'width="' + embWidth + '" height="' + embHeight+ '" id="unit">' +
		'<param name="allowScriptAccess" value="sameDomain" />' +
		'<param name="movie" value="' + fileName + '?'+antiCache+'" />' +
		'<param name="quality" value="high" />' +
		'<param name="FlashVars" value="p='+page+'" />' +
		'<param name="wmode" value="transparent" />' +
		'<embed src="' + fileName + '?'+antiCache+'" quality="high" wmode="transparent" width="' + embWidth + '" FlashVars="p='+page+'" ' +
		'" height="' + embHeight + '" name="unit" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
}
function LoadTestObjectUnitLO(divId, filename, embWidth, embHeight) {
	var d = document.getElementById(divId);
	d.innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ' +
		'width="' + embWidth + '" height="' + embHeight+ '" id="unitLO">' +
		'<param name="allowScriptAccess" value="sameDomain" />' +
		'<param name="movie" value="' + fileName + '" />' +
		'<param name="quality" value="high" />' +
		'<param name="wmode" value="transparent" />' +
		'<embed src="' + fileName + '" quality="high" wmode="transparent" width="' + embWidth + 
		'" height="' + embHeight + '" name="unitLO" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';

}

function LoadTestObjectMov(divId, filename, embWidth, embHeight) {
	var d = document.getElementById(divId);
	d.innerHTML = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" ' +
		'width="' + embWidth + '" height="' + embHeight+ '" id="movie" align="middle">' +
		'<param name="autoplay" value="false" />' +
		'<param name="movie" value="' + fileName + '" />' +
		'<param name="quality" value="high" />' +
		'<param name="controller" value="true" />' +
		'<param name="loop" value="false" />' +
		'<embed src="' + fileName + '" quality="high" width="' + embWidth + 
		'" height="' + embHeight + '" name="movie" align="middle" loop="false" autoplay="false" controller="true" bgcolor="000000" pluginspage="http://www.apple.com/quicktime/download/" /></object>';

}

// update the last page we are on everytime we load the flash object, so we can continue from where we left off
function updateLastPage(url)
{
	var req = null;

	if (window.XMLHttpRequest)
	{
		req = new XMLHttpRequest(); // Firefox, Safari, ...
			
		if (req.overrideMimeType) 
		{
			req.overrideMimeType('text/xml');
		}
	} 
	else if (window.ActiveXObject) 
	{
		try
		{
			req = new ActiveXObject("Msxml2.XMLHTTP"); 
		}
		catch (e)
		{
			try
			{
				req = new ActiveXObject("Microsoft.XMLHTTP"); // Internet Explorer 
			}
			catch (e) {}
		}
	}

	req.onreadystatechange = function()
	{ 
		if(req.readyState == 4)
		{
			if(req.status == 200)
			{
				//alert(req.responseText);
				//document.getElementById(divid).innerHTML = req.responseText;
			}
			else
			{
				//document.getElementById(divid).innerHTML = "Error: [returned status code " + req.status + "] [" + req.statusText + "]";
			}
		}
		if(req.readyState == 3)
		{
			//r.innerHTML = "Receiving...";
		}
		if(req.readyState == 2)
		{
			//r.innerHTML = "Sent...";
		}
		if(req.readyState == 1)
		{
			//r.innerHTML = "<tr><td>Open...</td></tr>";
		}
		if(req.readyState == 0)
		{
			//r.innerHTML = "Uninitialsed...";
		}
	}

	req.open("GET", url, false);
	req.send(null);

	return req.responseText;

}
