var imgSrc = "http://www.mcgrawhill.ca/college/olcsupport/mcshane6e/selfassess/";
// ---------------------------------------
var ansWin = null;
var qCount = 16;
// ---------------------------------------
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 = "" + "8";
var rlabel = "" + "40";
var top1 = "Low<br>individualism<br>8-22"
var top2 = "Moderate<br>individualism<br>23-30"
var top3 = "High<br>individualism<br>31-40"
var rsp = "";
rsp += BeginPage();
rsp += GetFeedback0();
rsp += MakeTable(8,40,totals[1],llabel,rlabel,top1,top2,top3,15,8,9);
rsp += GetFeedback1();
var top1 = "Low<br>collectivism<br>8-22"
var top2 = "Moderate<br>collectivism<br>23-30"
var top3 = "High<br>collectivism<br>31-40"
rsp += MakeTable(8,40,totals[2],llabel,rlabel,top1,top2,top3,15,8,9);
rsp += GetFeedback2();
rsp += EndPage();
WriteResponse(rsp);
return false;
}
// ---------------------------------------
function GetFeedback0() {
var winCode = "<h3 class=\"explanation\">Understanding Your Score on the Individualism-Collectivism Scale</h3><p>This self-assessment estimates your level of individualism and collectivism. At one time, experts thought that these two cross-cross-cultural values were opposites. Now, we understand that they represent separate values that are generally unrelated to each other. Each scale has a potential score ranging from 8 to 40 points. Higher scores indicate that the person has a higher level of each cross-cultural value.</p><hr noshade size=\"1\">\n";
return winCode
}
// ---------------------------------------
function GetFeedback1() {
var winCode = "<p><b>Individualism</b><br>Individualism refers to the extent that you value independence and personal uniqueness. Highly individualist people value personal freedom, self-sufficiency, control over their own lives, and appreciation of their unique qualities that distinguish them from others. The following graph shows the range of individualism in general. However, keep in mind that the average level of individualism is higher in some cultures (such as Canada) than in others.</p><hr noshade size=\"1\">\n";
return winCode
}
// ---------------------------------------
function GetFeedback2() {
var winCode = "<p><b>Collectivism</b><br>Collectivism refers to the extent that we value our duty to groups to which we belong, and to group harmony. Highly collectivist people define themselves by their group membership and value harmonious relationships within those groups. The following graph shows the range of collectivism in general. However, keep in mind that the average level of collectivism is lower in some cultures (such as Canada) than in others.</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
}
