
function displayHelp(message) {
	self.status = message;
	return true;
}

// ##### START OF CIBC WG Confidentiality Agreement #####
// Respond to the click on a research document.
// Check that a cookie called 'CIBCWG_Confidentiality' was set.
// If it has been set, go straight to the research document.
// Otherwise, display the Confidentiality Agreement.
// If the user clicks 'Yes' to the agreement, prompt the user for
// a userid and password and record the user's reponse in the 
// confidentiality log; then go to the research document.
// If the user clicks 'No' to the agreement, do nothing.
function checkClick(myDocumentURL, cgiDir) {

	//alert("myDocumentURL is: " + myDocumentURL + " cgiDir is: " + cgiDir);

	if (getCookie("CIBCWG_Confidentiality") == "Yes")
	{
		// display the research document
		window.location.href = myDocumentURL;
	}
	else
	{
		// define the text string which makes up the Confidentiality Agreement
		var confidIntro="Confidentiality Agreement\n\nThis is an agreement between CIBC World Markets Inc.(\"CIBC WM\") and You.\nIn consideration of being given access to information on this Web site considered confidential by CIBC WM, You agree as follows:\n\n"
		var confidPoint1="1. \"Confidential Information\" means a User Identification Code and Password which may be used by You to access CIBC WM's Research Web site.\n";
		var confidPoint2="2. Your User Identification Code and Password may only be used by You on a single computer or terminal at any one time.  You will\n(i) hold the User Identification Code and Password in trust and strict confidence,\n(ii) not disclose or otherwise make available the User Identification Code and Password to anyone.\n";
		var confidPoint3="3. If You become aware that your User Identification Code and Password is being used by a third party, You will inform CIBC WM immediately.\n";
		var confidPoint4="4. CIBC WM may at any time require You to cease use of the User Identification Code and Password.\n";
		var confidPoint5="5.  Your acceptance of this agreement (signified by clicking on the \"Yes\" button below), will be electronically recorded and stored by CIBC WM. \n";
		var confidPoint6="6. This agreement is governed by the laws of the Province of Ontario and may be amended only by an agreement in writing.\n\n";
		var confidAgree="Do you accept the terms of the above agreement ?\n";

		// display the Confidentiality Agreement
		if (confirm(confidIntro + confidPoint1 + confidPoint2 + confidPoint3 +
					confidPoint4 + confidPoint5 + confidPoint6 + confidAgree))

		{
			// reset the cookie time (in milliseconds) to 180 days later
			var expiry = new Date();

			expiry.setTime(expiry.getTime() + 180 * 24 * 60 * 60 * 1000);
			setCookie("CIBCWG_Confidentiality", "Yes", expiry);

			// record acceptance of the Confidentiality agreement and
			// then display the research document
			window.location.href = cgiDir + "/recordResearchConfid?" + myDocumentURL;
		}
	}
}

// store a cookie value for a given name, value, and date, for the whole site
function setCookie(name, value, expiry)
{
	var expiryDate = expiry.toGMTString();
	document.cookie = name + "=" + value + "; expires=" + expiryDate +
						"; path=/";
}

// return a cookie value for a given name
function getCookie(name)
{
	var start, end;

	start = document.cookie.indexOf(name + "=");
	if (start < 0)
		return "";
	start += name.length + 1;
	end = document.cookie.indexOf(";", start);
	if (end < 0)
		return(document.cookie.substring(start,document.cookie.length));
	else
		return(document.cookie.substring(start,end));
}
// ##### END OF CIBC WG Confidentiality Agreement #####

