
function openFullscreen(sURL,sName){
	var padding = 10;
	var width	= screen.availWidth - padding;
	var height	= screen.availHeight - padding - 50; //make room for status bar
	var yes		= 1;
	var windowprops	= 'scrollbars=1,resizable=1,,status=1,width=' + width + ',height=' + height + ',top=0,left=0';
	window.oChildWin = window.open(sURL,sName, windowprops)
}
function openApplicationWindow(courseName, courseID) {
	var w = (790);
	var h = (564);
	var t = ((screen.height - h) / 2);
	var l = ((screen.width - w) / 2);
	var popup;
	if (courseID.length > 0) {
		if (parseInt(courseID) != 2796) {
			popup = window.open('/20/FrameSet.aspx?CID='+courseID,'BEAppWin','height='+h+',width='+w+',top='+t+',left='+l+',toolbar=no,menubar=no,status=yes,location=no,scrollbars=yes,resizable=yes');
		} else {
			popup = window.open('https://www.betraining.com/20/FrameSet.aspx?CID='+courseID,'BEAppWin','height='+h+',width='+w+',top='+t+',left='+l+',toolbar=no,menubar=no,status=yes,location=no,scrollbars=yes,resizable=yes');
		}
	} else {
		if (courseName != 'vnbwnj') {
			popup = window.open('/20/FrameSet.aspx?CN='+courseName,'BEAppWin','height='+h+',width='+w+',top='+t+',left='+l+',toolbar=no,menubar=no,status=yes,location=no,scrollbars=yes,resizable=yes');
		} else {
			popup = window.open('https://www.betraining.com/20/FrameSet.aspx?CN='+courseName,'BEAppWin','height='+h+',width='+w+',top='+t+',left='+l+',toolbar=no,menubar=no,status=yes,location=no,scrollbars=yes,resizable=yes');
		}
	}
	
	return popup;
}
function redirectLegacyApplication(url) {
	parent.document.location = url;
}
function openCertificateWindow(courseID,score,name,course,bank) {
	var w = (790);
	var h = (564);
	var t = ((screen.height - h) / 2);
	var l = ((screen.width - w) / 2);
	if (courseID) 
		window.open('/20/CI/PrintCertificate.aspx?PID='+courseID,'BECertWin','height='+h+',width='+w+',top='+t+',left='+l+',toolbar=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=yes');
	else
		window.open('printcert.html?score='+score+'&name='+name+'&course='+course+'&bank='+bank,'BECertWin','height='+h+',width='+w+',top='+t+',left='+l+',toolbar=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=yes');
}
function openDisclaimerWindow(organizationID) {
	var w = (300);
	var h = (200);
	var t = ((screen.height - h) / 2);
	var l = ((screen.width - w) / 2);
	window.open('/20/Disclaimer.aspx?O='+organizationID,'BEDiscWin','height='+h+',width='+w+',top='+t+',left='+l+',toolbar=no,menubar=no,status=no,location=no,scrollbars=no,resizable=no');
}
function openHelpWindow() {
	var customerID = '<%@Session["sessionBankID"]%>';
	var w = (790);
	var h = (564);
	var t = ((screen.height - h) / 2);
	var l = ((screen.width - w) / 2);
	
	if (customerID == "2858")
		appWin = window.open('/Robo/Projects/CI/coursehelp/Customer/AtchleyGlossary.htm','BEHelpWin','height='+h+',width='+w+',top='+t+',left='+l+',toolbar=no,menubar=no,status=no,location=no,scrollbars=yes');
	else
		appWin = window.open('/Robo/Projects/CI/coursehelp/Course_Help.htm#The_Main_Menu.htm','BEHelpWin','height='+h+',width='+w+',top='+t+',left='+l+',toolbar=no,menubar=no,status=no,location=no,scrollbars=yes');
}
function openPasswordWindow() {
	var w = (350);
	var h = (350);
	var t = ((screen.height - h) / 2);
	var l = ((screen.width - w) / 2);
	appWin = window.open('/20/ChangePassword.aspx','BEChangePassword','height='+h+',width='+w+',top='+t+',left='+l+',toolbar=no,menubar=no,status=no,location=no,scrollbars=no');
}
function openPrintWindow(f, o) {
	var w = (781);
	var h = (450);
	var t = ((screen.height - h) / 2);
	var l = ((screen.width - w) / 2);
	appWin = window.open('/20/CI/CourseReport.aspx?F='+f+'&O='+o,'BECourseReport','height='+h+',width='+w+',top='+t+',left='+l+',toolbar=no,menubar=no,status=yes,location=no,scrollbars=yes');	
}
/*CourseMenu.aspx rollover content functions*/
function showShortCourseName(div,text) {
	var myTitleDiv = document.getElementById("course"+div);
	tempCourseTitle = myTitleDiv.innerHTML;
	//alert(text);
	myTitleDiv.innerHTML = text;
}
function showFullCourseName(div,text) {
	var myTitleDiv = document.getElementById("course"+div);
	tempCourseTitle = myTitleDiv.innerHTML;
	myTitleDiv.className = 'full_name';
	myTitleDiv.innerHTML = text;
	document.getElementById("duedate"+div).style.display = 'none';
	document.getElementById("comments"+div).style.display = 'none';
	//myTitleDiv.className = 'full_name';
}
function hideFullCourseName(div) {
	var myTitleDiv = document.getElementById("course"+div);
	myTitleDiv.className = 'course';
	myTitleDiv.innerHTML = tempCourseTitle;
	document.getElementById("duedate"+div).style.display = 'inline';
	document.getElementById("comments"+div).style.display = 'inline';
}
function showPopUpDiv(id,text,class_name) {
	var myPopUpDiv = document.getElementById("popup"+id);
	myPopUpDiv.style.display = "block";
	myHTML = "<div class=\"popupStyle\"><DIV STYLE=\"position:relative; width:340px; height:21px; background-image:URL(../images/layout/base/course.home.header.gif);\">";
	myHTML += "<div style=\"color:white; font-size:11px; font-family:verdana;font-weight:bold;position:absolute;top:3px;left:10px;\">Course Comment</div>";
	myHTML += "</DIV>";
	myHTML += "<DIV STYLE=\"position:relative; width:338px; background-color:#fff; border:1px solid #aaa;\">";
	myHTML += "<div style=\"padding:10px;\">";
	myHTML += "	<DIV id=\"popupText\" align=\"left\" STYLE=\"position:relative; width:318px; color:black; font-size:11px; font-family:verdana;\">";
	myHTML += "<p>"+text+"</p></DIV></div></DIV></div></div>";
	myPopUpDiv.innerHTML = myHTML;
	//alert(id+":"+text+":"+class_name);
}
function hidePopUpDiv(id) {
	var myPopUpDiv = document.getElementById("popup"+id);
	myPopUpDiv.style.display = "none";
}
function sortCourseMenu(order, filter, cid, uid) {
	document.location = 'CourseMenu.aspx?CID='+cid+'&UID='+uid+'&F='+filter+'&O='+order;
}

var defaultProgressBar = "Course Progress:&nbsp;";
var timerDiv = null; 
var timerID = null; 
var timerOn = false; 
var timecount = 500;

function doJunk(div) {
	var changeme = document.getElementById("changeme");
	if (div == 'x') {
		changeme.innerHTML = defaultProgressBar;
		timerOn = false;
	} else {
		changeme.innerHTML = CourseTree.sections[div].title+":&nbsp;";
		stopTime();
	}
}
function dontDoJunk(div) { 
	 if (timerOn == false) {
		 timerID=setTimeout( "doJunk('x')" , timecount); 
		 timerOn = true;
	 }  
}
function stopTime() { 
	 if (timerOn) { 
		clearTimeout(timerID); 
		timerID = null; 
		timerOn = false;
	 } 
}
function sectionClick(index) {
	TopFrame.toggleItemDisplay('sectionName','block');
	Navigator.index.section = index;
	Navigator.index.subsection = 0;
	Navigator.index.page = 0;
	// TopFrame.toggleItemDisplay('subNav','block');
	// TopFrame.createTabs();
	Navigator.updatePosition(Navigator.index.section, Navigator.index.subsection, Navigator.index.page);
	if (Navigator.getCurrentSection().id == 'posttest') {
		parent.frames[2].toggleItemDisplay('CurveRight', 'none');
		parent.frames[2].toggleItemDisplay('Back', 'none');
		parent.frames[2].toggleItemDisplay('pageInfo', 'none');
		parent.frames[2].toggleItemDisplay('Next', 'none');
	}
}
function drawProgressBar() {
	myProgress = '<span class="sectionLabel" id="changeme">Course Progress:&nbsp;</span><span class="sectionIcons">';
	myLockTest = false;
	for (x=0;x<CourseTree.sections.length;x++) {
		var section = CourseTree.sections[x];
		myStatus = "not.started";
		myIcon = "";
		if (section.id == 'posttest')
			myIcon = "test.";
		myWidth = "12";
		if (section.id == 'posttest' || section.id == 'pretest') {
			myIcon = "test.";
			myWidth = "14";
		}
		myLink = "sectionClick("+x+")";
		if (section.isStarted() || (section.id == 'pretest' && State.read("pretest"+CourseTree.id) != null) || (section.id == 'posttest' && State.read("posttest"+CourseTree.id) != null)) myStatus = "started";
		if (Parameters.isSectionRequired(section) & !section.isCompleted()) {
			myStatus = "required";
			myLockTest = true;
		}
		if (section.isCompleted()) {
			myStatus = "completed";
		}
		if (section.id == 'posttest' && myLockTest == true && myStatus != "completed") {
			myStatus = "locked";
			section.enabled = false;
			myLink = "void(0)";
		}
		if (Navigator.getCurrentSection())
			if (section.id == Navigator.getCurrentSection().id)
				myStatus = 'current';
		myProgress += '<a href="javascript:'+myLink+';" onmouseover="doJunk('+x+');" onmouseout="dontDoJunk();">';
		myProgress += '<img src="../../images/layout/base/progress/progress.'+myIcon+myStatus+'.gif" width="'+myWidth+'" height="20" align="middle" border="0">';
		myProgress += '</a>';
		if (x != CourseTree.sections.length - 1) myProgress += '<img src="../../images/layout/base/progress/white.spot.gif" width="8" height="2" align="middle" border="0">';
	}
	myProgress += '</span>';
	document.getElementById("progressBar").innerHTML = myProgress;
}