- // ---------------------------------------------------------------
- // Author: Hans Paulini
- // Description: main times functions
- // ---------------------------------------------------------------
- //Times2
- //****************************
- //Menu
- var contentMenuVisi=false;
- var showingFlash=new Array;
- var showingGFlash=new Array;
- var showingChap=1;
- var thisAnswer=false;
- //****************************
- //Extention Mode
- var extentionScreens;
- var extentionPosition=0;
- var extentionScreensMode=false;
- var extentionStepJump=false;
- //OnLoad functions------------------------
- //Navigation is loaded
- function initNav(){
- frames.timesContent.document.location.replace(rootPath+'times/load.htm');
- if(isNav){
- initNNResizeBug();
- }
- }
- if(isNav){
- B04 = false;
- }
- //Content is loaded
- function conLoaded(){
- mode=load;
- updateNowAll(newChapter,newSection,newScreen,newStep);
- if (eval(contentFrame+'.step0')){
- newStep=(backVar==1)?eval(contentFrame+".stepLength")-1:0;
- showStepLayer();
- readInitStrings();
- backVar=0;
- }
- if ((load=="content"&&!prgHintMode)||load=="extention"||load=='assess'){
- markMenuItem(newChapter);
- if(contentArray[newChapter][0]){
- if(contentArray[newChapter].length>1){
- loadTextToHead(contentArray[newChapter][0]+' - '+contentArray[newChapter][newSection][0],"");
- }else{
- loadTextToHead(contentArray[newChapter][0][0],"");
- }
- }
- readIndex();
- if(newScreen==sectionScreens){
- found=false;
- positionNow=newChapter+'-'+newSection;
- for (i=0;i<history.length;i++){
- if(history[i]==positionNow){
- found=true;
- }
- }
- if(!found){
- history[history.length]=positionNow;
- showBobbles();
- for(s=1;s<contentArray.length+1;s++){
- if(checkHistory('C'+s)){
- showLayer('menu','KapHook'+s);
- }
- }
- }
- }
- if(helpVisi==true){
- if(!helpWIN.closed){
- helpWIN.frames.mainFrame.location.reload()
- }
- }
- if(frames.timesContent.stepLoaded){frames.timesContent.stepLoaded(newStep);}
- showNav();
- // showLayer(navFrame,"layB01");
- showLayer(navFrame,"layB07");
- showLayer(navFrame,"layB08");
- specialButtonControl();
- if(extentionStepJump){
- newStep=oldExtentionStep;
- changeStep();
- extentionStepJump=false;
- }
- }
- if (load=="menu"){
- loadTextToHead('Menu',"");
- updateNowView();
- // hideLayer(navFrame,"layB01");
- hideLayer(navFrame,"layB08");
- showLayer(navFrame,"layB07");
- }
- if (top.load=='extention'){
- if(frames.timesContent.extentionScreens){
- extentionScreens=frames.timesContent.extentionScreens;
- extentionScreensMode=true;
- }
- }
- if (load=="test_result"){
- initTestResult();
- hideNav();
- // hideLayer(navFrame,"layB01");
- showLayer(navFrame,"layB12");
- showLayer(navFrame,"layB08");
- }
- if (load=='assess'){
- errorCount=0;
- if(frames.timesContent.document.forms[0]){
- if(isNav){
- frames.timesContent.document.captureEvents(Event.CLICK);
- frames.timesContent.document.onclick=clickTestNN;
- }else{
- frames.timesContent.document.forms[0].onclick=clickTest;
- }
- }
- if(SecondChance){
- score(-1);
- }
- thisAnswer=false;
- hideNav();
- firstRunAnswerSpecialTest=0;
- showLayer(navFrame,"layB08");
- showLayer(navFrame,"layB09");
- showLayer(navFrame,"layB10");
- showLayer(navFrame,"layB11");
- showLayer(navFrame,"layB12");
- specialButtonControl();
- }
- if (load=='extention'||load=='hints'){
- showLayer(navFrame,"layB12");
- showLayer(navFrame,"layB08");
- if(extentionScreensMode){
- showLayer(navFrame,"layB09");
- showLayer(navFrame,"layB10");
- }
- }
- if (load=='start'){
- initTestVars();
- if(getCookie('TimesActualPosition')){
- pos=getCookie('TimesActualPosition').split('-');
- if(newChapter!=pos[0]||newSection!=pos[1]||newScreen!=pos[2]){
- if(confirm(askRestore)){restoreStanding();}
- }
- }
- showLayer(navFrame,"layB07");
- showLayer(navFrame,"layB12");
- }
- if (load=='start' && fairMode==true){
- fairModeInit();
- }
- if (load=='loadScreen'){
- checkPlugins();
- showLayer(navFrame,"layB12");
- }
- if (load=='pluginCheckFalse'){
- showLayer(navFrame,"layB12");
- }
- controlLayLoading("hide");
- updateNowAll(newChapter,newSection,newScreen,newStep);
- if(helpVisi==true){
- if(!helpWIN.closed){
- helpWIN.frames.mainFrame.location.reload()
- }
- }
- load='';
- if(reviewMode){
- loadReviewFrame();
- }
- if(history.length==0){
- hideLayer(navFrame,"layB06");
- }
- }
- var lastTestScreen=false;
- var prgHintMode=false;
- //The screen change comes from Navigation bar
- function clickControl(par){
- clearSound();
- if (mode=="menu"){
- chapVar=(newChapter==0)?1:newChapter+1;
- menuChanges(chapVar,newSection);
- for(c=1;c<11;c++){
- hideLayer('menu','KapLine'+c);
- }
- }
- if (mode=="tool"){
- changeScreen();
- }
- if (mode=="content"&&!prgHintMode){
- readClosingStrings();
- if(par == "next"){next();}
- if(par == "back"){back();}
- if(par == "forward"){forward();}
- if(par == "backward"){backward();}
- }
- else if(mode=="extention"){
- readClosingStrings();
- if(extentionScreensMode){
- if(par == "next"){
- if(newStep==frames.timesContent.stepLength-1){
- clickControl('forward');
- }else{
- next();
- }
- }
- if(par == "back"){
- if(newStep==0){
- clickControl('backward');
- }else{
- back();
- }
- }
- if(par == "forward"){
- if(extentionPosition<extentionScreens.length-1){
- frames.timesContent.document.location.replace(rootPath+'content/'+extentionScreens[extentionPosition+1]+".htm");
- extentionPosition++;
- }else{
- extentionStepJump=true;
- extentionScreensMode=false;
- extentionPosition=0;
- changeScreen();
- }
- }
- if(par == "backward"){
- if(extentionPosition>0){
- frames.timesContent.document.location.replace(rootPath+'content/'+extentionScreens[extentionPosition-1]+".htm");
- extentionPosition--;
- }else{
- extentionStepJump=true;
- extentionScreensMode=false;
- extentionPosition=0;
- changeScreen();
- }
- }
- }else{
- if(par == "next"){if(newStep==frames.timesContent.stepLength-1){--newScreen;};next();}
- if(par == "back"){if(newStep==0){++newScreen;backward()}else{back()}}
- if(par == "forward"){--newScreen;extentionStepJump=true;forward();}
- if(par == "backward"){++newScreen;extentionStepJump=true;backward();}
- }
- }
- else if(mode=="test_result"){
- if(courseComplete()){
- initEndScreen();
- }else{
- readIndex();
- if(comeFromMenu||chapters==newChapter+1){
- comeFromMenu=false;
- buttonUp(8);
- }else{
- changeScreen();
- }
- if(lastTestScreen){
- buttonUp(8);
- lastTestScreen=false;
- }
- }
- }
- else if(mode=="test_hint"){
- buttonUp(8);
- }
- else if(mode=="assess"){
- readClosingStrings();
- oldLayer='';
- oldLayerArray.length=0;
- if((newStep==frames.timesContent.stepLength-1)&&(newScreen==sectionScreens)&&(par=="next"||par=="forward")){
- if(afterChapterTestGoTo==1){
- if(courseComplete()){
- initEndScreen();
- }else{
- buttonUp(8);
- }
- }else if(afterChapterTestGoTo==2){
- buttonUp(5);
- }
- lastTestScreen=true;
- return;
- }
- if(par == "next"){next();}
- if(par == "back"){back();}
- if(par == "forward"){forward();}
- if(par == "backward"){backward();}
- }
- else if(mode=="pluginCheckFalse"){
- frames.timesContent.document.location.replace(rootPath+'times/load.htm');
- }
- else if(mode=="start"||prgHintMode){
- controlLayLoading("show");
- if(par == "next"){
- if (newStep<eval(contentFrame+".stepLength")-1){
- newStep++;
- changeStep();
- if(hintCounter>0){
- showLayer(navFrame,"layB10");
- }
- }else {
- par= 'forward';
- }
- }
- if(par == "back"){
- if (newStep>0){
- newStep--;
- changeStep();
- if(hintCounter>0){
- showLayer(navFrame,"layB10");
- }
- }else {
- par= 'backward';
- }
- }
- if(par == "forward"){
- if(prgHintMode){
- hintCounter++;
- if(hintFiles.length==1){
- prgHintMode=false;
- buttonUp(8);
- return;
- }
- }
- if(hintCounter<hintFiles.length){
- frames.timesContent.document.location.replace(rootPath+'content/'+hintFiles[hintCounter]);
- }else{
- prgHintMode=false;
- buttonUp(8);
- return;
- }
- if(hintCounter>0){
- showLayer(navFrame,"layB10");
- }else{
- hideLayer(navFrame,"layB10");
- hideLayer(navFrame,"layB09");
- }
- }
- if(par == "backward"){
- hintCounter--;
- frames.timesContent.document.location.replace(rootPath+'content/'+hintFiles[hintCounter]);
- if(hintCounter>0){
- showLayer(navFrame,"layB10");
- }else{
- hideLayer(navFrame,"layB10");
- hideLayer(navFrame,"layB09");
- }
- }
- showLayer(navFrame,"layB11");
- prgHintMode=true;
- }
- controlLayLoading("hide");
- frames.timesContent.focus();
- }
- //next button
- function next(pos) {
- if(isNav){
- if((pos != null) && (pos != undefined)){
- newStep=pos;
- if (newStep<=eval(contentFrame+".stepLength")-1){
- changeStep();
- }else{
- alert('stepIndex '+pos+' nicht vorhanden');
- }
- }else{
- if (newStep<eval(contentFrame+".stepLength")-1){
- newStep++;
- changeStep();
- }else{
- forward();
- }
- }
- }else{
- if (pos != null){
- newStep=pos;
- if (newStep<=eval(contentFrame+".stepLength")-1){
- changeStep();
- }else{
- alert('stepIndex '+pos+' nicht vorhanden');
- }
- }else{
- if (newStep<eval(contentFrame+".stepLength")-1){
- newStep++;
- changeStep();
- }else {
- forward();
- }
- }
- }
- }
- //back button
- function back() {
- if(newStep>0){
- newStep--;
- changeStep();
- }else{
- backVar=1;
- backward();
- }
- }
- function initEndScreen(){
- hideNav();
- hideNavAll();
- for(c=1;c<contentArray.length+1;c++){
- hideLayer('menu','KapLine'+c);
- hideLayer('menu','KapTxt'+c);
- hideLayer('menu','KapHook'+c);
- hideLayer('menu','Kap'+c);
- }
- loadTextToHead(courseTitle,"");
- updateNowView();
- showLayer(navFrame,"layB08");
- frames.timesContent.document.location.replace(rootPath+finishScreen);
- }
- function courseComplete(){
- secNum=0;
- for(o=0;o<contentArray.length;o++){
- if(contentArray[o].length>1){
- secNum=secNum+(contentArray[o].length-1);
- }else{
- secNum++;
- }
- }
- //alert(history.length+'<'+(secNum-1));
- if(history.length<secNum){
- return false;
- }else{
- return true;
- }
- }
- //forward button
- function forward() {
- newStep=-1;
- readIndex();
- if (newScreen<sectionScreens){
- newScreen=parseInt(newScreen)+1;
- changeScreen();
- }else{
- if (newSection<chapterSections){
- newSection=parseInt(newSection)+1;
- newScreen=1;
- changeScreen();
- }
- else{
- if(newChapter==chapters-1&&courseComplete()){
- initEndScreen();
- }else{
- if(parseInt(afterLastChapterScreenGoTo)==1){
- buttonUp(8);
- }
- if(parseInt(afterLastChapterScreenGoTo)==2){
- if(newChapter+1<chapters){
- newChapter=parseInt(newChapter)+1;
- newScreen=1;
- if(contentArray[newChapter].length>1){
- newSection=1;
- }else{
- newSection=0;
- }
- changeScreen();
- }else{
- buttonUp(8);
- }
- }
- }
- }
- }
- }
- //backward button
- function backward() {
- readIndex();
- if (newScreen>1){
- newScreen=parseInt(newScreen)-1;
- changeScreen();
- }else{
- if(newSection>1){
- newSection=parseInt(newSection)-1;
- readIndex();
- newScreen=sectionScreens;
- changeScreen();
- }else{
- buttonUp(8);
- }
- }
- }
- function menuChanges(chapter,section,screen){
- newChapter=chapter-1;
- newSection=section;
- newScreen=(screen)?screen:1;
- changeScreen();
- frames.timesContent.focus();
- }
- //Layer control functions------------------------------
- //Main functions
- function changeStep(){
- if(frames.timesContent.stepLoaded){frames.timesContent.stepLoaded(newStep);}
- if(newStep>=0){
- updateNowAll(newChapter,newSection,newScreen,newStep);
- hideToolLayer();
- clearSound();
- for(var j=0; j<nowVisiLayers.length; j++){
- if(nowVisiLayers[j].indexOf('G')==-1){
- hideLayer(conFrame,nowVisiLayers[j]);
- }
- }
- if(frames.timesContent.oldLayer!=null&&frames.timesContent.oldLayer!=''){
- hideLayer(conFrame,frames.timesContent.oldLayer);
- }
- nowVisiLayers.length=0;
- showStepLayer();
- readInitStrings();
- if(mode!='extention'&&extentionScreensMode==false){
- showNav();
- }
- specialButtonControl();
- if(nowSoundId!=''||nowVideoId!='')changeVol(volMousePos);
- }else{changeScreen();}
- }
- function changeScreen(){
- clearSound();
- hideNav();
- showingFlash.length=0;
- lockClickTest=false;
- scoreRuntimeMode=false;
- hideMenu();
- nowVisiLayers.length=0;
- showLayer(navFrame,"layLoading");
- newChapter*=1;newSection*=1;newScreen*=1;
- if(contentArray[newChapter].length>1){
- contentFileName=contentArray[newChapter][newSection][newScreen];
- }else{
- contentFileName=contentArray[newChapter][0][newScreen];
- }
- showScreen=rootPath+"content/"+contentFileName+".htm";
- frames.timesContent.document.location.replace(showScreen);
- readIndex();
- updateNowView(newScreen,sectionScreens);
- }
- var oldExtentionStep;
- function goToExtention(fileName){
- oldExtentionStep=newStep;
- hideNav();
- showLayer(navFrame,"layLoading");
- frames.timesContent.document.location.replace(rootPath+'content/'+fileName+".htm");
- }
- function updateNowView(num,of){
- refNow=(isNav)?'nowNN':'now';
- hideLayer(navFrame,refNow);
- if (isIE){
- refLink = window.frames.nav.document.all.now;
- if(refLink)
- refLink.innerHTML = num*1 +' / '+ of ;
- }
- if (isNav){
- if(frames.nav.document.layers.nowNN){
- refLink = frames.nav.document.layers.nowNN.document;
- refLink.write('<font class="now">'+num*1+' / '+of+'</font>');
- refLink.close();
- }
- }
- if(num&&of){
- showLayer(navFrame,refNow);
- }
- }
- function enableNowAll(){
- if(nowAll){
- nowAll=false;hideLayer(navFrame,refNow);
- }else{
- nowAll=true;
- updateNowAll(newChapter,newSection,newScreen,newStep);
- }
- }
- function updateNowAll(cha,sec,scr,ste){
- if(ste==-1)ste=0;
- cha=cha+1;++ste;
- if(cha==null){hideLayer(navFrame,refNow);}
- if(nowAll||devMode){
- if (document.all){
- refLink = frames.nav.document.all.nowAll;
- refLink.innerHTML = cha +' - '+ sec +' - '+scr +' - '+ste;
- }
- if (document.layers){
- if(frames.nav.document.layers.nowNNAll){
- refLink = frames.nav.document.layers.nowNNAll.document;
- refLink.write('<font class="now">'+cha +' - '+ sec +' - '+scr +' - '+ste+'</font>');
- refLink.close();
- }
- }
- refNow=(isNav)?'nowNNAll':'nowAll';
- showLayer(navFrame,refNow);
- }
- }
- function readInitStrings(){
- if(eval('frames.timesContent.step'+newStep)){
- eval(eval('frames.timesContent.step'+newStep+'.initStrings'));
- }
- }
- function readClosingStrings(){
- if(eval('frames.timesContent.step'+newStep)){
- eval(eval('frames.timesContent.step'+newStep+'.closingStrings'));
- }
- }
- var flashObject;
- var approveLayer = 0;
- var reproveLayer = 0;
- var audioQuality = "high";
- function audioOptions() {
- var audioOptions = window.open("../times/audiooptions.htm","audioOptions","titlebar=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=250,height=250,scrollbars=auto");
- }
- function showStepLayer(){
- //Times 2
- //****************
- showingFlash.length=0;
- showingGFlash.length=0;
- approveLayer = 0;
- reproveLayer = 0;
- clearTimeout(waitingLoopTimer);
- if(newStep>=0){
- //Stoppt alle laufenden Flash Sounddateien
- stopFlashSound();
- //****************************************
- nowVisiLayers.length=0;
- numLay=eval('frames.timesContent.step'+newStep+'.visibleLayers.length');
- if(eval('frames.timesContent.step'+newStep+'.visibleLayers')!=''){
- for(i=0;i<numLay;i++){
- showLay=eval(contentFrame+'.step'+newStep+'.visibleLayers['+i+']');
- if(showLay.indexOf('G')!=-1){
- showingGFlash[showingGFlash.length]=showLay;
- }
- if(showLay.indexOf('F')!=-1){
- showingFlash[showingFlash.length]=showLay;
- }
- if((showLay.indexOf('A')!=-1) && (audioQuality != "off")){
- showingFlash[showingFlash.length]=showLay;
- }
- if(showLay.indexOf('V')!=-1){
- clearSound();
- playVideo(showLay);
- }
- if(showLay.indexOf('T')!=-1){
- if(showLay.indexOf('Tr')!=-1){
- reproveLayer = showLay;
- } else {
- if(showLay.indexOf('Ta')!=-1){
- approveLayer = showLay;
- } else {
- showLayer(conFrame,showLay);
- }
- }
- }
- if(showLay.indexOf('S')!=-1){
- clearSound();
- playSound(showLay);
- }else{
- nowVisiLayers[i]=showLay;
- if(contentMenuVisi&&showLay.indexOf('F')!=-1){
- }else{
- if(showLay.indexOf('Ta')==-1&&showLay.indexOf('Tr')==-1){
- showLayer(conFrame,showLay);
- }
- }
- }
- }
- }
- waitingLoop();
- }
- }
- function approve() {
- unprove();
- if (approveLayer){
- showLayer(conFrame,approveLayer);
- }
- }
- function reprove() {
- unprove();
- if (reproveLayer){
- showLayer(conFrame,reproveLayer);
- }
- }
- function unprove() {
- if (approveLayer){
- hideLayer(conFrame,approveLayer);
- }
- if (reproveLayer){
- hideLayer(conFrame,reproveLayer);
- }
- }
- var waitingLoopTimer=false;
- function waitingLoop(par){
- if(clearObject){
- if(clearObject.IsPlaying()){
- waitingLoopTimer=setTimeout('waitingLoop()',100);
- }else if(showingFlash.length>0||showingGFlash.length>0){
- for(e=0;e<showingFlash.length;e++){
- if(isNav){
- if(eval('frames.timesContent.document.layers.'+showingFlash[e])){
- flashObject=eval('frames.timesContent.document.layers.'+showingFlash[e]+'.document.embeds[0]');
- eval('frames.timesContent.document.layers.'+showingFlash[e]+'.document.embeds[0].Rewind');
- }
- }else{
- if(eval('frames.timesContent.document.'+showingFlash[e]+'f')){
- flashObject=eval('frames.timesContent.document.'+showingFlash[e]+'f');
- }
- }
- if(flashObject){
- if(menu){
- showLayer('timesContent',showingFlash[e]);
- }else{
- flashObject.Rewind();
- }
- if(showingFlash[e].indexOf('A')==-1){
- GotoFrameDiv(showingFlash[e],0);
- flashObject.Play();
- }else{
- if(par!='menu'){
- GotoFrameDiv(showingFlash[e],0);
- flashObject.Play();
- }
- }
- }
- }
- for(e=0;e<showingGFlash.length;e++){
- showLayer('timesContent',showingGFlash[e]);
- }
- }
- }
- }
- function startFlash(){
- if(showingFlash){
- for(f=0;f<showingFlash.length;f++){
- showLay=showingFlash[f];
- flashObject=null;
- if(document.layers){
- if(eval('frames.timesContent.document.layers.'+showLay)){
- flashObject=eval('frames.timesContent.document.layers.'+showLay+'.document.embeds[0]');
- }
- }else{
- if(eval('frames.timesContent.document.'+showLay+'f')){
- flashObject=eval('frames.timesContent.document.'+showLay+'f');
- }
- }
- showLayer('timesContent',showLay);
- if(flashObject){
- flashObject.Play();
- }
- }
- }
- }
- var letItPlay = false;
- var clearObject;
- function stopFlashSound(){
- if(isNav){
- if(frames.nav.document.layers.clearSound){
- clearObject=frames.nav.document.layers.clearSound.document.embeds[0];
- }
- }else{
- if(frames.nav.document.clearSoundf){
- clearObject=frames.nav.document.clearSoundf;
- }
- }
- if(clearObject){
- clearObject.Rewind();
- if (letItPlay!=true) {
- clearObject.Play();
- }
- }
- return;
- }
- //Button control functions-------------------------
- //reading "contentArray"
- function readIndex(){
- if(contentArray[newChapter].length>1){
- sectionScreens=eval("contentArray["+newChapter+"]["+newSection+"].length")-1;
- }else{
- sectionScreens=eval("contentArray["+newChapter+"][0].length")-1;
- }
- chapterSections=eval("contentArray["+newChapter+"].length")-1;
- chapters=contentArray.length;
- }
- function specialButtonControl(){
- if(newStep>=0){
- buttons=eval('frames.timesContent.step'+newStep+'.buttons');
- if(buttons.charAt(0)=="0"){
- hideLayer(navFrame,"layB09");
- }
- if(buttons.charAt(1)=="0"){
- hideLayer(navFrame,"layB10");
- }
- if(buttons.charAt(2)=="0"){
- hideLayer(navFrame,"layB11");
- }
- if(buttons.charAt(3)=="0"){
- hideLayer(navFrame,"layB12");
- }
- }
- }
- //hides Navigation Buttons
- function hideNav(){
- hideLayer(navFrame,"layB09");
- hideLayer(navFrame,"layB10");
- hideLayer(navFrame,"layB11");
- hideLayer(navFrame,"layB12");
- }
- function hideNavAll(){
- // hideLayer(navFrame,"layB01");
- hideLayer(navFrame,"layB07");
- hideLayer(navFrame,"layB08");
- }
- //shows Navigation Buttons
- function showNav(){
- // showLayer(navFrame,"layB01");
- readIndex();
- showLayer(navFrame,"layB12");
- showLayer(navFrame,"layB11");
- if (newChapter==0 && newSection==1 && newScreen==1 && newStep==0){hideLayer(navFrame,"layB09");}
- else{showLayer(navFrame,"layB09");}
- if (newChapter==0 && newSection==1 && newScreen==1){hideLayer(navFrame,"layB10");}
- else{showLayer(navFrame,"layB10");}
- }
- //Loading Image Control Function
- function controlLayLoading(par){
- if (par=="show")
- showLayer(navFrame,"layLoading");
- else if(par=="hide")
- hideLayer(navFrame,"layLoading");
- else if(par!="show" && par!="hide")
- alert("Error controlLayLoading");
- }
- function showTXT(bNo) {
- if (bNo<10){ txtObj = "layTXT" + "0" + bNo ;}else{txtObj = "layTXT" + bNo ;}
- showLayer(navFrame,txtObj);
- }
- function hideTXT(bNo) {
- hideLayer(navFrame,txtObj);
- }
- function checkButtonHeight(){
- for(i=2;i<14;i++){
- buttonObj = (i<10) ? "layB"+"0"+i : "layB"+i;
- buttonTop=getObjTop(buttonObj);
- if (buttonTop<1){buttonDown(i);}
- else if(buttonTop>1){buttonRestore(i);}
- }
- }
- function buttonDown(bNo){
- buttonObj = (bNo<10) ? "layB"+"0"+bNo : "layB"+bNo ;
- focusSelf();
- }
- function buttonRestore(bNo){
- if (bNo<10)buttonObj = "layB" + "0" + bNo ;
- else buttonObj = "layB" + bNo ;
- buttonUp(bNo);
- focusSelf();
- }
- function loadToContent(file){
- frames.timesContent.document.location=rootPath+file;
- hideMenu();
- hideNav();
- mode='tool';
- // hideLayer(navFrame,"layB01");
- showLayer(navFrame,"layB12");
- }
- var comeFromMenu=false;
- function buttonUp(bNo){
- if(toolVisi==true && bNo!=2 && bNo!=3 && bNo!=4 && bNo!=5 && bNo!=6&& bNo!=7){
- hideToolLayer();
- }
- if (bNo == 1) {//Show Menu-------------------------------------------------
- if(mode!='start'&&mode!='menu'&&mode!='test_result'){
- if(contentMenuVisi){
- hideMenu();
- }else{
- initMenu();
- }
- }
- }
- else if (bNo == 2) {//Help-------------------------------------------------
- if (helpVisi==false){
- hideToolLayer();
- helpWIN = window.open("../times/help.htm","help","titlebar=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=640,height=480,scrollbars=no");
- helpWIN.focus();
- helpVisi=true;
- }else{
- if (helpWIN.closed){
- helpVisi=false;
- buttonUp(2);
- }else{
- hideToolLayer();
- setTimeout('helpWIN.focus()',500);
- }
- }
- }
- else if (bNo == 3) {//Glossary-------------------------------------------------
- if (glossaryVisi==false){
- hideToolLayer();
- glossaryWIN = window.open('glossary.htm',"glossary","titlebar=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=740,height=480,scrollbars=no");
- glossaryWIN.focus();
- glossaryVisi=true;
- }else{
- if (glossaryWIN.closed){
- glossaryVisi=false;
- buttonUp(3);
- }else hideToolLayer();glossaryWIN.focus();
- }
- }
- else if (bNo == 4) {//Print-------------------------------------------------
- hideToolLayer();
- if(isIE){
- if (window.print){
- frames.timesContent.focus();
- frames.timesContent.print();
- }else{
- vbPrintPage();
- }
- }
- }
- else if (bNo == 5) {//Test
- if(mode=='menu'){
- comeFromMenu=true;
- }
- clearSound();
- hideMenu();
- assessControl('testbutton');
- frames.timesContent.document.location.replace(rootPath+'times/tm2_test_result.htm');
- }
- else if (bNo == 6) {//SaveLocal-------------------------------------------------
- if(confirm(askSaving)){
- saveStanding();
- }
- }
- else if (bNo == 7) {//Show tools-------------------------------------------------
- if(toolVisi==false){
- showLayer(navFrame,"layExtra");
- toolVisi=true;
- for ( i = 2; i < 7; i++ ){
- buttonsToShow= "layB0" + i;
- showLayer(navFrame,buttonsToShow);
- }
- showLayer(navFrame,"layB21");
- if(!B02||helpFiles.length==0){hideLayer(navFrame,"layB02");}
- if(!B03||glossaryFiles.length==0){hideLayer(navFrame,"layB03");}
- if(!B04){hideLayer(navFrame,"layB04");}
- if((testSection&&!B05)||mode=='start'||mode=='assess'){hideLayer(navFrame,"layB05");}
- if(!B06){hideLayer(navFrame,"layB06");}
- }else{
- hideToolLayer();
- }
- }
- else if (bNo == 8){//Menu-------------------------------------------------
- clearSound();
- controlLayLoading("show");
- frames.timesContent.document.location=rootPath+menuScreen;
- hideNav();
- }
- else if (bNo == 9) {//back-------------------------------------------------
- clickControl("back");
- }
- else if (bNo == 10) {//backward-------------------------------------------------
- clickControl("backward");
- }
- else if (bNo == 11) {//forward-------------------------------------------------
- clickControl("forward");
- }
- else if (bNo == 12) {//next-------------------------------------------------
- clickControl("next");
- }
- else if (bNo == 21) {//audio-------------------------------------------------
- audioOptions();
- }
- if(bNo!=2&&bNo!=3){self.focus();}
- }
- //hides Tool Buttons B02-B07
- function hideToolLayer(){
- toolVisi=false;
- volVisi = false;
- for ( i = 2; i < 7; i++ ){
- buttonsToHide= "layB0" + i; //helpvar for count i
- hideLayer(navFrame,buttonsToHide);
- }
- hideLayer(navFrame,"layExtra");
- hideLayer(navFrame,"layB21");
- }
- //Store functions--------------------------------------------
- function saveStanding(){
- setCookie('TimesPosition',history,expiry);
- text='';
- for(i=0;i<testResultsFile.length;i++){
- text+=testResultsFile[i]+'*';
- }
- setCookie('TestResults',text,expiry);
- if(mode=='menu'||mode=='test_result'){
- setCookie('TimesActualPosition','menu');
- }else{
- setCookie('TimesActualPosition',newChapter+'-'+newSection+'-'+newScreen,expiry);
- }
- }
- var tpos='';
- var tres='';
- function restoreStanding(){
- tpos=getCookie('TimesPosition');
- history=(tpos)?tpos.split(','):new Array;
- tres=getCookie('TestResults');
- if(tres){
- testResultsFile=tres.split('*');
- }
- testResultsFileNew=new Array;
- for(i=0;i<testResultsFile.length;i++){
- testResultsFileNew[i]= testResultsFile[i].split(',');
- }
- testResultsFile=testResultsFileNew;
- actPos=getCookie('TimesActualPosition');
- deleteStanding();
- if(actPos=='menu'){
- buttonUp(8);
- }else{
- pos=actPos.split('-');
- newChapter=pos[0];
- newSection=pos[1];
- newScreen=pos[2];
- changeScreen();
- }
- updateMenuStanding();
- }
- function deleteStanding(){
- deleteCookie('TestResults');
- deleteCookie('TimesPosition');
- deleteCookie('TimesActualPosition');
- }
- function playVideo(name){
- nowVideoId=name;
- if(isNav){
- if(onlineProject){
- eval('frames.timesContent.document.layers.'+name+'.document.embeds[0].Play()');
- }else{
- eval('frames.timesContent.document.layers.'+name+'.document.embeds[0].play()');
- }
- }else{
- eval('frames.timesContent.document.'+name+'v.Play();');
- }
- }
- function playSound(name){
- nowSoundId=name;
- if(isNav){
- if(onlineProject){
- eval('frames.timesContent.document.layers.'+name+'.document.embeds[0].Play()');
- }else{
- eval('frames.timesContent.document.layers.'+name+'.document.embeds[0].play();');
- }
- }else{
- eval('frames.timesContent.document.'+name+'s.Play();');
- }
- }
- function clearSound(){
- if(nowSoundId!=''){
- if(isNav){
- if(onlineProject){
- eval('frames.timesContent.document.layers.'+nowSoundId+'.document.embeds[0].Stop();');
- eval('frames.timesContent.document.layers.'+nowSoundId+'.document.embeds[0].SetCurrentPosition(0);');
- }else{
- eval('frames.timesContent.document.layers.'+nowSoundId+'.document.embeds[0].stop();');
- }
- }else{
- eval('frames.timesContent.document.'+nowSoundId+'s.stop();');
- eval('frames.timesContent.document.'+nowSoundId+'s.CurrentPosition="0";');
- }
- nowSoundId='';
- }else if(nowVideoId!=''){
- if(isNav){
- if(onlineProject){
- eval('frames.timesContent.document.layers.'+nowVideoId+'.document.embeds[0].Stop();');
- eval('frames.timesContent.document.layers.'+nowVideoId+'.document.embeds[0].SetCurrentPosition(0);');
- }else{
- eval('frames.timesContent.document.layers.'+nowVideoId+'.document.embeds[0].stop();');
- eval('frames.timesContent.document.layers.'+nowVideoId+'.document.embeds[0].rewind();');
- }
- }else{
- eval('frames.timesContent.document.'+nowVideoId+'v.stop();');
- eval('frames.timesContent.document.'+nowVideoId+'v.CurrentPosition="0";');
- }
- nowVideoId='';
- }
- }
- //*******************************************************
- //Menu Functions
- //*******************************************************
- var lastMovie='';
- var closeMenu=false;
- content=contentArray;
- function stopFlash(){
- if(showingFlash){
- for(f=0;f<showingFlash.length;f++){
- showLay=showingFlash[f];
- flashObject=null;
- if(document.layers){
- if(eval('frames.timesContent.document.layers.'+showLay)){
- flashObject=eval('frames.timesContent.document.layers.'+showLay+'.document.embeds[0]');
- }
- }else{
- if(eval('frames.timesContent.document.'+showLay+'f')){
- flashObject=eval('frames.timesContent.document.'+showLay+'f');
- }
- }
- hideLayer('timesContent',showLay);
- if(flashObject){
- if(showLay.indexOf('A')==-1){
- flashObject.StopPlay();
- }
- }
- }
- }
- if(showingGFlash){
- for(f=0;f<showingGFlash.length;f++){
- hideLayer('timesContent',showingGFlash[f]);
- }
- }
- if(frames.timesContent.document.showingFlash2){
- for(f=0;f<frames.timesContent.document.showingFlash2.length;f++){
- showLay=frames.timesContent.document.showingFlash2[f];
- flashObject=null;
- if(document.layers){
- if(eval('frames.timesContent.document.layers.'+showLay)){
- flashObject=eval('frames.timesContent.document.layers.'+showLay+'.document.embeds[0]');
- }
- }else{
- if(eval('frames.timesContent.document.'+showLay+'f')){
- flashObject=eval('frames.timesContent.document.'+showLay+'f');
- }
- }
- hideLayer('timesContent',showLay);
- if(flashObject){
- flashObject.StopPlay();
- }
- }
- }
- }
- function focusSelf(){
- self.focus();
- }
- function hideMenu(){
- clearTimeout(waitingLoopTimer);
- if(mode!='menu'){
- waitingLoop('menu');
- }
- hideLayer('timesContent','Menu');
- hideLayerContent('KapConnect');
- for(c=1;c<11;c++){
- hideLayer('menu','KapLine'+c);
- }
- if(mode=='menu'){
- for(c=1;c<11;c++){
- hideLayer('timesContent','TxtS'+c);
- hideLayer('timesContent','TxtC'+c);
- hideLayer('timesContent','HokS'+c);
- hideLayer('timesContent','HookC'+c);
- hideLayer('timesContent','SecConnect'+c);
- hideLayer('timesContent','KapLine'+c);
- hideLayer('timesContent','S'+c);
- hideLayer('timesContent','C'+c);
- }
- }
- contentMenuVisi=false;
- }
- eventMovie=false;
- function onMouseClick(evt){
- if(isNav){
- if(evt.target.name){
- eventMovie=evt.target.name;
- }
- }else{
- eventMovie='true';
- }
- if(eventMovie){
- if(eventMovie!='Menu'&&mode!='menu'){
- setTimeout('hideMenu()',500);
- }
- }
- }
- function onClickSection(cha,sec){
- hideMenu();
- menuChanges(cha+1,sec);
- parent.focus();
- }
- function onClickChapter(cha){
- hideMenu();
- if(contentArray[cha].length>1){
- menuChanges(cha+1,1);
- }else{
- menuChanges(cha+1,0);
- }
- parent.focus();
- }
- function initMenu(){
- if(isNav){NNvar='NN'}else{NNvar=''}
- hideMenu();
- stopFlash();
- //stopFlashSound();
- oldSectionLayer=false;
- vars="actChap="+(newChapter+1)+"&";
- vars+="actSec="+newSection+"&";
- //alert('reset');
- if(newChapter==0&&newSection==1&&history.length==0&&(newStep==0||newStep==-1)){
- vars='';
- }else{
- markMenuItem(newChapter);
- }
- for(s=1;s<contentArray.length+1;s++){
- if(checkHistory('C'+s)){
- value=1;
- }else{
- value=0;
- }
- vars+="seenChap"+(s-1)+"="+value+"&";
- for(q=1;q<contentArray[(s*1)-1].length;q++){
- if(checkHistory('C'+((s*1))+'S'+(q))){
- value=1;
- }else{
- value=0;
- }
- vars+="seenSec"+(s-1)+(q-1).toString()+"="+value+"&";
- }
- }
- headLineText='<object id="Menuf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0" width="477" height="360">'+
- '<param name=movie value="../laypic/menu.swf?'+vars+'">'+
- '<param name="quality" value="high">'+
- '<param name="LOOP" value="false">'+
- '<param name="PLAY" value="true">'+
- '<param name="wmode" value="transparent">'+
- '<embed src="../laypic/menu_nn.swf?'+vars+'" name="x" quality="high" wmode=transparent swLiveConnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="477" height="360" play="true" loop="false"></embed></object>';
- if (isIE){
- refLink = window.frames.timesContent.document.all.Menu;
- if(refLink){
- refLink.innerHTML = headLineText ;
- }
- showLayer('timesContent','Menu');
- }
- if (isNav){
- if(mode=='menu'){
- //Start NN Menu
- contentMenuVisi=true;
- if(isNav){
- frames.timesContent.document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
- }
- frames.timesContent.document.onmouseover = onMouseOver;
- frames.timesContent.document.onmouseout = onMouseOut;
- for(c=1;c<contentArray.length+1;c++){
- if(contentArray[c-1].length>1){
- loadText('timesContent','TxtC'+c,contentArray[c-1][0]);
- }else{
- hideLayerContent('KapConnect');
- loadText('timesContent','TxtC'+c,contentArray[c-1][0][0]);
- }
- showLayer('timesContent','C'+c);
- showLayer('timesContent','TxtC'+c);
- showLayer('menu','KapLine'+c);
- showLayer('menu','KapTxt'+c);
- showLayer('menu','Kap'+c);
- }
- if(contentArray[newChapter].length>1){
- openSections(newChapter+1);
- }else{
- updateMenuStanding();
- }
- }else{
- if(window.frames.timesContent.document.layers.Menu){
- refLink = window.frames.timesContent.document.layers.Menu.document;
- refLink.write(headLineText);
- refLink.close();
- showLayer('timesContent','Menu');
- }
- }
- }
- if(mode!='menu'){
- contentMenuVisi=true;
- }
- if(isNav){
- frames.timesContent.document.captureEvents(Event.MOUSEDOWN);
- }
- frames.timesContent.document.onmousedown = onMouseClick;
- for(c=0;c<contentArray.length;c++){
- showLayer('menu','KapLine'+(c+1));
- showLayer('menu','KapTxt'+(c+1));
- showLayer('menu','Kap'+(c+1));
- }
- }
- function showBobbles(){
- for(c=0;c<contentArray.length;c++){
- showLayer('menu','KapTxt'+(c+1));
- showLayer('menu','Kap'+(c+1));
- }
- }
- //************************************************************
- //Menu DHTML Functions
- //************************************************************
- var lastMovie='';
- var closeMenu=false;
- content=contentArray;
- eventMovie=false;
- var showingMenuTXT='bla';
- var startID=1;
- function openSections(id){
- startID=id*1;
- if(isNaN(id)){
- return;
- }else{
- showingChap=id;
- sectionLength=(contentArray[id-1].length-1)*1;
- completeLength=sectionLength+startID;
- if(completeLength>11){
- startID=11-sectionLength;
- }
- endID=startID+sectionLength;
- for(b=startID;b<endID;b++){
- showLayer('timesContent','S'+b);
- if(b<endID-1){
- showLayer('timesContent','SecConnect'+b);
- }
- }
- for(a=startID;a<endID;a++){
- che=id-1;sec=a-startID+1;
- loadText('timesContent','TxtS'+a,contentArray[che][sec][0]);
- showLayer('timesContent','TxtS'+a);
- }
- updateMenuStanding();
- positionTop=27+((id-1)*35);
- shiftToContent('KapConnect',220,positionTop);
- if(contentArray[showingChap-1].length>1){
- showLayerContent('KapConnect');
- }else{
- hideLayerContent('KapConnect');
- }
- }
- }
- eventMovie=false;
- pause=false;
- oldChapterLayer=false;
- oldSectionLayer=false;
- function onMouseOver(evt){
- onMouseOut('over');
- if(evt.target.name){
- eventMovie=evt.target.name;
- }
- if(eventMovie){
- if(eventMovie.indexOf('Txt')!=-1){
- eventMovie=eventMovie.substring(3,eventMovie.length);
- }
- if(eventMovie.indexOf('C')!=-1&&eventMovie.length<4){
- if(oldChapterLayer){
- if(oldChapterLayer.indexOf(eventMovie)!=-1){
- return;
- }
- }
- pause=setTimeout('changeChapter()',50);
- }
- if(eventMovie.indexOf('S')!=-1&&eventMovie.length<4){
- if(oldSectionLayer){
- if(oldSectionLayer.indexOf(eventMovie)!=-1){
- return;
- }
- changePic('timesContent',oldSectionLayer,'img'+oldSectionLayer,'../laypic/tm2_menu_sec.gif');
- }
- oldSectionLayer=eventMovie;
- if(eventMovie.indexOf(newSection+startID-1)!=-1&&newChapter==showingChap-1){
- oldSectionLayer=false;
- }else{
- changePic('timesContent',eventMovie,'img'+eventMovie,'../laypic/tm2_menu_sec_filled2.gif');
- }
- overFlash(showingChap.toString()-1,((eventMovie.substring(1,eventMovie.length)*1)-(startID)+1));
- }
- }
- }
- function changeChapter(){
- for(c=1;c<11;c++){
- hideLayer('timesContent','TxtS'+c);
- hideLayer('timesContent','SecConnect'+c);
- hideLayer('timesContent','S'+c);
- }
- if(oldChapterLayer){
- changePic('timesContent',oldChapterLayer,'img'+oldChapterLayer,'../laypic/tm2_menu_kap.gif');
- }
- oldChapterLayer=eventMovie;
- changePic('timesContent',eventMovie,'img'+eventMovie,'../laypic/tm2_menu_kap_filled2.gif');
- showingChap=eventMovie.substr(1,2);
- openSections(showingChap);
- overFlash(showingChap.toString()-1,0);
- }
- function onMouseOut(vari){
- clearTimeout(pause);
- eventMovie=false;
- }
- function loadText(frame,id,text){
- if(id.indexOf('S')!=-1){
- num=id.substring(4,id.length);
- text='<a href="#" onClick="parent.clickSection('+num+');return false" onmouseover="parent.overSection('+num+');" onmouseout="parent.outSection('+num+');">'+text+'</a>';
- }
- if(id.indexOf('C')!=-1){
- num=id.substring(4,id.length);
- text='<a href="#" onClick="parent.clickChapter('+num+');return false" onmouseover="parent.overChapter('+num+');" onmouseout="parent.outChapter('+num+');">'+text+'</a>';
- }
- if (isIE){
- refLink = eval('window.frames.'+frame+'.document.all.'+id);
- if(refLink){
- refLink.innerHTML = text ;
- }
- }
- if (isNav){
- refLink = eval('window.frames.'+frame+'.document.layers.'+id+'.document');
- refLink.write('<font class="textflow10">'+text+'</font>');
- refLink.close();
- }
- }
- function updateMenuStanding(){
- if(newChapter==0&&newSection==1&&history.length==0&&(newStep==0||newStep==-1)){
- }else{
- markMenuItem(newChapter,newSection);
- }
- if(mode=='menu'){
- for(c=1;c<11;c++){
- hideLayer('timesContent','HookS'+c);
- }
- //Reading History
- showBobbles();
- for(s=1;s<contentArray.length+1;s++){
- if(checkHistory('C'+s)){
- showLayer('timesContent','HookC'+s);
- showLayer('menu','KapHook'+s);
- }
- for(q=1;q<contentArray[(showingChap*1)-1].length;q++){
- if(checkHistory('C'+((showingChap*1))+'S'+(q))){
- showLayer('timesContent','HookS'+(q+startID-1));
- }
- }
- }
- }
- }
- function markMenuItem(cha,sec){
- //Position Now
- if(sec){
- for(y=1;y<11;y++){
- changePic('timesContent','S'+y,'imgS'+y,'../laypic/tm2_menu_sec.gif');
- }
- changePic('timesContent','C'+((cha*1)+1),'imgC'+((cha*1)+1),'../laypic/tm2_menu_kap_filled.gif');
- if((cha*1)+1==showingChap*1){
- changePic('timesContent','S'+(sec+(startID-1)),'imgS'+(sec+(startID-1)),'../laypic/tm2_menu_sec_filled.gif');
- }
- }else{
- for(y=1;y<11;y++){
- changePic('menu','Kap'+y,'imgKap'+y,'../laypic/tm2_menu_button.gif');
- }
- changePic('timesContent','C'+((cha*1)+1),'imgC'+((cha*1)+1),'../laypic/tm2_menu_kap_filled.gif');
- changePic('menu','Kap'+((cha*1)+1),'imgKap'+((cha*1)+1),'../laypic/tm2_menu_button_filled.gif');
- showBobbles();
- if(checkHistory('C'+(cha))){
- showLayer('menu','KapHook'+(cha));
- }
- }
- }
- function changePic(frame,layer,name,src){
- if(isIE){
- obj=eval('frames.'+frame+'.document.all.'+name);
- if(obj){
- obj.src=src;
- }
- }else{
- obj=eval('frames.'+frame+'.document.layers.'+layer+'.document.'+name);
- obj.src=src;
- }
- }
- function returnPicSrc(frame,layer,name){
- if(isIE){
- obj=eval('frames.'+frame+'.document.all.'+name);
- if(obj){
- return obj.src;
- }else{return false}
- }else{
- obj=eval('frames.'+frame+'.document.layers.'+layer+'.document.'+name);
- return obj.src;
- }
- }
- function clickSection(num){
- hideMenu();
- menuChanges(showingChap,(num-startID)+1);
- parent.focus();
- }
- function clickChapter(num){
- hideMenu();
- if(contentArray[showingChap-1].length>1){
- menuChanges(showingChap,1);
- }else{
- menuChanges(showingChap,0);
- }
- parent.focus();
- }
- function changePic(frame,layer,name,src){
- if(isIE){
- if(eval('frames.'+frame+'.document.all.'+name)){
- obj=eval('frames.'+frame+'.document.all.'+name);
- if(obj){
- obj.src=src;
- }
- }
- }else{
- if(eval('frames.'+frame+'.document.layers.'+layer)){
- obj=eval('frames.'+frame+'.document.layers.'+layer+'.document.'+name);
- obj.src=src;
- }
- }
- }
- function checkHistory(layName){
- sectionFound=false;
- chapSectionsShowed=new Array();
- for(l=0;l<history.length;l++){
- nameArray=history[l].split('-');
- chap=(nameArray[0]*1)+1;
- searchString='C'+chap+'S'+nameArray[1];
- if(layName==searchString){
- sectionFound=true;
- }
- num=parseInt(nameArray[0]*1);
- if(chapSectionsShowed[num]){
- chapSectionsShowed[num]+=1;
- }else{
- chapSectionsShowed[num]=1;
- }
- }
- for(m=0;m<chapSectionsShowed.length;m++){
- if(contentArray[m].length>1){
- subVar=1;
- }else{
- subVar=0;
- }
- if(chapSectionsShowed[m]==contentArray[m].length-subVar){
- num=m+1;
- searchString='C'+num;
- if(searchString.indexOf(layName)!=-1){
- return true;
- }
- }
- }
- if(sectionFound){
- return true;
- }
- return false;
- }
- function loadTextToHead(left,right){
- if(isNav){NNvar='NN'}else{NNvar=''}
- if (left == "") {
- left = window.frames.timesContent.document.title;
- }
- headLineText='<table border="0" cellspacing="0" cellpadding="5" height="40" width="740"><tr><td class="pageHeadline" valign="top">'+left+'</td><td class="chapterHeadline" valign="top" align="right">'+right+'</tr></table>';
- if (isIE){
- refLink = window.frames.head.document.all.Headline;
- if(refLink){
- refLink.innerHTML = headLineText ;
- }
- }
- if (isNav){
- refLink = window.frames.head.document.layers.Headline.document;
- refLink.write('<font class="textflow10">'+headLineText+'</font>');
- refLink.close();
- }
- }
- var closeOverFlash=false;
- var showingMenuTXT='a';
- function overFlash(chap,sec){
- if(mode=='menu'){
- hideLayerContent(showingMenuTXT);
- if(sec==0){
- showingMenuTXT="ChapTxt"+chap.toString();
- }else{
- showingMenuTXT="SecTxt"+chap.toString()+(sec-1).toString();
- }
- if(showLayerContent(showingMenuTXT)){
- showLayerContent('TextFieldBg');
- }
- }
- return;
- }
- function outFlash(get){
- return;
- }
- //Review Functions
- function sendReview(){
- path=frames.timesContent.document.location.href;
- pathArray=path.split('/');
- fileName=pathArray[pathArray.length-1];
- fileName=fileName.substring(0,fileName.length-4);
- frames.review.document.forms.reviewForm.fileID.value=fileName;
- frames.review.document.forms.reviewForm.submit();
- }
- function loadReviewFrame(){
- path=frames.timesContent.document.location.href;
- pathArray=path.split('/');
- fileName=pathArray[pathArray.length-1];
- fileName=fileName.substring(0,fileName.length-4);
- if(mode=="content"||mode=="extention"||mode=="assess"){
- frames.review.document.location.replace('http://www.firstmedia.de/cgi-bin/'+project+'/review.pl?'+fileName);
- return;
- }
- if(mode=="menu"){
- frames.review.document.location.replace('http://www.firstmedia.de/cgi-bin/'+project+'/review.pl?start');
- }
- }
- //***********************************
- //Init Testresult page
- //***********************************
- function initTestResult(){
- if(isIE){
- image1 = new Image();
- image1.src="../laypic/test_button_line.gif";
- }
- text='<table width="400" border="0" cellspacing="0" cellpadding="0">';
- //alert(testResultsFile);
- for(q=0;q<contentArray.length;q++){
- chapName=(contentArray[q].length>1)?contentArray[q][0]:contentArray[q][0][0];
- text+='<tr valign="top"><td width="221" class="textflow10" height="35"><div align="left">'+chapName+'</div></td><td width="179" height="30" class="textflow8">';
- if(testResults[q]){
- if(testResults[q]==1){
- text+='<img src="../laypic/test_button_line.gif" width="168" height="17">';
- showLayer(contentFrame,'Button'+(q+1));
- count=0;countRight=0;
- for(z=0;z<testResultsFile.length;z++){
- if(q==testResultsFile[z][2]){
- count++;
- if(testResultsFile[z][1]>0){
- countRight++;
- }
- }
- }
- //alert(countRight+'--'+count);
- //alert('Button'+(q+1)+'--'+Math.round(parseInt(countRight)/parseInt(count)*100));
- Phtml='<font style="font-family: Arial, Helvetica, sans-serif; font-size: 8pt; font-weight: bold">'+Math.round(parseInt(countRight)/parseInt(count)*100)+' %</font>';
- loadText('timesContent','chaprecord'+q,Phtml);
- shiftByContent('chaprecord'+q,Math.round(parseInt(countRight)/parseInt(count)*100),0);
- shiftByContent('Button'+(q+1),Math.round(parseInt(countRight)/parseInt(count)*100),0);
- }
- }
- text+='</td></tr>';
- }
- text+='</table>';
- id='Tab';
- if (isIE){
- refLink = eval('window.frames.timesContent.document.all.'+id);
- if(refLink){
- refLink.innerHTML = text ;
- }
- }
- if (isNav){
- refLink = eval('window.frames.timesContent.document.layers.'+id+'.document');
- refLink.write(text);
- refLink.close();
- }
- shiftByContent('ButtonEnd',testEndResult,0);
- if(testEndResult>=testMinResult){
- showLayerContent('Passed');
- }
- }
- var testQuestions=0;
- var testQuestionsSeen=0;
- var testQuestionsOK=0;
- var testEndResult=0;
- var testSection = new Array;
- testResults = new Array;
- for(s=0;s<10;s++){testResults[s]=0;}
- testResultsFile = new Array;
- testResults.length=contentArray.length;
- function initTestVars(){
- if(testQuestions==0){
- for(s=0;s<testSection.length;s++){
- c=testSection[s][0];
- se=testSection[s][1]+1;
- testQuestions+=(contentArray[c][se].length-1);
- found=true;
- for(f=1;f<contentArray[c][se].length;f++){
- testResultsFile[testResultsFile.length] = new Array(contentArray[c][se][f],-1,c);
- }
- testResults[c]=1;
- }
- }
- }
- var lastAnswerID=1;
- var errorCount=0;
- function clickTestNN(evt){
- if(evt.target.name=='checkbox'){
- clickTest();
- }
- }
- function checkRightWrong(questionNr,dezCode){
- id=decTobin(dezCode).split('');
- id.reverse();
- if(id[questionNr-1]=='1'){
- return true;
- }else{
- return false;
- }
- }
- var lockClickTest=false;
- function clickTest(){
- if(!lockClickTest){
- compareBitPatternReturn=compareBitPattern().split('&');
- if(scoreRuntimeMode){
- if(compareBitPatternReturn[1]=='1'&&!checkRightWrong(compareBitPatternReturn[0],scoreRuntimeM)){
- errorCount++;
- score(0,scoreRuntimecList);
- }
- if(rateMulti(scoreRuntimeM,scoreRuntimePoints,'rigid')>0){
- score(scoreRuntimePoints,scoreRuntimecList);
- compareBitPatternReturn[0]='0';
- lockClickTest=true;
- }
- }
- lay='';
- if(eval('frames.timesContent.answerLayer'+compareBitPatternReturn[0])){
- //hideOldLayers
- lay=eval('frames.timesContent.answerLayer'+lastAnswerID);
- lay=lay.split(' ');
- for(l=0;l<lay.length;l++){
- hideLayerContent(lay[l]);
- }
- //showNewLayers
- lay=eval('frames.timesContent.answerLayer'+compareBitPatternReturn[0]);
- lay=lay.split(' ');
- lastAnswerID=compareBitPatternReturn[0];
- }
- if(compareBitPatternReturn[1]=='1'){
- if(lay.length>0){
- for(l=0;l<lay.length;l++){
- showText(lay[l]);
- }
- }
- if(frames.timesContent.legalErrors){
- if(errorCount>frames.timesContent.legalErrors){
- fileName=frames.timesContent.document.location.href;
- fileName=fileName.split('/');
- fileName=fileName[fileName.length-1];
- fileName=fileName.substring(2,fileName.length-4);
- testFileNameNow=fileName;
- for(z=0;z<testResultsFile.length;z++){
- if(testResultsFile[z][0].indexOf(testFileNameNow)!=-1){
- testResultsFile[z][1]=0;
- }
- }
- frames.timesContent.document.location.replace(rootPath+'times/tm2_test_hint.htm');
- }
- }
- }
- }
- }
- var oldBitPattern=false;
- //check which checkbox was clicked (1-x)
- function compareBitPattern(){
- pos=0;
- nowBitPattern=genBitPattern();
- if(oldBitPattern==false){
- oldBitPattern='';
- for(p=0;p<nowBitPattern.length;p++){
- oldBitPattern="0"+oldBitPattern;
- }
- }
- countFound=0;
- for(u=nowBitPattern.length-1;u>0;u--){
- if(nowBitPattern.charAt(u)!=oldBitPattern.charAt(u)){
- countFound++;
- pos=u;
- }
- }
- if(countFound>1){
- for(u=nowBitPattern.length-1;u>0;u--){
- if(nowBitPattern.charAt(u)=='1'){
- pos=u;
- }
- }
- }
- oldBitPattern=nowBitPattern;
- return nowBitPattern.length-pos+'&'+nowBitPattern.charAt(pos);
- }
- var scoreRuntimeMode=false;
- var scoreRuntimeM=false;
- var scoreRuntimePoints=false;
- var scoreRuntimecList=false;
- var scoreRuntimewList=false;
- function scoreRuntime(m,points,cList){
- scoreRuntimeM=m;
- scoreRuntimePoints=points;
- scoreRuntimecList=cList;
- scoreRuntimeMode=true;
- }
- var showTestResult=false;
- var lockFunctionScore=false;
- var cList;
- var wList;
- function score(points,cList,wList){
- fileName=frames.timesContent.document.location.href;
- fileName=fileName.split('/');
- fileName=fileName[fileName.length-1];
- fileName=fileName.substring(0,fileName.length-4);
- testFileNameNow=fileName;
- //alert(testFileNameNow);
- for(z=0;z<testResultsFile.length;z++){
- if(testResultsFile[z][0].indexOf(testFileNameNow)!=-1){
- if(testResultsFile[z][1]==-1||points==-1){
- for(z=0;z<testResultsFile.length;z++){
- if(testResultsFile[z][0].indexOf(testFileNameNow)!=-1){
- testResultsFile[z][1]=points;
- if(points>0&&cList){
- lay=cList.split(' ');
- for(l=0;l<lay.length;l++){
- showLayerContent(lay[l]);
- }
- }else if (wList){
- lay=wList.split(' ');
- for(l=0;l<lay.length;l++){
- showLayerContent(lay[l]);
- }
- }
- return;
- }
- }
- }
- }
- }
- }
- function setLocalRegister(wert){
- frames.timesContent.document.forms[0].score.value=wert;
- }
- function setGlobalRegister(name,value){
- alert("diese Routine ist noch nicht implementiert");
- }
- function getGlobalRegister(name){
- alert("diese Routine ist noch nicht implementiert");
- }
- function rateObject(solution,option) {
- var register = frames.timesContent.document.forms[0].elements[0].value;
- if (register == "") {
- GotoLabel("G01","_flash0",solution);
- return 0;
- }
- var Werte = register.split('/');
- if (Werte[0] == Werte[1]) {
- return 1;
- } else {
- GotoLabel("G01","_flash0",solution);
- return 0;
- }
- }
- function rateMulti(m,n,option){
- pattern=genBitPattern();
- if(isNaN(m)){
- binCode=decTobin(ascii.lastIndexOf(m));
- start=binCode.length-pattern.length;
- m=parseInt(binCode.substr(start,pattern.length),2);
- }
- if(parseInt(pattern,2)==parseInt(m)){
- if(option=='rigid'){
- return n;
- }else if(option=='weak'){
- return n;
- }
- }else{
- return 0;
- }
- }
- function rateSingle(m,n){
- if(isNaN(m)){
- binCode=decTobin(ascii.lastIndexOf(m));
- start=binCode.length-pattern.length;
- m=parseInt(binCode.substr(start,pattern.length),2);
- }
- if(parseInt(genBitPattern(),2)==m){
- return n;
- }else{
- return 0;
- }
- }
- function genBitPattern(){
- userInput='';
- for(w=0;w<frames.timesContent.document.forms[0].elements.length;w++){
- if(frames.timesContent.document.forms[0].elements[w].checked){
- userInput="1"+userInput;
- }else{
- userInput="0"+userInput;
- }
- }
- return userInput
- }
- var ascii="01234567890123456789012345678901" +
- " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"+
- "[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
- function decTobin(decCode){
- decstring = decCode+" ";
- dec=new Object;
- binut="";
- i=0;
- m=0;
- k=0;
- bit = new Object();
- bitstream = new Object();
- //For every char(decvalue)
- while (m<decstring.length-1)
- {j="";
- while (decstring.charAt(m)!="," && m<decstring.length-1)
- {j=j+decstring.charAt(m);++m}
- //Convert decimal to binary
- if (j>=128) {bit[8]=1;j=j-128;} else {bit[8]=0;}
- if (j>=64) {bit[7]=1;j=j-64;} else {bit[7]=0;}
- if (j>=32) {bit[6]=1;j=j-32;} else {bit[6]=0;}
- if (j>=16) {bit[5]=1;j=j-16;} else {bit[5]=0;}
- if (j>=8) {bit[4]=1;j=j-8;} else {bit[4]=0;}
- if (j>=4) {bit[3]=1;j=j-4;} else {bit[3]=0;}
- if (j>=2) {bit[2]=1;j=j-2;} else {bit[2]=0;}
- if (j>=1) {bit[1]=1;j=j-1;} else {bit[1]=0;}
- for (i=8;i>0;--i){
- bitstream[k+1]=bit[i];
- binut=binut+bitstream[k+1];}
- ++k;
- }
- return binut;
- }
- function changeTextColor(lay,color){
- if (isIE){
- refLink = eval('frames.timesContent.document.all.'+lay);
- if(refLink){
- refLink.style.color=color;
- }else{
- alert('Layer existiert nicht');
- }
- }
- }
- function GotoFrame(movie,frame) {
- frame--;
- eval('frames.timesContent.document.' + movie + '.GotoFrame(' + frame + ')');
- }
- function GotoFrameDiv(movie,frame){
- frame--;
- if(document.layers){
- eval('frames.timesContent.document.layers.'+movie+'.document.embeds[0].GotoFrame('+frame+');');
- eval('frames.timesContent.document.'+movie+'.document.embeds[0].GotoFrame('+frame+');');
- } else {
- eval('frames.timesContent.document.'+movie+'f.GotoFrame('+frame+')');
- }
- }
- function GotoLabel(movie,level,label) {
- if(document.layers){
- eval('frames.timesContent.document.layers.'+movie+'.document.embeds[0].TGotoLabel("' + level + '","' + label + '")');
- } else {
- eval('frames.timesContent.document.' + movie + 'f.TGotoLabel("' + level + '","' + label + '")');
- }
- }
- function SetFlashVariable(movie,name,value) {
- if(document.layers){
- var TheMovie = eval('frames.timesContent.document.layers.'+movie+'.document.embeds[0]');
- TheMovie.SetVariable(name,unescape(value));
- } else {
- var TheMovie = eval('frames.timesContent.document.' + movie + 'f');
- TheMovie.setVariable(name,unescape(value));
- }
- }