function onclickH(e)
{
                var alert_string = "Event model: "+emod+"\n";

                switch (emod)
                {
                                 case "NN4":
						clickID = e.target.id;
                                 break;
                                 case "W3C":
						clickID = e.target.id;
                                 break;
                                 case "IE4+":
                                                  /* (E) */
                                                  e = window.event;
						clickID = e.srcElement.id;
                                 break;
                }

		clickRow = clickID.substring(1,2);
		if (clickID.substring(0,1) == "C") {
			formCount[clickID.substring(1,2)] = parseInt(clickID.substring(2,3));
			formTotal = 0;
			rowCount = 0;
			for(row in formCount) {
				formTotal = formTotal + formCount[row];
				rowCount++;
			}
			formAverage = formTotal/rowCount;
			formPercent = Math.round(formTotal/(rowCount*4)*100);
			for(i=0;i<=4;i++) {
				rowID = clickID.substring(0,2) + i;
				document.getElementById(rowID).style.background="";
				document.getElementById(rowID).innerHTML="&nbsp;";
			}
			if (formAverage <= 1.5) {
				displayR3 = "inline";
				displayR2 = "none";
				displayR1 = "none";
			} else if (formAverage <= 2.5) {
				displayR3 = "none";
				displayR2 = "inline";
				displayR1 = "none";
			} else {
				displayR3 = "none";
				displayR2 = "none";
				displayR1 = "inline";
			}
			document.getElementById("Rt").innerHTML="<p>Your assessment of your strategic planning process scores <span class=\"bold larger\">"+formPercent+"</span></p>";
			document.getElementById("R1").style.display=displayR1;
			document.getElementById("R2").style.display=displayR2;
			document.getElementById("R3").style.display=displayR3;
			//document.getElementById("R4").innerHTML="<p>formTotal: "+formTotal+" Rows selected: "+rowCount+" Average score: "+formAverage;
			//document.getElementById(clickID).style.background= "#0c0";
			document.getElementById(clickID).innerHTML="<img src=\"/images/tick.jpg\" width=\"35\" height=\"35\" alt=\"Y\">";
		}
                return true;
}

function onloadH(e)
{

                emod = (e) ? (e.eventPhase) ? "W3C" : "NN4" : "IE4+"; 

                if (emod == "NN4")
                                 document.captureEvents(Event.CLICK);

                document.onclick = onclickH;

                return true;
}
function quoteTimer()
{
	xretQuote = quotes[Math.floor(numQuotes*Math.random())];
	retQuote = xretQuote.split("|");
	document.getElementById("quote").innerHTML = "<p>" + retQuote[0] + "</p><p class=\"bold\">" + retQuote[1] + "</p>";
	window.setTimeout(quoteTimer, 10000);
}
function windowLoad(e)
{
	quoteTimer();
	onloadH(e);
}
//define the event handler for the onload event
//window.onload = onloadH;
//window.onload = quoteTimer;
window.onload = windowLoad;

//global vars
var emod;
var formCount = new Array();
var quotes = new Array();
quotes[0] = "So may a thousand actions once afoot, end in one purpose, and be well borne without defeat|Shakespeare";
quotes[1] = "Alice: Which way should I go?<br>Cat: That depends on where you are going<br>Alice: I don't know where I'm going!<br>Cat:  Then it doesn't matter which way you go!!|Lewis Carroll";
quotes[2] = "If you always do what you've always done, you'll  always get  what you've always gotten|Anon";
quotes[3] = "If you don't know where you are going, you will wind up somewhere else.|Yogi Bera";
quotes[4] = "Strategic Planning is a process by which we can envision the future and develop the necessary procedures and operations to influence and achieve that future.|Clark Crouch";
quotes[5] = "Plans are nothing; planning is everything.|Dwight D. Eisenhower";
quotes[6] = "The best way to predict the future is to create it.|Unknown";
quotes[7] = "Start with the end in mind|Steven Covey";
quotes[8] = "A good plan is like a road map: it shows the final destination and usually the best way to get there|Stanley Judd";
numQuotes = quotes.length;
