/*
<applet
  code='org.pscode.tool.applet.VersionCheck'
  archive='lib/vc.jar'
  alt='Enable Java to proceed'
  width='200'
  height='30'>
<PARAM NAME='targetVersion' VALUE='1.6'>
<PARAM NAME='redirect' VALUE='http://www.java.com/'>
<PARAM NAME='applet' VALUE='applet.html'>
This applet requires the Java Plug-In available from
<a href='http://www.java.com/'>http://www.java.com/</a>.
</applet>
*/

var TEST = false;
/** Script to write the applet element for the version check code. */

function getNameValueAsElement(attribute, value) {
	var paramElement =
		"<PARAM NAME='"
		+
		attribute
		+
		"' VALUE='"
		+
		value
		+
		"'>";
	return paramElement;
}

/*
*/
function getAppletElement(version, redirect) {
	return getAppletElement(version, redirect, undefined);
}

function getAppletElement(version, redirect, applet) {
	if (TEST) alert(version + applet + redirect);
	var appletString = '';
	if (applet!=undefined) {
		appletString = getNameValueAsElement("applet", applet);
	}
	var appletElement =
		"<APPLET"
		+
		" CODE='org.pscode.tool.applet.VersionCheck'"
		+
		" ARCHIVE='lib/vc.jar'"
		+
		" ALT='Enable Java to proceed'"
		+
		" WIDTH='200'"
		+
		" HEIGHT='30'>"
		+
		getNameValueAsElement("targetVersion", version)
		+
		getNameValueAsElement("redirect", redirect)
		+ 
		appletString
		+ 
		getNameValueAsElement("bouncer", "bouncer.html")
		+ 
		"<p>Requires Java.  "
		+ 
		"Get it from <a href='http://www.java.com'>www.java.com</a>.</p>"
		+
		"</APPLET>"
		;
	if (TEST) alert(appletElement);
	return appletElement;
}

