// JavaScript Document
function getLusiPlayer( link, width, height, isRtv ) {
	var e = link.split('.');
	e = e[e.length-1];

	if( !width )
		width = 290;
	if( !height )
		height = 300;
	if( !isRtv )
		isRtv = false;
	
	var WMP7;
	try {
		if ( navigator.appName != "Netscape" ) {
			WMP7 = new ActiveXObject('WMPlayer.OCX');
		}
	}
	catch (error) {
		;
	}
	var HTML = '';

	// Windows Media Player 7 Code
	if ( WMP7 ) {
		HTML += ('<OBJECT height="'+ height +'" width="'+ width +'" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" VIEWASTEXT>');
		HTML += ('<PARAM NAME="URL" VALUE="'+ link +'">');
		HTML += ('<PARAM NAME="rate" VALUE="1">');
		HTML += ('<PARAM NAME="balance" VALUE="0">');
		HTML += ('<PARAM NAME="currentPosition" VALUE="0">');
		HTML += ('<PARAM NAME="defaultFrame" VALUE="">');
		HTML += ('<PARAM NAME="playCount" VALUE="999">');
		HTML += ('<PARAM NAME="autoStart" VALUE="0">');
		HTML += ('<PARAM NAME="currentMarker" VALUE="0">');
		HTML += ('<PARAM NAME="invokeURLs" VALUE="-1">');
		HTML += ('<PARAM NAME="baseURL" VALUE="">');
		HTML += ('<PARAM NAME="mute" VALUE="0">');
		HTML += ('<PARAM NAME="uiMode" VALUE="full">');
		HTML += ('<PARAM NAME="stretchToFit" VALUE="0">');
		HTML += ('<PARAM NAME="windowlessVideo" VALUE="1">');
		HTML += ('<PARAM NAME="enabled" VALUE="-1">');
		HTML += ('<PARAM NAME="enableContextMenu" VALUE="0">');
		HTML += ('<PARAM NAME="fullScreen" VALUE="0">');
		HTML += ('<PARAM NAME="SAMIStyle" VALUE="">');
		HTML += ('<PARAM NAME="SAMILang" VALUE="">');
		HTML += ('<PARAM NAME="SAMIFilename" VALUE="">');
		HTML += ('<PARAM NAME="captioningID" VALUE="">');
		HTML += ('<PARAM NAME="Volume" VALUE="100">');
		HTML += ('</OBJECT>');
	}
	// Windows Media Player 6.4 Code
	else {
		HTML += ('<OBJECT classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" ');
		HTML += ('codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" ');
		HTML += ('width="'+ width +'" height="'+ height +'"');
		HTML += ('standby="Loading Microsoft Windows Media Player components..." ');
		HTML += ('type="application/x-oleobject" VIEWASTEXT> ');
		HTML += ('<PARAM NAME="FileName"           VALUE="'+ link +'">');
		HTML += ('<PARAM NAME="TransparentAtStart" Value="false">');
		HTML += ('<PARAM NAME="AutoStart"          Value="false">');
		HTML += ('<PARAM NAME="AnimationatStart"   Value="false">');
		HTML += ('<PARAM NAME="ShowControls"       Value="false">');
		HTML += ('<PARAM NAME="ShowDisplay"	 value ="false">');
		HTML += ('<PARAM NAME="playCount" VALUE="999">');
		HTML += ('<PARAM NAME="displaySize" 	 Value="0">');
		HTML += ('<PARAM NAME="Volume" VALUE="100">');
		HTML += ('<embed type="application/x-mplayer2" ');
		HTML += ('pluginspage= ');
		HTML += ('"http://www.microsoft.com/Windows/MediaPlayer/" ');
		HTML += ('src="'+ link +'" ');
		HTML += ('Name=MediaPlayer ');
		HTML += ('transparentAtStart=0 ');
		HTML += ('autostart=0 ');
		HTML += ('playcount=999 ');
		HTML += ('volume=100');
		HTML += ('animationAtStart=0 ');
		HTML += ('width="'+ width +'" height="'+ height +'" ');	
		HTML += ('displaySize=0></embed> ');
		HTML += ('</OBJECT> ');
	}
	if( isRtv )
		return HTML;
	else
		document.write( HTML );	
}

function getLusiFlash( link, width, height ) {
	//return '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ width +'" height="'+ height +'"><param name="movie" value="'+ link +'"><param name="quality" value="high"><param name="wmode" value="transparent"><embed src="'+ link +'" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ width +'" height="'+ height +'"></embed></object>';
	return '<embed src="'+ link +'" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ width +'" height="'+ height +'"></embed>';
}

function Play( id, url, width, height ) {
	var el = getObjectById(id);
	if( !el ) {
		return;
	}
	var html = '';
	var filter = /\.swf$/
	if( filter.test(url) ) {
		html = getLusiFlash( url, width, height );
	}
	else {
		html = getLusiPlayer( url, width, height, true );
	}
	/*
	el.style.width = width +'px';
	el.style.height = height +'px';
	*/
	el.style.display = '';
	el.innerHTML = html;
	
	
}
