// Adjust Flash

function displayFlash(param) {
	var showFlash = true;

	// Check for Safari
	var agent = navigator.userAgent
	var result = agent.search(/Safari.+/);
	if (result != -1) {
		showFlash = false;
	}

	// Show Flash on language selection page
	if (param.substr(0,14) == "?page=lang-sel") {
		showFlash = true;
	}
	// Show alternative text for Safari at start page
	else if (param == "?page=start-de" && !showFlash) {
		document.write('<div id="start-alt"><p>Herzlich willkommen im Heart of Golf, ')
		document.write('der grenzübergreifenden Golfregion – Waldviertel - Bohemia. ')
		document.write('Heart of Golf - im Herzen Europas ')
		document.write('schlägt unser Herz voll Begeisterung für das Golfspiel. ')
		document.write('Und für unsere Gäste.</p>');
		document.write('<p><em>13 Golfplätze, 18 Partnerhotels</em></p></div>');
	}
	else if (param == "?page=start-en" && !showFlash) {
		document.write('<div id="start-alt"><p>English</p>')
		document.write('<p><em>…</em></p></div>');
	}
	else if (param == "?page=start-cz" && !showFlash) {
		document.write('<div id="start-alt"><p>Český</p>')
		document.write('<p><em>…</em></p></div>');
	}

	// Display Flash
	if (showFlash) {
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="800px" height="100%" id="hog" align="middle">');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<param name="movie" value="/files/hog-bg.swf' + param + '" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="scale" value="noscale" />');
		document.write('<param name="salign" value="t" />');
		document.write('<param name="bgcolor" value="#ffffff" />');
		document.write('<param name="wmode" value="opaque" />');
		document.write('<embed src="/files/hog-bg.swf' + param + '" quality="high" scale="noscale" salign="t" bgcolor="#ffffff" wmode="opaque" width="800px" height="100%" name="HOG-Interim-001" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
	}
	// Or show alternative for Safari
	else {
		document.write('<div id="bg-static"></div>');
	}
}

function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function setFooter() {

	if (document.getElementById) {
		var windowHeight = getWindowHeight();

		if (windowHeight > 0) {
			var contentHeight = document.getElementById('content').offsetHeight + document.getElementById('content').offsetTop;
			var footerElement = document.getElementById('footer');
			var flashElement = document.getElementById('hog');
			var footerHeight  = footerElement.offsetHeight;
			var adjHeight = 0;
			var minHeight = 580;

			if (windowHeight > contentHeight) {
				adjHeight = Math.max(windowHeight, minHeight);
			}
			else {
				adjHeight = Math.max(contentHeight, minHeight);
			}
			footerElement.style.height = adjHeight + "px";
			flashElement.height = adjHeight + "px";
		}
	}
}
window.onload = function() {
	setFooter();
}
window.onresize = function() {;
	setFooter();
}