﻿function InitApplet(applet, eventfunc)
{
	var aName = navigator.appName.toUpperCase();
	/*if(aName.indexOf('MICROSOFT')>=0) // Internet Explorer
	{//might be a dotnet applet, init it
	
	
		if(document.getElementById(applet)!=null && (document.getElementById(applet).DocumentBase==null))
			document.getElementById(applet).DocumentBase = document.URL;
	}*/
	setTimeout("EventPolling('"+applet+"', '"+eventfunc+"');", 10);
}

function EventPolling(applet, eventfunc)
{
	
	var type = document.getElementById(applet).fetchNextEvent(0);
	if(type!=0)
	{
		var p1 = document.getElementById(applet).fetchNextEvent(1);
		var p2 = document.getElementById(applet).fetchNextEvent(2);
		var p3 = document.getElementById(applet).fetchNextEvent(3);
		if(type<0)
		{
			if(type==-1)
				window.status = p1;
			if(type==-2)
				window.open(p1, p2);
		}
		else if(eventfunc!="")
			eval(eventfunc+"(type, p1, p2, p3);");
		document.getElementById(applet).fetchNextEvent(-1);
	}
	setTimeout("EventPolling('"+applet+"', '"+eventfunc+"');", 10);
}


