function initWMVPlayer(VideoSource,VideoWidth,VideoHeight,ShowControls,ShowStatusBar,ShowTracker)
{
	var ObjectTag = "<OBJECT ID=\"MediaPlayer\" name=\"MediaPlayer\" WIDTH=\""+VideoWidth+"\" HEIGHT=\""+VideoHeight+"\" CLASSID=\"CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95\" CODEBASE=\"http://www.microsoft.com/ntserver/netshow/download/en/nsmp2inf.cab#Version=5,1,51,415\" standby=\"Loading Microsoft Media Player components...\" type=\"application/x-oleobject\">";
		ObjectTag += "<PARAM NAME=\"AutoStart\" VALUE=\"1\">";
		ObjectTag += "<PARAM NAME=\"FileName\" VALUE=\"" + VideoSource + "\">";
		ObjectTag += "<PARAM NAME=\"ShowControls\" VALUE=\"" + ShowControls + "\">";
		ObjectTag += "<PARAM NAME=\"ShowStatusBar\" VALUE=\"" + ShowStatusBar + "\">";
		ObjectTag += "<PARAM NAME=\"EnableFullScreenControls\" VALUE=\"true\">"; 
		ObjectTag += "<PARAM NAME=\"fullScreen\" VALUE=\"true\">"; 
		ObjectTag += "<PARAM NAME=\"AutoSize\" VALUE=\"0\">";
		ObjectTag += "<PARAM NAME=\"ControlType\" VALUE=\"0\">";
		ObjectTag += "<PARAM NAME=\"ShowTracker\" VALUE=\"" + ShowTracker + "\">";
		ObjectTag += "<PARAM NAME=\"InvokeURLs\" VALUE=\"1\">";
		ObjectTag += "<EMBED Type=\"video/x-ms-asf-plugin\" fullScreen=\"true\" EnableFullScreenControls=\"true\" pluginspage=\"http://www.microsoft.com/windows/mediaplayer/download/default.asp\" src=\"" + VideoSource + "\" name=\"MediaPlayer\" AutoStart=\"1\" ShowControls=\"" + ShowControls + "\" ShowStatusBar=\"" + ShowStatusBar + "\" AutoSize=\"0\" width=\""+VideoWidth+"\" height=\""+VideoHeight+"\" DefaultFrame=\"script\" ShowTracker=\"" + ShowTracker + "\">";
		ObjectTag += "</OBJECT>";
	document.write(ObjectTag);
}

function videoFullScreen()
{
	MediaPlayer.DisplaySize=3;
}

function WMVplayback(VideoSource,VideoWidth,VideoHeight,ShowControls,ShowStatusBar,ShowTracker)
{
	var obj = new Object;
	if (BrowserDetect.browser == "Explorer")
	{
		obj.code = "<OBJECT ID=\"MediaPlayer\" name=\"MediaPlayer\" WIDTH=\""+VideoWidth+"\" HEIGHT=\""+VideoHeight+"\" CLASSID=\"CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95\" CODEBASE=\"http://www.microsoft.com/ntserver/netshow/download/en/nsmp2inf.cab#Version=5,1,51,415\" standby=\"Loading Microsoft Media Player components...\" type=\"application/x-oleobject\">";
		obj.code += "<PARAM NAME=\"AutoStart\" VALUE=\"1\">";
		obj.code += "<PARAM NAME=\"FileName\" VALUE=\"" + VideoSource + "\">";
		obj.code += "<PARAM NAME=\"ShowControls\" VALUE=\"" + ShowControls + "\">";
		obj.code += "<PARAM NAME=\"ShowStatusBar\" VALUE=\"" + ShowStatusBar + "\">";
		obj.code += "<PARAM NAME=\"EnableFullScreenControls\" VALUE=\"true\">"; 
		obj.code += "<PARAM NAME=\"fullScreen\" VALUE=\"true\">"; 
		obj.code += "<PARAM NAME=\"AutoSize\" VALUE=\"0\">";
		obj.code += "<PARAM NAME=\"ControlType\" VALUE=\"0\">";
		obj.code += "<PARAM NAME=\"ShowTracker\" VALUE=\"" + ShowTracker + "\">";
		obj.code += "<PARAM NAME=\"InvokeURLs\" VALUE=\"0\">";
		obj.code += "<EMBED Type=\"video/x-ms-asf-plugin\" fullScreen=\"true\" EnableFullScreenControls=\"true\" pluginspage=\"http://www.microsoft.com/windows/mediaplayer/download/default.asp\" src=\"" + VideoSource + "\" name=\"MediaPlayer\" AutoStart=\"1\" ShowControls=\"" + ShowControls + "\" ShowStatusBar=\"" + ShowStatusBar + "\" AutoSize=\"0\" width=\""+VideoWidth+"\" height=\""+VideoHeight+"\" DefaultFrame=\"script\" ShowTracker=\"" + ShowTracker + "\">";
		obj.code += "</OBJECT>";
	}
	else
	{
	
		obj.code = "<object type='video/x-ms-wmv' data='" + VideoSource + "' width='"+VideoWidth+"' height='"+VideoHeight+"' ID='MediaPlayer'>";
		obj.code += "<param name='src' value='" + VideoSource + "' />";
		obj.code += "<param name='autostart' value='true' />";
		obj.code += "<param name='controller' value='" + ShowControls + "' />";
		obj.code += "</object>";
	}
	
	obj.video = null;
	
	obj.timer = -1;
	
	obj.render = function()
	{
		document.write(this.code);
		this.video = $('MediaPlayer');
		this.initTimer();
	};
	
	obj.initTimer = function()
	{
		var thisobj = this;
		this.timer = setInterval(function()
		{
			if (thisobj.onInterval) thisobj.onInterval();
		},250);
	};
	
	obj.gotoTime = function(seconds)
	{
		this.video.CurrentPosition = seconds;
	};
	/*

	obj.onInterval = function()
	{
		$('trace').update(this.video.CurrentPosition);
	};
*/
	return obj;
}


	
/*
	// Check if a response function is defined and if it is, set the AjaxTool response function
	if(typeof window.loginResponse == 'function')
	{
		// function exists, so we can use it
		at.responseFunction = loginResponse;
	}
	
*/
