/** Web only feature, ask info before application could be loaded. */
function getApplicationStartMessage()
{
	if (   shockwaveDetector == undefined
		|| com.indg.BrowserDetection == undefined
		|| sSettings.shockwave == undefined)
		throw new Error();
	
	var theShockwaveDetector = shockwaveDetector;
	var theBrowserDetection = com.indg.BrowserDetection;
	var theSettings = sSettings.shockwave;
	
	var theMinimalVersion = new Version(10, 2, 0);
	
	if (theSettings != undefined && theSettings.minimalVersion != undefined)
		theMinimalVersion = com.indg.Util.parseVersionString(theSettings.minimalVersion);

	com.indg.BrowserHacks.run("shockwave.version", theMinimalVersion);
	
	var theTextKey = null;
	var theShowDownloadPlayer = true;
	if (!theShockwaveDetector.installed) {
		theTextKey = "shockwavePlayer_Missing";
	} else if (theBrowserDetection.OS == "osx10.6" && theBrowserDetection.browser == "safari") {
		theTextKey = "shockwavePlayer_64BitWarning";
		theShowDownloadPlayer = false;
	} else if (theShockwaveDetector.version.lessThen(theMinimalVersion)) {
		theTextKey = "shockwavePlayer_OldVersion";
	} else {
		return "";
	}
		
	var theMessage = '<message title="' + com.indg.ResourceManager.getString("shockwavePlayer_Name") + '" width="500" height="520">';
	theMessage += '<Text top="20" left="0" right="0" bottom="60" fontSize="14">';
	theMessage += '[nl_NL|' + escapeXmlString(com.indg.ResourceManager.getString(theTextKey, null, "nl")) + ']';
	theMessage += '[en_US|' + escapeXmlString(com.indg.ResourceManager.getString(theTextKey, null, "en")) + ']'; 
	theMessage += '</Text>';
	theMessage += '<VBox width="160" height="160" left="20" bottom="45" horizontalAlign="center" verticalGap="0" >';
	theMessage += '<Spacer height="8"/>';
	theMessage += '<Canvas width="160" height="125">';
	theMessage += '	<Image source="WebData/2d.png" height="110" width="116" verticalCenter="0" horizontalCenter="0"/>';
	theMessage += '</Canvas>';
	theMessage += '<HBox width="100%"><Spacer width="50%"/><Label text="[nl_NL|Geen 3D][en_US|No 3D]" /><Spacer width="50%" /></HBox>';
	theMessage += '</VBox>';
	theMessage += '<VBox width="160" height="160" right="20" bottom="45" horizontalAlign="center" verticalGap="0" >';
	theMessage += '<Spacer height="8"/>';
	theMessage += '<Canvas width="160" height="125">';
	theMessage += '	<Image source="WebData/3d.png" height="121" width="152" verticalCenter="0" horizontalCenter="0"/>';
	theMessage += '</Canvas>';
	theMessage += '<HBox width="100%"><Spacer width="50%"/><Label text="[nl_NL|3D met Shockwave][en_US|3D with Shockwave]" /><Spacer width="50%" /></HBox>';
	theMessage += '</VBox>';
	theMessage += '<HRule bottom="45" />';
	theMessage += '<HBox height="40" bottom="0">';
	if (theShowDownloadPlayer)
		theMessage += '<Button label="Download Shockwave Player" action="url" fontSize="18">http://get.adobe.com/shockwave/</Button>';
	theMessage += '<Canvas percentWidth="100" />';
	theMessage += '<Button label="[nl_NL|Doorgaan][en_US|Continue]" action="start" fontSize="18"/>';
	theMessage += '</HBox>';
	theMessage += '</message>';
	
	return theMessage;
}

function escapeXmlString(aString /*:String*/)/*:String*/
{
	var theString = aString;
	theString = theString.replace(/&/g, "&amp;");
	theString = theString.replace(/</g, "&lt;");
	theString = theString.replace(/>/g, "&gt;");
	return theString;
}

function trackPage(aPageName)
{
	com.indg.Log.debug("trackPage: " + aPageName + " :: " + sIndgGoogleAnalytics);
	
	try {
		// We need to have a global object, so we can call this before the webwrapper is initialized.	
		if (sIndgGoogleAnalytics != null)
    		sIndgGoogleAnalytics.trackPageview(aPageName);
	} catch (theError) {
		com.indg.Log.error(theError.message);	
	}
}

function openINDGSite()
{
	com.indg.Log.debug("openINDGSite");
	
	try {
		var theUrl = "http://www.indg.nl/";
		var theWindow = window.open(theUrl);
		if (!theWindow)
			document.location.href = theUrl;
	} catch (theError) {
		com.indg.Log.error(theError.message);	
	}
}
