var imgSrc = "http://www.mcgrawhill.ca/college/olcsupport/mcshane6e/selfassess/";
// ---------------------------------------
var ansWin = null;
var qCount = 12;
// ---------------------------------------
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 cntlname; var cntlname2; var cont; var cont2;
// currently supports 2 categories
var totals = new Array(3);
totals[0] = 0;
totals[1] = 0;
totals[2] = 0;
for (var i = 0; i < qCount; i++) {
	cntlname2 = "Q" + (i+1) + "Cat";
	cont2 = theForm[cntlname2].value;
	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;
	}
	totals[cont2] += (cont/1);
}
var llabel = "" + "6";
var rlabel = "" + "42";
var top1 = "Low affective<br>commitment<br>6-19"
var top2 = "Below average<br>20-27"
var top3 = "Average<br>28-31"
var top4 = "Above average<br>32-36"
var top5 = "High affective<br>commitment<br>37-42"
var rsp = "";
rsp += BeginPage();
rsp += GetFeedback0();
rsp += MakeTable(6,42,totals[1],llabel,rlabel,top1,top2,top3,top4,top5,14,8,4,5,5);
rsp += GetFeedback1();
top1 = "Low continuance<br>commitment<br>6-12"
top2 = "Below average<br>13-20"
top3 = "Average<br>21-25"
top4 = "Above average<br>26-31"
top5 = "High continuance<br>commitment<br>32-42"
rsp += MakeTable(6,42,totals[2],llabel,rlabel,top1,top2,top3,top4,top5,7,8,5,6,10);
rsp += GetFeedback2();
rsp += EndPage();
WriteResponse(rsp);
return false;
}
// ---------------------------------------
function GetFeedback0() {
var winCode = "<h3 class=\"explanation\">Understanding Your Score on the School Commitment Scale</h3><p>This scale measures both affective commitment and continuance commitment toward your school.</p><hr noshade size=\"1\">\n";
return winCode
}
// ---------------------------------------
function GetFeedback1() {
var winCode = "<p><b>Affective commitment</b><br>Affective commitment refers to a person's emotional attachment to, identification with, and involvement in a particular organization. In this scale, the organization is the school where you are attending as a student. Scores on this scale range from 6 to 42. A higher score indicates a higher level of affective commitment.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;How does your score compare with others? Ideally, you would compare your score with the collective results of other students in your class, but this might not be possible. Alternatively, the graph provides a more general estimate of high and low affective commitment based on a sample of Canadian employees.</p><hr noshade size=\"1\">\n";
return winCode
}
// ---------------------------------------
function GetFeedback2() {
var winCode = "<p><b>Continuance commitment</b><br>Continuance commitment occurs when employees believe it is in their own personal interest to remain with the organization. People with a high continuance commitment have a strong calculative bond with the organization. In this scale, the organization is the school where you are attending as a student.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;How does your score compare with others? Ideally, you would compare your score with the collective results of other students in your class, but this might not be possible. Alternatively, the graph provides a more general estimate of high and low continuance commitment based on a sample of Canadian employees.</p>\n";
return winCode
}
// ---------------------------------------
function MakeTable(datamin,datamax,dscore,ll,lr,lt1,lt2,lt3,lt4,lt5,bl1,bl2,bl3,bl4,bl5) {
// bl1 + bl2 + bl3 should equal spread
var spread = datamax - datamin;
var maxwidth = 600;
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 = bl3*dfactor;
var bar4 = bl4*dfactor;
var bar5 = gwidth - (bar1 + bar2 + bar3 + bar4);
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=\"20%\">" + lt1 + "</td><td class=\"smlabel\" width=\"20%\">" + lt2 + "</td><td class=\"smlabel\" width=\"20%\">" + lt3 + "</td><td class=\"smlabel\" width=\"20%\">" + lt4 + "</td><td class=\"smlabel\" width=\"20%\">" + lt5 + "</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\"><img src=\"" + imgSrc + "blackspacer.gif\" width=\"" + bar4 + "\" height=\"10\"><img src=\"" + imgSrc + "grayspacer.gif\" width=\"" + bar5 + "\" 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
}
