
function $E(id)
{
	return document.getElementById(id);
}

var g_player= {
	pl_version:0,installed:"",uninstalled:"",
	pl_width:0,pl_height:0,last_updated:"2007-05-20",vodObj:null,noteType:0, 
	pl_clsid:"881DD649-257D-4683-91CA-3AB5EE5C1DBC",
	plugname:"NeoPlugIn.NeoPlayer",
	mediatype:"wmv",

	//STATIC_PAGE_ROOT: "http://www.nibaa.tv/download/myclan/",
	//dw_clsid:"A4848023-943C-432A-BD3F-A4F56DC08D86",
	//objname:"RBActivex.RabCtrl",
	//iniFile:"C:\\Program Files\\Rabbitclan\\RBUpdater.exe",
	//windows_name:"Rab player",
	STATIC_PAGE_ROOT: "http://www.nibaa.tv/download/",
	dw_clsid:"C220E775-094C-4AF8-8004-15C2D73CCCF2",
	objname:"NeoActivex.NeoCtl",
	iniFile:"C:\\Program Files\\NeoStreaming\\NSUpdater.exe",
	windows_name:"neo! player",
		
initPlayer: function ()
	{
		var video=$E("playerctrl");
		video.style.width=g_player.pl_width;
		video.style.height=g_player.pl_height;
		var str='';
		if(g_player.mediatype!='flv')
		{
			str='<object id="dapplayer" classid="clsid:'+g_player.pl_clsid+'" width='+g_player.pl_width+' height='+g_player.pl_height+'></object>';	
			video.innerHTML=str;
			var object=$E("dapplayer");
			//object.SetClientWindowsName(g_player.windows_name,g_player.windows_name);
			object.SetClientExePath(g_player.iniFile);
		}
	},	
		
noteUnInstalled: function()
	{
		var video=$E("playerctrl");
		video.style.width=g_player.pl_width;
		video.style.height=g_player.pl_height;
		video.style.cursor='pointer';	
		//video.innerHTML='<a href="http://www.nibaa.tv/download/download.jsp" target="_blank"><img src="toInstallPlayer.gif" style=position:relative;top:0;left:0;cursor:"hand" border=0/></a>';
		video.innerHTML='<OBJECT class=CNeoCtl id=neoactivex codeBase='+g_player.STATIC_PAGE_ROOT+'NeoActivex.cab#Version=1,0,0,1029 height=1 width=1 classid=CLSID:'+g_player.dw_clsid+'></OBJECT><a href="'+g_player.STATIC_PAGE_ROOT+'download.jsp" target="_blank"><img src="toInstallPlayer.gif" style=position:relative;top:0;left:0;cursor:"hand" border=0 width='+g_player.pl_width+' height='+g_player.pl_height+'/></a>';
	},
		
noteUnPlugInstalled: function()
	{
		var video=$E("playerctrl");
		video.style.width=g_player.pl_width;
		video.style.height=g_player.pl_height;
		video.style.cursor='pointer';	
		//video.innerHTML='<a href="http://www.nibaa.tv/download/download.jsp" target="_blank"><img src="toInstallPlayer.gif" style=position:relative;top:0;left:0;cursor:"hand" border=0/></a>';
		video.innerHTML='<OBJECT class=CNeoCtl id=neoplugin codeBase='+g_player.STATIC_PAGE_ROOT+'NeoPlayer.cab#Version=1,0,0,1029 height=1 width=1 classid=CLSID:'+g_player.pl_clsid+'></OBJECT><a href="'+g_player.STATIC_PAGE_ROOT+'download.jsp" target="_blank"><img src="../../../images/toInstallPlayer.gif" style=position:relative;top:0;left:0;cursor:"hand" border=0 width='+g_player.pl_width+' height='+g_player.pl_height+'/></a>';
	},
		
load:function()
	{
		try
		{
			vodObj= new ActiveXObject(g_player.objname);
			g_player.installed=true;
		}
		catch(e)
		{
			g_player.noteUnInstalled();
			g_player.installed=false;
		}

		if(g_player.installed)
		{
			try
			{
				var object= new ActiveXObject(g_player.plugname);
				g_player.installed=true;
			}
			catch(e)
			{
				g_player.noteUnPlugInstalled();
				g_player.installed=false;
			}
		}

		if(g_player.installed)
		{
			vodObj.SetParam("IniFile", "");
			vodObj.SetParam( "URL", "%1");
			vodObj.init();
			g_player.initPlayer();
		}
	},

play:function(URL)
	{
		var video=$E("dapplayer");
		if(g_player.mediatype=='flv')
		{
			var str='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+g_player.pl_width+'" height="'+g_player.pl_height+'"><param name="movie" value="../../../images/player.swf"><param name="quality" value="high"><param name="menu" value="false"><param name="allowFullScreen" value="true" /><param name="FlashVars" value="vcastr_file='+URL+'&vcastr_title=&IsAutoPlay=1"><embed src="../../../images/player.swf" allowFullScreen="true" FlashVars="vcastr_file='+URL+'&vcastr_title=" menu="false" quality="high" width="'+g_player.pl_width+'" height="'+g_player.pl_height+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
			$E("playerctrl").innerHTML=str;
		}
		else
		{
			video.PlayMedia(URL);
		}
	}
};

