// DXStudioPlayer.js - Script to include the player's ActiveX control

var dxsutil = new Object();

dxsutil.isIE = (navigator.userAgent && navigator.userAgent.indexOf("MSIE") != -1);

dxsutil.DXStudioPlayer = function (src, id, target)
{
	if (!document.getElementById)
		return;
	
	this.params = new Object();
	this.src	= src;
	this.id		= id;
	this.target	= target;
	this.displaySettings = '';
};

dxsutil.DXStudioPlayer.prototype = {
	addParam	: function(name, value) { this.params[name] = value; },
	getParams	: function() 			{ return this.params; },
	installer	: function() 			{ return !(this.noinstaller == true); },
	getHTML		: function()
	{
		var nodeHTML = "";
		if (dxsutil.isIE)
		{
			nodeHTML += '<object id="'+ this.id + '" width="100%" height="100%" ';
			//nodeHTML += ' ondrop="drop()" ondragenter="cancelEvent()" ondragover="cancelEvent()" ';
			nodeHTML += ' classid="clsid:0AC2706C-8623-46F8-9EDD-8F71A897FDAE">';
			nodeHTML += ' <param name="src" value="'+ this.src +'" />';
			
			//var params = this.getParams();
			//for (var key in params) 
			//	nodeHTML += '<param name="'+ key +'" value="'+ params[key] +'" />';

			nodeHTML += " <param name='DisplaySettings' value='" + this.displaySettings + "' />";
			nodeHTML += '</object>';
		}
		else
		{
			nodeHTML += '<embed name="' + this.id + '" src="' + this.src + '" ';
			nodeHTML += ' type="application/x-dxstudio" height="100%" width="100%" ';
		//	nodeHTML += ' pluginspage="http://www.dxstudio.com/downloads/player/vLatest/" ';
			nodeHTML += ' pluginspage="http://www.3dream.net/jsp/public/installer/install.jsp" ';
			nodeHTML += " DisplaySettings='" + this.displaySettings + "'";
			nodeHTML += '></embed>';
		}
		return nodeHTML;
	},
	write: function(elementId)
	{
		var elem = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
		elem.innerHTML = this.getHTML();
	}
};

var DXStudioPlayer = dxsutil.DXStudioPlayer;
