/* START VARIABLE DECLARES                                          */

var timer, redx_timer, tid1, tid2
var curObjHolder = this.window
var flashArgs
var rt = 0
var done = 0
var begOp = 0
var dykFlag = 0
var blinker = 0
var supFlag = 0
var curNum = 0
var whichPart = 0
var cMarkCount = 0
var whichEntry = 0
var phoneEntry = 0
var moneyEntry = 0
var chboxError = 0
var tempBtnOff = 0
var radbtnError = 0
var jump_button = 0
var caseSensitive = 0
var pulldownError = 0
var startTextEntriesAt = 0
var st1 = ""
var st2 = ""
var endOp = 1
var oWrite = 1
var goFocus = 1
var keyTrigger = 13
var audioFileIndex = 1
var pwCaseSensitive = 1
var nextpartFuncCall = "nextpage()"

var cArray = new Array()
var thePDFs = new Array()
var theLinks = new Array()
var hideObjs = new Array()
var pageSteps = new Array()
var textEntry = new Array()
var extraFader = new Array()


/* END VARIABLE DECLARES                                             */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/* START PRELOAD CODE                                                */

document.write("<meta http-equiv='imagetoolbar' content='no'>")
if (_DEBUGREPORT == 1) {
  document.write("<div id='debugger' style='position:absolute; width:24px; height:12px; z-index:5; left:" + TEMPLATE_DEBUGGER_LEFT + "px; top:5px'><a href='#' onClick='openDebugWindow()'><img src='images/debug.jpg' border='0'></a></div>")
}
if (_JUMPBTN == 1) {
  document.write("<div id='jumpinput' style='position:absolute; width:24px; height:12px; z-index:5; left:" + TEMPLATE_JUMPINPUT_LEFT + "px; top:7px'><form name='jumpform' onsubmit='return false' method='post'><input name='jumpfield' tabIndex='1' type='text' style='width:24px' value='' onkeydown='noJudge()' maxlength='3'></form></div>")
  document.write("<div id='jumpbtn' style='position:absolute; width:1px; height:1px; z-index:5; left:" + TEMPLATE_JUMPBTN_LEFT + "px; top: 7px'><input type='button' name='Button' onClick='parent.bottomFrame.goPage(jumpform.jumpfield.value)' class='jumpbtn' value='Jump'></div>")
}
document.onhelp = function () {return false}

function setupSCTemplate() {

if (parent.frames['bottomFrame'].audioOn == 1)
  setTimeout('audioForSC()', 100)
}

function audioForSC() {

if (layerExists('audio'))
  document.getElementById('audio').style.visibility = 'visible'
}

function setupPageTemplate() {

dTracePoint("Entering setupPageTemplate().", 3)
if  (parent.bottomFrame.document.readyState != 'complete') {
  dTracePoint("hidden.htm not ready...Reloading.", 4)
  parent.mainFrame.location.reload()
  return
  }
var lessonName = parent.bottomFrame.writePageTitle()
var pageStr = parent.bottomFrame.writePageNum()
var soundString = getSoundString()
var glossString = getGlossString()
dTracePoint("Calling initFlashFeedback().", 4)
initFlashFeedback()
dTracePoint("initFlashFeedback() Done.", 4)
document.write("<div id='topsetup' style='position:absolute; width:" + TEMPLATE_TOP_SETUP_WIDTH + "px; height:" + TEMPLATE_TOP_SETUP_HEIGHT + "px; z-index:3; left:0px; top:0px'>"
               + "<div id='pullmenu' style='position:absolute; width:1px; height:1px; z-index:2; left:" + TEMPLATE_PULLMENU_LEFT + "px; top:" + TEMPLATE_TOP_BTNS_OFFSET + "px; visibility: hidden'><a href='#' onMouseOut='hideMenu()' onFocus='if(this.blur)this.blur()'><object id='pmenu' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='" + TEMPLATE_DROPMENU_WIDTH + "' height='" + TEMPLATE_DROPMENU_HEIGHT + "' border='0'><param name='movie' value='" + TEMPLATE_FLASH_PATH + "drop_menu.swf'><param name='quality' value='high'><param name='scale' value='exactfit'><param name='wmode' value='Transparent'><embed name='pmenu' src='" + TEMPLATE_FLASH_PATH + "drop_menu.swf' width='" + TEMPLATE_DROPMENU_WIDTH + "' height='" + TEMPLATE_DROPMENU_HEIGHT + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' scale='exactfit' border='0'></embed></object></a></div>"
               + "<div id='title' style='position:absolute; width:" + TEMPLATE_TITLE_WIDTH + "px; height:1px; z-index:9; left:" + PAGE_TEXT_OFFSET_LEFT + "px; top:" + TEMPLATE_TITLE_TOP + "px' class='modtitle'>" + lessonName + "</div>"
               + "<div id='progmod' style='position:absolute; width:1px; height:1px; z-index:1; left:" + TEMPLATE_PROGMOD_LEFT + "px; top:" + TEMPLATE_TOP_BTNS_OFFSET + "px'><a href='#' onMouseOver='showMenu()' onFocus='if(this.blur)this.blur()'><img id='progmodpic' src='" + TEMPLATE_IMAGE_PATH + "progmod.gif' border='0'></a></div>"
               + soundString
               + glossString
               + "<div id='helpbtn' style='position:absolute; width:1px; height:1px; z-index:7; left:" + getBtnLt(155) + "px; top:" + TEMPLATE_TOP_BTNS_OFFSET + "px'><a href='#' onClick='helppage()' onMouseOut='MM_swapImgRestore()' onMouseOver='doBottom(this)' onFocus='if(this.blur)this.blur()'><img name='help' src='" + TEMPLATE_IMAGE_PATH + "help.gif' border='0'></a></div>"
               + "<div id='printbtn' style='position:absolute; width:1px; height:1px; z-index:6; left:" + getBtnLt(222) + "px; top:" + TEMPLATE_TOP_BTNS_OFFSET + "px'><a href='#' onClick='window.print()' onMouseOut='MM_swapImgRestore()' onMouseOver='doBottom(this)' onFocus='if(this.blur)this.blur()'><img name='print' src='" + TEMPLATE_IMAGE_PATH + "print.gif' border='0'></a></div>"
               + "<div id='exitbtn' style='position:absolute; width:1px; height:1px; z-index:3; left:" + getBtnLt(294) + "px; top:" + TEMPLATE_TOP_BTNS_OFFSET + "px'><a href='#' onClick='closepage()' onMouseOut='MM_swapImgRestore()' onMouseOver='doBottom(this)' onFocus='if(this.blur)this.blur()'><img name='exit' src='" + TEMPLATE_IMAGE_PATH + "exit.gif' border='0'></a></div>"
             + "</div>"
             + "<div id='bottomsetup' style='position:absolute; width:" + TEMPLATE_BOTTOM_SETUP_WIDTH + "px; height:" + TEMPLATE_BOTTOM_SETUP_HEIGHT + "px; z-index:3; left:" + TEMPLATE_BOTTOM_SETUP_LEFT + "px; top:" + TEMPLATE_BOTTOM_SETUP_TOP + "px'>"
               + "<div id='forwardbtn' style='position:absolute; width:1px; height:1px; z-index:2; left:" + TEMPLATE_FWDBTN_LEFT + "px; top:" + TEMPLATE_BOTTOM_BTNS_OFFSET + "px'><a href='#' onClick='nextpage()' onFocus='if(this.blur)this.blur()'><img src='" + TEMPLATE_IMAGE_PATH + "forward.gif' border='0'></a></div>"
               + "<div id='backbtn' style='position:absolute; width:1px; height:1px; z-index:1; left:" + TEMPLATE_BACKBTN_LEFT + "px; top:" + TEMPLATE_BOTTOM_BTNS_OFFSET + "px'><a href='#' onClick='backpage()' onFocus='if(this.blur)this.blur()'><img src='" + TEMPLATE_IMAGE_PATH + "backward.gif' border='0'></a></div>"
               + "<div id='pagenum' style='position:absolute; width:" + TEMPLATE_PAGENBR_WIDTH + "px; height:1px; z-index:3; left:" + TEMPLATE_PAGENBR_LEFT + "px; top:" + TEMPLATE_PAGENBR_TOP + "px'>"
                 + "<div align='center' class='pagenumber'>" + pageStr + "</div>"
               + "</div>"
             + "</div>"
             + "<div id='Layer1' style='position:absolute; width:" + TEMPLATE_TOTAL_WIDTH + "px; height:" + TEMPLATE_TOTAL_HEIGHT + "px; z-index:1; left:0px; top:0px'>"
               + "<table width='" + TEMPLATE_TOTAL_WIDTH + "' height='" + TEMPLATE_TOTAL_HEIGHT + "' border='0' cellspacing='0' cellpadding='0'>"
                 + "<tr height='" + TEMPLATE_TOP_SETUP_HEIGHT + "'><td height='" + TEMPLATE_TOP_SETUP_HEIGHT + "'><img src='" + TEMPLATE_IMAGE_PATH + "template_top.gif'></td></tr>"
                 + "<tr height='" + TEMPLATE_TOTAL_WORKAREA_HEIGHT + "'><td height='" + TEMPLATE_TOTAL_WORKAREA_HEIGHT + "'></td></tr>"
                 + "<tr height='" + TEMPLATE_BOTTOM_SETUP_HEIGHT + "'><td height='" + TEMPLATE_BOTTOM_SETUP_HEIGHT + "'><img src='" + TEMPLATE_IMAGE_PATH + "template_bottom.gif' align='bottom'></td></tr>"
               + "</table>"
             + "</div>")
if (TEMPLATE_AUDIO_BUTTON == 1) {
  var audioFileHolder = TEMPLATE_AUDIO_PATH + "blank_movie.swf"
  Flash_embedSWF(audioFileHolder, 1, 1, "audioFlash", 1)
  if (parent.frames['bottomFrame'].audioOn == 1) {
    dTracePoint("Calling first audio load.", 1)
    loadNextAudio()
    }
  }
dTracePoint("Exiting setupPageTemplate().", 3)
}

function initFlashFeedback() {
var feedbackLeftOffset = TEMPLATE_TOTAL_WORKAREA_WIDTH - 208
var feedbackTopOffset = TEMPLATE_TOTAL_WORKAREA_HEIGHT + 13
var feedHelper1LeftOffset = feedbackLeftOffset + 17
var feedHelper2LeftOffset = feedbackLeftOffset + 100
var feedHelperTopOffset = INTERACTION_LINE_HEIGHT + feedbackTopOffset

document.write("<div id='correct' style='position:absolute; width:1px; height:1px; z-index:3; left:" + feedbackLeftOffset + "px; top:" + feedbackTopOffset + "px; visibility: hidden'><script>Flash_embedSWF('flash/correct.swf', 188, 50, 'corFlash', 1)" + "<" + "/" + "script>" + "<" + "/" + "div>")
document.write("<div id='incorrect' style='position:absolute; width:1px; height:1px; z-index:3; left:" + feedbackLeftOffset + "px; top:" + feedbackTopOffset + "px; visibility: hidden'><script>Flash_embedSWF('flash/incorrect.swf', 188, 50, 'incFlash', 1)" + "<" + "/" + "script>" + "<" + "/" + "div>")
document.write("<div id='inchelper1' style='position:absolute; width:1px; height:1px; z-index:4; left:" + feedHelper1LeftOffset + "px; top:" + feedHelperTopOffset + "px; visibility: hidden'>" + "<a href='#' onClick='lowerInc()' onFocus='if(this.blur)this.blur()'>" + "<img src='images/transparentSquare.gif' width='73' height='34' border='0'>" + "<" + "/" + "a>" + "<" + "/" + "div>")
document.write("<div id='inchelper2' style='position:absolute; width:1px; height:1px; z-index:4; left:" + feedHelper2LeftOffset + "px; top:" + feedHelperTopOffset + "px; visibility: hidden'>" + "<a href='#' onClick='manageWrong();lowerInc()' onFocus='if(this.blur)this.blur()'>" + "<img src='images/transparentSquare.gif' width='73' height='34' border='0'>" + "<" + "/" + "a>" + "<" + "/" + "div>")
}

function doBottom(myObj) {
var helper = myObj.children[0].src.split("/")
var whichFile = helper[(helper.length-1)].split(".")[0]
var theFile = TEMPLATE_IMAGE_PATH + whichFile + "_rollover.gif"
if ((whichFile == "audio_off") && (parent.frames['bottomFrame'].audioOn == 0))
  whichFile = "audio"
MM_swapImage(whichFile, '', theFile, 1)
}

function getSoundString() {
var thisStr = ""

if (TEMPLATE_AUDIO_BUTTON == 1) {
  if (parent.frames['bottomFrame'].audioOn == 1)
    theAudPic = 'audio.gif'
  else
    theAudPic = 'audio_off.gif'
  thisStr = "<div id='audiobtn' style='position:absolute; width:1px; height:1px; z-index:5; left: " + getBtnLt(155) + "px; top: 37px'><a href='#' onClick='toggleAudio()' onMouseOut='MM_swapImgRestore()' onMouseOver='doBottom(this)' onFocus='if(this.blur)this.blur()'><img id='audiopic' name='audio' src='" + TEMPLATE_IMAGE_PATH + theAudPic + "' border='0'></a></div>"
  tempBtnOff += 73
  }
return(thisStr)
}

function getGlossString() {
var thisStr = ""

if (TEMPLATE_GLOSSARY_BUTTON == 1) {
  thisStr = "<div id='glossbtn' style='position:absolute; width:1px; height:1px; z-index:4; left: " + getBtnLt(155) + "px; top: 37px'><a href='#' onClick='showGlossary()' onMouseOut='MM_swapImgRestore()' onMouseOver='doBottom(this)' onFocus='if(this.blur)this.blur()'><img id='glosspic' name='glossary' src='" + TEMPLATE_IMAGE_PATH + "glossary.gif' border='0'></a></div>"
  tempBtnOff += 87
  }
return(thisStr)
}

function getBtnLt(theLeft) {
return (theLeft + tempBtnOff)
}

if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
  document.write('<SCRIPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('Sub lineTo_FSCommand(ByVal command, ByVal args)\n');
  document.write('  call lineTo_DoFSCommand(command, args)\n');
  document.write('end sub\n');
  document.write('</SCRIPT\> \n');
  }

/* END PRELOAD CODE                                                  */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/* START INITIALIZATION FUNCTIONS                                    */

function initPage() {

dTracePoint("Entering initPage().", 3)
if (typeof(iType) == "undefined")
  iType = "other"
if (iType == "multi")
  initMulti()
else if (iType == "keypress")
  initKeypress()
else if (iType == "textentry")
  initTextentry()
if (document.getElementById("interpic") != null)
  initInteractionBox()
initPageLite()
setTimeout('curObjHolder.focus()', 50)
dTracePoint("Exiting initPage().", 3)
}

function initPageLite() {
if (IE) {
  dTracePoint("Entering initPageLite().", 3)
  var flashEmbeds = document.getElementsByTagName("object")
  for (var i = 0; i < flashEmbeds.length; i++) {
    flashEmbeds[i].outerHTML = flashEmbeds[i].outerHTML
    }
  window.focus()
  dTracePoint("Exiting initPageLite().", 3)
  }
}

function initMulti() {
var Objs, theObj
var thePicTop, cSpace, cDist, curSpot
var cCount = 0
var cTotalHeight = 0
var titleOffset = 10

if (document.getElementById("graphicpic1").style.pixelWidth < TEMPLATE_TOTAL_WIDTH)
  titleOffset--
document.getElementById("graphicpic1").src = TEMPLATE_IMAGE_PATH + "mc_" + mType + "text.gif"
theObj = document.getElementById("questiontext")
document.getElementById("graphic").style.pixelTop = MULTI_CHOICE_PIC_TOP
document.getElementById("graphic1").style.pixelTop = MULTI_CHOICE_PIC_TOP + titleOffset
theObj.style.pixelTop = MULTI_CHOICE_PIC_TOP + MULTI_CHOICE_QUESTION_OFFSET
curSpot = (theObj.style.pixelTop + theObj.scrollHeight)
cSpace = MULTI_CHOICE_END_WHITESPACE - (curSpot - MULTI_CHOICE_PIC_TOP)
cSpace = (cSpace > MULTI_CHOICE_DEFAULT) ? MULTI_CHOICE_DEFAULT : cSpace
Objs = document.getElementsByTagName("DIV")

for (i=0;i<Objs.length;i++) {
  theObj = Objs[i]
  if(theObj.id.indexOf("multi") != -1) {
    theObj.onclick = function(){checkMulti(this)}
    theObj.onmouseover = function(){this.style.cursor='hand'}
    theObj.onmouseout = function(){this.style.cursor='default'}
    cArray[cCount] = new choice(theObj, theObj.scrollHeight, theObj.innerHTML)
    theObj.innerHTML = '<img align="top" id="arrow" src="' + TEMPLATE_IMAGE_PATH + 'arrow1.gif"> <p class="choice">' + cArray[cCount].ins + '</p>'
    cArray[cCount].hgt = theObj.scrollHeight
    cTotalHeight += theObj.scrollHeight
    cCount++
    }
  }
cDist = ((cSpace - cTotalHeight) / (cCount + 1))
curSpot += cDist
document.getElementById("graphic").style.visibility = "visible"
document.getElementById("graphic1").style.visibility = "visible"
document.getElementById("questiontext").style.visibility = "visible"
for (i=0;i<cCount;i++) {
  cArray[i].obj.style.pixelTop = curSpot
  cArray[i].obj.style.visibility = "visible"
  curSpot += (cArray[i].hgt + cDist)
  }
document.getElementById("explain").style.pixelTop = cArray[(cCount-1)].obj.style.pixelTop + cArray[(cCount-1)].hgt + MULTI_CHOICE_FEEDBACK_OFFSET
}

function initKeypress() {

}

function initTextentry() {
var Objs, taObjs
var theObj
var tRange
var count = 0

Objs = document.getElementsByTagName("INPUT")
taObjs = document.getElementsByTagName("TEXTAREA")
for (i=0;i<Objs.length;i++) {
  theObj = Objs[i]
  if(theObj.name.indexOf("textfield") != -1) {
    if (theObj.accessKey == "")
      theObj.value = ""
    else {
      theObj.value = theObj.accessKey
      if (oWrite == 1) {
        document.execCommand("OverWrite","","true")
        } 
      }
    theObj.parentElement.parentElement.style.visibility = "visible"
    textEntry[count++] = theObj
    curObjHolder = textEntry[startTextEntriesAt]
    }
  }
for (i=0;i<taObjs.length;i++) {
  theObj = taObjs[i]
  if(theObj.id.indexOf("textfield") != -1) {
    if (theObj.accessKey == "")
      theObj.value = ""
    else {
      theObj.value = theObj.accessKey
      if (oWrite == 1) {
        document.execCommand("OverWrite","","true")
        }
      }
    theObj.parentElement.parentElement.style.visibility = "visible"
    textEntry[count++] = theObj
    curObjHolder = textEntry[startTextEntriesAt]
    }
  }
if (typeof(curObjHolder.type) != "undefined") {
  tRange = curObjHolder.createTextRange()
  tRange.move("character", 0)
  tRange.select()
  }
if (goFocus == 1)
  curObjHolder.focus()
}

function initInteractionBox() {
var tbPageLeftOffset = 0
var myObj1 = document.getElementById("interactiontxt")
var myObj2 = document.getElementById("interactionpic")
var myObj3 = document.getElementById("pagetext")
var myObj4 = document.getElementById("interpic")
var myObj5 = document.getElementById("leftcontent")
var holder = (Math.ceil(myObj1.scrollHeight / INTERACTION_LINE_HEIGHT) < 2) ? 2 : Math.ceil(myObj1.scrollHeight / INTERACTION_LINE_HEIGHT)
var theBoxHeight = INTERACTION_BASE_HEIGHT + (INTERACTION_LINE_HEIGHT * (holder - 1))

if (myObj5.style.pixelWidth == TEMPLATE_TOTAL_WORKAREA_WIDTH) {
  holder += "a"
  tbPageLeftOffset = (TEMPLATE_TOTAL_WORKAREA_WIDTH - (INTERACTION_BASE_WIDTH + (INTERACTION_OFFSET_LEFT * 2) + 2))
  }
myObj4.src = TEMPLATE_IMAGE_PATH + "interaction" + holder + ".gif"
holder = (myObj5.style.pixelHeight - theBoxHeight)
myObj1.style.pixelWidth = INTERACTION_TEXT_WIDTH
myObj1.style.pixelLeft = (INTERACTION_OFFSET_LEFT + INTERACTION_TEXT_OFFSET_LEFT + tbPageLeftOffset)
myObj2.style.pixelLeft = (INTERACTION_OFFSET_LEFT + tbPageLeftOffset)
document.getElementById("interactiontxt").style.pixelTop = (INTERACTION_TEXT_OFFSET_HEIGHT + holder)
document.getElementById("interactionpic").style.pixelTop = holder
MM_showHideLayers('interactiontxt','','show','interactionpic','','show','pagetext','','show')
}

/* END INITIALIZATION FUNCTIONS                                      */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/* START NAVIGATION FUNCTIONS                                        */

function nextpage() {

if (dykFlag == 1)
  dyk()
else {
  if ((rt == 1) && (parent.mainFrame.location.href.indexOf("sc") != -1))
    parent.bottomFrame.noRandomRecordRight()
  parent.bottomFrame.goNext()
  }
}

function thispage() {
parent.bottomFrame.goHere()
}

function backpage() {
parent.bottomFrame.goPrev()
}

function restartCourse() {
parent.location.href = "page1.htm"
}

function goNested(direction) {
parent.bottomFrame.navNested(direction)
}

function closepage() {

if (confirm("Are you sure you want to exit?")) {
  if (parent.bottomFrame.api_test) {
    LMSSetValue("cmi.core.exit", "suspend")
    LMSCommit()
    LMSFinish("")
    }
  window.top.close();
  }
}

function helppage() {
NewWindow('help.htm','win1','770','425','no','no')
}

function showGlossary() {
NewWindow('gloss_new.htm','win1','794','454','no','no')	
}

function reference() {
NewWindow('gallery.htm','win1','544','550','no','no')
}


/* END NAVIGATION FUNCTIONS                                          */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/* START UTILITY FUNCTIONS                                           */

function noJudge() {
event.cancelBubble = true
}

function setRightFlag() {
rt = 1
}

function showThem(msg) {

alert(msg)
window.focus()
}

function anchStuff() {
document.location.href = "#gohere"
}

function checkMenuStatus() {
var mBound = document.getElementById('pullmenu').style.pixelTop

if (event.clientY >= mBound)
  MM_showHideLayers('pullmenu','','hide')
}

function showMenu() {
MM_showHideLayers('pullmenu','','show')
}

function hideMenu() {
MM_showHideLayers('pullmenu','','hide')
}

function toggleBkBtn(showorhide) {
MM_showHideLayers('backbtn','',showorhide)
}

function toggleFwdBtn(showorhide) {

if (document.location.href.indexOf("HSBC%20Master%20Folder") == -1)
  MM_showHideLayers('forwardbtn','',showorhide)
}

function printPdf(whichPdf) {
var holder = "document.pdfFile" + (whichPdf+1) + ".print()"

eval(holder)
}

function showPDF(whichPDF, wWidth, wHeight, wScroll, wResize) {
var rWidth = (!wWidth) ? 662 : wWidth
var rHeight = (!wHeight) ? 588 : wHeight
var rScroll = (!wScroll) ? 'no' : wScroll
var rResize = (!wResize) ? 'no' : wResize

NewWindow(thePDFs[whichPDF],'pdfwin',rWidth,rHeight,rScroll,rResize)
}

function setUpDD() {
var j = 0
var findDrags = document.getElementsByTagName("div")

for (i=0;i<findDrags.length;i++) {
  if (findDrags[i].className.substring(0,6) == "dragrt") {
    initSpots[j] = findDrags[i].style.pixelLeft
    initSpots[(j+1)] = findDrags[i].style.pixelTop
    j += 2
    }
  }
}

function resetLayer(layr, q) {
var cName = "dragrt" + q
q--

layr.style.pixelLeft = initSpots[(q*2)]
layr.style.pixelTop = initSpots[((q*2)+1)]
layr.className = cName
}

function clearAnswers() {
var myObj

for(i=1;i<(correctsNeeded+2);i++) {
  myObj = document.getElementById(i)
  resetLayer(myObj, i)
  }
ownsSlot = 0
}

function toggleAudio() {
var myAudio = document.getElementById('audiopic')
var myObj = document.getElementById('audioFlash')

if (parent.frames['bottomFrame'].audioOn == 1) {
  myAudio.src = TEMPLATE_IMAGE_PATH + "audio_off_rollover.gif"
  myAudio.oSrc = TEMPLATE_IMAGE_PATH + "audio_off.gif"
  if (myObj != null)
    myObj.LoadMovie(0, 'flash/blank_movie.swf')
  audioFileIndex = 1
  parent.frames['bottomFrame'].audioOn = 0
  }
else {
  myAudio.src = TEMPLATE_IMAGE_PATH + "audio_rollover.gif"
  myAudio.oSrc = TEMPLATE_IMAGE_PATH + "audio.gif"
  if (myObj != null)
    loadNextAudio()
  parent.frames['bottomFrame'].audioOn = 1
  }
}

var fadeCount = 0

function showPic(layerNameShow) {

fadeCount = 0
if ((IE) && (st1 != "")) {
  document.getElementById(st1).filters.alpha.opacity = 100
  clearInterval(tid1)
  }
else if (st1 != "") {
  alert("notIEbutdone")
  }
st1 = layerNameShow
MM_showHideLayers(layerNameShow,'','show')
tid1 = setInterval('fadeIn()',50);
}

function hidePic(layerNameHide) {

fadeCount = 0
if (st2 != "") {
  document.getElementById(st2).filters.alpha.opacity = 0
  clearInterval(tid2)
  }
st2 = layerNameHide
tid2 = setInterval('fadeOut()',50);
}

function fadeIn() {
var myObj1
var theRate = 0

fadeCount++
endOp = (IE) ? 100 : 1
theRate = (IE) ? (5 * fadeCount) : (.05 * fadeCount)
myObj1 = document.getElementById(st1)

if (IE)
  myObj1.filters.alpha.opacity = theRate
else
  myObj1.style.opacity = theRate
if (((IE) && (myObj1.filters.alpha.opacity >= endOp)) || (myObj1.style.opacity >= endOp)) {
  clearInterval(tid1)
  st1 = ""
  doneFadingIn()
  }
}

function fadeOut() {
var myObj2
var theRate = 1

fadeCount++
theRate = (IE) ? (100 - (5 * fadeCount)) : (1 - (.05 * fadeCount))
myObj2 = document.getElementById(st2)
if (IE)
  myObj2.filters.alpha.opacity = theRate
else
  myObj2.style.opacity = theRate
if (((IE) && (myObj2.filters.alpha.opacity <= begOp)) || (myObj2.style.opacity <= begOp)) {
  clearInterval(tid2)
  st2 = ""
  doneFadingOut()
  }
}

var cakeTimer

function doneFadingIn() {

if (curNum < 6)
  cakeTimer = setTimeout('runSlideShow()', 2500)
else {
  MM_showHideLayers('skipintro','','hide')
  if (IE) {
    document.getElementById('theflash').GotoFrame(2)
    document.getElementById('theflash').Play()
    }
  else {
    document.embeds.theflash.GotoFrame(2)
    document.embeds.theflash.Play()
    }
  }
}

function runSlideShow() {

curNum++
hidePic('graphic')
}

function doneFadingOut() {

document.getElementById('graphicpic').onload = function() {checkState()}
document.getElementById('graphicpic').src = TEMPLATE_IMAGE_PATH + curNum + ".jpg"
}

function checkState() {

showPic('graphic')
document.getElementById('graphicpic').onload = ''
}

function swap(myObj) {
var holder = myObj.parentElement.id + "txt"

myObj.onclick = ""
myObj.style.cursor = "default"
myObj.children[0].src = TEMPLATE_IMAGE_PATH + "checkbox_checkmark.jpg"
showPic(holder)
correctsNeeded--
if (correctsNeeded == 0)
  toggleFwdBtn('show')
}

function closeSim(timeInMilSecs) {

if (document.getElementById("incorrect").style.visibility == "visible")
  lowerInc()
showHideSimObjs('hide')
MM_showHideLayers('simulation','','show')
clearTimeout(timer)
setTimeout("showHideSimObjs('show')", timeInMilSecs)
if (iType == "textentry")
  timer = setTimeout("initTextentry()", timeInMilSecs)
else
  timer = setTimeout("curObjHolder.focus()", timeInMilSecs)
}

function showHideSimObjs(showOrHide) {
var sh

MM_showHideLayers('simulation','','hide')
if (showOrHide == "show")
  sh = "visible"
else
  sh = "hidden"
for (i=0;i<hideObjs.length;i++)
  document.getElementById(hideObjs[i]).style.visibility = sh
}

function switchCSS(myObj, cls) {
myObj.className = cls
}

function checkLength(myObj, lastChr) {
var holder = ""
var tabInd = (myObj.tabIndex + 1)
this.lastChr = (!lastChr) ? "" : lastChr

if ((myObj.value.length == myObj.maxLength) && (myObj.value.charAt(myObj.value.length-1) != lastChr)) {
  holder = "textfield" + tabInd
  document.getElementsByName(holder)[0].focus()
  }
}

function notab() {

if (event.keyCode == 9) {
  event.keyCode = 0
  event.returnValue = false
  event.cancelBubble = true
  return false
  }
}

function clearValue(myObj) {
var tRange

if (myObj.accessKey == "") {
  myObj.value = ""
  document.execCommand("OverWrite","","false")
  }
else if (oWrite == 1)
  document.execCommand("OverWrite","","true")
tRange = myObj.createTextRange()
tRange.move("character", 0)
tRange.select()
}

function checkKeyTrigger(evt) {
var evt  = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);

if (((evt.keyCode == keyTrigger) && (node.type == "text") && (done < textChecks.length)) || (evt == "now"))
  eval(textChecks[done])
}

function setDone(x) {

done = x
if (done == 99) {
  MM_showHideLayers('right','','hide','wrong','','hide')
  window.focus()
  }
}

function showHideRolls(myNum, showOrHide, picType, orientType, leftInd, topInd, theSpec) {
var wOffset = 0
var hOffset = 0
var rightWidth
var rightHeight
var wHolderRight, wHolderLeft
var holder = "roll" + myNum
var theHolderObj = document.getElementById(holder)
var theObj = document.getElementById('rollbox')
var thePicObj = document.getElementById('rollpic')
var theFrameObj = document.getElementById('rightcontent')
var theX = window.event.offsetX + window.event.srcElement.parentElement.parentElement.style.pixelLeft
var theY = window.event.offsetY + window.event.srcElement.parentElement.parentElement.style.pixelTop + 20
leftInd = showHideRolls.arguments[4] ? showHideRolls.arguments[4] : 15
topInd = showHideRolls.arguments[5] ? showHideRolls.arguments[5] : 10
theSpec = showHideRolls.arguments[6] ? showHideRolls.arguments[6] : theFrameObj.style.pixelLeft

if (picType != "noformat") {
  if (showOrHide == "show") {
    if (theFrameObj != null) {
      if ((theFrameObj.scrollWidth > theFrameObj.style.pixelWidth) && (theFrameObj.scrollHeight <= theFrameObj.style.pixelHeight))
        hOffset = 20
      else if ((theFrameObj.scrollHeight > theFrameObj.style.pixelHeight) && (theFrameObj.scrollWidth <= theFrameObj.style.pixelWidth))
        wOffset = 20
      rightHeight = theFrameObj.style.pixelHeight - hOffset
      rightWidth = theFrameObj.style.pixelWidth - wOffset
      }
    if (picType != "fixed") {
      thePicObj.width = ((theHolderObj.scrollWidth + (leftInd * 2)) > rightWidth) ? rightWidth :(theHolderObj.scrollWidth + (leftInd * 2))
      thePicObj.height = ((theHolderObj.scrollHeight + (topInd * 2) + 4) > rightHeight) ? rightHeight : (theHolderObj.scrollHeight + (topInd * 2) + 4)
      }
    if (orientType == "move") {
      wHolderRight = ((window.event.x - theSpec) + (thePicObj.width / 2))
      wHolderLeft = (theX - (thePicObj.width / 2))
      if ((wHolderRight <= rightWidth) && (wHolderLeft >= (theX - (window.event.x - theSpec))))
        theObj.style.pixelLeft = (theX - (thePicObj.width / 2))
      else if (wHolderRight > rightWidth)
        theObj.style.pixelLeft = ((theX - (window.event.x - theSpec)) + (rightWidth - thePicObj.width))
      else
        theObj.style.pixelLeft = (theX - (window.event.x - theSpec))
      theObj.style.pixelTop = ((theY + thePicObj.height) < rightHeight) ? theY : (rightHeight - thePicObj.height)
      }
    else if (orientType == "bottom") {
      theObj.style.pixelTop = rightHeight - thePicObj.height
      }
    else if (orientType == "top") {
      theObj.style.pixelTop = 0
      }
    else if (orientType == "middle") {
      theObj.style.pixelTop = (rightHeight / 2) - (thePicObj.height / 2)
      }
    }
  MM_showHideLayers('rollbox','',showOrHide)
  if ((orientType != "static") && (showOrHide != "hide")) {
    theHolderObj.style.pixelLeft = theObj.style.pixelLeft + leftInd
    theHolderObj.style.pixelTop = theObj.style.pixelTop + topInd
    }
  }
MM_showHideLayers(holder,'',showOrHide)
}

function showHideRollsOrder(myNum) {
var holder = "roll" + myNum
var holder1 = "rollm" + myNum
var holder2 = "roll" + (myNum-1)
var holder3 = "rollm" + (myNum+1)

MM_showHideLayers(holder,'','show',holder1,'','hide')
if (document.getElementById(holder2) != "undefined")
  MM_showHideLayers(holder2,'','hide')
if (document.getElementById(holder3) != "undefined")
  MM_showHideLayers(holder3,'','show')
}

function showHideAllRadios(num, showOrHide) {
var radb
var sh

if (showOrHide == "show")
  sh = "visible"
else
  sh = "hidden"

for (i=0;i<num;i++) {
  radb = "rdo" + (i + 1)
  document.getElementById(radb).parentElement.style.visibility = sh
  if (showOrHide == "hide")
    document.getElementById(radb).parentElement.style.pixelTop = 0
  }
curObjHolder = this.window
}

function hideAllChkBoxes(num) {
var chbox

for (i=0;i<num;i++) {
  chbox = "chk" + (i + 1)
  document.getElementById(chbox).parentElement.style.visibility = "hidden"
  document.getElementById(chbox).parentElement.style.pixelTop = 0
  }
curObjHolder = this.window
}

function showHideAllRadios(num, showOrHide) {
var radb
var sh

if (showOrHide == "show")
  sh = "visible"
else
  sh = "hidden"

for (i=0;i<num;i++) {
  radb = "rdo" + (i + 1)
  document.getElementById(radb).parentElement.style.visibility = sh
  if (showOrHide == "hide")
    document.getElementById(radb).parentElement.style.pixelTop = 0
  }
curObjHolder = this.window
}

function hideAllTextEntries() {

for (i=0;i<textEntry.length;i++)
  textEntry[i].parentElement.parentElement.style.visibility = "hidden"
curObjHolder = this.window
}

function disableAllTextEntries() {

for (i=0;i<textEntry.length;i++) {
  textEntry[i].contentEditable = false
  textEntry[i].onfocus = ""
  }
curObjHolder = this.window
}

function scRight() {
var args = scRight.arguments

if (args != null) {
  for (i=0;i<args.length;i++) {
    if (document.getElementById(args[i]) != null) {
      MM_showHideLayers(args[i],'','show')
      }
    }
  }
setRightFlag()
setDone(99)
disableAllTextEntries()
runCor()
}

function scWrong() {

setDone(99)
disableAllTextEntries()
if (document.getElementById("advice") != null)
  document.getElementById("advice").style.visibility = "visible"
runInc()
}

function dyk() {
var timing = 5000

if (document.getElementById('dykcover').scrollWidth > 200)
  timing = 7500
MM_showHideLayers('dyk','','show','dykbox','','show','dykcover','','show','dyktitle','','show')
setTimeout("dykFinish()", timing);
}

function dykFinish() {

dykFlag = 0
nextpage()
}

function textImgMover(myTxtObj) {
var myNum = parseInt(myTxtObj.name.split('textfield')[1])
var myLeftObjId = "leftEnd" + myNum
var tRange = myTxtObj.createTextRange()
var myAmt = tRange.boundingWidth + 2

if (myAmt > 1) {
  myTxtObj.style.pixelWidth = myAmt
  document.getElementById(myLeftObjId).style.pixelLeft = (oldEndPos[(myNum-1)] + myAmt) - 2
  }
}

function getOrigPos() {

for (i=0;i<document.getElementsByName('leftEnd').length;i++)
  oldEndPos[i] = document.getElementsByName('leftEnd')[i].parentElement.style.pixelLeft
}

function grabFileName(theDoc, noExtension) {
var theURL = ""
var rtnValue = ""

if (theDoc.URLUnencoded.indexOf("/") == -1)
  theURL = theDoc.URLUnencoded.split("/")
else
  theURL = theDoc.URLUnencoded.split("\\")

for (i=0;i<theURL[(theURL.length-1)].length;i++) {
  if (theURL[(theURL.length-1)].charAt(i) != '#')
    rtnValue += theURL[(theURL.length-1)].charAt(i)
  }
if (noExtension)
  rtnValue = rtnValue.split('.')[0]
return rtnValue
}

function layerExists(theLayer) {

if (document.getElementById(theLayer) != null)
  return true
else
  return false
}

function layerExistsInParent(theLayer) {

if (document.getElementById(theLayer) != null)
  return true
else
  return false
}

function openLink(myObj) {

if (typeof(myObj) == "object")
  whichLink = (parseInt(myObj.parentElement.id.split("link")[1]) - 1)
else
  whichLink = myObj
if (theLinks[whichLink] != "")
  NewWindow(theLinks[whichLink],'ref','700','500','no','no')
}


/* END UTILITY FUNCTIONS                                             */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/* START INTERACTION FUNCTIONS                                       */

function nextpart() {
var rObj, gObj, wObj, cObj, cLay, aObj, aSrc, aLay

if (whichPart == pageSteps.length) {
  eval(nextpartFuncCall)
  return
  }
if (pulldownError || chboxError || radbtnError) {
  if (parent.frames['bottomFrame'].location.href.indexOf("schidden.htm") != -1)
    scWrong()
  else
    runInc()
  return
  }
rObj = document.getElementById("rightcontent")
gObj = document.getElementById("graphicpic")
wObj = document.getElementById("wrongpic")
cObj = document.getElementById("correctpic")
cLay = document.getElementById("right")
aObj = document.getElementById("arrowpic")
aLay = document.getElementById("showarrow")
clearTimeout(timer)
if(aLay != null)
  aLay.style.visibility = "hidden"
lowerInc()

if(gObj != null) {
  if (pageSteps[whichPart].gsrc != "") {
    gObj.src = pageSteps[whichPart].gsrc
    }
  if (pageSteps[whichPart].glft != "") {
    gObj.parentElement.style.pixelLeft = pageSteps[whichPart].glft
    }
  if (pageSteps[whichPart].gtop != "") {
    gObj.parentElement.style.pixelTop = pageSteps[whichPart].gtop
    }
  if((wObj != null) && (rObj != null)) {
    setTimeout('updateWrongLayer()', 50)
    }
  }
if(aObj != null) {
  if (pageSteps[whichPart].asrc != "") {
    aObj.src = pageSteps[whichPart].asrc
    }
  }
if(aLay != null) {
  if (pageSteps[whichPart].alft != "") {
    aLay.style.pixelLeft = pageSteps[whichPart].alft
    }
  if (pageSteps[whichPart].atop != "") {
    aLay.style.pixelTop = pageSteps[whichPart].atop
    }
  }
if(cLay != null) {
  cLay.style.visibility = "visible"
  if (pageSteps[whichPart].clft != "") {
    cLay.style.pixelLeft = pageSteps[whichPart].clft
    }
  if (pageSteps[whichPart].ctop != "") {
    cLay.style.pixelTop = pageSteps[whichPart].ctop
    }
  }
if(cObj != null) {
  if (pageSteps[whichPart].cwid != "") {
    cObj.width = pageSteps[whichPart].cwid
    }
  if (pageSteps[whichPart].chgt != "") {
    cObj.height = pageSteps[whichPart].chgt
    }
  }
whichPart++
if (supFlag == 1)
  suplmnt()
}

function updateWrongLayer() {
var rObj = document.getElementById("rightcontent")
var gObj = document.getElementById("graphicpic")
var wObj = document.getElementById("wrongpic")

wObj.width = gObj.width
wObj.height = gObj.height
wObj.width = (rObj.scrollWidth > parseInt(rObj.style.width)) ? rObj.scrollWidth : parseInt(rObj.style.width)
wObj.height = (rObj.scrollHeight > parseInt(rObj.style.height)) ? rObj.scrollHeight : parseInt(rObj.style.height)
if ((wObj.height > parseInt(rObj.style.height)) && (wObj.width == parseInt(rObj.style.width)))
  wObj.width -= 20
if ((wObj.width > parseInt(rObj.style.width)) && (wObj.height == parseInt(rObj.style.height)))
  wObj.height -= 20
}

function checkMulti(theObj) {

if(theObj.id.indexOf("right") != -1) {
  if (parent.frames['bottomFrame'].location.href.indexOf("schidden.htm") != -1)
    scRight()
  else {
    toggleFwdBtn('show')
    runCor()
    }
  for (i=0;i<cArray.length;i++) {
    cArray[i].obj.onclick = ""
    cArray[i].obj.onmouseover = function(){this.style.cursor='default'}
    }
  showRightMulti()
  }
else if (parent.frames['bottomFrame'].location.href.indexOf("schidden.htm") != -1) {
  scWrong()
  for (i=0;i<cArray.length;i++) {
    cArray[i].obj.onclick = ""
    cArray[i].obj.onmouseover = function(){this.style.cursor='default'}
    }
  showRightMulti()
  }
else
  runInc()
}

function showRightMulti() {

if ((document.getElementById("incorrect").style.visibility == "visible") && (parent.frames['bottomFrame'].location.href.indexOf("schidden.htm") == -1))
  lowerInc()
document.getElementById("multiright").children[0].src = "images/green_arrow1.gif"
document.getElementById("multiright").children[1].className = "choiceright"
MM_showHideLayers('explain','','show')
}

function gotoLink(numToCheck, myFunc, subStrNum) {
var holder = ""
var tempVal = ""
var ansHolder = ""
var tempCase = 0
var notEmpty = 0
var node = ""

for (i=0;i<numToCheck;i++) {
  if ((phoneEntry == 1) && (!isNaN(textAnswers[whichEntry].charAt(0))) && (textAnswers[whichEntry].length == 10)) {
    tempVal = ""
    for (k=0;k<textEntry[whichEntry].value.length;k++) {
      if ((!isNaN(textEntry[whichEntry].value.charAt(k))) && (textEntry[whichEntry].value.charAt(k) != " ")) {
        tempVal += textEntry[whichEntry].value.charAt(k)
        }
      }
    }
  else if ((moneyEntry == 1) && (textAnswers[whichEntry].charAt(0) == '$')) {
    holder = textEntry[whichEntry].value
    if (holder.charAt(0) == '$')
      holder = holder.substring(1, holder.length)
    tempVal = parseFloat(holder)
    textAnswers[whichEntry] = parseFloat(textAnswers[whichEntry].substring(1, textAnswers[whichEntry].length))
    if (!isNaN(tempVal))
      notEmpty = 1
    }
  else
    tempVal = textEntry[whichEntry].value
  tempCase = 0
  node = textEntry[whichEntry].type
  if ((node == "password") && (pwCaseSensitive == 1))
    tempCase = 1
  if ((caseSensitive == 0) && (tempCase == 0) && (typeof(tempVal) == "string"))
    tempVal = tempVal.toLowerCase()
  holder = textAnswers[whichEntry]
  if (subStrNum != null) {
    tempVal = tempVal.substring(0,subStrNum)
    holder = textAnswers[whichEntry].substring(0,subStrNum)
    }
  for (j=0;j<tempVal.length;j++) {
    if (tempVal.charAt(j) != "_") {
      notEmpty = 1
      }
    }
  tempVal = notEmpty ? tempVal : ""
  notEmpty = 0
  if ((caseSensitive == 0) && (tempCase == 0) && (typeof(textAnswers[whichEntry]) == "string"))
    holder = textAnswers[whichEntry].toLowerCase()
  if (tempVal != holder) {
    if (parent.frames['bottomFrame'].location.href.indexOf("schidden.htm") != -1)
      scWrong()
    else
      runInc()
    whichEntry -= i
    return
    }
  whichEntry++
  }
setDone((done+1))
eval(myFunc)
}

function judgeEvent() {

if ((done < keyPresses.length) && (keyPresses[done] != "")) {
  if (!isNaN(keyPresses[done].charAt(0))) {
    if (event.keyCode == keyPresses[done]) {
      event.keyCode = 0
      event.returnValue = false
      event.cancelBubble = true
      if (keyCommands[done] != null)
        eval(keyCommands[done])
      else
        eval(keyCommands[0])
      setDone(done+1)
      return false
      }
    else {
      if ((event.keyCode != 16) && (event.keyCode != 17))
        event.keyCode = 0
      event.returnValue = false
      event.cancelBubble = true 
      if (parent.frames['bottomFrame'].location.href.indexOf("schidden.htm") != -1)
        scWrong()
      else
        runInc()
      return false
      }
    }
  }
}

function resetMatching() {
var holder = ""

MM_showHideLayers('graphic1','','hide','flashstuff','','show')
if (IE)
  myObj = document.getElementById('lineTo')
else
  myObj = document.embeds.lineTo
holder = myObj.movie
myObj.LoadMovie(0, "blank_movie.swf");
myObj.LoadMovie(0, holder);
}

function showPage() {

MM_showHideLayers('graphic1','','show','flashstuff','','hide')
setTimeout("resetMatching()", 3500)
}

function submitPage() {
var notRight = 0

if (typeof(rightAns) != "number") {
  for (i=0;i<correctsNeeded;i++) {
    if (userAns[i] != rightAns[i]) {
      notRight = 1
      break
      }
    }
  }
else if (userAns[0] != rightAns)
  notRight = 1
if (notRight == 0) {
  if (parent.frames['bottomFrame'].location.href.indexOf("schidden.htm") != -1)
    scRight()
  else {
    toggleFwdBtn('show')
    runCor()
    }
  if (IE)
    document.getElementById('lineTo').setVariable("_global.draggingOn", 0)
  else
    document.embeds.lineTo.setVariable("_global.draggingOn", 0)
  }
else if (parent.frames['bottomFrame'].location.href.indexOf("schidden.htm") != -1) {
  scWrong()
  if (IE)
    document.getElementById('lineTo').setVariable("_global.draggingOn", 0)
  else
    document.embeds.lineTo.setVariable("_global.draggingOn", 0)
  }
else
  runInc()
}

function updateCoords() {
var theData = flashArgs.split(" ")
var chcNum = theData[0]
var ansNum = theData[1] - 1
var checkDone = theData[2]

userAns[ansNum] = chcNum
if (checkDone == 1)
  submitPage()
}

function lineTo_DoFSCommand(command, args) {
var f

flashArgs = args
f = eval(command)
f()
}

function loadNextAudio() {
dTracePoint("Entering loadNextAudio().", 3)
var theNextAudio

theNextAudio = TEMPLATE_AUDIO_PATH + "audio_" + grabFileName(document, 1) + "_" + audioFileIndex + ".swf"
document.getElementById('audioFlash').LoadMovie(0, theNextAudio)
audioFileIndex++
setTimeout('loadChecker()', 50)
dTracePoint("Exiting loadNextAudio().", 3)
}

function loadChecker() {
dTracePoint("Entering loadChecker().", 3)
var blankAudioFile = TEMPLATE_FLASH_PATH + "blank_movie.swf"

if (document.getElementById('audioFlash').PercentLoaded() == 0)
  document.getElementById('audioFlash').LoadMovie(0, blankAudioFile)
dTracePoint("Exiting loadChecker().", 3)
}

function showX(e) {
var xOffset = 0
var yOffset = 0

clearTimeout(redx_timer)
if (document.getElementById('rightcontent') != null) {
  xOffset = document.getElementById('rightcontent').style.pixelLeft + 10
  yOffset = document.getElementById('rightcontent').style.pixelTop + 10
  }
document.getElementById('redx').style.pixelLeft = e.clientX - xOffset
document.getElementById('redx').style.pixelTop = e.clientY - yOffset
MM_showHideLayers('redx','','show')
redx_timer = setTimeout("MM_showHideLayers('redx','','hide')", 1000)
}

function showCheckmark(num) {
var layerNum = "chk" + num
var rightNum = "right" + num

cMarkCount++
MM_showHideLayers(layerNum,'','show',rightNum,'','hide','redx','','hide')

if (cMarkCount == correctsNeeded) {
  MM_showHideLayers('wrong','','hide')
  runCor()
  }
}


/* END INTERACTION FUNCTIONS                                         */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/* START FEEDBACK FUNCTIONS                                          */

function manageWrong() {

anchStuff()
showArrow()
}

function showArrow() {

if (document.getElementById("incorrect").style.visibility == "visible")
  lowerInc()
MM_showHideLayers('showarrow','','show','showarrow1','','show')
blinker = 0
clearTimeout(timer)
timer = setInterval("blinkArrow()", 500)
}

function blinkArrow() {

blinker++
if (document.getElementById('showarrow').style.visibility == 'visible')
  MM_showHideLayers('showarrow','','hide','showarrow1','','hide')
else
  MM_showHideLayers('showarrow','','show','showarrow1','','show')
if (blinker == 6)
  clearTimeout(timer)
}

function lowerInc() {
var myObj

if (IE)
  myObj = document.getElementById('incFlash')
else
  myObj = document.embeds.incFlash
if (document.getElementById('incorrect').style.visibility == 'visible') {
  myObj.GotoFrame(11)
  myObj.Play()
  MM_showHideLayers('inchelper1','','hide','inchelper2','','hide')
  setTimeout("MM_showHideLayers('incorrect','','hide')", 600)
  }
setTimeout('curObjHolder.focus()', 50)
}

function lowerCor() {
var myObj

if (IE)
  myObj = document.getElementById('corFlash')
else
  myObj = document.embeds.corFlash
if (document.getElementById('correct').style.visibility == "visible") {
  myObj.GotoFrame(11)
  myObj.Play()
  setTimeout("MM_showHideLayers('correct','','hide')", 600)
  }
setTimeout('curObjHolder.focus()', 50)
}

function runInc() {
var myObj

if (IE)
  myObj = document.getElementById('incFlash')
else
  myObj = document.embeds.incFlash
clearTimeout(timer)
MM_showHideLayers('incorrect','','show','inchelper1','','show','inchelper2','','show','correct','','hide','showarrow','','hide')
myObj.Rewind()
myObj.Play()
}

function runCor() {
var myObj

if (IE)
  myObj = document.getElementById('corFlash')
else
  myObj = document.embeds.corFlash
clearTimeout(timer)
MM_showHideLayers('correct','','show','incorrect','','hide','inchelper1','','hide','inchelper2','','hide','showarrow','','hide')
myObj.Rewind()
myObj.Play()
}

function clearInc() {

clearTimeout(timer)
lowerInc()
MM_showHideLayers('showarrow','','hide')
}


/* END FEEDBACK FUNCTIONS                                            */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/* START STANDARD FUNCTIONS                                          */

function MM_swapImage() {
var i, x
var j = 0
var a = MM_swapImage.arguments

document.MM_sr = new Array
for (i=0;i<(a.length-2);i+=3) {
  if ((x=MM_findObj(a[i])) != null) {
    document.MM_sr[j++] = x
    if (!x.oSrc) {
      x.oSrc = x.src
      }
    x.src = a[(i+2)]
    }
  }
}

function MM_swapImgRestore() {
var i, x
var a = document.MM_sr

for (i=0;(a && (i<a.length) && (x=a[i]) && x.oSrc);i++)
  x.src = x.oSrc
}

function MM_showHideLayers() {
var i, p, v, obj
var args = MM_showHideLayers.arguments

for (i=0; i<(args.length-2); (i += 3)) {
  if ((obj=MM_findObj(args[i])) != (null)) {
    v = args[(i+2)]
    if (obj.style) {
      obj = obj.style
      v = (v == 'show') ? 'visible' : (v == 'hide') ? 'hidden' : v
      }
    obj.visibility = v
    }
  }
}

function MM_findObj(n, d) {
var p, i, x

if (!d)
  d = document
if (((p=n.indexOf("?")) > 0) && (parent.frames.length)) {
  d = parent.frames[n.substring(p+1)].document
  n = n.substring(0, p)
  }
if ((!(x=d[n])) && (d.all))
  x = d.all[n]
for (i=0;(!x && i<d.forms.length);i++)
  x = d.forms[i][n]
for (i=0;(!x && d.layers && i<d.layers.length);i++)
  x = MM_findObj(n, d.layers[i].document)
if (!x && d.getElementById)
  x = d.getElementById(n)
return x
}

function NewWindow(mypage, myname, w, h, scroll, resize) {
var winl = ((screen.width - w) / 2)-5
var wint = ((screen.height - h) / 2)-28
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable='+resize+''
win = window.open(mypage, myname, winprops)
//if (parseInt(navigator.appVersion) >= 4)
  //win.window.focus()
}

function setCookie (cookieName, cookieValue, expires, path, domain, secure) {
parent.document.cookie = escape(cookieName) + '=' + escape(cookieValue) + (expires ? '; EXPIRES=' + expires.toGMTString() : '') + (path ? '; PATH=' + path : '') + (domain ? '; DOMAIN=' + domain : '') + (secure ? '; SECURE' : '');
}

function getCookie (cookieName) {
var cookieValue = null;
var posName = document.cookie.indexOf(escape(cookieName) + '=');

if (posName != -1) {
  var posValue = posName + (escape(cookieName) + '=').length;
  var endPos = document.cookie.indexOf(';', posValue);
  if (endPos != -1)
    cookieValue = unescape(document.cookie.substring(posValue, endPos));
  else
    cookieValue = unescape(document.cookie.substring(posValue));
  }
return cookieValue
}

function dTracePoint(msg, sev) {
var dCookie
var holder1 = "<b>DEBUG - Page " + grabFileName(document,1) + ":</b> " + msg + "<br>"
var holder2 = holder1

if ((_DEBUGALERTS == 1) && (_DEBUGSEVERITY >= sev))
  alert(holder1)
if ((dCookie != null) && (dCookie.indexOf('DEBUG') != -1)) {
  dCookie = getCookie('debugCookie')
  holder2 = dCookie + holder1
  }
if (_DEBUGREPORT == 1)
  setCookie('debugCookie',holder2)
}

function showDebugReport() {
var dCookie = getCookie('debugCookie')

if ((dCookie != null) && (dCookie.indexOf('DEBUG') != -1))
  document.getElementById('debugLayer').innerHTML = dCookie
else
  document.getElementById('debugLayer').innerHTML = "No Debug Data."
document.getElementById('resetInfo').style.pixelTop = document.getElementById('debugLayer').scrollHeight + 15
document.getElementById('printInfo').style.pixelTop = document.getElementById('debugLayer').scrollHeight + 15
MM_showHideLayers('resetInfo','','show','printInfo','','show')
}

function openDebugWindow() {
NewWindow('debug.htm','debug_win','700','500','yes','yes')
}

function dClearInfo() {

setCookie('debugCookie','')
showDebugReport()
}

function dPrintInfo() {
window.print()
}


/* END STANDARD FUNCTIONS                                            */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/* START CONSTRUCTOR FUNCTIONS                                       */

function choice(obj, hgt, ins) {

this.obj = (!obj) ? "" : obj
this.hgt = (!hgt) ? "" : hgt
this.ins = (!ins) ? "" : ins
}

function pageStep(gsrc, glft, gtop, asrc, alft, atop, clft, ctop, cwid, chgt) {

this.gsrc = (!gsrc) ? "" : gsrc
this.glft = (!glft) ? "" : glft
this.gtop = (!gtop) ? "" : gtop
this.asrc = (!asrc) ? "" : asrc
this.alft = (!alft) ? "" : alft
this.atop = (!atop) ? "" : atop
this.clft = (!clft) ? "" : clft
this.ctop = (!ctop) ? "" : ctop
this.cwid = (!cwid) ? "" : cwid
this.chgt = (!chgt) ? "" : chgt
}


/* END CONSTRUCTOR FUNCTIONS                                         */
