//replacement regular expressions var expUpToPage = /^.*page/i; var expAOrB = /(a|b)$/i; var lessonCompleted = false; var currentLessonPage; var popupWindowContents = ""; var popupWin = null; var isNav = (document.all) ? false: true; var childRef; if(parent.frames.lessonFrame != null) childRef = eval("parent.frames.lessonFrame"); //Called by User in Lesson Page, used to retrieve the MODULE name to be written to the title area function txtModuleName() { return objLessonModule.moduleName; } //Called by User in Lesson Page, used to retrieve the CopyRight statement function txtCopyRight() { var theReturn = (copyright != "") ? copyright: " "; return theReturn; } //Called by User in Lesson Page, used to retrieve the PAGE name to be written to the subtitle area function txtTitleLabel() { var pageNum = getPageNum(); var theReturn; if(pageNum <= topPage) theReturn = (pageNum < objLessonModule.pages.length) ? objLessonModule.pages[pageNum].pageName: "Registration"; else theReturn = "Registration"; return theReturn; } //OBJECT: Lesson Object created by USER in inc_ModuleInfo function objLesson(txtModuleName) { this.moduleName = txtModuleName; this.pages = new Array(); this.theStatus = "incomplete"; this.getStatus = checkStatus; this.setCurrentPageCompletion = compPage; this.addPage = setPage; this.isCompleted = false; } //OBJECT: Lesson Page Object created by USER in inc_ModuleInfo function objLessonPage(idxNumber, txtPageName) { this.pageNumber = idxNumber; this.pageName = txtPageName; this.linkPage = "page" + idxNumber; this.isCompleted = false; return this; } //Called by objLesson(): addPage() method to create a Page function setPage(idxIndex, txtPageName) { this.pages[this.pages.length] = new objLessonPage(idxIndex, txtPageName); } //Called by objLesson(): getStatus(), returns "completed"/"incomplete" depending upon whether or not the Lesson is completed function checkStatus() { var iterator; var theResult = ""; var theTest = true; for(iterator = 0; iterator < this.pages.length; iterator++) if(!this.pages[iterator].isCompleted) theTest = false; this.isCompleted = theTest; this.theStatus = (theTest) ? "completed": this.theStatus; if(theTest) lessonCompleted = true; return this.theStatus; } //Called by objLesson(): setCurrentPageCompletion(), used to set individual page completion to True function compPage() { var pageNum = getPageNum(); if(pageNum < this.pages.length) this.pages[pageNum].isCompleted = true; return true; } //Called by User in Lesson Page, used to write the "page number of pages" images function writePageInfo() { var txtPageInfo = " "; var currentPage = getPageNum(); if((currentPage <= topPage)&&(currentPage > 0)) txtPageInfo = 'Page ' + currentPage + ' of ' + topPage; return(txtPageInfo); } //Called by writeLink(), writeOutlineInfo(), showMenu(), txtTitleLabel(), compPage(), writePageInfo(), used to determine current page number function getPageNum() { var pageNum; if(parent.frames.lessonFrame != null) pageNum = (expUpToPage.test(parent.frames.lessonFrame.location.href)) ? parseInt(parent.frames.lessonFrame.location.href.replace(expUpToPage, "")): objLessonModule.pages.length; else pageNum = 0; return pageNum; } //Called by User in Lesson Page, used to write navigation links function writeLink(linkDisplay) { var theHREF; var pageNum = getPageNum(); var theDir = linkDisplay.toLowerCase(); if(theDir == "back") { if(pageNum > 0) theHREF = "Back"; else theHREF = " "; }else{ if(pageNum == topPage) { theHREF = "Next"; }else{ if(pageNum < topPage) theHREF = "Next"; else theHREF = " "; } } return(theHREF); } //Called by User in Lesson Page, used to write lesson outline function writeOutlineInfo() { var theReturn = ''; var pageNum = getPageNum(); if(pageNum == 0) { var thePage; var arrReturn = new Array(); arrReturn[arrReturn.length] = "Contents"; } return theReturn; } //Called by User in Lesson Page, used to create and open Menu popupWindow function showMenu() { closePopup(); var pageNum = getPageNum(); var htmlHeader = "
\n\n\n" + "\n\n\n\n\n
\n"; var htmlTween = "
\n"; var arrReturn = new Array(); var thePage; for(thePage = 0; thePage < objLessonModule.pages.length; thePage++) arrReturn[arrReturn.length] = "" + objLessonModule.pages[thePage].pageName + ""; var theMenu = arrReturn.join("
") + "
"; var htmlFooter = "
Close Window 
"; var theHeight = 90 + ((topPage + 1) * 14); if(theHeight > 600) theHeight = 600; window.popupWindowContents = htmlHeader + "Contents" + htmlTween + theMenu + htmlFooter; window.setTimeout("openPopup(400, " + theHeight + ")", 500); return true; } //Called by .Sort(), used to sort arrays of objects by 'name' function byName(a, b) { var anew = a.term.toLowerCase(); var bnew = b.term.toLowerCase(); if (anew < bnew) return -1; if (anew > bnew) return 1; return 0; } //Called by showMenu(), showActPopup(), showMainGlossary(), showGlossaryPopup(), used to open the popupWindow function openPopup(widthVal, heightVal) { var x, y, wdt, hgt; wdt = (widthVal) ? widthVal: 340; hgt = (heightVal) ? heightVal: 300; x = ((window.screen.width - wdt) / 2); y = ((window.screen.height - hgt) / 2); x = (x < 0) ? 0: x; y = (y < 0) ? 0: y; window.popupWin = window.open('popupWin.html', 'PopupWindow', 'toolbar=no,status=no,menubar=no,resizable=yes,scrollbars=yes,location=no,top=' + y + ',left=' + x + ',width=' + wdt + ',height=' + hgt); window.popupWin.focus(); return true; } //Called by showMenu(), showActPopup(), showMainGlossary(), showGlossaryPopup(), used to close an open popupWindow function closePopup() { if(window.DefWin == null) if(window.opener) if(window.opener != null) if(window.opener.location != null) window.DefWin = window.opener.DefWin; if(window.DefWin != null) if(window.DefWin.closed) { window.DefWin = null; }else{ window.DefWin.close(); window.DefWin = null; } if(window.DefWin != null) window.DefWin = null; return true; } //Called by writeTermHTML(), used to generate a random link name function getRandom(low, high) { var range = high - low + 1; return Math.floor(Math.random() * range) + low; } //Called by User in frame pages, used to indicate that this script has loaded var isLessonLoaded = true;