

var userHasScrolled = false;
var currentHelpHTML = '';

function vid_done() {
	//alert('done');
	// in Gecko browsers, calling the hide function directly from Flash object crashes browser... instead
	//	set timeout
	//HideHelpBox();
	setTimeout('HideHelpBox();',100);
}
function vid_close() {
	//alert('you asked me to close');
	// in Gecko browsers, calling the hide function directly from Flash object crashes browser... instead
	//	set timeout
	//HideHelpBox();
	setTimeout('HideHelpBox();',100);
}

function UserScrolled() {
	// call from onScroll event, etc. to use to prevent help if something (scrolling) has already been done
	userHasScrolled = true;
}

function LaunchHelpBox(inMode, inHTML) {
	// only ShowHelpBox if able to set and read cookie... we're limiting these from showing up all the time 
	//	by setting cookies... so if can't set one, user might see this over and over on the same day
	
	if (TestForCookies() == true) {
		// for behavior-specific filtering, add call to event handler... if inMode is "not_if_scrolled", then
		//	do nothing if userHasScrolled set to true
		switch (inMode) {
			case 'not_if_scrolled':
				// only launch if user hasn't scrolled
				if (userHasScrolled == false) {
					ShowHelpBox('', inHTML);
				}
				break;
			default:
				ShowHelpBox('', inHTML);
				break;
		}
	}
}

function TestForCookies() {
	var cookieTest = false;
	var cookieName = 'cookietest';
	document.cookie = cookieName + '=yes;';
	var cookieVals = '' + document.cookie;
	var testCookieIndexStart = cookieVals.indexOf(cookieName);
	if (testCookieIndexStart == -1) {
		// do nothing 
	}
	else {
		var testCookieIndexEnd = cookieVals.indexOf(';',testCookieIndexStart);
		if (testCookieIndexEnd == -1) {
			testCookieIndexEnd = cookieVals.length; 
		}
		var testCookieValue = '';
		testCookieValue = unescape(cookieVals.substring(testCookieIndexStart + cookieName.length + 1, testCookieIndexEnd));
		if (testCookieValue == 'yes') {
			cookieTest = true;
		}
	}
	
	if (cookieTest == true) {
		return true;
	}
	else {
		return false;
	}
}

function HideHelpBox() {
	var helpBox = GetObject('helpbox');
	var helpShell = GetObject('helpshell');
	
	SwitchFilterTrans('helpshell', '0');
	helpShell.innerHTML = '';
	helpShell.style.display = 'none';
	
	helpBox.style.display = 'none';
}

function SwitchFilterTrans(inObj, inTransType) {
	var theObj = GetObject(inObj);
	if (document.all &&! window.opera) {
		theObj.style.filter = 'revealTrans(duration=0.5, transition=' + inTransType +')';
	}
}

function ShowHelpBox(inCase, inHTML) {
	var helpBox = GetObject('helpbox');
	var helpShell = GetObject('helpshell');

	helpBox.style.display = 'block';
	helpShell.style.display = 'block';
	helpShell.innerHTML = '';
	
	SwitchFilterTrans('helpshell', '0'); 
	PrintActiveContent('helpshell',inHTML);
}
