/*
  This code is from Dynamic Web Coding 
  at http://www.dyn-web.com/
  Copyright 2003 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  Permission granted to use this code 
  as long as this entire notice is included.

  NOTE: The functions called onmouseover/out plus the message variables need to be included early in the document 
  or errors will be triggered if user hovers over tooltip-activating links before page completely loaded
*/
function doTooltip(e, msg) {
  if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
  Tooltip.clearTimer();
  Tooltip.show(e, msg);
}

function hideTip() {
  if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
  Tooltip.timerId = setTimeout("Tooltip.hide()", 300);
}

function openHelperWindow(strWindow) {
	// Written by Steve Chapman
 	var height = Math.floor(screen.height * 0.5);
 	var width = Math.floor(screen.width * 0.5);
 	var top = Math.floor((screen.height - height) * 0.6);
 	var left = Math.floor((screen.width - width) * 0.9);
 	var helperWindow = window.open(strWindow + ".htm", strWindow + "Window", "resizable=yes,scrollbars=yes,height=" + height + ",width=" + width + ",top=" + top + ",left="+left);
 	helperWindow.focus();
}

function setStatusMessage(strMessage) {
	// Written by Steve Chapman
	status = strMessage;
	return true;
}

function clearStatusMessage() {
	// Written by Steve Chapman
	return setStatusMessage("");
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function revealAnswer(readersChoice, correctChoice) {
	// Written by Steve Chapman
	// When the reader makes a choice:
	//   highlight the correct choice,
	//   grey out the wrong answer(s), and
	//   display the blurb for the reader's choice.
	for (var i=1; i<=5; i++) {
		var answer = 'Answer' + i;
		var blurb = 'Blurb' + i;
	   	var answerObj = document.getElementById(answer);
		if (!answerObj) 
			return;
		// alert("i="+i+", answer="+answer+", answerObj="+answerObj);
	   	if (i == correctChoice) {
	   		answerObj.style.fontWeight = 'bold';
		} else {
			answerObj.style.color = 'gray';
		}  
	   	if (i == readersChoice) {
			MM_showHideLayers(blurb, '', 'show');
		} else {
			MM_showHideLayers(blurb, '', 'hide');
		}  
	}   
}	

dw_startup_complete = true; // Added in