function WMPObject( url, width, height, position, objectId )
{
	this.objectId = objectId || "wmpobject";
	this.url = url || "";
	this.width = width || "320";
	this.height = height || "300";
	this.position = position || "0";
}

WMPObject.prototype.toString = function()
{
	var tag = ""
	
	tag += '<object id="' + this.objectId + '" width="' + this.width + '" height="' + this.height + '" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" type="application/x-oleobject">';
	tag += '<param name="CurrentPosition" value="' + this.position + '" />';
	tag += '<param name="ShowStatusBar" value="1" />';
	tag += '<param name="ShowControls" value="1" />';
	tag += '<param name="ShowAudioControls" value="1" />';
	tag += '<param name="ShowPositionControls" value="0" />';
	tag += '<param name="ShowTracker" value="1" />';
	tag += '<param name="ShowDisplay" value="0" />';
	tag += '<param name="ShowCaptioning" value="0" />';
	tag += '<param name="ShowGoToBar" value="0" />';
	tag += '<param name="ControlType" value="2" />';
	tag += '<param name="Autostart" value="1" />';
	tag += '<param name="InvokeUrls" value="1" />';
	tag += '<param name="SendStateChangeEv" value="1" />';
	tag += '<param name="SendOpenChangeEv" value="1" />';
	tag += '<param name="SendPlayChangeEv" value="1" />';
	tag += '<param name="AllowChangeCtrlType" value="1" />';
	tag += '<param name="AllowChangeDisplaySize" value="1" />';
	tag += '<param name="AllowScan" value="1" />';
	tag += '<param name="AutoRewind" value="1" />';
	tag += '<param name="PlayCount" value="1" />';
	tag += '<param name="Volume" value="1" />';
	tag += '<param name="Filename" value="' + this.url + '" />';
	tag += '<embed id="' + this.objectId + '" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/" width="'+this.width+'" height="'+this.height+'" src="'+this.url+'" currentPosition="'+this.position+'" ShowStatusBar="0"></embed>';
	tag += '</object>';
	
	return tag;
}

WMPObject.prototype.write = function( id )
{
	if( id ) this.divId = id;
	document.getElementById( this.divId ).innerHTML = this.toString()
}

WMPObject.prototype.changePosition = function( position )
{
	var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
	
	if( isIE )
	{
		var player = document.getElementById( this.objectId );
		player.currentPosition = position;
		player.play();
	}
	else
	{
		this.position = position;
		this.write()
	}
}