// Functions for toggling 'Overlay' display items

function getFlashMovie(movieName) {
    var isIE = navigator.appName.indexOf("Microsoft") != -1;
    return (isIE) ? window[movieName] : document[movieName];
}


function showOverlay_rant() {
	
	// Scroll to top of page
	scroll(0,0);
	
	// Show overlay
	var overlay = document.createElement('div');
	overlay.id = 'overlay';
	
	var overlay_bg = document.createElement('div');
	overlay_bg.id = 'overlay_bg';
	
	var content = '<div id="overlay_fg">';
	content += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="640" height="525">';
	content += '<param name="movie" value="media/video/player_rant.swf" />';
	content += '<param name="quality" value="high" />';
	content += '<embed src="media/video/player_rant.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="640" height="525"></embed>';
	content += '</object>';
	content += '<p><a href="#" onclick="return hideOverlay();">Close</a></p>';
	content += '</div>';

	overlay.innerHTML = content;

	document.body.insertBefore(overlay, document.body.firstChild);
	document.body.insertBefore(overlay_bg, document.body.firstChild);


	return false;
}

function showOverlay_grow() {
	
	// Scroll to top of page
	scroll(0,0);
	
	// Show overlay
	var overlay = document.createElement('div');
	overlay.id = 'overlay';
	
	var overlay_bg = document.createElement('div');
	overlay_bg.id = 'overlay_bg';
	
	var content = '<div id="overlay_fg_small">';
	content += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="470" height="350">';
	content += '<param name="movie" value="media/video/grow_citizens.swf" />';
	content += '<param name="quality" value="high" />';
	content += '<embed src="media/video/grow_citizens.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="470" height="350"></embed>';
	content += '</object>';
	content += '<p><a href="#" onclick="return hideOverlay();">Close</a></p>';
	content += '</div>';

	overlay.innerHTML = content;

	document.body.insertBefore(overlay, document.body.firstChild);
	document.body.insertBefore(overlay_bg, document.body.firstChild);


	return false;
}

function showOverlay_bring() {
	
	// Scroll to top of page
	scroll(0,0);
	
	// Show overlay
	var overlay = document.createElement('div');
	overlay.id = 'overlay';
	
	var overlay_bg = document.createElement('div');
	overlay_bg.id = 'overlay_bg';
	
	var content = '<div id="overlay_fg_small">';
	content += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="470" height="350">';
	content += '<param name="movie" value="media/video/bring_child.swf" />';
	content += '<param name="quality" value="high" />';
	content += '<embed src="media/video/bring_child.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="470" height="350"></embed>';
	content += '</object>';
	content += '<p><a href="#" onclick="return hideOverlay();">Close</a></p>';
	content += '</div>';

	overlay.innerHTML = content;

	document.body.insertBefore(overlay, document.body.firstChild);
	document.body.insertBefore(overlay_bg, document.body.firstChild);


	return false;
}


function hideOverlay() {

	
	// Hide overlay
	var overlay = document.getElementById('overlay');

	if(overlay) {
		document.body.removeChild(overlay);
	}
	
	var overlay_bg = document.getElementById('overlay_bg');

	if(overlay_bg) {
		document.body.removeChild(overlay_bg);
	}
}

