home *** CD-ROM | disk | FTP | other *** search
- //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 = "<a href=\"./page" + (pageNum - 1) + ".html\" class='titleLink'>Back</a>";
- else
- theHREF = " ";
- }else{
- if(pageNum == topPage)
- {
- theHREF = "<a href=\"./finish.html\" class='pageLink'>Next</a>";
- }else{
- if(pageNum < topPage)
- theHREF = "<a href=\"./page" + (pageNum + 1) + ".html\" class='pageLink'>Next</a>";
- 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] = "<b>Contents</b><ul>";
- for(thePage = 0; thePage < objLessonModule.pages.length; thePage++)
- if(thePage == 0)
- arrReturn[arrReturn.length] = objLessonModule.pages[thePage].pageName;
- else
- arrReturn[arrReturn.length] = '<a href="page' + thePage + '.html">' + objLessonModule.pages[thePage].pageName + "</a>";
- theReturn = arrReturn.join("<li>") + "</ul>";
- }
- return theReturn;
- }
-
- //Called by User in Lesson Page, used to create and open Menu popupWindow
- function showMenu()
- {
- closePopup();
- var pageNum = getPageNum();
- var htmlHeader = "<br clear='all'>\n<table width='90%' border=0 cellpadding=4 cellspacing=0 align='center' class='popupTable'>\n<tr>\n" +
- "<td bgcolor='#336699' class='popupTitle'>\n";
- var htmlTween = "</td>\n</tr>\n<tr>\n<td valign='middle'>\n";
- var arrReturn = new Array();
- var thePage;
- for(thePage = 0; thePage < objLessonModule.pages.length; thePage++)
- arrReturn[arrReturn.length] = "<a href=\"#\" onclick=\"opener.childRef.location.href='page" + thePage + ".html';\">" + objLessonModule.pages[thePage].pageName + "</a>";
- var theMenu = arrReturn.join("<br>") + "<br clear='all'>";
- var htmlFooter = "</td></tr><tr><td align='right'><a href='javascript: window.close();'>Close Window</a> </td>\n</tr>\n</table>";
- 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 <array>.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;