function showOverlay(){
	var overlayHTML = "<div id='GB_overlay'></div>";
	overlayHTML += "<div id='billboard'>";
	overlayHTML += "<p id='waitingForSchedStart'>Waiting for scheduled game to start in <span id='schedStartSeconds'>X</span> seconds.</p>";
	overlayHTML += "<p id='waitingForOpponents'>Waiting for opponents to join.<input id='cancelJoin' type='submit' value='Cancel'/></p>";
	overlayHTML += "<p id='synchMessage'>Synching up for game start.</p>";
	overlayHTML += "<p id='countdown'>3</p>";
	overlayHTML += "<p id='rollingOver'>Doing year-end accounting...</p>";
	overlayHTML += "<p id='gameOver'>GAME OVER</p>";
	overlayHTML += "<p id='throbber'><img src='/i/loadingAnimation.gif'/></p>";
	overlayHTML += "</div>";
	
	var addNew = false;
	if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
		jQuery("body","html").css({height: "100%", width: "100%"});
		jQuery("html").css("overflow","hidden");
		if (document.getElementById("GB_HideSelect") === null) {//iframe to hide select elements in ie6
			addNew = true;
			//jQuery("body").append("<iframe id='GB_HideSelect'></iframe>" + overlayHTML);
			jQuery("#overlayAttacher").append("<iframe id='GB_HideSelect'></iframe>" + overlayHTML);
		}
	}else{//all others
		if(document.getElementById("GB_overlay") === null){
			addNew = true;
			//jQuery("body").append(overlayHTML);
			jQuery("#overlayAttacher").append(overlayHTML);
		}
	}
	
	if(addNew == true){
		if(detectMacXFF()){
			jQuery("#GB_overlay").addClass("GB_overlayMacFFBGHack");//use png overlay so hide flash
		}else{
			jQuery("#GB_overlay").addClass("GB_overlayBG");//use background and opacity
		}
	}else{
		jQuery('#billboard,#throbber,#GB_overlay,#GB_HideSelect').show();
	}
	
	tb_position();
}

function tb_position() {
var TB_WIDTH = 300;  
var TB_HEIGHT = 100;  
jQuery("#billboard").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
	if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
		jQuery("#billboard").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
	}
}

function hideOverlay() {
	jQuery('#throbber,#billboard').hide();
 	jQuery("#GB_overlay").fadeOut("fast",function(){jQuery('#billboard,#GB_overlay,#GB_HideSelect').hide();});
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		jQuery("body","html").css({height: "auto", width: "auto"});
		jQuery("html").css("overflow","");
	}
	return false;
}

function hideGreyoutMessages(){
	jQuery('#waitingForSchedStart,#waitingForOpponents,#synchMessage,#countdown,#rollingOver,#gameOver').hide();
}

//jQuery(document).ready(function(){showOverlay();});