function BrowserCheck(){var a=navigator.appName;this.mac=navigator.appVersion.indexOf("Mac")!=-1;this.b=a=="Netscape"?"ns":a=="Microsoft Internet Explorer"?"ie":a;this.version=navigator.appVersion;this.v=parseInt(this.version);this.ns=this.b=="ns"&&this.v>=5;this.ns5=this.b=="ns"&&this.v==5;this.ns6=this.b=="ns"&&this.v==5;this.ie=this.b=="ie"&&this.v>=4;this.ie4=this.version.indexOf("MSIE 4")>0;this.ie5=this.version.indexOf("MSIE 5")>0;if(this.mac)this.ie=this.ie5;this.ie5mac=this.ie5&&this.mac;
this.min=this.ns||this.ie}is=new BrowserCheck;if(is.min==false||is.ie5mac)alert("Your browser can't handle this page. You need NS6 or IE5 on Windows, or NS6 on Mac.");function PageDim(){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,InGap=false;
function SuppressBackspace(a){if(InGap!=true){thisKey=is.ns?a.keyCode:window.event.keyCode;var e=false;if(thisKey==13)if(document.getElementById("FeedbackDiv").style.display!="none"){HideFeedback();e=true}if(thisKey==8)e=true;if(e==true)if(is.ie){window.event.returnValue=false;window.event.cancelBubble=true}else a.preventDefault()}}var NavLightColor="#fff7bf",NavShadeColor="#7f7740",NavBarColor="#FFFFCC",FuncLightColor="#ffbf7f",FuncShadeColor="#7f4000",ExBGColor="#FFFFCC";
function NavBtnOver(a){a.style.padding="1px 3px 3px 1px";a.style.borderLeftColor=NavLightColor;a.style.borderTopColor=NavLightColor;a.style.borderRightColor=NavShadeColor;a.style.borderBottomColor=NavShadeColor}function NavBtnOut(a){a.style.borderColor=NavBarColor;a.style.padding="2px 2px 2px 2px"}
function NavBtnDown(a){a.style.borderLeftColor=NavShadeColor;a.style.borderTopColor=NavShadeColor;a.style.borderRightColor=NavLightColor;a.style.borderBottomColor=NavLightColor;a.style.padding="3px 1px 1px 3px"}function FuncBtnOver(a){a.style.padding="2px 7px 4px 5px";a.style.borderLeftColor=FuncLightColor;a.style.borderTopColor=FuncLightColor;a.style.borderRightColor=FuncShadeColor;a.style.borderBottomColor=FuncShadeColor}
function FuncBtnOut(a){a.style.borderColor="#FFFFCC";a.style.padding="3px 6px 3px 6px"}function FuncBtnDown(a){a.style.borderLeftColor=FuncShadeColor;a.style.borderTopColor=FuncShadeColor;a.style.borderRightColor=FuncLightColor;a.style.borderBottomColor=FuncLightColor;a.style.padding="4px 5px 2px 7px"}
var topZ=100,CurrentBox=-1,Feedback="",CluesAcross="Waagerecht:",CluesDown="Senkrecht:",Correct="Richtig. Gut gemacht.",Incorrect="Du hast Fehler gemacht. Die falschen Buchstaben wurden entfernt.",GiveHint="Ein richtiger Buchstabe wurde hinzugef&#252;gt.",YourScoreIs="Dein Punktestand: ",BuiltGrid="",BuiltExercise="",Penalties=0,FirstShow=true,ReadingURL="[ReadingURL]",TempReading="",CurrBoxElement=null,GridOpener='<center><table border="1" cellpadding="0" cellspacing="0">',GridRowOpener="<tr>",GridRowCloser=
"</tr>",BlankCell='<td bgcolor="#000000" width="30" height="30">&nbsp;</td>',LetterOnlyCell='<td bgcolor="#ffffff" width="30" height="30" align="center" valign="middle"><span class="GridLetter">[Letter]</span></td>',NumLetterCell='<td bgcolor="#ffffff" style="cursor: pointer; cursor: hand;" width="30" height="30" align="center" valign="top" onclick="ShowClue([ClueNum],[x],[y])"><sup><a href="javascript:DoNothing()" onclick="ShowClue([ClueNum],[x],[y])">[ClueNum]</a></sup>&nbsp;<span class="GridLetter">[Letter]</span></td>',
GridCloser="</table></center><br />",GetAnswerOpener='<div class="FunctionButtonBar"><form name="AnswerForm" action="" onSubmit="return false;">';GetAnswerOpener+='<table border="0" align="center" cellpadding="2" cellspacing="2">';var GetAnswer='<tr><td valign="top"><span class="ClueText">[ThisClue]</span></td>';GetAnswer+='<td valign="top"><input type="text" class="AnswerBox" name="[BoxName]" size="[AnsLength]" maxlength="[AnsLength]" onfocus="InGap=true;"></input></td>';GetAnswer+='<td valign="top"><span class="FunctionButton" onmouseover="FuncBtnOver(this)" onmouseout="FuncBtnOut(this)" ';
GetAnswer+='onmousedown="FuncBtnDown(this)" onmouseup="FuncBtnOver(this)" ';GetAnswer+='onclick="EnterAnswer(document.AnswerForm.[BoxName].value,[boolAcross],[AnsLength],[x],[y])">';GetAnswer+="&nbsp;<b>Eintragen</b>&nbsp;</span></td>";GetAnswer+='<td valign="top"><span class="FunctionButton" onmouseover="FuncBtnOver(this)" onmouseout="FuncBtnOut(this)" ';GetAnswer+='onmousedown="FuncBtnDown(this)" onmouseup="FuncBtnOver(this)" ';GetAnswer+=" onclick=\"ShowHint([boolAcross],[x],[y],'document.AnswerForm.[BoxName]')\">";
GetAnswer+="&nbsp;<b>Tipp</b>&nbsp;</span></td>";GetAnswer+="</tr>";var GetAnswerCloser="</table></form></div>";
function WriteFeedback(a){a=a+"<br /><br />";document.getElementById("FeedbackContent").innerHTML=a;a=document.getElementById("FeedbackDiv");topZ++;a.style.zIndex=topZ;pg=new PageDim;a.style.left=Math.floor(pg.W/3)+"px";a.style.width=Math.floor(pg.W/3)+"px";a.style.top=is.ns?Math.floor(pg.H/3)+window.pageYOffset+"px":Math.floor(pg.H/3)+document.body.scrollTop+"px";a.style.display="block";InGap=false}
function HideFeedback(){document.getElementById("FeedbackContent").innerHTML="";document.getElementById("FeedbackDiv").style.display="none"}function WriteToInstructions(a){a='<span class="FeedbackText">'+a+"</span>";document.getElementById("InstructionsDiv").innerHTML=a}function WriteClue(a){document.getElementById("ClueDiv").innerHTML=a}
function StartUp(){if(is.ns)window.addEventListener("keypress",SuppressBackspace,false);else if(is.min==true&&is.ie5mac==false){document.attachEvent("onkeydown",SuppressBackspace);window.attachEvent("onkeydown",SuppressBackspace)}BuildExercise();DisplayExercise()}
function BuildExercise(){var a="";a="";for(var e=GridOpener,d=0;d<L.length;d++){e+=GridRowOpener;for(var c=0;c<L[d].length;c++)if(L[d][c]=="")e+=BlankCell;else{if(C[d][c]>0){a=NumLetterCell;a=ReplaceStuff("[ClueNum]",C[d][c],a);a=ReplaceStuff("[x]",d,a);a=ReplaceStuff("[y]",c,a)}else a=LetterOnlyCell;a=G[d][c]!=""?ReplaceStuff("[Letter]",G[d][c],a):ReplaceStuff("[Letter]","&nbsp;",a);e+=a}e+=GridRowCloser}e+=GridCloser;BuiltExercise=a=e}
function DisplayExercise(){var a="";a+=BuiltExercise;document.getElementById("GridDiv").innerHTML=a}
function BuildClue(a,e,d,c){var b="";if(c==true){if(a>=A.length)return"";if(A[a]==null)return"";b=GetAnswer;b=ReplaceStuff("[ThisClue]",a+". "+A[a],b);b=ReplaceStuff("[BoxName]","BA"+a,b);AnsLength=0;i=e;for(j=d;j<L[i].length;){if(L[i][j]!="")AnsLength++;else break;j++}b=ReplaceStuff("[AnsLength]",AnsLength,b);b=ReplaceStuff("[boolAcross]","true",b)}else{if(a>=D.length)return"";if(D[a]==null)return"";b=GetAnswer;b=ReplaceStuff("[ThisClue]",a+". "+D[a],b);b=ReplaceStuff("[BoxName]","BD"+a,b);AnsLength=
0;i=e;for(j=d;i<L.length;){if(L[i][j]!="")AnsLength++;else break;i++}b=ReplaceStuff("[AnsLength]",AnsLength,b);b=ReplaceStuff("[boolAcross]","false",b)}b=ReplaceStuff("[x]",e,b);return b=ReplaceStuff("[y]",d,b)}
function ShowClue(a,e,d){var c="",b="",f="";b=0;var g;CurrBoxElement=a;if(A[a]!=null){f=GetAnswer;b="Waagerecht: "+a+". "+A[a];f=ReplaceStuff("[ThisClue]",b,f);c+=f;c=ReplaceStuff("[BoxName]","BA"+a,c);b=0;f=e;for(g=d;g<L[f].length;){if(L[f][g]!="")b++;else break;g++}c=ReplaceStuff("[AnsLength]",b,c);c=ReplaceStuff("[boolAcross]","true",c)}if(D[a]!=null){f=GetAnswer;b="Senkrecht: "+a+". "+D[a];f=ReplaceStuff("[ThisClue]",b,f);c+=f;c=ReplaceStuff("[BoxName]","BD"+a,c);b=0;f=e;for(g=d;f<L.length;){if(L[f][g]!=
"")b++;else break;f++}c=ReplaceStuff("[AnsLength]",b,c);c=ReplaceStuff("[boolAcross]","false",c)}c=GetAnswerOpener+c+GetAnswerCloser;c=ReplaceStuff("[x]",e,c);c=ReplaceStuff("[y]",d,c);WriteClue(c);if(eval("document.AnswerForm.BA"+a)!=null)eval("document.AnswerForm.BA"+a).focus();else eval("document.AnswerForm.BD"+a)!=null&&eval("document.AnswerForm.BD"+a).focus()}
function EnterAnswer(a,e,d,c,b){a=a.toUpperCase();c=c;b=b;for(var f=0;f<d;){if(f<a.length)G[c][b]=a.charAt(f);if(e==true)b++;else c++;f++}BuildExercise();DisplayExercise();InGap=false;CurrBox=null}
function ShowHint(a,e,d,c){e=e;d=d;var b="";if(a==true)for(;d<L[e].length;){if(L[e][d]!=""){b+=L[e][d];if(G[e][d]!=L[e][d]){G[e][d]=L[e][d];Penalties++;break}}else break;d++}else for(;e<L.length;){if(L[e][d]!=""){b+=L[e][d];if(G[e][d]!=L[e][d]){G[e][d]=L[e][d];Penalties++;break}}else break;e++}if(eval(c)!=null)eval(c).value=b}function ReplaceStuff(a,e,d){for(var c=d.indexOf(a),b="",f="";c>-1;){b=d.substring(0,c);f=d.substring(c+a.length,d.length);d=b+e+f;c=d.indexOf(a)}return d};
