// Determine user browser
var b = navigator.userAgent;
var ie = (b.indexOf("MSIE") > 0 && b.indexOf("Win") > 0 && b.indexOf("Windows 3.1") < 0);

var code = '"just2easy/Web.class"';

document.writeln('<object id="j2e" width="100%" height="100%"');

if (ie == true){	
	document.writeln(' classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" \
		codebase="http://java.sun.com/update/1.5.0/jinstall-1_5-windows-i586.cab#Version=5,0,0,9"');
}
else
	document.writeln(' code=' +code+ ' archive=' +arch);

document.writeln(' \
	 type="application/x-java-applet;version=1.5" \
	 >');

document.writeln(' \
	<param name="type" value="application/x-java-applet;version=1.5"> \
	<param name="codebase" value=' +base+ '> \
	<param name="archive"  value=' +arch+ '> \
	<param name="code"     value=' +code+ '> \
	<param name="scriptable" value="false">');

document.writeln('<param name="browser" value="' + b + '">');

function isValid( c_name ){
	if (document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name + "=");

		if (c_start!=-1)	// Cookie exists, file was opened before
			document.writeln('<param name="old" value="true">');
		else				// Store cookie
			document.cookie = c_name + "=true;expires=0";
	}
}

function confirmUnload(){
	var j = document.getElementById('j2e');
	var c = j.changed();

	if (c=="yes")
		return 'You have made changes, and they will be lost!';

	if (c=="store")
		return 'You have opened files from the on-line store. Changes to these files cannot be uploaded once this page is closed!';
}

//register function with the event handler
window.onbeforeunload = confirmUnload;
