// External Javascript file used to generate the Omnis web client control on an HTML page
function outputActiveXParameter(pnum, pname, pvalue)
{
	if (pname!="")
	{
		document.write("<param name=\"Param")
		document.write(pnum)
		document.write("\" value=\"")
		document.write(pname)
		document.write("=")
		document.write(pvalue)
		document.writeln("\">")
	}
}
function outputPluginParameter(pnum, pname, pvalue)
{
	if (pname!="")
	{
		document.write("\"Param")
		document.write(pnum)
		document.write("=\"")
		document.write(pname)
		document.write("=")
		document.write(pvalue)
		document.write("\" ")
	}
}
function checkUserAgent(string)
{
  var detect = navigator.userAgent.toLowerCase();
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}
function browserIsFirefox()
{
	return checkUserAgent("firefox");
}
function browserIsSafari()
{
	return checkUserAgent("safari");
}
function isPluginInstalled()
{
	numPlugins = navigator.plugins.length;
	for (i = 0; i < numPlugins; i++)
	{
	  plugin = navigator.plugins[i];
	  if (plugin.name =="Omnis Unicode RCC Plugin")
	  {
	    return true
	  }
	}
  return false
}



if (navigator.appName == "Microsoft Internet Explorer" && navigator.platform == "Win32" && navigator.userAgent.indexOf("Opera") == -1) 
{
	document.write("<center><object classid=\"clsid:13510606-30FA-11D2-B383-444553540000\"")
	if (odownload == "yes")
    {
        document.write(" codebase=\"ftp://ftp.omnis.net/Studio42/Win32/WebSmart/ie/omwebie.cab\"")
    }
	document.write(" width=\"")
	document.write(owidth)
	document.write("\" height=\"")
	document.write(oheight)
	document.writeln("\">")
	document.writeln("<param name=\"_Version\" value=\"65536\">")
	document.writeln("<param name=\"_ExtentX\" value=\"7161\">")
	document.writeln("<param name=\"_ExtentY\" value=\"7373\">")
	document.writeln("<param name=\"_StockProps\" value=\"0\">")
	document.write("<param name=\"OmnisServer\" value=\"")
	document.write(oserver)
	document.writeln("\">")
	document.write("<param name=\"OmnisLibrary\" value=\"")
	document.write(olibrary)
	document.writeln("\">")
	document.write("<param name=\"OmnisClass\" value=\"")
	document.write(oclass)
	document.writeln("\">")
	if (ounicodeserver == "yes")
	{
		document.writeln("<param name=\"OmnisUnicodeServer\" value=\"1\">")
	}
	document.write("<param name=\"WebServerURL\" value=\"")
	document.write(owebserverurl)
	document.writeln("\">")
	document.write("<param name=\"WebServerScript\" value=\"")
	document.write(owebserverscript)
	document.writeln("\">")
	outputActiveXParameter(1,omparam1name, omparam1value)
	outputActiveXParameter(2,omparam2name, omparam2value)
	outputActiveXParameter(3,omparam3name, omparam3value)
	outputActiveXParameter(4,omparam4name, omparam4value)
	outputActiveXParameter(5,omparam5name, omparam5value)
	outputActiveXParameter(6,omparam6name, omparam6value)
	outputActiveXParameter(7,omparam7name, omparam7value)
	outputActiveXParameter(8,omparam8name, omparam8value)
	outputActiveXParameter(9,omparam9name, omparam9value)
	document.writeln("</object><center>")
} 
else 
{
	if (odownload == "yes" && navigator.platform == "Win32" && browserIsFirefox() && !isPluginInstalled())
	{
		document.writeln("</script>")	
		document.writeln("<script type=\"text/javascript\">")
		document.writeln("function doneFN(url, status)")
		document.writeln("{")
		document.writeln("alert(\"Firefox must be restarted to complete Webclient Installation\");")
		document.writeln("}")			
		document.writeln("xpi={\'webclient\':\'http://releases.mozilla.org/pub/mozilla.org/extensions/webclient/webclient-1.0.0.2-fx-windows.xpi\'};")
		document.writeln("InstallTrigger.install(xpi,doneFN);")
		document.write("</script>")	
	}
	if (navigator.platform == "Win32" && browserIsSafari())
		document.write("<center><embed type='application/omnis-plugin' name=\"rcc1\" width=\"")
	else
		document.write("<center><embed type='application/OMNIS-RCC-plugin' name=\"rcc1\" width=\"")
	document.write(owidth)
	document.write("\" height=\"")
	document.write(oheight)
	document.write("\" OmnisServer=\"")
	document.write(oserver)
	document.write("\" OmnisLibrary=\"")
	document.write(olibrary)
	document.write("\" OmnisClass=\"")
	document.write(oclass)
	if (ounicodeserver == "yes")
	{
		document.write("\" OmnisUnicodeServer=\"1")
	}
	document.write("\" WebServerUrl=\"")
	document.write(owebserverurl)
	document.write("\" WebServerScript=\"")
	document.write(owebserverscript)
	outputPluginParameter(1,omparam1name, omparam1value)
	outputPluginParameter(2,omparam2name, omparam2value)
	outputPluginParameter(3,omparam3name, omparam3value)
	outputPluginParameter(4,omparam4name, omparam4value)
	outputPluginParameter(5,omparam5name, omparam5value)
	outputPluginParameter(6,omparam6name, omparam6value)
	outputPluginParameter(7,omparam7name, omparam7value)
	outputPluginParameter(8,omparam8name, omparam8value)
	outputPluginParameter(9,omparam9name, omparam9value)
	document.write("\"></center>")
}

