// -1)&&(this.version.charAt(x) < 10)){ vnum += this.version.charAt(x); x++; } this.v = parseInt(vnum); } else{ this.v = parseInt(this.version); } if (this.ns&&(this.v == 5)){ this.v = 6; } this.min = (this.v > 5); } is = new BrowserCheck(); if ((is.min == false)||(is.ie5mac)){ alert('Your browser can\'t handle this page. You need NS6+ or IE6+ on Windows, or NS6+ on Mac.'); } function PageDim(){ //Get the page width and height this.W = 600; this.H = 400; if (is.ns) this.W = window.innerWidth; if (is.ie) this.W = document.body.clientWidth; if (is.ns) this.H = window.innerHeight; if (is.ie) this.H = document.body.clientHeight; } var pg = null; function SuppressBackspace(e){ if (is.ns) { thisKey = e.keyCode; } else { thisKey = window.event.keyCode; } var Suppress = false; if (thisKey == 8) { Suppress = true; } if (Suppress == true){ if (is.ie){ window.event.returnValue = false; window.event.cancelBubble = true; } else{ e.preventDefault(); } } } var NavLightColor = '#ffffff'; var NavShadeColor = '#7f7f7f'; var NavBarColor = '#ffffff'; var FuncLightColor = '#ffffff'; var FuncShadeColor = '#7f7f7f'; var ExBGColor = '#ffffff'; function NavBtnOver(Btn){ Btn.style.padding = '1px 3px 3px 1px'; Btn.style.borderLeftColor = NavLightColor; Btn.style.borderTopColor = NavLightColor; Btn.style.borderRightColor = NavShadeColor; Btn.style.borderBottomColor = NavShadeColor; } function NavBtnOut(Btn){ Btn.style.borderColor = NavBarColor; Btn.style.padding = '2px 2px 2px 2px'; } function NavBtnDown(Btn){ Btn.style.borderLeftColor = NavShadeColor; Btn.style.borderTopColor = NavShadeColor; Btn.style.borderRightColor = NavLightColor; Btn.style.borderBottomColor = NavLightColor; Btn.style.padding = '3px 1px 1px 3px'; } function FuncBtnOver(Btn){ Btn.style.padding = '2px 7px 4px 5px'; Btn.style.borderLeftColor = FuncLightColor; Btn.style.borderTopColor = FuncLightColor; Btn.style.borderRightColor = FuncShadeColor; Btn.style.borderBottomColor = FuncShadeColor; } function FuncBtnOut(Btn){ Btn.style.borderColor = '#ffffff'; Btn.style.padding = '3px 6px 3px 6px'; } function FuncBtnDown(Btn){ Btn.style.borderLeftColor = FuncShadeColor; Btn.style.borderTopColor = FuncShadeColor; Btn.style.borderRightColor = FuncLightColor; Btn.style.borderBottomColor = FuncLightColor; Btn.style.padding = '4px 5px 2px 7px'; } function Card(ID){ this.elm=document.getElementById(ID); this.name=ID; this.css=this.elm.style; this.elm.style.left = 0 +'px'; this.elm.style.top = 0 +'px'; this.HomeL = 0; this.HomeT = 0; this.tag=-1; this.index=-1; } function CardGetL(){return parseInt(this.css.left)} Card.prototype.GetL=CardGetL; function CardGetT(){return parseInt(this.css.top)} Card.prototype.GetT=CardGetT; function CardGetW(){return parseInt(this.elm.offsetWidth)} Card.prototype.GetW=CardGetW; function CardGetH(){return parseInt(this.elm.offsetHeight)} Card.prototype.GetH=CardGetH; function CardGetB(){return this.GetT()+this.GetH()} Card.prototype.GetB=CardGetB; function CardGetR(){return this.GetL()+this.GetW()} Card.prototype.GetR=CardGetR; function CardSetL(NewL){this.css.left = NewL+'px'} Card.prototype.SetL=CardSetL; function CardSetT(NewT){this.css.top = NewT+'px'} Card.prototype.SetT=CardSetT; function CardSetW(NewW){this.css.width = NewW+'px'} Card.prototype.SetW=CardSetW; function CardSetH(NewH){this.css.height = NewH+'px'} Card.prototype.SetH=CardSetH; function CardInside(X,Y){ var Result=false; if(X>=this.GetL()){if(X<=this.GetR()){if(Y>=this.GetT()){if(Y<=this.GetB()){Result=true;}}}} return Result; } Card.prototype.Inside=CardInside; function CardSwapColours(){ var c=this.css.backgroundColor; this.css.backgroundColor=this.css.color; this.css.color=c; } Card.prototype.SwapColours=CardSwapColours; function CardHighlight(){ this.css.backgroundColor='#000000'; this.css.color='#ffffff'; } Card.prototype.Highlight=CardHighlight; function CardUnhighlight(){ this.css.backgroundColor='#330066'; this.css.color='#ffffff'; } Card.prototype.Unhighlight=CardUnhighlight; function CardOverlap(OtherCard){ var smR=(this.GetR()<(OtherCard.GetR()+10))? this.GetR(): (OtherCard.GetR()+10); var lgL=(this.GetL()>OtherCard.GetL())? this.GetL(): OtherCard.GetL(); var HDim=smR-lgL; if (HDim<1){return 0;} var smB=(this.GetB()OtherCard.GetT())? this.GetT(): OtherCard.GetT(); var VDim=smB-lgT; if (VDim<1){return 0;} return (HDim*VDim); } Card.prototype.Overlap=CardOverlap; function CardDockToR(OtherCard){ this.SetL(OtherCard.GetR() + 5); this.SetT(OtherCard.GetT()); } Card.prototype.DockToR=CardDockToR; function CardSetHome(){ this.HomeL=this.GetL(); this.HomeT=this.GetT(); } Card.prototype.SetHome=CardSetHome; function CardGoHome(){ this.SetL(this.HomeL); this.SetT(this.HomeT); } Card.prototype.GoHome=CardGoHome; var CorrectResponse = 'Das war richtig!'; var IncorrectResponse = 'Das war nicht richtig!'; var YourScoreIs = 'Ihre Punktzahl beträgt: '; var Correction = '[strCorrection]'; var DivWidth = 600; //default value var FeedbackWidth = 200; //default var ExBGColor = '#ffffff'; var PageBGColor = '#ffffff'; var TextColor = '#000000'; var TitleColor = '#793d00'; var Penalties = 0; var Score = 0; var CurrDrag = -1; var topZ = 100; var DragWidth = 200; var LeftColPos = 100; var RightColPos = 500; var DragTop = 120; var StartTime = (new Date()).toLocaleString(); var HPNStartTime = (new Date()).getTime(); var Finished = false; var SubmissionTimeout = 30000; //Fixed and draggable card arrays FC = new Array(); DC = new Array(); function doDrag(e) { if (CurrDrag == -1) {return}; if (is.ie){var Ev = window.event}else{var Ev = e} var difX = Ev.clientX-window.lastX; var difY = Ev.clientY-window.lastY; var newX = DC[CurrDrag].GetL()+difX; var newY = DC[CurrDrag].GetT()+difY; DC[CurrDrag].SetL(newX); DC[CurrDrag].SetT(newY); window.lastX = Ev.clientX; window.lastY = Ev.clientY; return false; } function beginDrag(e, DragNum) { CurrDrag = DragNum; if (is.ie){ var Ev = window.event; document.onmousemove=doDrag; document.onmouseup=endDrag; } else{ var Ev = e; window.onmousemove=doDrag; window.onmouseup=endDrag; } DC[CurrDrag].Highlight(); topZ++; DC[CurrDrag].css.zIndex = topZ; window.lastX=Ev.clientX; window.lastY=Ev.clientY; return false; } function endDrag(e) { if (CurrDrag == -1) {return}; DC[CurrDrag].Unhighlight(); if (is.ie){document.onmousemove=null}else{window.onmousemove=null;} onEndDrag(); CurrDrag = -1; return true; } function onEndDrag(){ //Is it dropped on any of the fixed cards? var Docked = false; var DropTarget = DroppedOnFixed(CurrDrag); if (DropTarget > -1){ //If so, send home any card that is currently docked there for (var i=0; i OverlapArea){ OverlapArea = Temp; Result = i; } } return Result; } function StartUp(){ if (is.ie){ document.attachEvent('onkeydown',SuppressBackspace); window.attachEvent('onkeydown',SuppressBackspace); } else if (is.ns){ window.addEventListener('keypress',SuppressBackspace,false); } //Calculate page dimensions and positions pg = new PageDim(); DivWidth = Math.floor((pg.W*4)/5); DragWidth = Math.floor((DivWidth*3)/10); LeftColPos = Math.floor(pg.W/15); RightColPos = pg.W - (DragWidth + LeftColPos); DragTop = parseInt(document.getElementById('CheckButtonDiv').offsetHeight) + parseInt(document.getElementById('CheckButtonDiv').offsetTop) + 10; if (is.ie){ DragTop += 15; } //Shuffle the items on the right D = Shuffle(D); var CurrTop = DragTop; var TempInt = 0; var DropHome = 0; var Widest = 0; for (var i=0; i'; //required for Navigator rendering bug with images if (FC[i].GetW() > Widest){ Widest = FC[i].GetW(); } } if (Widest > DragWidth){Widest = DragWidth;} CurrTop = DragTop; DragWidth = Math.floor((DivWidth-Widest)/2) - 24; RightColPos = DivWidth + LeftColPos - (DragWidth + 14); var Highest = 0; var WidestRight = 0; for (i=0; i'; //required for Navigator rendering bug with images if (DC[i].GetW() > DragWidth){DC[i].SetW(DragWidth);} DC[i].css.cursor = 'move'; DC[i].css.backgroundColor = '#ffffff'; DC[i].css.color = '#000000'; TempInt = DC[i].GetH(); if (TempInt > Highest){Highest = TempInt;} TempInt = DC[i].GetW(); if (TempInt > WidestRight){WidestRight = TempInt;} } var HeightToSet = Highest; if (is.ns||is.ie5mac){HeightToSet -= 12;} var WidthToSet = WidestRight; if (is.ns||is.ie5mac){WidthToSet -= 12;} for (i=0; i 0)){ TotalCorrect++; } else{ DC[i].GoHome(); } } Score = Math.floor((100*(TotalCorrect-Penalties))/F.length); if (TotalCorrect == F.length) { Response = YourScoreIs + ' ' + Score + '%.'; WriteFeedback(Response + '
' + CorrectResponse); //Bug avoider for ie5mac if ((is.ie)&&(!is.mac)){ WriteToInstructions(Response); } Finished = true; setTimeout('Finish()', SubmissionTimeout); } else { Response = IncorrectResponse + '
' + YourScoreIs + ' ' + Score + '%.'; WriteFeedback(Response); Penalties++; // Penalty for inaccurate check } } function WriteFeedback(Feedback){ var Output = Feedback + '

'; document.getElementById('FeedbackContent').innerHTML = Output; var FDiv = document.getElementById('FeedbackDiv'); //Calculate and set its left setting topZ++; FDiv.style.zIndex = topZ; //Position the feedback div pg = new PageDim(); FDiv.style.left = Math.floor(pg.W/3) + 'px'; FDiv.style.width = Math.floor(pg.W/3) + 'px'; //Set the top again in case the window has been resized if (is.ns){ FDiv.style.top = Math.floor(pg.H/3) + window.pageYOffset + 'px'; } else{ FDiv.style.top = Math.floor(pg.H/3) + document.body.scrollTop + 'px'; } FDiv.style.display = 'block'; document.getElementById('FeedbackOKButton').focus(); } function HideFeedback(){ document.getElementById('FeedbackContent').innerHTML = ''; document.getElementById('FeedbackDiv').style.display='none'; FocusAButton(); if (Finished == true){ Finish(); } } function FocusAButton(){ if (document.getElementById('CheckButton1') != null){ document.getElementById('CheckButton1').focus(); } else{ document.getElementsByTagName('button')[0].focus(); } } function WriteToInstructions(Feedback) { Feedback = '' + Feedback + ''; document.getElementById('InstructionsDiv').innerHTML = Feedback; } function Finish(){ //If there's a form, fill it out and submit it if (document.store != null){ Frm = document.store; Frm.starttime.value = HPNStartTime; Frm.endtime.value = (new Date()).getTime(); Frm.mark.value = Score; Frm.submit(); } } //--> //]]>