var imgSrc = "http://www.mcgrawhill.ca/college/olcsupport/mcshane6e/selfassess/";
// ---------------------------------------
var ansWin = null;
var qCount = 30;
// ---------------------------------------
function WriteResponse(content) {
if (ansWin && !ansWin.closed) {
	ansWin.close()
}
ansWin = window.open("","","toolbar=NO,location=NO,resizable,scrollbars,width=650,height=450");
ansWin.document.write(content);
ansWin.document.close();
}
// ---------------------------------------
function GradeAssess(theForm) {
// add all the values
var choices = new Array(7);
choices[0] = "";
choices[1] = "Realistic";
choices[2] = "Investigative";
choices[3] = "Artistic";
choices[4] = "Social";
choices[5] = "Enterprising";
choices[6] = "Conventional";
var occup = new Array(31);
occup[0] = "";
occup[1] = "Actuary";
occup[2] = "Archeologist";
occup[3] = "Buyer";
occup[4] = "Computer operator";
occup[5] = "Corporate executive";
occup[6] = "Corporate trainer";
occup[7] = "Dietitian";
occup[8] = "Economist";
occup[9] = "Elementary school teacher";
occup[10] = "Fashion model";
occup[11] = "Fire fighter";
occup[12] = "Foreign exchange trader";
occup[13] = "Jeweler";
occup[14] = "Life insurance agent";
occup[15] = "Lobbyist";
occup[16] = "Mathematics teacher";
occup[17] = "Medical illustrator";
occup[18] = "Minister/Priest/Rabbi";
occup[19] = "Pediatrician";
occup[20] = "Pharmacist";
occup[21] = "Pilot";
occup[22] = "Production manager";
occup[23] = "Professional athlete";
occup[24] = "Public relations director";
occup[25] = "Recreation leader";
occup[26] = "School administrator";
occup[27] = "Sculptor";
occup[28] = "Tax auditor";
occup[29] = "Veterinarian";
occup[30] = "Wine maker";
var correct = new Array(31);
correct[0] = "";
correct[1] = "Conventional";
correct[2] = "Investigative";
correct[3] = "Enterprising";
correct[4] = "Conventional";
correct[5] = "Enterprising";
correct[6] = "Artistic";
correct[7] = "Social";
correct[8] = "Investigative";
correct[9] = "Social";
correct[10] = "Artistic";
correct[11] = "Realistic";
correct[12] = "Enterprising";
correct[13] = "Realistic";
correct[14] = "Enterprising";
correct[15] = "Enterprising";
correct[16] = "Conventional";
correct[17] = "Artistic";
correct[18] = "Social";
correct[19] = "Investigative";
correct[20] = "Investigative";
correct[21] = "Realistic";
correct[22] = "Conventional";
correct[23] = "Realistic";
correct[24] = "Artistic";
correct[25] = "Social";
correct[26] = "Social";
correct[27] = "Artistic";
correct[28] = "Conventional";
correct[29] = "Investigative";
correct[30] = "Realistic";
var feedback = "<blockquote><table border=\"0\" cellpadding=\"4\" cellpadding=\"0\"><tr valign=\"top\"><td><b>Occupation</b></td><td><b>Correct answer</b></td><td><b>Your answer</b></td></tr>";
var cntlname; var cont; var atotal = 0;
for (var i = 0; i < qCount; i++) {
	cntlname = "pd"+ (i+1);
	cont = theForm[cntlname].options[theForm[cntlname].selectedIndex].value;
	if (cont == 99) {
		alert("One or more questions are unanswered. Please complete the form and try again.");
		return false;
	}
	feedback += "<tr valign=\"top\"><td>" + occup[i+1] + "</td>";
	feedback += "<td>" + correct[i+1] + "</td>";
	if (cont == 0) {
		feedback += "<td><strike>" + choices[theForm[cntlname].selectedIndex] + "</strike></td>";
	} else {
		feedback += "<td></td>";
	}
	feedback += "</tr>";
	atotal += (cont/1);
}
feedback += "</table></blockquote>";
var llabel = "" + "0";
var rlabel = "" + "30";
var top1 = "Low score<br>0-10"
var top2 = "Moderate score<br>11-20"
var top3 = "High score<br>21-30"
var rsp = "";
rsp += BeginPage();
rsp += MakeTable(0,30,atotal,llabel,rlabel,top1,top2,top3,11,10,9);
rsp += GetFeedback1();
rsp += feedback;
rsp += EndPage();
WriteResponse(rsp);
return false;
}
// ---------------------------------------
function GetFeedback1() {
var winCode = "<hr noshade size=\"1\"><h3 class=\"explanation\">Understanding Your Score on the Holland Career Types Scale</h3><p>The Holland Career Types Scale gives you feedback on how well you can match Holland's six different types of work environments with the corresponding occupations. This ability to match occupations with environments is very useful as you try to determine which jobs best suit your personality. Commercial self-assessments are available to help you estimate the Holland types that relate to your personality. Then, you need to determine whether as specific job is compatible with that Holland type.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Scores on the scale can range from 0 to 30, indicating the number of occupations that you correctly matched to the corresponding Holland type. The average score for a typical class of business students is 18.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Following is a table of the correct answers, incorrect choices shown alongside.</p>\n";
return winCode
}
// ---------------------------------------
function MakeTable(datamin,datamax,dscore,ll,lr,lt1,lt2,lt3,bl1,bl2,bl3) {
// bl1 + bl2 + bl3 should equal spread
var spread = datamax - datamin;
var maxwidth = 550;
var dfactor = (maxwidth - (maxwidth%spread))/spread;
var gwidth = spread * dfactor;
var gscore = (dscore - datamin) * dfactor;
var ptrloc = gscore - 7;
var ptricon;
if ( (ptrloc) < 0 ) {
	ptricon = "redpointerleft.gif\" width=\"8\"";
	ptrloc = gscore
} else {
	if ( (ptrloc + 15) > gwidth ) {
		ptricon = "redpointerright.gif\" width=\"8\"";
		ptrloc = gscore - 8
	} else {
		ptricon = "redpointer.gif\" width=\"15\""
	}
}
// var padder = 0;
var bar1 = bl1*dfactor;
var bar2 = bl2*dfactor;
var bar3 = gwidth - (bar1 + bar2);
var winCode = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\"><tr valign=\"bottom\"><td></td><td></td><td width=\"" + gwidth + "\" align=\"center\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr valign=\"bottom\" align=\"center\"><td class=\"smlabel\" width=\"33%\">" + lt1 + "</td><td class=\"smlabel\" width=\"34%\">" + lt2 + "</td><td class=\"smlabel\" width=\"33%\">" + lt3 + "</td></tr></table></td><td></td><td></td></tr><tr valign=\"bottom\"><td rowspan=\"2\" align=\"right\" valign=\"middle\" class=\"smlabel\">" + ll + "</td><td align=\"right\"><img src=\"" + imgSrc + "whitespacer.gif\" width=\"4\" height=\"1\"><img src=\"" + imgSrc + "blackspacer.gif\" width=\"1\" height=\"25\"></td><td nowrap align=\"center\"><img src=\"" + imgSrc + "grayspacer.gif\" width=\"" + bar1 + "\" height=\"10\"><img src=\"" + imgSrc + "blackspacer.gif\" width=\"" + bar2 + "\" height=\"10\"><img src=\"" + imgSrc + "grayspacer.gif\" width=\"" + bar3 + "\" height=\"10\"></td><td><img src=\"" + imgSrc + "blackspacer.gif\" width=\"1\" height=\"25\"><img src=\"" + imgSrc + "whitespacer.gif\" width=\"4\" height=\"1\"></td><td rowspan=\"2\" valign=\"middle\" class=\"smlabel\">" + lr + "</td></tr><tr valign=\"top\"><td align=\"right\"><img src=\"" + imgSrc + "whitespacer.gif\" width=\"4\" height=\"1\"><img src=\"" + imgSrc + "blackspacer.gif\" width=\"1\" height=\"20\"></td><td nowrap valign=\"bottom\"><img src=\"" + imgSrc + "whitespacer.gif\" width=\"" + ptrloc + "\" height=\"1\"><img height=\"12\" src=\"" + imgSrc + ptricon + "></td><td><img src=\"" + imgSrc + "blackspacer.gif\" width=\"1\" height=\"20\"><img src=\"" + imgSrc + "whitespacer.gif\" width=\"4\" height=\"1\"></td></tr></tr></table>";
winCode += "<p align=\"center\"><font color=\"#cc0000\"><b>Your score was " + dscore + ".</b></font> The range of possible scores is from " + datamin + " to " + datamax + ".</p>";
return winCode
}
// ---------------------------------------
function BeginPage() {
var winCode = "<html><head><title>Organizational Behaviour Self-Assessment Exercises</title>\n<link type=\"text/css\" href=\"" + imgSrc + "css.css\" rel=\"stylesheet\">\n";
winCode += "<script language=\"JavaScript\">\n<!--\n// ---------------------------\n";
winCode += "function printScreen(){\nif (window.print) {\n window.print();\n} else {\n alert(\"Your browser does not support printer links embedded within a web page. PC users, however, can right-click within the window and a popup menu will appear from which you can print. Macintosh users can access a similar menu by holding down the mouse for several seconds.\");\n}\n}\n";
winCode += "//-" + "->\n</script>\n</head>\n";
winCode += "<body bgcolor=\"#ffffff\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n<tr><td bgcolor=\"#000000\"><font size=\"4\">&nbsp;</font></td></tr>\n</table>\n<table border=\"0\" width=\"100%\" cellpadding=\"20\" cellspacing=\"0\">\n<tr valign=\"top\"><td>\n\n";
return winCode
}
// ---------------------------------------
function EndPage() {
var winCode = "\n\n<p class=\"footer\"><hr noshade size=\"1\" />\n<font face=\"Symbol\" color=\"ff0000\">&#168;</font> <a href=\"javascript:printScreen()\"><b>Print Screen</b></a>\n</p>\n<p class=\"footer\"><a href=\"mailto:highered_web@mcgrawhill.ca\">Comments or questions?</a><br>Copyright &copy; 2004 McGraw-Hill Ryerson Limited<br>&nbsp;</p></td></tr></table></body></html>";
return winCode
}
