<!--
// returns the version of Flash when it is and -1 if it is not installed
function getInstalledFlashVersion()
{
	if (navigator.mimeTypes && navigator.mimeTypes.length)
	{
		x = navigator.mimeTypes['application/x-shockwave-flash'];
		if (x && x.enabledPlugin)
		{
				y = x.enabledPlugin.description;
				return y.charAt(y.indexOf('.')-1);
		}
	}
	else if (navigator.userAgent.indexOf("MSIE") >= 0 && (navigator.appVersion.indexOf("Win") != -1))
	{
		// IE flash detection.
		if (flashVersionIsInstalledIE(1))
		{
			for (var i=3; ; i++)
			{
				if (!flashVersionIsInstalledIE(i))
				{
					if(i == 3)
					{
						if(flashVersionIsInstalledIE(2))
						{
							// Flash 2 is a special case
							return 2;
						}
						return 1;
					}
					return i - 1;
				}
			}
		}
		else if (flashVersionIsInstalledIE(2))
		{
			// Flash 2 is a special case
			return 2;
		}
	}
	return -1;
}


// returns true if the Flash with version 'version' is installed
// FOR USE WITH IE ONLY
function flashVersionIsInstalledIE(version)
{
	try
	{
		flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + version);
		return true;
	}
	catch(e)
	{
		return false;
	}
}

// returns true if gamesplayer is installed as a plugin in FireFox-like browser.
function isZylomGamesPlayerInstalledFF()
{
	if (navigator.mimeTypes && navigator.mimeTypes.length)
	{
		x = navigator.mimeTypes['application/x-zylomgamesplayer;version=2.0.0.0'];
		if (x && x.enabledPlugin)
		{
			return true;
		}
	}
	return false;
}

// sets the hidden-input 'hasZylomGamesPlayer' true when the ZylomGamesPlayer is installed
// if it is not installed then it stays false
function isZylomGamesPlayerInstalledIE()
{
	document.write('<input type="hidden" name="hasZylomGamesPlayer" id="hasZGP" value="false">');
	// this is a work-around because [var o = new ActiveXObject('ZylomGamesPlayer.ZylomGamesPlayerCtrlZylom.1');] crashes the browser
	document.write('<script for="ZylomSupportExtension" event="Receive(method, param)" language="javascript">if ((method == "ZGP_STATE" || method == "ZylomGamesPlayerState") && param == "STATE_EXTENSION_STARTED"){document.getElementById("hasZGP").value = true;}</script>');
	document.write('<div style="position: absolute; left-1px; top:-1px; width:1; height:1;">');
	document.write(' <object id="ZylomSupportExtension" ');
	document.write(' 	classid="clsid:BFF1950D-B1B4-4ae8-B842-B2CCF06D9A1B" ');
	document.write('	width="1" height="1">');
	document.write('  <param name="ZGP_extensionCabURL" value="http://' + document.location.hostname + '/activex/ZylomSupportExtension.1.0.1.cab">');
	document.write('  <param name="ZGP_extensionName" value="ZylomSupportExtension">');
	document.write('  <param name="ZGP_updateCabURL" value="">');
	document.write('  <param name="ZGP_foregroundColorBGR" value="0x000000">');
	document.write('  <param name="ZGP_backgroundColorBGR" value="0xFFFFFF">');
	document.write('  <param name="partnerName" value="zylom">');
	document.write(' </object>');
	document.write('</div>');
}

// Returns the installed JavaVersion by using the applet 'com.zylom.website.support.JavaParameter'
function getInstalledJavaVMVersion()
{
	res = 'undefined';
	if (navigator.plugins && navigator.plugins.length)
	{
		found = false;
		for (i=0; i<navigator.plugins.length&&!found; i++)
		{
			res = navigator.plugins[i].name;
			if (res.indexOf('Java') >= 0)
			{
				found = true;
			}
		}
		if(!found)
		{
			res = 'unknown';
		}
	}
   	else if (navigator.userAgent.indexOf("MSIE") >= 0 && (navigator.appVersion.indexOf("Win") != -1))
	{
		applet = document.getElementById('va');
		if (applet)
		{
			try
			{
				res = applet.getParameter('java.version', 'not_found') + ' [' + applet.getParameter('java.vendor', 'not_found') + ']';
			}
			catch(e)
			{
				res = 'error';
			}
		}
	}
	return res;
}

// Adds client-browser specific information to a page. This info is stored in hidden-variables:
// - screenWidth, screenHeight, colorDepth, userAgent, javaEnabled,
//  cookieEnabled, flashVersion, hasZylomGamesPlayer, javaVersion
function addSupportIncidentInformation()
{
	document.open();
	document.write('<input type="hidden" name="screenWidth" value="' + screen.width + '">');
	document.write('<input type="hidden" name="screenHeight" value="' + screen.height + '">');
	if (screen.colorDepth)
	{
		document.write('<input type="hidden" name="colorDepth" value="' + screen.colorDepth + '">');
	}
	else if (screen.pixelDepth)
	{
		document.write('<input type="hidden" name="colorDepth" value="' + screen.pixelDepth + '">');
	}
	document.write('<input type="hidden" name="javaEnabled" value="' + navigator.javaEnabled() + '">');

	document.write('<input type="hidden" name="userAgent" value="' + navigator.userAgent + '">');
	document.write('<input type="hidden" name="cookieEnabled" value="' + navigator.cookieEnabled + '">');

	var canUseActiveX = 'unknown';
	var flashVersion = getInstalledFlashVersion();
	var canUseFlash = true;
	if (flashVersion == -1)
	{
		canUseFlash = false;
		flashVersion = 'unknown';
	}
	document.write('<input type="hidden" name="flashEnabled" value="' + canUseFlash + '">');
	document.write('<input type="hidden" name="flashVersion" value="' + flashVersion + '">');

	if (navigator.userAgent.indexOf("MSIE") >= 0)
	{
		isZylomGamesPlayerInstalledIE();
	}
	else
	{
		document.write('<input type="hidden" name="hasZylomGamesPlayer" value="' + isZylomGamesPlayerInstalledFF() + '">');
	}
	document.write('<input type="hidden" name="javaVersion" id="jv" value="' + getInstalledJavaVMVersion() + '">');
	document.close();
}

function submitSupportIncident()
{
	if (document.getElementById('ac').value == 'finish')
	{
		document.getElementById('jv').value = getInstalledJavaVMVersion();
	}
	document.forms['contact'].submit();
}

function addVersionApplet()
{
    document.write('<div style="position:absolute; left:0; top:0;">')
    document.write('<app'+'let name="versionApplet" id="va" width="1" height="1" code="com.zylom.website.support.JavaParameter.class" codebase="."></applet>');
    document.write('</div>');
}

// -->