/* tjw
if(top == self) sfc(unescape(window.location.pathname));
*/
trace ("hilite main");
	debug ("in hilite");

	debug ("are scripts working?");
  	var isIE = false; 
	
	if(document.all && navigator.userAgent.indexOf("Opera")==-1) isIE = true; 	    // its IE
	else if(document.getElementById) isIE = false;  								// its netscapey
	debug ("Is this IE? " + isIE);

	var aCodes = ["VOA0", "VOA1", "VOA2", "BHS0"]
	aCodes["BHS0"] = ["Benedictine Health Services","Leadership", "Warren Hoffman","warrenhoffman@comcast.net"];
	

	

/*  // The UNORGANIZED VERSION.  not very useful anymore.  
	var aScores = [ 
				  "c01", "c02", "c03", "c04", "c05", "c06", "c07", "c08", 
                  "q01", "q02", "q03", "q04", "q05", "q06", "q07", "q08",
				  "q09", "q10", "q11", "q12", "q13", "q14", "q15", "q16",
				  "q17", "q18", "q19", "q20", "q21", "q22", "q23", "q24",
   				  "q25", "q26", "q27", "q28", "q29", "q30", "q31", "q32", 
				  "q33", "q34", "q35", "q36", "q37", "q38", "q39", "q40",
				  "q41", "q42", "q43", "q44", "q45", "q46", "q47", "q48" 								
 				];
*/	
// the test version, tiny for quick assessment completion
//	var aScores = ["q01", "q02", "q03", "q04", "q05"];
	
	var aScores = [

//ORGANIZATIONAL QUESTIONS 
				  	"c01", "c02", "c03", "c04", "c05", "c06", "c07", "c08"	 		// ZONE questions
				   ,																// separator comma - don't lose it!
// EU FACETS/QUESTIONS
					"q27", "q36", "q38"												// Change
				   ,"q35", "q40", "q41", "q28", "q44"		 						// Power
				   ,"q11", "q16", "q18", "q23", "q02", "q25", "q33"					// Fulfillment
				   ,"q03", "q04", "q06", "q26", "q31", "q14", "q19", "q30", "q32"	// Team

// IP FACETS/QUESTIONS
				   ,"q01", "q15", "q17", "q20", "q47", "q12", "q39"					// Attention
				   ,"q05", "q21", "q22", "q24", "q42", "q43"						// Outlook
				   ,"q07", "q08", "q09", "q45", "q46", "q48"						// Reflection
 				   ,"q13", "q29", "q37", "q10", "q34"								// Information

				  ];
	aScores["c01"] = ["NC",0, "agree","disagree"];
	aScores["c02"] = ["NC",0, "agree","disagree"];
	aScores["c03"] = ["NC",0, "agree","disagree"];
	aScores["c04"] = ["NC",0, "agree","disagree"];
	aScores["c05"] = ["NC",0, "agree","disagree"];
	aScores["c06"] = ["NC",0, "agree","disagree"];
	aScores["c07"] = ["NC",0, "agree","disagree"];
	aScores["c08"] = ["NC",0, 1,2,3,4,5];

	aScores["q01"] = ["A",0,10,-10];							// y - IP, mA, f13, z2
	aScores["q02"] = ["F",0,-10,10];							// x - EU, mF, f12, z7
	aScores["q03"] = ["T",0,-10,10];							// x - EU, mT, f1,  z4
	aScores["q04"] = ["T",0,10,-10];							// x - EU, mT, f1,  z5, z1
	aScores["q05"] = ["O",0,10,-10];							// y - IP, mO, f14, z3, z6
	aScores["q06"] = ["T",0,10,-10];							// x - EU, mT, f1,  z3, z6 
	aScores["q07"] = ["R",0,10,-10];							// y - IP, mR, f20, z3   
	aScores["q08"] = ["R",0,10,-10];							// y - IP, mR, f20, z3   
	aScores["q09"] = ["R",0,10,-10];							// y - IP, mR, f20, z3   
	aScores["q10"] = ["I",0,-10,10];							// y - IP, mI, f16, z1
	aScores["q11"] = ["F",0,10,-10];							// x - EU, mF, f11, z6
	aScores["q12"] = ["A",0,10,-10];							// y - IP, mA, f19, z7,z3
	aScores["q13"] = ["I",0,-10,10];							// y - IP, mI, f15, z2
	aScores["q14"] = ["T",0,-10,10];							// x - EU, mT, f5,  z2 
	aScores["q15"] = ["A",0,-10,10];							// y - IP, mA, f13, z6
	aScores["q16"] = ["F",0,-10,10];							// x - EU, mF, f11, z7     
	aScores["q17"] = ["A",0,-10,10];							// y - IP, mA, f13, z5   
	aScores["q18"] = ["F",0,10,-10];							// x - EU, mF, f11, z6
	aScores["q19"] = ["T",0,10,-10];							// x - EU, mT, f5,  z6 
	aScores["q20"] = ["A",0,-10,10];							// y - IP, mA, f13, z3
	aScores["q21"] = ["O",0,10,-10];							// y - IP, mO, f14, z1, z5
	aScores["q22"] = ["O",0,-10,10];							// y - IP, mO, f14, z3
	aScores["q23"] = ["F",0,10,-10];							// x - EU, mF, f11, z6
	aScores["q24"] = ["O",0,10,-10];							// x - IP, mO, f14, z1,z5
	aScores["q25"] = ["F",0,10,-10];							// x - EU, mF, f2,  z4 
	aScores["q26"] = ["T",0,10,-10];							// x - EU, mT, f1,  z3
	aScores["q27"] = ["C",0,10,-10];							// x - EU, mF, f6,  z3  
	aScores["q28"] = ["P",0,10,-10];							// x - EU, mP, f3,  z4
	aScores["q29"] = ["I",0,10,-10];							// y - IP, mI, f15, z2, z4
	aScores["q30"] = ["T",0,10,-10];							// x - EU, mT, f5,  z3, z2
	aScores["q31"] = ["T",0,-10,10];							// x - EU, mT, f1,  z3 
	aScores["q32"] = ["T",0,-10,10];							// x - EU, mT, f5,  z3
	aScores["q33"] = ["F",0,10,-10];							// x - EU, mF, f2,  z7 
	aScores["q34"] = ["I",0,-10,10];							// y - IP, mI, f16, z1 
	aScores["q35"] = ["P",0,-10,10];							// x - EU, mP, f10, z4
	aScores["q36"] = ["C",0,-10,10];							// x - EU, mC, f6,  z3
	aScores["q37"] = ["I",0,-10,10];							// y - IP, mI, f17, z3  
	aScores["q38"] = ["C",0,-10,10];							// x - EU, mC, f7,  z2 
	aScores["q39"] = ["A",0,-10,10];							// y - IP, mA, f19, z3 
	aScores["q40"] = ["P",0,-10,10];							// x - EU, mP, f10, z4 
	aScores["q41"] = ["P",0,-10,10];							// x - EU, mP, f10, z4 
	aScores["q42"] = ["O",0,10,-10];							// y - IP, mO, f14, z1, 
	aScores["q43"] = ["O",0,10,-10];							// x - IP, mO, f14, z1 
	aScores["q44"] = ["P",0,-10,10];							// y - EU, mP, f9,  z4 
	aScores["q45"] = ["R",0,10,-10];							// y - IP, mR, f18, z7 
	aScores["q46"] = ["R",0,-10,10];							// y - IP, mR, f18, z7  
	aScores["q47"] = ["A",0,-10,10];							// y - IP, mA, f13, z3,z6 
	aScores["q48"] = ["R",0,-10,10];							// y - IP, mR, f18, z7  
 
 	var aOutput   = ["EU", "C", "P", "F", "T", "IP", "A", "O", "R", "I"];
	
	aOutput["EU"] = ["EU",          0,0,0];
	aOutput["C"]  = ["Change",      0,0,0];
	aOutput["P"]  = ["Power",       0,0,0];
	aOutput["F"]  = ["Fulfillment", 0,0,0];
	aOutput["T"]  = ["Team",        0,0,0];
	
	aOutput["IP"] = ["IP",		   	0,0,0];
	aOutput["A"]  = ["Attention",   0,0,0];
	aOutput["O"]  = ["Outlook",	   	0,0,0];
	aOutput["R"]  = ["Reflection",  0,0,0];
	aOutput["I"]  = ["Information", 0,0,0];

/*	
	var aOutcome = ["na", 
				   ['WE / think', 'WE / think: a UNIFYING inquirer', 'WETHINKWE.htm'],
				   ['we / THINK', 'we / THINK: a unifying INQUIRER', 'WETHINKTHINK.htm'],
				   ['i / THINK', 'i / THINK: an entrepreneurial INQUIRER', 'ITHINKTHINK.htm'],
				   ['I / think', 'I / think: an ENTREPRENEURIAL inquirer', 'ITHINKI.htm'],
				   ['I / do', 'I / do: an ENTREPRENEURIAL pragmatist', 'IDOI.htm'],
				   ['i/ DO', 'i / DO: an entrepreneurial PRAGMATIST', 'iDODO.htm'],
				   ['we / DO', 'we / DO: a unifying PRAGMATIST', 'WEDODO.htm'],
				   ['WE / do', 'WE / do: a UNIFYING inquirer', 'WEDOWE.htm'],
				   
				   ];
*/
	var aOutcome = ["na", 
				   ['WE / think', 'an inquiring UNIFIER', 'WETHINKWE.htm'],
				   ['we / THINK', 'a unifying INQUIRER', 'WETHINKTHINK.htm'],
				   ['i / THINK', 'an entrepreneurial INQUIRER', 'ITHINKTHINK.htm'],
				   ['I / think', 'an inquiring ENTREPRENEUR', 'ITHINKI.htm'],
				   ['I / do', 'a pragmatic ENTREPRENEUR', 'IDOI.htm'],
				   ['i/ DO', 'entrepreneurial PRAGMATIST', 'IDODO.htm'],
				   ['we / DO', 'a unifying PRAGMATIST', 'WEDODO.htm'],
				   ['WE / do', 'a pragmatic UNIFIER', 'WEDOWE.htm'],
				   
				   ];

	
	var xProfile = ['na', 
				   'The "I / do": The ENTREPRENERUIAL pragmatist',
				   'The "I / think": The ENTREPRENERUIAL inquirer',
				   'The "WE / do": The UNIFYING pramatist',
				   'The "WE / think": The unifying INQUIRER',
				   ]; 
	var yProfile = ['na', 
				   'The "i / DO": The entrepreneurial PRAGMATIST',
				   'The "i / THINK": The entrepreneurial INQUIRER',
				   'The "we / DO": The unifying PRAGMATIST',
				   'The "we / THINK": The UNIFYING inquirer',
				   ]; 

    var xAxis = 0;
	var yAxis = 0;
	var profile = "";
	var quadrant = 1;
	var dominant = "X";
	var octant = 1; 

//	debug ('aOutput["C"][1] is: ' + aOutput["C"][1]);

//   debug ("aScores 2 Array length is: " + aScores.length);
		
//	debug ("aScores: " + aScores ["q01"][0] + aScores ["q01"][1] + aScores ["q01"][2] + aScores ["q01"][3]+ aScores ["q01"][4]);
    
	var totals = new Object(); 
    totals.numquestions = aScores.length;
	totals.myHigh  = 0;
	totals.myProfile = "Inquirer";
	
	totals.NC = new Object();  
    totals.EU = new Object();
	totals.IP = new Object(); 
	
	totals.EU.Total = 0;
	totals.EU.Count = 0;
	totals.EU.C = new Object();
	totals.EU.C.Total = 0;
	totals.EU.C.Count = 0;

	totals.EU.P = new Object();
	totals.EU.F = new Object();
	totals.EU.T = new Object();
	
	totals.A = new Object();
	totals.O = new Object();
	totals.R = new Object();
	totals.I = new Object();
	
	totals.EU.R = new Object();
	totals.EU.U = new Object(); 
	totals.IP.I = new Object(); 
	totals.IP.P = new Object(); 

	totals.NC.count = 0; 
	totals.EU.count = 0; 
	totals.IP.count = 0;
	totals.EU.value = 0;
	totals.IP.value = 0;
	
	totals.EU.R.total = 0; 
	totals.EU.R.myMax = 0; 
	totals.EU.U.total = 0; 
	totals.EU.U.myMax = 0; 
	totals.IP.I.total = 0;
	totals.IP.I.myMax = 0; 
	totals.IP.P.total = 0;
	totals.IP.P.myMax = 0; 	
	
//	debug_f == true;
	var firstTime=true;                      //* saves original background colors in form fields
    var w;
    
//    var	debug_f	= false;
//	var	subdocd	= "";	
//	var	eventsd	= false;
//	var	traced	= false;
//	var debugd	= false;
//	var	showd	= false;
//	var	messagesd	= false;
//	var	errorsd		= false;

endtrace ("hilite main");

function checkandProcess()
{	trace("checkandProcess");
    str = "";
//	debug ("Starting... "); 
	if (verify2 (document.assess, aScores))                             //* run the form validation routine first
	{
		formProcess(aScores); 
		endtrace("checkandProcess");
		return true;
	}
//	return false;
	endtrace("checkandProcess");
	return false;

}


function formReset()
{	trace("formReset");
	
	laErr=document.getElementById("laDivErr");  //i.e only need to fix
	debug ("laErr is: " + laErr);	
	window.scrollTo(0,0);
	laErr.style.display = "none";
	var f = document.start;
	for(var i = 0; i < f.length; i++)
   	{
       	var e = f.elements[i];
		if (e.style.backgroundColor == "yellow")
				e.style.backgroundColor = e.BC;  //* restore original background color from expando property.
	
	}
	endtrace("formReset");
	return true;
	
}

function formProcess(a)
{	trace ("formProcess");
//	debug ("processing form...");
	laErr=document.getElementById("laDivErr");  //i.e only need to fix
	laErr.style.display = "none";

	debug ("laErr is: " + laErr);	

	
	window.scrollTo(0,0);
//	alert ( "Thank you...  \n" + 
//           	"One Moment while we Process your Results....");
//	var total = 0;
/*	
	var s = "";
	var t =	"";
	var type = "XX";
	var value = 0;
	for(var j = 0; j < a.length; j++)					//step through my question array
	{
		value = 0; 
		s = a[j];										//get the named instance in the array
		t = a[s][0];									//get the zeroeth entry to use to de-reference correct value
//	    debug("s is: " + s + "t is: " + t); 
		type = t;
		totals[type].count += 1; 
//		debug("totals." + type + ".count is now:  " + totals[type].count);
		
		value = a[s][1];                                // the value has been put in the 1st array entry
//		debug ("type is: "+ type + " value is: " + value); 
		if (type != "XX")
		{
			if (type == "RU")
				if (value <= 0)
				   {
				   	totals.RU.R.total += value; 
//					debug ("R total is: " +	totals.RU.R.total );
				   }
				 else
				   {
				   	totals.RU.U.total += value; 
//					debug ("U total is: " +		totals.RU.U.total );
				   }
			else
				if (value >= 0)
				   {
				   	totals.IP.I.total += value; 
//					debug ("I total is: " +		totals.IP.I.total);
				   }
				 else
				   {
				   	totals.IP.P.total += value; 
//					debug ("P total is: " +		totals.IP.P.total );
				   }


		}
		

//		show("s", s);

//		debug ("process form: question " + s + " chose answer: " + t);
//		total += a[j][0];						//get the zeroeth value from the NAMED array element 
	}

*/
	xAxis =  Math.round(aOutput["EU"][2] / aOutput["EU"][3] * 100);
	yAxis =  Math.round(aOutput["IP"][2] / aOutput["IP"][3] * 100);
	
	debug ("EU count: " + aOutput["EU"][1] + "; EU score: " + aOutput["EU"][2] + "; EU max: " + aOutput["EU"][3] + "; EU Percentage Score: " + xAxis +"%");
	debug ("-- change count: " + aOutput["C"][1] + "; change score: " + aOutput["C"][2] + "; change max: " + aOutput["C"][3] + "; change Percentage Score: " + Math.round(aOutput["C"][2] / aOutput["C"][3] * 100) +"%");
	debug ("-- power count: " + aOutput["P"][1] + "; power score: " + aOutput["P"][2] + " power max: " + aOutput["P"][3] + "; power Percentage Score: " + Math.round(aOutput["P"][2] / aOutput["P"][3] * 100) +"%");
	debug ("-- fulfillment count: " + aOutput["F"][1] + "; fulfillment score: " + aOutput["F"][2] + " fulfillment max: " + aOutput["F"][3] + "; fulfillment Percentage Score: " + Math.round(aOutput["F"][2] / aOutput["F"][3] * 100) +"%");
	debug ("-- team count: " + aOutput["T"][1] + "; team score: " + aOutput["T"][2] + " Team max: " + aOutput["T"][3] + "; Team Percentage Score: " + Math.round(aOutput["T"][2] / aOutput["T"][3] * 100) +"%");

	debug ("IP count: " + aOutput["IP"][1] + "; IP score: " + aOutput["IP"][2] + "; IP max: " + aOutput["IP"][3] + "; IP Percentage Score: " + yAxis +"%");
	debug ("-- attention count: " + aOutput["A"][1] + "; attention score: " + aOutput["A"][2] + " attention max: " + aOutput["A"][3] + "; attention Percentage Score: " + Math.round(aOutput["A"][2] / aOutput["A"][3] * 100) +"%");
	debug ("-- outlook count: " + aOutput["O"][1] + "; outlook score: " + aOutput["O"][2] + " outlook max: " + aOutput["O"][3] + "; outlook Percentage Score: " + Math.round(aOutput["O"][2] / aOutput["O"][3] * 100) +"%");
	debug ("-- reflection count: " + aOutput["R"][1] + "; reflection score: " + aOutput["R"][2] + " reflection max: " + aOutput["R"][3] + "; reflection Percentage Score: " + Math.round(aOutput["R"][2] / aOutput["R"][3] * 100) +"%");
	debug ("-- information count: " + aOutput["I"][1] + "; informationo score: " + aOutput["I"][2] + " information max: " + aOutput["I"][3] + "; information Percentage Score: " + Math.round(aOutput["I"][2] / aOutput["I"][3] * 100) +"%");

	debug ("xAxis * xAxis is: " + xAxis * xAxis + " yAxis * yAxis is: " + yAxis * yAxis );
	dominant = ((xAxis * xAxis) >= (yAxis * yAxis)) ? "X" : "Y";
	if (xAxis >= 0)											
		quadrant = (yAxis >= 0) ? 1 : 4; 	
	else 
		quadrant = (yAxis >= 0) ? 2 : 3; 
	
	if (xAxis >= 0)
	{ 
		if (yAxis >= 0) 
			octant = (dominant == "X") ? 1 : 2; 
		else 
			octant = (dominant == "X") ? 8 : 7; 
	}
	else
		if (yAxis >= 0) 
			octant = (dominant == "X") ? 4 : 3; 
		else 
			octant = (dominant == "X") ? 5 : 6; 

	document.forms.assess.Xaxis.value = xAxis;
	document.forms.assess.XaxisNum.value = aOutput["EU"][2] / 10;
	document.forms.assess.Change.value = Math.round(aOutput["C"][2] / aOutput["C"][3] * 100);
	document.forms.assess.ChangeNum.value = aOutput["C"][2] / 10;
	document.forms.assess.Power.value = Math.round(aOutput["P"][2] / aOutput["P"][3] * 100);
	document.forms.assess.PowerNum.value = aOutput["P"][2] / 10;
	document.forms.assess.Fulfillment.value = Math.round(aOutput["F"][2] / aOutput["F"][3] * 100);
	document.forms.assess.FulfillmentNum.value = aOutput["F"][2] / 10;
	document.forms.assess.Team.value = Math.round(aOutput["T"][2] / aOutput["T"][3] * 100);
	document.forms.assess.TeamNum.value = aOutput["T"][2] / 10;

	document.forms.assess.Yaxis.value = yAxis;
	document.forms.assess.YaxisNum.value = aOutput["IP"][2] / 10;
	document.forms.assess.Attention.value = Math.round(aOutput["A"][2] / aOutput["A"][3] * 100);
//	alert ("attention value has been set to: " + document.forms.assess.Attention.value);
	document.forms.assess.AttentionNum.value = aOutput["A"][2] / 10;
	document.forms.assess.Outlook.value = Math.round(aOutput["O"][2] / aOutput["O"][3] * 100);
	document.forms.assess.OutlookNum.value = aOutput["O"][2] / 10;
	document.forms.assess.Reflection.value = Math.round(aOutput["R"][2] / aOutput["R"][3] * 100);
	document.forms.assess.ReflectionNum.value = aOutput["R"][2] / 10;
	document.forms.assess.Information.value = Math.round(aOutput["I"][2] / aOutput["I"][3] * 100);
	document.forms.assess.InformationNum.value = aOutput["I"][2] / 10;

	document.forms.assess.pName.value = aOutcome[octant][0];	
	document.forms.assess.pLongName.value = aOutcome[octant][1];	
	document.forms.assess.pFileName.value = aOutcome[octant][2];	

	
	debug ( " xAxis is: " + xAxis + " and yAxis is: " + yAxis + " so dominant Axis is: " + dominant + " quadrant is: " + quadrant + " and octant is: " + octant ); 
	debug ("document.forms.assess.pName.value is: " + document.forms.assess.pName.value + "; document.forms.assess.pLongName.value is: " + document.forms.assess.pLongName.value + "; document.forms.assess.pFileName.value is: " + document.forms.assess.pFileName.value);
	
	alert(
		  "Thank you for your participation. \n" 
		 + "According to your responses, your profile shows: \n \n" 
		 + "EU Axis           Total:  " +  Math.round(aOutput["EU"][2] / aOutput["EU"][3] * 100) + "%\n"
		 + "  - Change       Facet:  " +  Math.round(aOutput["C"][2] / aOutput["C"][3] * 100) + "%\n"
 		 + "  - Power         Facet:  " +  Math.round(aOutput["P"][2] / aOutput["P"][3] * 100) + "%\n"
		 + "  - Fulfillment   Facet:  " +  Math.round(aOutput["F"][2] / aOutput["F"][3] * 100) + "%\n"
 		 + "  - Team           Facet:  " +  Math.round(aOutput["T"][2] / aOutput["T"][3] * 100) + "%\n\n"

		 + "IP Axis             Total:  " +  Math.round(aOutput["IP"][2] / aOutput["IP"][3] * 100) + "%\n"
		 + "  - Attention      Facet:  " +  Math.round(aOutput["A"][2] / aOutput["A"][3] * 100) + "%\n"
		 + "  - Outlook        Facet:  " +  Math.round(aOutput["O"][2] / aOutput["O"][3] * 100) + "%\n"
 		 + "  - Reflection    Facet:  " +  Math.round(aOutput["R"][2] / aOutput["R"][3] * 100) + "%\n"
 		 + "  - Information  Facet:  " +  Math.round(aOutput["I"][2] / aOutput["I"][3] * 100) + "%\n"

		 );
	
	


endtrace("formProcess"); 
}


//* A utility function that returns true if a string contains only 
//* whitespace characters.
function isblank(s)
{	trace("isblank"); 
   	for (var i = 0; i < s.length; i++)
   	{
       	var c = s.charAt(i);
       	if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
   	}
   	endtrace("isblank"); 
	return true;
}

//* This is the function that performs form verification. It will be invoked
//* from the onSubmit() event handler. The handler should return whatever
//* value this function returns.
function verify2(f, a)
{	
trace("verify2"); 
		var allgood = true;
		var msg;
    	var empty_fields = "";
    	var numeric_fields = "";
    	var validvalue_fields = "";
 /*   	totals.X = 0; 
    	totals.R = 0; 
    	totals.U = 0; 
    	totals.I = 0; 	
    	totals.P = 0; 
*/
	aOutput["EU"] = ["EU",          0,0,0];
	aOutput["C"]  = ["Change",      0,0,0];
	aOutput["P"]  = ["Power",       0,0,0];
	aOutput["F"]  = ["Fulfillment", 0,0,0];
	aOutput["T"]  = ["Team",        0,0,0];
	
	aOutput["IP"] = ["IP",		    0,0,0];
	aOutput["A"]  = ["Attention",   0,0,0];
	aOutput["O"]  = ["Outlook",	    0,0,0];
	aOutput["R"]  = ["Reflection",  0,0,0];
	aOutput["I"]  = ["Information", 0,0,0];
	
	totals.NC.count = 0; 
	totals.EU.count = 0; 
	totals.IP.count = 0; 
	totals.EU.R.total = 0; 
	totals.EU.R.myMax = 0;
	totals.EU.R.normScore =0;
	totals.EU.U.total = 0; 
	totals.EU.U.myMax = 0; 
	totals.EU.U.normScore =0;
	totals.IP.I.total = 0;
	totals.IP.I.myMax = 0; 
	totals.IP.I.normScore =0;
	totals.IP.P.total = 0;
	totals.IP.P.myMax = 0; 	
	totals.IP.P.normScore =0;	
		
//		debug ("a Array length is: " + a.length);
		
		
		var q = document.getElementsByTagName("P");
		debug (" I found " + n + " p tags. ");
		for (var n = 0; n < q.length; n++)
		{ 
			debug ("q[n].className is: " + q[n].className);
			if (q[n].className == "fstyle2") q[n].className = "fstyle1";   // remove any prior background highlighting for questions not answered
		}

		for(var j = 0; j < a.length; j++)					//step through my question array
    	{
			
			var s = a[j];									//get the NAME OF THE question id from my question array
//			debug ("s is: " + s); 
			var e = f.elements[s];							//collect all the form elements with that same name into a collection
			var type = a[s][0];    							// get the question type to total as we go.  stored in first element of array; 
			debug ("s is: " + s + " type is: " + type); 
			
			var myValue =0;
			var myMin=0;
			var myMax = 0;
			
			var chk = false;
			for (var i = 0; i < e.length; i++)			    //step through the collection to make sure one has been picked and to build totals
			{
				var myEl = e[i];
				var myAnsIndex = 0;
//				var myEl = getElementById(??);
				myAnsIndex = eval(myEl.value.valueOf());	        // get the NUMERIC value of the current radio button; the radio button entries are returned as strings, need to convert to numeric
				myAnsIndex += 1; 							     	// i have used the first two entries in the array for other purposes. Need to add one to get correct index referencing
				myValue = a[s][myAnsIndex]; 						// assign the SECOND (NOT ZEROETH, ONE-ETH) element in my array to the number that was checked
				if (myValue < 0)
					if (myValue < myMin) myMin = myValue; 
				if (myValue > 0)
					if (myValue > myMax) myMax = myValue; 
//				debug ("myMin is: " + myMin);
				debug ("The first " + s + " value is " + myEl.value + ".  Is it checked? " + myEl.checked);
				if (myEl.checked == true) 
				{
					chk = true; 				     			// this group had an answer  the check flag is only good once?
					a[s][1] = myValue; 						// assign the SECOND (NOT the ZEROETH, the ONE-ETH) element in my array to the number that was checked
//					debug ("question " + s + " chosen answer was: " + myEl.value + " which is index position: " + myAnsIndex + " in my array and which has value: " + a[s][1]);
				}
			}
			debug ("type is: " + type); 
			if (type != "NC")										// the "NC" questions are not aggregated
			{
				aOutput[type][1] += 1;								// update question count for this facet	
				aOutput[type][2] += a[s][1];							// update subtotal for this facet 
				aOutput[type][3] = aOutput[type][1] * 10;			// update max value for this facet 
//				debug ('aOutput["1"] is: ' + aOutput["1"]); 
				if (type == "C" ||  type == "P" ||  type == "F" ||  type == "T")  
				{
					aOutput["EU"][1] += 1; 							// update question count for the EU axis
					aOutput["EU"][2] += a[s][1];  					// update EU Axis running total
				    aOutput["EU"][3] = aOutput["EU"][1] * 10;		   // update EU Axis Max value
				}
				else
				{
					aOutput["IP"][1] += 1; 							// update question count for the EU axis
					aOutput["IP"][2] += a[s][1];  					// update EU Axis running total
				    aOutput["IP"][3] = aOutput["IP"][1] * 10;		   // update EU Axis Max value
				}
			debug ('aOutput[' + type + '][1] is: ' + aOutput[type][1] + ' and aOutput[' + type + '][2] is: ' + aOutput[type][3] + ' aOutput["EU"][1] Num EU questions is: ' + aOutput["EU"][1] + ' aOutput["EU"][3] Max value is: ' + aOutput["EU"][3]);
			}
/*			
			if (type == "RU")
				{
					totals.RU.R.myMax += myMin;
					totals.RU.U.myMax += myMax;
				}
			if (type == "IP")
				{
					totals.IP.I.myMax += myMax;
					totals.IP.P.myMax += myMin;
				}
*/			
			
			debug ("length of e is still: " + e.length);
			debug ("chk is: " + chk);
			if (chk == false)									//no answer selected for this group
				for (var i = 0; i < e.length; i++)			    //step through again to mark em. 
				{
					var myEl = e[i];
//					if (firstTime) e[i].BC = e[i].style.backgroundColor;  //* store original background color as expando property.
//					if (firstTime) myEl.BC = myEl.style.backgroundColor;  //* store original background color as expando property.
//					if (firstTime) myEl.BC = "white";  //* store original background color as expando property.
//					debug ("BC expando property saving color for element: " + s + " as " + myEl.style.backgroundColor);
//					myEl.style.backgroundColor = "yellow";
					myEl2 = myEl.parentNode; 							 // this is the <p> tag
//					debug ("myEl2.tagName is: " + myEl2.tagName);
//					for (n in myEl2)
//						debug (n);
//					debug("myEl2.class is: " + myEl2.class);
//					myEl2.style.backgroundColor = "yellow";
					myEl2.className = "fstyle2";
//					myEl.alt = "yellow";
//					myEl.color = "#000000";
//					myEl.parent.style.backgroundColor = "yellow";
//					myEl.checked = true; 
//					show("the element object", myEl);
//					debug ("the element object" + myEl);
//					debug ("the element object's parent node type is" + myEl.parentNode.nodeType);
//					debug ("the element object's parent node name is" + myEl.parentNode.name);
					allgood = false;
				}
			}
 //   	debug("end");
    	if (allgood)
			return true;
		laErr=document.getElementById("laDivErr");  //i.e only need to fix?
		debug ("in verify2 - laErr is: " + laErr.innerHTML);	
		window.scrollTo(0,0);
		laErr.style.display = "block";
		firstTime = false;
//		laErr.style.display = "block"; 

endtrace("verify2"); 	
		return false;
}

var MyID = null;
var MyStr = null;
var MyAct = null;
var MyDis = null;
var MyFil = 0;

function hla(MyEve,MyID,MyAct)
{	
trace("hla"); 
	if(document.all && navigator.userAgent.indexOf("Opera")==-1)
	{
		MyStr = "document.all." + MyID + ".innerHTML";
		MyDis = eval(MyStr) + "<hr />" + MyAct;
		MyStr = "document.all." + MyID + ".innerText";
		MyStr = eval(MyStr);
		MyPos = MyStr.indexOf("  ");
		MyStr = MyStr.substr(0,MyPos);
		hlIE(MyDis);
	}
	else if(document.getElementById)
	{
		hlMO(MyEve,MyAct);
	}
endtrace("hla");
}

function hlt(MyEve,MyStr)
{	
trace("hlt");
//  	debug("in hlt"); 
  	if(document.all && navigator.userAgent.indexOf("Opera")==-1) hlIE(MyStr);
	else if(document.getElementById) hlMO(MyEve,MyStr);
endtrace("hlt");
}

function hli(MyEve,MyInd) {
	if(document.all && navigator.userAgent.indexOf("Opera")==-1) hlIE(eval(MyInd));
	else if(document.getElementById) hlMO(MyEve,eval(MyInd));
}

function hlIE(MyDis)
{	
trace("hlIE");
	document.all.HLie.innerHTML = MyDis;
	document.all.HLie.style.left = window.event.clientX + 32 + "px";
	if((document.body.clientWidth - window.event.clientX) < document.all.HLie.offsetWidth) {
		document.all.HLie.style.left = (document.body.clientWidth - (document.all.HLie.offsetWidth + 2)) + "px";
	}
	document.all.HLie.style.top = document.body.scrollTop + window.event.clientY + 10 + "px";
	if((document.body.clientHeight - window.event.clientY) < document.all.HLie.offsetHeight) {
		if(((document.body.clientWidth - window.event.clientX) < (document.all.HLie.offsetWidth + 33)) && ((document.body.clientHeight - window.event.clientY) < document.all.HLie.offsetHeight)) {
			document.all.HLie.style.left = (document.body.clientWidth - (document.all.HLie.offsetWidth + 2)) + "px";
			document.all.HLie.style.top = document.body.scrollTop + (window.event.clientY - (document.all.HLie.offsetHeight + 5)) + "px";
		}
		else {
			document.all.HLie.style.top = document.body.scrollTop + (document.body.clientHeight - (document.all.HLie.offsetHeight + 5)) + "px";
		}
	}
	document.all.HLie.filters.revealTrans.Transition = MyFil;
	document.all.HLie.filters.revealTrans.Apply();
	document.all.HLie.style.visibility = "visible";
	document.all.HLie.filters.revealTrans.Play();
	MyFil++;

endtrace("hlIE");
}

function hlMO(MyEve,MyDis)
{
trace("hlMO");
	MyEle=document.getElementById("HLnn");
	MyEle.innerHTML = MyDis;
	X = MyEve.pageX + 20;
	MyEle.style.left = X + "px";
	if((window.innerWidth - X) < MyEle.offsetWidth)
	{
		X = (window.innerWidth - (MyEle.offsetWidth + 24));
		MyEle.style.left = X + "px";
	}
	MyEle.style.top = MyEve.pageY + 5 + "px";
	if((MyEve.pageY + MyEle.offsetHeight + 2) > (window.pageYOffset + window.innerHeight)) {
		if(((window.innerWidth - X) < (MyEle.offsetWidth + 24)) && ((MyEve.pageY + MyEle.offsetHeight + 2) > (window.pageYOffset + window.innerHeight))) {
			MyEle.style.left = (window.innerWidth - (MyEle.offsetWidth + 20)) + "px";
			MyEle.style.top = MyEve.pageY - 20 - MyEle.offsetHeight + "px";
			if((MyEve.pageY - 20 - MyEle.offsetHeight) < window.pageYOffset) {
				MyEle.style.top = window.pageYOffset + 5 + "px";
				MyEle.style.left = 5 + "px";
			}
			else {
				MyEle.style.top = MyEve.pageY - (MyEle.offsetHeight + 20) + "px";
			}
		}
		else {
			MyEle.style.top = ((window.pageYOffset + window.innerHeight) - (MyEle.offsetHeight + 20)) + "px";
		}
	}
	MyEle.style.visibility = "visible";
endtrace("hlMO");
}

function omc(u,d)
{
trace("omc");	
	location='mailto:' + u + '@' + d;
endtrace("omc");	
}

function hlOff()
{
trace("hlOff");	
	if(document.all && navigator.userAgent.indexOf("Opera")==-1) {
		document.all.HLie.filters.revealTrans.Transition = MyFil;
		document.all.HLie.filters.revealTrans.Apply();
		document.all.HLie.style.visibility = "hidden";
		document.all.HLie.filters.revealTrans.Play();
		MyFil++;
		if(MyFil == 24) MyFil = 0;
	}
	else if(document.getElementById) {
		MyEle=document.getElementById("HLnn");
		MyEle.style.visibility = "hidden";
	}
endtrace("hlOff");	
}

var popwin = null;

function PopWin(DocID,WinX,WinY,WinP)
{
trace("popwin");		
	if(popwin) {
		if(!popwin.closed) popwin.close();
	}
	switch(WinP) { 
		case "w":	//centered in opener window
			popwin = window.open(DocID,"PopUpWin","dependent=1,scrollbars=1,width=" + WinX + ",height=" + WinY + ",left=" + (((document.body.clientWidth/2)-(WinX/2))+self.screenLeft) + ",top=" + (((document.body.clientHeight/2)-(WinY/2))+self.screenTop));
		break;
		default:	//centered in screen
			popwin = window.open(DocID,"PopUpWin","dependent=1,scrollbars=1,width=" + WinX + ",height=" + WinY + ",left=" + ((screen.availWidth/2)-(WinX/2)) + ",top=" + ((screen.availHeight/2)-(WinY/2)));
		break;
	}
endtrace("popwin");	
}

function ImgOn(ImgName, WinText)
{
trace("ImgOn");		
	if(document.images) {
		document[ImgName].src = eval(ImgName + "_h.src");
	}
	window.status = WinText;
endtrace("ImgOn");
}

function ImgOff(ImgName)
{
trace("ImgOff");	
	if(document.images) {
		document[ImgName].src = eval(ImgName + ".src");
	}
	window.status = '';
endtrace("ImgOff");	
}

/* used in /focus/00777 */
function cfe()
{
trace("cfe");		
	if(top == self) {
		var MyPage = unescape(window.location.pathname);
		if((MyPage.indexOf('/') == 0) && (MyPage.indexOf('?') == -1)){
			var SetCont = "/cgi-local/sfe?p=" + MyPage;
			location.href = SetCont;
		}
	}
endtrace("cfe");	
}

/* used in x-files */
function pc(MyDiv,MyWid)
{
trace("pc");		
	if(document.layers) {
		if(document.cp.clip.height < window.innerHeight) {
			MyOff = ((window.innerWidth - (window.innerWidth * MyWid)) / 2 );
			document.cp.left = (MyOff + ((window.innerWidth / 2) - (document.cp.clip.width / 2)));
			document.cp.pageY = ((window.pageYOffset + (window.innerHeight / 2)) - (document.cp.clip.height / 2)); 
		}
	}
	else if(document.all) {
		if(document.all.cp.offsetHeight < document.body.clientHeight) {
			MyOff = ((document.body.clientWidth - (document.body.clientWidth * MyWid)) / 2 );
			document.all.cp.style.left = (MyOff + ((document.body.clientWidth / 2) - (document.all.cp.offsetWidth / 2)));
			document.all.cp.style.top = ((document.body.scrollTop + (document.body.clientHeight / 2)) - (document.all.cp.offsetHeight / 2));
		}
	}
	else if(document.getElementById) {
		MyEle=document.getElementById(MyDiv);
		if(MyEle.offsetHeight < window.innerHeight) {
			MyOff = ((window.innerWidth - (window.innerWidth * MyWid)) / 2 );
			MyEle.style.left = (MyOff + ((window.innerWidth / 2) - (MyEle.offsetWidth / 2)));
			MyEle.style.top = ((window.pageYOffset + (window.innerHeight / 2)) - (MyEle.offsetHeight / 2));
		}
	}
endtrace("pc");
}
