// JavaScript Document
WMV = function(mov, width, height)
{
    this.mov = mov || "";
    this.width = width || "100%";
    this.height = height || "100%";
    this.id = "";
    this.params = new Object();
};

WMV.resizeTo = function(id, w, h) { 
    var movie = document.getElementById(id); 
	movie.width = w; 
	movie.height = h;
};

WMV.prototype.getMov = function() { return this.mov; };
WMV.prototype.setMov = function(mov) { this.mov = mov; };
WMV.prototype.getWidth = function() { return this.width; };
WMV.prototype.setWidth = function(w) { this.width = w; };
WMV.prototype.getHeight = function() { return this.height; };
WMV.prototype.setHeight = function(h) { this.height = h; };
WMV.prototype.getId = function() { return this.id; };
WMV.prototype.setId = function(id) { this.id = id; };
WMV.prototype.getParam = function(name) { return this.params[name]; };
WMV.prototype.getParams = function() { return this.params; };
WMV.prototype.setParam = function(name, value) { this.params[name] = value; };

WMV.prototype.getParamTags = function()
{
    var paramTags = "";
    for (var param in this.getParams()) {
        paramTags += '<param name="' + param + '" value="' + this.getParam(param) + '" />';
    }
    if (paramTags == "") {
        paramTags = null;
    }
    return paramTags;
};
WMV.prototype.getHTML = function()
{
    var WMVHTML = "";
    if (window.ActiveXObject && navigator.userAgent.indexOf('Mac') == -1) { // PC IE
		WMVHTML += "<object id='" + this.getId() + "' classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' width='" + this.getWidth() + "' height='" + this.getHeight() + "' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>";
		WMVHTML += "<param name='fileName' value='" + this.getMov() + "' />";
		WMVHTML += "<param name='animationatStart' value='false' />";
		WMVHTML += "<param name='transparentatStart' value='false' />";
		WMVHTML += "<param name='autoStart' value='false' />";
		WMVHTML += "<param name='loop' value='false' />";
		if (this.getParamTags() != null)
		{
			WMVHTML += this.getParamTags();
		}
        WMVHTML += "<" + "/object>";
    }
    else { // Everyone else
		WMVHTML += "<embed id='" + this.getId() + "' src='" + this.getMov() + "' width='" + this.getWidth() + "' height='" + this.getHeight() + "' autostart='0' type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/'";
		for (var param in this.getParams()) {
            WMVHTML += " " + param + "='" + this.getParam(param) + "'";
        }
        WMVHTML += "><" + "/embed>";
    }

    return WMVHTML;
};
WMV.prototype.render = function(elementId)
{
    //if(WMV.hasVersion(this.getRequiredVersion())) {
        if (elementId) {
            document.getElementById(elementId).innerHTML = this.getHTML();
        }
        else {
            document.write(this.getHTML());
        }
    //}
	//else
	//{
	//	document.write('<div class="no_WMV"><p>This portion of the site requires the latest version of the WMV Player Browser Plug-in. You may download this plug-in via Macromedia\'s website. WMV Player lets your web browser play video and animations made with WMV.</p>');
	//	document.write('<p align="center"><a href="http://www.macromedia.com/go/getWMVplayer/" target="blank"><img src="http://www.macromedia.com/images/shared/download_buttons/get_WMV_player.gif" border="0" /></a></p>');
	//	document.write('<p>&nbsp;</p><p align="center">After you have installed the latest WMV Player, you may <a href="javascript:document.location.reload(true);">reload this page</a>.</p></div>');
	//}
};


function RenderWMV(id, movieURL, width, height, showControls, showStatusBar) 
{
	if (showControls == null)
	{
		showControls = 1;
	}
	
	if (showStatusBar == null)
	{
		showStatusBar = 1;
	}
	
	/*
	document.writeln("<div>");
	document.writeln("<object id='mediaPlayer' classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' width='" + width + "' height='" + height + "' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>");
	document.writeln("<param name='fileName' value='" + movieURL + "'>");
	document.writeln("<param name='animationatStart' value='false'>");
	document.writeln("<param name='transparentatStart' value='false'>");
	document.writeln("<param name='autoStart' value='false'>");
	document.writeln("<param name='showControls' value='" + showControls + "'>");
	document.writeln("<param name='loop' value='false'>");
	document.writeln("<embed type='application/x-mplayer2' pluginspage='http://microsoft.com/windows/mediaplayer/en/download/' id='mediaPlayer' name='mediaPlayer' ");
	document.writeln("displaysize='4' autosize='-1' showcontrols='" + showControls + "' showtracker='-1' showdisplay='0' ");
	document.writeln("showstatusbar='" + showStatusBar + "' videoborder3d='-1' width='" + width + "' height='" + height + "' ");
	document.writeln("src='" + movieURL + "' autostart='false' designtimesp='5311' loop='false'>");
	document.writeln("</embed>");
	document.writeln("</object>");
	document.writeln("</div>");
	*/

	document.write('<div id="fwmvcontainer_' + id + '"><' + '/div><script language="javascript" type="text/javascript">var wmvform = new WMV("' + movieURL + '", "' + width + '", "' + height + '");');
	document.write('wmvform.setParam("showcontrols", "' + showControls + '");');
	document.write('wmvform.setId("' + id + '");');
	document.write('wmvform.render("fwmvcontainer_' + id + '");</' + 'script>');
}