rtl_lang=["ar","he"];Tips.planet=new Class({Extends:Tips,initialize:function(B,A){this.parent(B,A);this.tip.addEvents({mouseenter:this.tipEnter.bind(this),mouseleave:this.tipLeave.bind(this)})},tipEnter:function(){this.timer=$clear(this.timer)},tipLeave:function(){this.elementLeave()},elementEnter:function(B,A){A.retrieve("tip:text"," ");this.parent(B,A)},elementLeave:function(B,A){$clear(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this,A)},update:function(B){var A=$(B.el);if(A){var C=A.retrieve("tip:native");if(C==B.code){this.tip.removeClass("ajax-loading");A.store("tip:loaded",B.code);A.store("tip:title",B.title).store("tip:text",B.text);this.titleElement.set("html",B.title);this.textElement.set("html",B.text)}}}});function planetHelp(A){log("planetHELP td? "+A);if(A&&!window.planetTips){log("planetHELP error "+A);return }if(A&&window.planetTips){planetTips.update(A);return }if(!window.planetTips){window.planetTips=new Tips.planet(".ptip",{className:"ptips",fixed:true,hideDelay:400,showDelay:400,onShow:function(E,D){log("tip onShow"+E+"/"+D);if(!D){return }var B=D.retrieve("tip:loaded",false);var F=D.retrieve("tip:native");var C=E.getElement("div.tip-title");log("native = "+F+" / loaded = "+B);if(!B&&F){C.set("html","Lade...");E.store("waitingfor",F);E.addClass("ajax-loading");json("planethelp&c="+F+"&el="+D.id)}E.setStyle("visibility","visible")}});log("planetTips created")}else{planetTips.attach(".ptip");log("planetTips attached")}}function log(A){if(window.console){console.log(A)}}function jumpTo(A){document.location.href=site_url+A}function notifyChanged(C){log("notifyChanged "+C.id+"/"+C.value);var B=C.id.split("_"),A=C.checked?1:0;log("v="+A+"  el.value:"+C.value+" / "+C.checked);json("save_notify&key="+B[1]+"&value="+A)}var d_url="php/ajax.php?a=",j_url="php/json.php?a=";function demo(){shade(1);cards.play("startdemo")}function shade(A){var B=$("overlay")||new Element("div",{id:"overlay","class":"overlay",events:{click:function(){shade(0)}}}).inject(document.body);var C=B.retrieve("rc",0);if(A){C++}else{if(C>0){C--}}if(B){B.setStyle("display",(C)?"block":"none")}}function iSearchUnits(){json("search")}function stripTags(B){var A=/(<([^>]+)>)/gi;if(typeof B=="string"){return B.replace(A,"")}if(B.value){B.value=B.value.replace(A,"")}return B.value}function rndParam(){return $time()-$random(0,1000)}function searchUnits(){var A=$("term");if(A){A.addClass("ajax-busy")}jsonp("search_units","searchform")}function toggleTurbo(A){var B=$("bxconf");if(B){B.setStyle("display",A.checked?"none":"block")}}function newUnit(){json("new_unit")}function initSearchVoc(){json("searchv_init")}function restrictSearch(C,A){var B=$("term");if(B){B.addClass("ajax-busy")}jsonp("search_voc&res="+C+"&v="+A,"f-search-v")}function Editor(A){includeOnce("tmx4");json(A)}function Stats(C,A,B){var D=(C)?"&subject="+C:"";if(A){D=D+"&type="+A}if(B){D=D+"&uid="+B}$("checkres").empty().addClass("ajax-loading");loadCSS("stats");json("stats"+D)}function updateStats(A){if(A&&A.id=="stats_uid"){Stats(0,0,A.options[A.selectedIndex].value);return }var C=$("stats_subject"),B=$("stats_type");if(!C.options.length){alert("(Noch) keine Daten vorhanden!");return }Stats(C.options[C.selectedIndex].value,B.options[B.selectedIndex].value)}function Messages(A){if(typeof A=="number"){A="&page="+A}else{A=(A)?"&folder="+A:""}json("messages"+A)}function Groups(){json("groups")}function ManageGroups(){AjaxReq("checkres","friends","get")}function isEmail(A){var B=/^[-_.a-z0-9]+@(([-_a-z0-9]+\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i;return B.test(A)}function badUsername(B){var A="";var C=/(\||\*|%|\\|\/|\+|\&|"|'|_|\?)+/;if(B==""){A=uit.requname}else{if(B.length<4){A=uit.unameshort.replace(/%d/,"4")}else{if(B.length>15){A=uit.unamelong.replace(/%d/,"15")}else{if(C.test(B)){A=uit.illchar}}}}return A}function trm(B){var A=B.value.trim();if(B.value!=A){B.value=A}return A}function checkForm(E,D){var B=false,F,A;if(!E.length){return true}if(!D){D=""}for(var C=0;C<E.length;C++){F=D+E[C];A=$(F);if(A){A=A.value}B=display(F,(!A)?uit.reqfield:"")||B}return B}function checkAll(){var error=false;var t=$("teacher");if(t){t=t.value}if(t){error=checkForm(["realname","schultyp","schulname","schulsite"],"")}var v_un,v_em,v_e2,v_pw,v_p2,ec=$chk(window.document.fregister.cap),et=$chk(window.document.fregister.terms);with(window.document.fregister){v_un=stripTags(username.value.trim());if(username.value!=v_un){username.value=v_un}v_em=trm(email);v_e2=trm(email2);v_pw=pw.value;v_p2=pw2.value;v_ui=ui.value;if(ec){var v_cap=cap.value}if(et){var v_te=terms.checked}}error=display("username",badUsername(v_un))||error;error=display("email",(v_em&&isEmail(v_em))?"":uit.emailbad)||error;if(!v_e2){error=display("email2",uit.reqfield)}else{if(v_e2!=v_em){error=display("email2",uit.emaildiff)}else{display("email2","")}}error=display("pwr",badPassword(v_pw))||error;if(!v_p2){error=display("pw2",uit.reqfield)}else{if(v_p2!=v_pw){error=display("pw2",uit.passdiff)}else{display("pw2","")}}error=display("ui",(v_ui)?"":uit.reqfield)||error;if(ec){error=display("cap",(v_cap)?"":uit.reqfield)||error}if(et){error=display("terms",(v_te)?"":uit.reqtermsc)||error}return error}function SubmitReg(){if(!checkAll()){new Request.JSON({url:"php/register.php",onComplete:react}).post($("fregister"))}return false}function isBad(B){var A="";var C=/(\*|\\|\/|\+|\/&|"|'|_|\?)+/;if(B.trim()==""||C.test(B)){A=uit.invalid}return A}function SubmitLicence(){var A=window.document.faccount.licence.value.trim();error=display("licence",isBad(A));if(error){return false}new Request.JSON({url:"php/licence.php",onComplete:react}).post($("faccount"))}function Register(){ajax("register")}function ChLang(B,A){window.location.href=B+"?ui="+Selected(A)}function menuHighlight(D){var A=$("globalnav").getElements("a");for(var B=0;B<A.length;B++){A[B].set("class",(A[B].id==D)?"active":"")}if(D!="gn-profile"&&$("left1").get("html")!=""){$("left1").empty().setStyle("display","none")}if(D!="gn-photos"){var C=$("content");if(C.offsetWidth==980){C.setStyle("width","780px");$("left").setStyle("display","block")}}}function fullWidth(){$("left").setStyle("display","none");$("content").setStyle("width","980px");$("checkres").setStyle("width","100%")}function toggleHelp(){var A=$("help");if(A){var B=A.getStyle("display");A.setStyle("display",(B=="none")?"":"none");savePref("hidehelp",(B=="none")?"0":"1")}}function Reset(A){if(confirm("Auswertung wirklich löschen?")){json("reset_unit&id="+A)}}function showTrans(A,B){if(A&&B){json("show_trans&vid="+A+"&lang="+B)}}function ToggleExt(){var A=$$("#searchform tr.ext");A.each(function(C){var B=C.getStyle("display");C.setStyle("display",(B=="none")?"":"none")})}function editSection(E,C,B){var D=$(E).getNext();var F=D.getFirst();if(window.console){console.log("editSection",D.id,F)}if(F&&F.tagName.toLowerCase()=="select"){D.innerHTML=D.retrieve("html")}else{D.store("html",D.innerHTML);D.innerHTML="";var G=C+"-selsec";var A=new Element("select",{id:G,"class":""}).addEvent("change",function(){var I=Selected(this);var H=this.id.split("-");if(I=="new"){if(confirm("Neuen Abschnitt anlegen?")){json("new_section&x="+H[0])}}else{json("save_section&x="+H[0]+"&s="+I)}}).inject(D);if(A&&B){json("list_sections&id="+B+"&sel="+G+"&x="+C)}}}function unitChanged(C){var B=Selected(C);var A=$("c_section");if(A&&B){json("list_sections&id="+B+"&sel=c_section")}}function sectionChanged(B,A){var C=Selected(B);A=A||Selected("c_unit");if(C=="new"&&A&&confirm("Neuen Abschnitt anlegen?")){json("new_section&id="+A+"&sel="+B.id)}}function SaveProfile(B){var A=$("f_info_"+B);if(A){new Request.JSON({url:"php/save_profile.php",onComplete:react,onFailure:function(){alert("failed")}}).post(A)}return false}function Error(A){if(A.errors=="unauthorized"){UpdateUserInfo();return true}else{if(A.v&&A.v.error){info(A.v.error);return true}}}function isBody(A){return(/^(?:body|html)$/i).test(A.tagName)}function hideHelp(B){while(B&&!isBody(B)){if(B.tagName.toLowerCase()=="div"&&B.get("class")=="help"){var A=new Fx.Slide(B,{duration:300,transition:Fx.Transitions.linear});A.toggle();return true}B=B.parentNode}}function json(A){new Request.JSON({url:j_url+A,onComplete:react}).get()}function jsonp(B,A){new Request.JSON({url:j_url+B,onComplete:react}).post($(A))}function cardPage(B,A){json("show_cards&page="+B+"&id="+A)}function ff(A){new Request.JSON({url:j_url+"ff&c="+A,onComplete:react}).get()}function loadCSS(A){var B=$(A+"-css")||new Element("link",{rel:"stylesheet",media:"screen",type:"text/css",href:"css/"+A+".css",id:A+"-css"}).inject(document.head);return B}function upload_photos(){dest=$("checkres");dest.empty().addClass("ajax-loading");new Request.HTML({url:d_url+"upload",update:dest,onComplete:function(){dest.removeClass("ajax-loading");$("flash-info").appendText("Adobe Flash "+Browser.Plugins.Flash.version+" entdeckt!");filter={"Images (*.jpg, *.jpeg, *.gif, *.png)":"*.jpg; *.jpeg; *.gif; *.png"};var A=new FancyUpload2($("upload-status"),$("upload-list"),{url:$("form-upload").action,fieldName:"photoupload",path:"Swiff.Uploader.swf",container:$("upload-container"),onLoad:function(){$("upload-status").removeClass("hide");$("upload-fallback").destroy()},debug:true,target:"upload-browse-images",removeButton:"upload-clear",typeFilter:filter});$("upload-browse-images").addEvent("click",function(){if(window.console){console.log("browse images!",A)}A.browse();return false});$("upload-clear").addEvent("click",function(){A.removeFile();return false});$("upload-upload").addEvent("click",function(){A.upload();return false})}}).get()}function uProfile(A){json("profile&id="+A)}function AutoUser(B){var A=$(B);if(A){new Autocompleter.Request.JSON(A,"php/query_ug.php",{postVar:"name",indicatorClass:"autocompleter-loading",multiple:true,selectFirst:true,selectMode:false,minLength:2})}}function react(D,A){var C;if(D&&typeof (D)=="object"){if(Error(D)){return false}if(D.up){for(C=0;C<D.up.length;C++){var E=$(D.up[C].id);if(E){if(D.up[C].disabled==0||D.up[C].disabled==1){E.disabled=D.up[C].disabled}if(D.up[C].display||D.up[C].display===""){E.setStyle("display",D.up[C].display)}if(D.up[C].title){E.set("title",D.up[C].title)}if(D.up[C].css){E.set("class",D.up[C].css)}if(D.up[C].remcss){E.removeClass(D.up[C].remcss)}if(D.up[C].html||D.up[C].html===""){E.set("html",D.up[C].html)}else{if(D.up[C].src){var B=(E.tagName.toLowerCase()=="img")?E:E.getFirst("img");if(B){B.set("src",D.up[C].src)}}else{if(D.up[C].items){SetSelect(E,D.up[C].items)}else{if(D.up[C].value){if(D.up[C].value=="-"){D.up[C].value=""}E.value=D.up[C].value}else{if(D.up[C].kill){E.slide("out")}}}}}if(D.up[C].select){Select(E,D.up[C].select)}if(D.up[C].tween){E.tween("background-color",D.up[C].tween)}if(D.up[C].done&&E.retrieve("waiting")){E.store("waiting",0)}}}}if(D.ui){if(window.uis){window.uis=$merge(window.uis,D.ui)}else{window.uis=D.ui}}if(D.units){if(!window._units){window._units=new Units()}window._units.process(D)}if(D.samplecont){SmallPlayer($(D.samplecont))}if(D.info&&typeof info=="function"){info(D.info)}if(D.dlg&&typeof dialog=="function"){dialog(D.dlg)}if(D.js){$exec(D.js)}planetHelp(D.tip)}else{A=A||D;if(A){alert(A)}}}function ui(A){return(window.uis)?window.uis[A]:""}function DeleteMessage(C,A){log("DeleteMessage"+C+"/"+A);DlgParam=C;var B=C.split("&");Confirm("trm_"+B[0],"CONFDELM",A,"DoDeleteMessage")}function DoDeleteMessage(A){if(A){new Request.JSON({url:j_url+"del_msg&id="+DlgParam,onComplete:react}).get()}else{$("dlg").innerHTML="";DlgParam=false}}function UpdateUserInfo(){var A=$("userinfo");if(A){ajax("userinfo",A)}}function Purchase(){window.open(purchase_link,"Lizenz kaufen","width=600,height=400,toolbar=yes,scrollbars=yes,resizable=yes,copyhistory=no")}function NewMessage(A){dest=$("checkres");var B=(A)?"&m="+A:"";dest.empty().addClass("ajax-loading");new Request.HTML({url:d_url+"newmessage"+B,update:dest,onComplete:function(){dest.removeClass("ajax-loading");AutoUser("m_to")}}).get()}function CheckInput(D,G,F,B){var A,C,E;A=$(D+G);if(!A||!$defined(A.value)){return false}C=A.value.trim();E=stripTags(C);if(C!=E){A.value=E;return display(G,uit.illtags)}if(!C&&F){return display(G,uit.reqfield)}if(G=="email"){if(!isEmail(C)){return display(G,uit.invalid)}}else{if(G=="name"||B){return display(G,isBad(C))}}display(G,"");return false}function SendFeedback(){var A=false,B="f_";A=CheckInput(B,"name",1,1)+CheckInput(B,"email",1)+CheckInput(B,"body",1);if(A){return false}jsonp("sendfeedback","messform")}function SendMessage(){var A,D,E,B="";A=window.document.messform.m_to.value.trim();E=stripTags(A);if(A!=E){B=display("to","Tags sind nicht erlaubt!");window.document.messform.m_to.value=E}else{B=display("to",isBad(E))}A=window.document.messform.m_subject.value.trim();E=stripTags(A);if(A!=E){B=B+display("subject","Tags sind nicht erlaubt!");window.document.messform.m_subject.value=E}else{B=B+display("subject",(E)?"":"Bitte Betreff eingeben")}A=window.document.messform.m_body.value.trim();E=stripTags(A);if(A!=E){B=B+display("body","Tags sind nicht erlaubt!");window.document.messform.m_body.value=E}else{B=B+display("body",(E)?"":"Keine Nachricht?!")}if(B){return false}info("senden...");var C=$("postres").empty().addClass("ajax-loading");new Request.JSON({url:j_url+"sendmessage",onComplete:function(H,I){C.removeClass("ajax-loading");if(!H){alert(I);return }if(H.errors.length==0){info("gesendet!");json("messages")}else{for(var G=0;G<H.errors.length;G++){var F=H.errors[G].split("&");if(H.errors[G]=="badrec"){display("to",H.bad)}else{if(H.errors[G]=="nosub"){display("subject","Bitte Betreff eingeben")}else{if(F[0]=="nobody"){display("body",F[1])}else{if(H.errors[G]=="unauthorized"){$("checkres").set("html","UNAUTHORIZED")}}}}}}}}).post($("messform"))}function Preview(A){if(!window.cfront){return false}if(window.imgsel&&imgsel.getHTML()){}else{if(A){window.cfront.synContent()}}var B=$("preview-ccfr").addClass("ajax-loading");new Request.JSON({url:j_url+"cprvw",onComplete:function(F,C){if(!F){alert("completed, but no json: "+C);return }if(B){B.removeClass("ajax-loading")}var I=$("preview-ct");if(I){I.set("html",F.title)}var H=Selected("c_theme");var G=$("preview-ccfr");if(G){G.className=(H)?"card_content cs_"+H:"card_content"}if(B){B.set("html",F.front.replace(/\\"/g,'"'))}var D=$("preview");var E=D.retrieve("auf");if(E){E.build()}else{E=new tmx_auf({card_id:"preview"});D.store("auf",E)}},onFailure:function(){alert("preview failed :-(")}}).post($("carded"))}var infoBar=new Class({initialize:function(){this.bar=$("infobar")||new Element("div",{id:"infobar"}).injectInside(document.body);this.timer=null;this.slide=new Fx.Slide(this.bar);this.slide.hide();this.slide.addEvent("complete",this.slidecomplete.bind(this));this.bar.setStyle("visibility","visible")},slidecomplete:function(){if(this.slide.open){this.starttimer()}else{this.bar.empty()}},show:function(A){this.bar.set("html",A);if(!this.slide.open){this.slide.slideIn()}},clear:function(){this.slide.slideOut()},starttimer:function(){if(this.timer){this.timer=window.clearTimeout(this.timer)}this.timer=this.clear.delay(3000,this)}});function info(A){if(!window.infobar){window.infobar=new infoBar()}window.infobar.show(A)}function includeOnce(A,E){if(document.getElementById(A)!=null){return }var C,D=document.getElementsByTagName("head")[0];var B=document.createElement("script");B.id=A;B.type="text/javascript";if(E){C=Browser.Engine.webkit?".js.ycomp.js":".js.ycomp.js.gz"}else{C=".js"}B.src="js/"+A+C;D.appendChild(B)}function display(C,B){log(C+"/"+B);var A=$(C+"_error");if(A){A.innerHTML=B;A.setStyle("display",B?"":"none")}else{alert(C+"_error nicht gefunden!")}return(B!="")}function Slide(C,A){var B=$(C);if(B){if((A=="out"&&B.get("slide").open)||A==("in"&&!B.get("slide").open)){B.slide(A)}}}function Confirm(B,D,E,C,G){var F=$(B);if(!F){alert("not found: "+B);F=document.body}var A=$("dlg");if(A){A.dispose()}else{A=new Element("div",{id:"dlg"})}if(F){A.inject(F,"after").setStyle("display","block")}ajax("confirm&code="+D+"&param="+encodeURIComponent(E)+"&fx="+C+"&id="+G,A)}function SubscribeUnit(A){if(A){json("subscribe&id="+A)}}function EditUnit(C){var B=$("unitopts"),A=$("search");if(B&&A){A.setStyle("display","none");B.set("html","loading...").setStyle("display","block")}json("edit_unit&id="+C,B)}var DlgParam;function ShowChars(B,A){if(!window.xchars){window.xchars=new tmx_chars()}xchars.show(B,A)}function charsForSearch(B){var A=$("revlang").value;var C=A>0?$("lang2"):$("lang");C=C.value;if(C){ShowChars(C,B)}}function closeChars(A){if(window.xchars){xchars.close(A)}}function savePref(B,A,C){if(!C){C=0}new Request.HTML({url:j_url+"save_pref",onComplete:function(D,E){if(D){if(D.info){info(D.info)}}else{alert(E)}}}).get({key:B,value:A,q:C})}function ts(E,D){var A=$("tsub_"+E);if(A){var F=A.getStyle("display");A.setStyle("display",(F=="none")?"":"none");savePref("cmhide_"+E,(F=="none")?"0":"1");var C=$("tsci_"+E);if(C){var B=(F=="none")?"open":"closed";C.set("src","img/arrow_"+B+".png")}}ShowChars(E);var G=$(D).getPosition();xchars.win.setStyles({top:G.y})}function delAccount(A){DlgParam=A;Confirm("myaccount","CONFDELAC",0,"doDeleteAccount",0)}function doDeleteAccount(A){$("dlg").innerHTML="";if(A){json("del_account&h="+DlgParam)}DlgParam=false}function ToggleUnit(D,A){if(window.console){console.log("ToggleUnit: ",D,A)}var B=$("aru_"+D);if(!B){return false}var C=(B.src.indexOf("minus")>=0);if(window.console){console.log("minus: ",C)}if(C){DlgParam=D;Confirm("tru_"+D,"CONFREMU",A,"DoRemoveUnit",D)}else{EditUnit(D+"&add=1")}}function DoRemoveUnit(A){$("dlg").innerHTML="";if(A){json("unsubscribe&id="+DlgParam)}DlgParam=false}function indicateSaving(B,A){B=$(B);if(B){B.setStyle("display",A?"block":"none");var C=B.getParent();if(C){if(A){C.removeClass("ajax-loading")}else{C.addClass("ajax-loading")}}}}function saveUnit(A){var B=false,C="u_";if(!A){B=CheckInput(C,"subject",1)+CheckInput(C,"name",1)+CheckInput(C,"tags",0)+CheckInput(C,"descr",0)}if(B){return false}indicateSaving("uebuttons");jsonp("save_unit","united")}function SetSelect(B,A){if(window.console){console.log("SetSelect",B.id)}B.set("html",A);B.disabled=(A)?0:1}function eMainChanged(){var D=$("u_msubject"),C=$("u_subject"),B=$("u_area"),A=Selected(D);C.setStyle("display",(A=="")?"none":"");SetSelect(C,"");B.setStyle("display",(A=="lang")?"":"none");if(A){json("esubjects&main="+A)}}function eSubjectChanged(){var E=$("u_msubject"),D=$("u_subject"),C=$("u_area"),A=Selected(E),B=Selected(D);if(B){json("areas&sub="+B)}else{C.disabled=true;C.innerHTML=""}}function SubjectChanged(B){var F=$("msubject"),E=$("subject"),D=$("area"),A=Selected(F),C=Selected(E);log("SubjectChanged("+B+") > "+A+"/"+C);if(B){SetSelect(E,"");D.disabled=true;D.innerHTML="";if(A){json("tagcloud&m="+A)}else{json("tagcloud")}}else{if(C){json("tagcloud&s="+C)}else{D.setStyle("display","none");D.innerHTML=""}}}var lang1="";var lang2="";function Select(E,D){var C=$(E);var B=C.length;var A;for(A=B-1;A>=0;A--){if(C.options[A].value==D){C.selectedIndex=A;break}}}function Selected(B){var A=$(B);return(A&&!A.disabled&&A.selectedIndex>-1)?A.options[A.selectedIndex].value:false}function MM_ChLL(C){var B=Selected("lang");var A=Selected("lang2");if((B!=lang1)&&(B==A)){Select("lang2",lang1);A=lang1}else{if((A!=lang2)&&(B==A)){Select("lang",lang2);A=lang2}}if(lang1!=B){lang1=B}if(lang2!=A){lang2=A}}function CollapseInit(A,B){var C=$$(A+" .intable");if(!C.length){return false}var D=$$(B);D.each(function(G,E){var F=new Fx.Slide(C[E],{duration:300});G.store("div",C[E]);if(!G.hasClass("open")){F.hide()}else{G.store("open",1)}C[E].setStyle("display","block")})}function initCollapse(B){var D,A,C,E,G,F;A=B.cont||"checkres";A=$(A);C=B.css||"intable";F=A.getElements("div."+C);if(!F.length){return false}G=A.getElements("."+B.head);log("h length: "+G.length+" / "+B.head);for(D=0;D<G.length;D++){E=new Fx.Slide(F[D],{duration:300});G[D].store("div",F[D]);if(B.ajax){G[D].store("ajax",B.ajax);G[D].addEvent("click",function(){Collapse3(this);return false})}if(B.alwaysrefresh){G[D].store("ar",1)}if(!G[D].hasClass("open")){E.hide()}else{G[D].store("open",1)}F[D].setStyle("display","block")}}function Collapse(E,B){var C=E.retrieve("open")||false;var G=E.retrieve("div");if(!G){if(window.console){console.log("Fehler: Kein cdiv!!!")}return }if(G&&G.innerHTML=="?"&&!C){var D=G.empty().addClass("ajax-loading");var A=new Request.HTML({url:d_url+"list_cards&id="+B,update:D,onComplete:function(){D.removeClass("ajax-loading")}}).get()}if(C){E.tween("background-color","#f0f0f0")}else{E.tween("background-color","#ddccbb")}G.slide(C?"out":"in");C=!C;E.store("open",C);var F=G.getElement("div .vadd");if(F&&G.innerHTML!="?"){if(C){AutoAdd(F)}else{if(addV.list==F){addVCard.detach()}}}return false}function Collapse2(B,E,C){var A=B.retrieve("open");var D=B.retrieve("div");if(D.innerHTML=="?"&&!A){ajax(C+"&id="+E,D)}if(B.hasClass("toggle")){B.toggleClass("is_open")}if(A){B.tween("background-color","#f0f0f0")}else{B.tween("background-color","#ddccbb")}D.slide(A?"out":"in");A=!A;B.store("open",A);return false}function Collapse3(E){if(!E){return false}var B=E.retrieve("open");var H=E.retrieve("div");var A=E.retrieve("ar");if(!B&&(H.innerHTML=="?"||A)){var F=E.retrieve("ajax");var G=H.id.split("-");G=G[1];var D=$time()-$random(0,1000);ajax(F+"&id="+G+"&r="+D,H)}if(B){E.tween("background-color","#f0f0f0")}else{E.tween("background-color","#ddccbb")}H.slide(B?"out":"in");B=!B;E.store("open",B);var C=E.getFirst();if(C&&C.tagName.toLowerCase()=="img"){C.set("src",B?"img/arrow_open.png":"img/arrow_closed.png")}return false}function AjaxReq(B,F,G,D){var E=$(B);var C={url:d_url+F};if(E){E.empty().addClass("ajax-loading");$extend(C,{update:E,onComplete:function(){E.removeClass("ajax-loading")}})}var A=new Request.HTML(C);if(G.toLowerCase()=="post"){if(!D){D=$("f-search-v")}A.post(D)}else{A.get()}}function ajax(C,B,A){if(window.console){console.log("a",C,B,A)}A=A||d_url;B=$(B||"checkres");B.empty().addClass("ajax-loading");new Request.HTML({url:A+C,update:B,onComplete:function(){B.removeClass("ajax-loading")}}).get()}function EditCard(A){Editor("edit_card&id="+A)}function NewCard(A){Editor("new_card&unit="+A)}function decodeId(B){var A=B.match(/[a-z]*-(\d*)-(\d*)\_[^\_]*\_(\d*)[-]?(\w*)?/);return(A)?{v1:A[1],m:A[2],v2:A[3]}:false}function markvoc(B){var A=$(B+"-fm");if(A){new Request.JSON({url:j_url+"mark&c="+B,onComplete:react}).post(A)}}function showmf(D){var A=$(D+"-fm");var B=$(D+"-vbpc");var C=$(D+"-mark").getFirst();if(!A){return }if(A.getStyle("display")!="none"){A.setStyle("display","none");C.setStyle("display","inline");if(B){B.setStyle("display","inline")}}else{if(B){B.setStyle("display","none")}C.setStyle("display","none");A.setStyle("display","inline")}}function toggleSearchDir(A){if(window.console){console.log("toogleSearchDir",A.innerHTML)}var B=A.innerHTML=="&gt;";A.innerHTML=B?"&lt;":"&gt;";$("revlang").value=(B)?1:0;SearchVoc()}function searchLangChanged(){var B=$("revlang").value;var A=B>0?"lang2":"lang";A=$(A).value;setLangDir("term",A);SearchVoc()}function setActiveInput(B){var A=B.target;log("setActiveInput "+A);if(A){window.act_input=A}}function linkSpecial(A){A=$(A);log("linking "+A);if(A){A.addEvent("focus",function(){window.act_input=this})}}function SearchVoc(B,D){if(D&&(D.keyCode!=13||!D.target||D.target.id!="term")){return }var C=(B>0)?"&page="+B:"";var A=$("term");if(A){A.addClass("ajax-busy")}jsonp("search_voc"+C,"f-search-v")}function ShowVoc(D,B){if(!B){var C=D.split("_");B=C[1];D=C[2];C=C[0].split("-");lang2=(C[0]=="v")?C[1]:C[0]}var A=(B==lang2)?lang1:lang2;cards.showterm(D,B,A)}function show(B){var A=$(B);if(A){A.style.display="block"}}function hide(B){var A=$(B);if(A){A.style.display="none"}}function mark(C,B,A){return C.replace(new RegExp("("+B.escapeRegExp()+")","i"),'<span class="'+A+'">$1</span>')}function validterm(A){var B=/[%\*_]/g;return !B.test(A)&&A.length}function isSentence(A){var B=/\s/g;if(!B.test(A.term)){return false}B=/[!\.\?]\)?$/;if(B.test(A.term)){A.type=10;return true}}function canAddTerm(B,F){var D={term:B.value,type:1};if(D.term.substr(0,1)=="?"){return false}if(!validterm(D.term)){alert(uit.illchar);return false}var A={en:{wt:2,re:/^(?:to )([\S]*)$/},de:{wt:1,re:/^(?:der|die|das)\s([\S]*)$/},fr:{wt:1,re:/^(?:le |la |l'|les |un |une )([\S]*)$/},es:{wt:1,re:/^(?:el|la|los|las|un|una)\s([\S]*)$/},it:{wt:1,re:/^(?:il |la |lo |l'|i |gli |le |un |una |un')([\S]*)$/},pt:{wt:1,re:/^(?:o|a|os|as|um|uma)\s([\S]*)$/}},E;if(A[F]){E=A[F];if(E.re.test(D.term)){if(F=="en"){alert('Verben bitte ohne "to " eingeben!');return false}else{alert("Nomen bitte ohne Artikel eingeben (Wortart und Geschlecht einstellen)!");return false}}}var C=isSentence(D,F)?uit.newsen:uit.newvoc;C=C.substitute({lang:F,term:D.term});return(confirm(C))?D:false}function TransAdd(B){var A=B.getParent();if(window.console){console.log("TransAdd: element= "+A.id)}if(!window.addTr){window.addTr=new addTrans()}addTr.attachTo(A)}var addTrans=new Class({initialize:function(){this.container=new Element("div",{id:"ved-autobox","class":"ved-autobox"}).injectInside(document.body);this.input=new Element("input",{type:"text",id:"ved-autoinput","class":"ved-autoinput"}).injectInside(this.container).addEvent("focus",function(){window.act_input=this});this.list=null;this.auto=new Autocompleter.Request.JSON(this.input,"php/query_v.php",{indicatorClass:"ajax-busy",postVar:"term",minLength:2,injectChoice:function(E){var D=E.term;var B=E.type;var A=E.extra;var F='<span class="ac-type">'+B+"</span>";if(A){F=F+'<span class="ac-info">'+A+"</span>"}var C=new Element("li",{html:mark(D,this.queryValue,"autocompleter-queried")+F});C.inputValue=D;C.store("vid",E.vid);this.addChoiceEvents(C).inject(this.choices)},onSelection:this.selected.bind(this),onUnknown:this.unknown.bind(this)})},unknown:function(){var A=canAddTerm(this.input,this.lang);if(A){var C=$(this.card+"-type");var B=(C&&C.value)?C.value:Selected(this.card+"-type");cards.newterm(A.term,this.lang,this.lang2,B,false,this.list.id)}},selected:function(C,E,D,A){var B=E.retrieve("vid").split("-");info("onSelection "+B[0]+"-"+B[1]+" - "+D);cards.addtrans(this.list,B[0],B[1],D);this.clear()},clear:function(){this.input.value=""},isSentence:function(A){var B=$(A+"-type");if(!B){return false}return B.value==10},detach:function(){this.container.setStyle("display","none").dispose()},attachTo:function(A){if(A==this.list){this.container.setStyle("display",(this.container.getStyle("display")=="none")?"":"none");return false}if(window.console){console.log("addTrans.attachTo: "+A.id)}var B=A.id.split("-");this.lang=B[4];this.lang2=B[1];this.card="v-"+B[1]+"-"+B[2];this.auto.options.postData={lang:this.lang};this.input.className=this.isSentence(this.card)?"ved-autosentence":"ved-autoinput";this.container.dispose().inject(A,"after");this.container.setStyle("display","");this.list=A;this.input.value="";this.input.focus()}});function setLangDir(B,C){B=$(B);if(!B){return }var A=!C||rtl_lang.indexOf(C)==-1?"ltr":"rtl";B.set("dir",A);if(C){B.set("lang",C);B.set("xml:lang",C)}}function AutoAdd(B){var A=$(B);if(!A){return }if(!window.addVCard){window.addVCard=new addV()}addVCard.attachTo(A)}var addV=new Class({initialize:function(){this.input=new Element("input",{type:"text",id:"vadd","class":"vadd"}).addEvent("focus",function(){window.act_input=this});this.sc=new Element("div",{});this.ss=new Element("select",{id:"avis","class":"vadd",events:{change:this.secselected.bind(this)}}).injectInside(this.sc);new Element("option",{html:"im letzten Abschnitt",value:"last"}).inject(this.ss);new Element("option",{html:"im ersten Abschnitt",value:"first"}).inject(this.ss);this.list=null;this.auto=new Autocompleter.Request.JSON(this.input,"php/query_v.php",{indicatorClass:"ajax-loading",postVar:"term",minLength:2,injectChoice:function(E){var D=E.term;var B=E.type;var A=E.extra;var F=' <span dir="ltr" class="ac-type">'+B+"</span>";if(A){F=F+' <span dir="ltr" class="ac-info">'+A+"</span>"}if(E.lang=="ar"){var C=new Element("li",{html:D+F,dir:"rtl"})}else{var C=new Element("li",{html:mark(D,this.queryValue,"autocompleter-queried")+F})}C.inputValue=D;C.store("vid",E.vid);this.addChoiceEvents(C).inject(this.choices)},onSelection:this.selected.bind(this),onUnknown:this.unknown.bind(this)})},unknown:function(){var A=canAddTerm(this.input,this.lang);if(A){log("unknown "+A.term+"/"+A.type);cards.newterm(A.term,this.lang,this.lang2,A.type,this.cardunit);this.input.value=""}},secselected:function(){this.secpref=this.ss.value},selected:function(F,H,G,B){var E=H.retrieve("vid").split("-");var C=this.cardunit;var A=(this.secpref=="after"&&this.ls)?"&s="+this.ls:"";var D=new Request.JSON({url:j_url+"addv&id="+E[1]+"&unit="+C+A,onSuccess:react,onFailure:function(I){alert("722 failed!")}}).get();this.input.value=""},addv:function(A,D){if(A&&A.v){if(Error(A)){return }var F=$("tcl-"+A.v.unit);if(!F){return }var E="cards.showterm("+A.v.card+"); return false";var B="DeleteCard("+A.v.xid+',"'+A.v.delh+'","'+A.v.title+'",1); return false';var C=new Element("div",{id:"tr"+A.v.xid,"class":"tr"});new Element("a",{text:A.v.title,"class":"col1 voc xtip",href:"#",onclick:E,rel:"???"}).injectInside(C);new Element("div",{"class":"col kasten",text:A.v.xautor}).injectInside(C);new Element("div",{id:A.v.xid+"-lvl","class":"col kasten",text:A.v.level}).injectInside(C);new Element("div",{id:A.v.xid+"-age","class":"col4",text:A.v.age}).injectInside(C);new Element("div",{id:A.v.xid+"-due","class":"col3",html:A.v.due}).injectInside(C);new Element("a",{href:"#","class":"col3 xtip",onclick:E,html:'<img class="icon" alt="pencil.png" src="/img/pencil.png"/>'}).injectInside(C);new Element("a",{href:"#","class":"col3 xtip",onclick:B,html:'<img class="icon" alt="DELETE" src="/img/cross.png"/>'}).injectInside(C);if(F){C.inject(F,"top")}}else{if(D){alert(D)}}},reattach:function(){this.attachTo()},detach:function(){this.input.setStyle("display","none").dispose();this.last=this.list.id;this.list=false;this.cardunit=false},uls:function(C,A){var B=$(C);if(B&&B==this.list){B.ls=A;this.ls=(A)?A:false;if(this.ls){this.iss(B)}}},iss:function(A){if(this.input!=this.sc.getPrevious()){this.secpref="after";this.ss.value=this.destsec;this.sc.inject(this.input,"after")}},attachTo:function(B){if(!B){B=$(this.last)}if(B==this.list){this.input.focus();return false}if(this.list){this.input.dispose()}var A,C=B.id.split("-");this.lang=C[1];setLangDir(this.input,this.lang);this.cardunit=C[2];this.collapsed=$("tcu_"+this.cardunit);this.auto.options.postData={lang:this.lang,unit:this.cardunit};A=B.getProperty("ls");this.ls=A?A.toInt():false;this.input.inject(B,"after");if(this.ls){this.iss(B)}else{this.sc.dispose();this.secpref=false}this.input.setStyle("display","");this.list=B;this.input.value="";this.input.focus()}});function SmallPlayer(D){var C=D.getElement("a.splayer");if(C){return new smPlayer(D,A,[])}var A=D.getElement("img.splayer");if(!A){return false}var B=A.getProperty("sample");if(B){return new smallPlayer(D,A,[B])}}var infoDiv=new Class({initialize:function(A){if(!A){return false}this.cardid=A.id;this.msgbox=A.getElement("div.ved_msg")||new Element("div",{id:this.cardid+"-msg","class":"ved_msg"}).inject(A.getElement("div.card_content"),"bottom");this.statusTimer=null},show:function(A){this.msgbox.set("html",A);if(this.msgbox.getStyle("opacity")<1){this.msgbox.setStyle("opacity",1)}this.msgbox.setStyle("display","block");this.starttimer()},hide:function(){this.msgbox.setStyle("display","none");this.msgbox.empty()},clear:function(){this.fx.start(1,0)},starttimer:function(){if(this.statusTimer){this.statusTimer=window.clearTimeout(this.statusTimer)}else{this.fx=this.msgbox.get("tween",{property:"opacity"});this.fx.addEvent("complete",this.hide.bind(this))}this.statusTimer=window.setTimeout("window.cards.message('"+this.cardid+"')",8000)}});function setInput(){window.act_input=this}var xcards=new Class({Implements:[Events,Options],options:{ajax_url:"php/json.php?a=get_card",css:{card:"card"},pos:{x:150,y:180,xoffset:10,yoffset:8},maxopen:8},initialize:function(A){this.setOptions(A);this.instances=new Hash();this.demos=false;this.x=this.options.pos.x;this.y=this.options.pos.y;this.z=100;var C=this.Failed.bind(this);var B=this.Completed.bind(this);this.ajaxOptions={url:this.options.ajax_url,onComplete:B,onFailure:C}},message:function(A,C){var B=this.instances.get(A);if(B){var D=B.retrieve("infodiv");if(!D){D=new infoDiv(B);B.store("infodiv",D)}if(C){D.show(C)}else{D.clear()}}},pop:function(K,F){var B=this.instances.get(K);if(B){this.bringtofront(B);$(B.id+"-ct").highlight("#ff0000");return B}var G=this;this.getHighestZ();this.z+=10;F=F||this.options.css.card;var I=this.instances.get(this.lastcard);if(I&&!I.isClosing){this.x+=this.options.pos.xoffset;this.y+=this.options.pos.yoffset}B=new Element("div",{id:K,"class":F,styles:{position:"absolute",left:this.x,top:this.y+window.getScrollTop(),"z-index":this.z}}).addEvent("mousedown",function(){G.bringtofront(this.id)});var J=new Element("div",{id:K+"-ct",text:K,"class":F+"_title",styles:{cursor:"move"}}).injectInside(B);var A=new Element("img",{id:K+"-info",src:"/img/info_w.png","class":"iinfo",title:window.uit.infowin,alt:"info"}).addEvent("click",function(){cards.show(B.retrieve("info_id"),0)}).injectInside(B);var L=new Element("img",{src:"/img/omega_w.png","class":"omega",title:window.uit.spchar,alt:"&Ouml;"}).addEvent("click",function(){ShowChars(B.retrieve("subject"),this)}).injectInside(B);var D=new Element("img",{src:"/img/close_w.png","class":"x",title:"Karte schließen",alt:"X"}).addEvent("click",function(){G.close(K)}).injectInside(B);var E=new Element("div",{id:K+"-ccfr","class":"card_content"}).injectInside(B);if(Browser.Engine.trident){B.setStyle("display","none")}else{B.setStyle("opacity",0)}B.injectInside(document.body);var H=new Element("div",{id:K+"-cext","class":"card_ext"}).injectInside(B);B.store("ext",H);new Drag.Move(B,{handle:J,snap:0,onBeforeStart:function(M){G.bringtofront(M.id)},onSnap:function(M){M.addClass("dragging")},onComplete:function(M){G.dc(M.id)}});this.instances.set(K,B);if(Browser.Engine.trident){B.setStyle("display","block")}else{var C=B.get("tween",{property:"opacity",duration:100});C.start(1)}this.lastcard=K;return B},Failed:function(){alert("Ajax failed :-(")},Completed:function(){this.fireEvent("onComplete",[this.response])},is_open:function(A){var B=this.instances.get(A);return(B&&!B.closing)},getHighestZ:function(){this.z=90;this.instances.each(function(A){var B=A.getStyle("zIndex").toInt();if(B>=this.z){this.z=B}}.bind(this))},bringtofront:function(B){if(typeof B=="string"){B=this.instances.get(B)}if(!B){return false}var A=B.getStyle("zIndex");if(A==this.z){return }B.setStyle("zIndex",A+5);this.instances.each(function(C){var D=C.getStyle("zIndex");if(D>A){C.setStyle("zIndex",D-10)}}.bind(this));B.setStyle("zIndex",this.z)},dc:function(A){if(typeof A=="string"){A=this.instances.get(A)}if(!A){return false}A.removeClass("dragging");this.x=A.offsetLeft;this.y=A.offsetTop-window.getScrollTop()},closejobs:function(C){C.setStyle("visibility","hidden");var A=this.instances.get(C.id);var B=C.retrieve("auf");if(B){this.freeAudio(A);delete B;B=null}C.destroy();this.instances.erase(A.id)},close:function(D,B){var A=this.instances.get(D);if(!A||A.isClosing){return }A.isClosing=true;if(A){if(window.addTr&&addTr.card==A.id){addTr.detach()}var C=A.get("tween",{property:"opacity",duration:200});C.addEvent("onComplete",function(){if(A.retrieve("demo")||A.retrieve("werten")){if(!B){shade(0)}}cards.closejobs(A)});C.start(0)}}});var tmx_cards=new Class({Extends:xcards,learn:function(A,B){var C=(B)?{s:B}:{u:A};shade(1);this.JSONRequest=new Request.JSON(this.ajaxOptions).get($merge(C,{r:$time()-$random(0,1000)}))},play:function(A){shade(1);var D=this.loaded.bind(this),B=this.Failed.bind(this);var C={url:(typeof A=="string")?"php/json.php?a="+A:"php/json.php?a=play&u="+A,onComplete:D,onFailure:B};new Request.JSON(C).get()},loaded:function(C,A){if(!C){alert("no json: "+A);return }var B;if(Error(C)||!C.cards){return }if(!this.demos){this.demos=[]}this.demos[C.unit]=[];for(B=0;B<C.cards.length;B++){C.cards[B]["unit"]=C.unit}this.demos[C.unit]["cards"]=C.cards;this.demos[C.unit]["uname"]=C.uname;this.demos[C.unit]["ix"]=0;this.demos[C.unit]["last"]=C.cards.length-1;this.display(C.unit,0)},display:function(B,C){if(B&&this.demos[B]){var A=this.demos[B]["ix"];if(C){A+=C}if(this.demos[B]["cards"][A]){this.demos[B]["ix"]=A;this.render(this.demos[B]["cards"][A])}}},showNav:function(C){var B=C.retrieve("unit"),A,E,D,F=C.retrieve("ext");if(F&&B&&this.demos[B]){A=this.demos[B]["ix"];F.empty();E=F.getElement("a.dnext")||new Element("a",{id:C.id+"-dnext","class":"dnext",html:"&nbsp;",title:"next",events:{click:this.display.bind(this,[B,1])}}).inject(F,"top");E.setStyle("display",(A<this.demos[B]["last"])?"block":"none");D=F.getElement("a.dprev")||new Element("a",{id:C.id+"-dprev","class":"dprev",html:"&nbsp;",title:"back",events:{click:this.display.bind(this,[B,-1])}}).inject(F,"top");D.setStyle("display",(A>0)?"block":"none")}},render:function(Q){var J,H=Q.unit?Q.unit:0,I=(Q.subject&&Q.subject=="demo");if(H&&I){J="demo-"+H}else{J=(Q.id.charAt(0)=="c")?Q.id:Q.type+Q.id}var M=$(J);var B=this.pop(J,Q.type=="v"?"vcard":false);B.store("xid",Q.xid);if(I){B.store("demo",1)}if(H){B.store("unit",H)}if(Q.more){B.store("more",Q.more)}if(Q.werten){B.store("werten",1);if(M){return }}if(!B){return }if(Q.intro){B.store("info",Q.intro);B.store("werten",0)}var D=$(J+"-info");if(D){D.setStyle("display",(Q.intro_id)?"block":"none")}if(Q.intro_id){B.store("info_id",Q.intro_id)}var T=$(J+"-ct");var E=$(J+"-ccfr");var R=(B.retrieve("werten")||I)?"":" (Vorschau)";if(E){if(Q.theme){E.className="card_content "+Q.theme}else{E.className="card_content"}}var S=E.getStyle("background-color");if(I&&Q.title=="?"){var A=this.demos[H]["ix"]+1,U=this.demos[H]["last"]+1;Q.title=this.demos[H]["uname"]+" ("+A+"/"+U+")"}if(Q.title.substr(0,1)=="["&&Q.title.substr(Q.title.length-1,1)=="]"){Q.title="[???]"}if(T){T.set("html",Q.title+R)}if(E){E.set("html",Q.front)}var O=E.getElement("div.muchmore");if(O){B.store("more",O.innerHTML);O.dispose().destroy();O=true}this.initAudio(B,E);B.store("learning",(Q.subject)?"s="+Q.subject:"u="+Q.unit);B.store("remaining",Q.remaining);var F=new tmx_auf({card_id:J});B.store("auf",F);if(I){this.showNav(B)}else{if(F.is_exercise(0)&&Q.nrlevel){this.showLevel(B,Q.level,Q.nrlevel)}}if(F.is_exercise(1)){var L=this.setExtension(B,uit.check,"cards.check('"+J+"');");log("render link="+L);F.setCheckLink(L)}else{if(Q.subject!="demo"&&Q.intro&&Q.intro_cont){this.shownext(B,1)}}if(F){F.focus()}var N=E.getElement("div.more");if(O&&N&&N.className=="more info"){var K=N.getElement("a");if(K){K.addEvent("click",this.more.bind(this,[B.id]))}}var G=E.getElements("div.frame");if(G.length>1){var C=E.getElements("a.next");if(C.length){B.store("aframe",0);B.store("frames",G);G[0].setStyle("visibility","visible");for(var P=0;P<C.length;P++){C[P].set("href","#").addEvent("click",this.nextFrame.bind(this,[B,C[P]]))}}}},show:function(D,A){var C="c"+D;var B=this.pop(C);B.store("werten",A);this.JSONRequest=new Request.JSON(this.ajaxOptions).get({id:D})},showx:function(C,A){if(window.console){console.log("showx",C)}var D="x"+C;var B=this.pop(D);B.store("werten",A);this.JSONRequest=new Request.JSON(this.ajaxOptions).get({xid:C})},check:function(A){var B=$(A).retrieve("auf");B.Check()},next:function(A,B,C){log("next "+A+"/"+B+"/"+C);this.close(A,1);this.learn(B,C)},more:function(B){var C=$(B);if(C){var D=C.retrieve("more");var E=C.retrieve("auf");var A=C.getElement("div.card_inside");if(A){A.innerHTML=D;if(E){E.initAudio()}}}return false},shownext:function(C,E){if(C.retrieve("demo")){this.setExtension(C);return }if(C.retrieve("remaining")){var A=C.retrieve("learning").split("=");log("remaining/learning "+A);var D=(A[0]=="s")?A[1]:"";var B=(A[0]=="u")?A[1]:0;A=(E)?uit.contex:ui_nextex;this.setExtension(C,A,"cards.next( '"+C.id+"', "+B+", '"+D+"' );")}else{this.setExtension(C,ui_closex,"cards.close('"+C.id+"');")}},feedback:function(A,F,D){var C=$(A);var E=C.retrieve("auf");if(E.is_exercise(0)){this.shownext(C)}if(!C.retrieve("werten")){return }this.newLevel(C,F);var B=C.retrieve("xid");new Request.JSON({url:"php/json.php?a=reg_card",onComplete:react}).get({x:B,value:F,more:D})},getExtLink:function(A){var B=A.retrieve("ext");return B?B.getElemenet("a"):null},setExtension:function(A,D,C){var F=A.retrieve("ext");if(F){var B=F.getElement("span")||new Element("span",{display:"none"}).inject(F,"bottom");B.innerHTML="";B.setStyle("display",D&&C?"":"none");if(C){var E=new Element("a",{href:"#",html:D}).addEvent("click",function(){$exec(C);return false}).inject(B);E.focus();return E}}return false},hideExtension:function(A,B){var C=A.retrieve("ext");if(C){C.setStyle("display",B?"none":"block")}},showLevel:function(B,A,C){var I,F,G=B.retrieve("ext");if(G){var E=G.getElement("ul")||new Element("ul",{id:B.id+"-exlev","class":"exlevels",title:A?"Level "+A:"Neue Vokabel"}).inject(G,"top");if(A==0){A=1;F=1}E.store("level",A.toInt());var H;for(var D=1;D<=C;D++){if(F){I="1*";F=0}else{I=D}H=new Element("li",{html:I}).inject(E);if(D==A){H.setStyle("background-color","#aaaaaa")}if(D==C){H.setStyle("margin",0)}}}},newLevel:function(B,A){var F,E,H=B.retrieve("ext"),C=B.retrieve("leitner");if(H){F=H.getElement("ul")}if(!F){return }var I=F.getChildren();var D=F.retrieve("level");log("newlevel r="+A+" // leitner="+C);if(A==2){E=Math.min(D+1,I.length)}else{if(C=="modern"){E=(A==1)?D:D-1}else{E=(A==1)?D-1:1}}if(E<1){E=1}log("oldlevel "+D+" > "+E);var G=new Color("#777");F.set("title","Level "+E);if(E!=D){I[D-1].tween("background-color",G.hex)}I[E-1].tween("background-color",G.mix(A?"#77ff77":"#ff7777",50).hex)},initAudio:function(B,A){if(!B||!A){return }this.freeAudio(B);var E=[],G,D,C,F=(A.length||typeof (A)=="array")?A:[A];for(C=0;C<F.length;C++){G=F[C].getElements(".splayer");if(G.length){for(D=0;D<G.length;D++){var H=G[D].getProperty("sample");var I=(H)?[H]:[];E.push(new smPlayer(F[C],G[D],I))}}}B.store("splayers",E)},freeAudio:function(A){if(A){var C=A.retrieve("splayers");if(C){for(var B=0;B<C.length;B++){C[B].kill();delete C[B]}delete C;C.length=0}}},autoplay:function(C,B){if(!C){return false}var A=C.retrieve("autoplayer");if(A){A.play_delayed(B)}},nextFrame:function(B,C){var E=B.retrieve("frames");var A=B.retrieve("aframe",false);var D=B.retrieve("auf");if(E&&E.length>0&&A!==false&&A<E.length-1){E[A].setStyle("visibility","hidden");A++;this.autoplay(E[A],200);E[A].setStyle("visibility","visible");if(D){D.frameChanged(E[A])}B.store("aframe",A)}if(C&&A==E.length-1){C.setStyle("display","none")}if(D){log("trfocauf");D.focus()}return false},pie:function(O){var H=O.getElement("table.pie");var B=O.getElement("canvas");var A=O.getElement("div.percent");if(A){A.setStyles({width:B.offsetWidth,left:B.offsetLeft,top:B.offsetTop+B.offsetHeight/2-A.offsetHeight/2})}if(!H||!B){return }var P=0;var M,R=[],K,E=[],I=0,S=0;var G=H.getElements("tr");for(var N=0;N<G.length;N++){M=G[N].getElements("td");if(M.length===0){continue}I=parseFloat(M[P].innerHTML);if(I>0){R.push(I);S+=I;E.push(G[N].getStyle("background-color"))}}if(typeof B.getContext==="undefined"){return }var J=B.getContext("2d");var C=[B.width,B.height];var D=Math.min(C[0],C[1])/2;var Q=[C[0]/2,C[1]/2];var F=0;for(N=0;N<R.length;N++){var L=R[N]/S;J.beginPath();J.moveTo(Q[0],Q[1]);J.arc(Q[0],Q[1],D,Math.PI*(-0.5+2*F),Math.PI*(-0.5+2*(F+L)),false);J.lineTo(Q[0],Q[1]);J.closePath();J.fillStyle=E[N];J.fill();F+=L}J.globalCompositeOperation="destination-out";J.fillStyle="#fff";J.beginPath();J.arc(Q[0],Q[1],D/2,0,Math.PI*2,true);J.fill()},closeSplash:function(A){var B=A.retrieve("splash");if(B){var D=A.retrieve("auf");B.destroy();A.eliminate("splash");if(D){D.focus()}}var C=A.retrieve("firstc")||A.getElement("div.card_content");this.autoplay(C,100);this.hideExtension(A,0);return false},Completed:function(P,J){this.parent();if(!P){alert("no json: "+J);return }if(Error(P)||!P.id){return }var K=(P.id.charAt(0)=="c")?P.id:P.type+P.id;var N=$(K);var B=this.pop(K,P.type=="v"?"vcard":false);B.store("xid",P.xid);if(P.more){B.store("more",P.more)}if(P.leitner){B.store("leitner",P.leitner)}if(P.leitner){log("leitner: "+P.leitner)}if(P.subject){B.store("subject",P.subject)}if(P.werten){B.store("werten",1);if(N){return }}if(!B){return }if(P.intro){B.store("info",P.intro);B.store("werten",0)}var D=$(K+"-info");if(D){D.setStyle("display",(P.intro_id)?"block":"none")}if(P.intro_id){B.store("info_id",P.intro_id)}var S=$(K+"-ct");var F=$(K+"-ccfr");var Q=B.retrieve("werten")?"":" (Vorschau)";if(F&&P.theme){F.addClass(P.theme)}if(P.title.substr(0,1)=="["&&P.title.substr(P.title.length-1,1)=="]"){P.title="[???]"}if(P.excounter){P.title=P.title+P.excounter}if(S){S.set("html",P.title+Q)}if(!F){return }if(P.splash){var H="splash";var R=new Element("div",{"class":"card_content "+H});B.store("splash",R);var A=new Element("div",{"class":"card_inside",html:P.splash}).injectInside(R);var L=A.getElement("a.close");if(L){L.addEvent("click",this.closeSplash.bind(this,B))}R.inject(F,"after");if(A.getElement("table.pie")){this.pie(A)}}F.set("html",P.front);B.store("learning",(P.scope=="s")?"s="+P.subject:"u="+P.unit);B.store("remaining",P.remaining);var E;var I=F.getElements("div.frame");if(I.length>1){log("frames: "+I.length+" ??? "+typeof (I));this.initAudio(B,I);E=I[0];var C=F.getElements("a.next");log("framelinks: "+C);if(C){log("framelinks: "+C.length)}if(C.length){B.store("aframe",0);B.store("frames",I);I[0].setStyle("visibility","visible");for(var O=0;O<C.length;O++){C[O].set("href","#").addEvent("click",this.nextFrame.bind(this,[B,C[O]]))}}}else{this.initAudio(B,F);E=F}var G=new tmx_auf({card_id:K});B.store("auf",G);if(G.is_exercise(0)&&P.nrlevel){this.showLevel(B,P.level,P.nrlevel)}if(G.is_exercise(1)){var M=this.setExtension(B,uit.check,"cards.check('"+K+"');");G.setCheckLink(M)}else{if(P.intro&&P.intro_cont){this.shownext(B,1)}}if(P.splash){log("saving fc "+F.id);B.store("firstc",E);this.hideExtension(B,1);if(L){(function(){L.focus()}).delay(200)}}else{if(G){G.focus()}this.autoplay(E,1500)}}});tmx_cards.v=new Class({Extends:tmx_cards,initialize:function(A){this.parent(A);this.v_ajax={url:"php/json.php?a=get_term",onComplete:this.vcompleted.bind(this),onFailure:this.Failed.bind(this)};this.v_save={url:"php/json.php?a=save_term",onComplete:this.saved.bind(this),onFailure:this.Failed.bind(this)}},showterm:function(C,B,A){this.JSONRequest=new Request.JSON(this.v_ajax).get({lang:B,lang2:A,id:C})},showvoc:function(B,A){this.JSONRequest=new Request.JSON(this.v_ajax).get({lang2:A,id:B})},clonevoc:function(A){this.JSONRequest=new Request.JSON(this.v_ajax).get({id:A,clone:1})},newterm:function(B,F,D,C,A,E){if(this.waitingfornew){return }this.waitingfornew=true;info("Neue Vokabel "+B+" wird angelegt...");this.JSONRequest=new Request.JSON(this.v_ajax).get({term:B,lang:F,lang2:D,id:-1,unit:A,ulid:E,type:C})},vcompleted:function(H,I){this.waitingfornew=false;if(H){if(Error(H)){return }var F="v-"+H.lang+"-"+H.id;if(window.mm){mm.create(H.id,H.term,H.lang)}var B=this.pop(F,"vcard");var E=$(F+"-ct");var A=$(F+"-ccfr");if(E){E.set("html",H.title)}if(A){A.set("html",H.editor);this.initAudio(B,A);var G=new bedeutungen(F,H.id,H.lang,H.tr_lang,H.meat,H.mart);B.store("bed",G);B.store("vid",H.id);B.store("subject",H.lang);if(H.meat||H.mart){B.addEvent("changed",this.changed.bind(this))}if(H.mea){this.trackChanges(F,["term","type","genus","alt","forms"]);var J=B.getElement("select.ved-genus");var D=B.getElement("select.ved-type");if(J&&D){D.addEvent("change",function(){J.setStyle("display",(this.selectedIndex==0)?"block":"none")})}}}if(H.v){addVCard.addv(H)}if(H.ul){var C=$(H.ul);if(C){this.addtrans(C,H.lang,H.id,H.term)}}react(H,"")}else{alert("Jason sagt: "+I)}},reset_trans:function(D,B){var A=$(D);if(!A){return }var C=A.retrieve("bed");if(C){C.reset_trans(B)}},trackChanges:function(E,G){var H=this;for(var C=0;C<G.length;C++){var D=$(E+"-"+G[C]);if(D){var A=D.tagName.toLowerCase();var F=D.getStyle("background-color");var B=$(E).getStyle("background-color");D.setStyle("background-color",B);D.store("bgrcol",B);if(A=="input"||A=="textarea"){D.addEvents({focus:this.focusChanged.bindWithEvent(this,true),blur:this.focusChanged.bindWithEvent(this,false)})}else{if(A=="select"){D.addEvent("change",function(){H.saveChanges(this)})}}}}},focusChanged:function(D,E){var B=D.target;if(E){window.act_input=B;B.store("startvalue",B.value);B.tween("background-color","#ffffff")}else{var C=B.retrieve("bgrcol");B.tween("background-color",C);var A=B.tagName.toLowerCase();if(A=="input"||A=="textarea"){stripTags(B)}if(B.value!=B.retrieve("startvalue")){B.store("changed",true);this.saveChanges(B)}}},fromId:function(B){var A=B.split("-");return(A[0]!="v")?false:{lang:A[1],id:A[2],card_id:A[0]+"-"+A[1]+"-"+A[2],el:A[3],data:{}}},changed:function(C,B,D){var A=this.fromId(B.card_id);A.data={key:C,params:D,value:B.changes};this.transmit(A)},saveChanges:function(B){element=$(B);var A=this.fromId(element.id);A.data={key:A.el,value:element.value};this.transmit(A)},transmit:function(C){var A=0;if(A){C.debugme=1;this.v_save=$merge({update:"checkres"},this.v_save)}var B=JSON.encode(C);if(A){this.saveRequest=new Request.HTML(this.v_save).get({id:C.id,up:B})}else{this.saveRequest=new Request.JSON(this.v_save).get({id:C.id,up:B})}},saved:function(C,B){react(C);if(C){if(C.error){this.message(C.card_id,C.error)}if(C.updated){var A,D=$(C.card_id);if(D){A=D.retrieve("bed");if(A&&C.key=="bed"){A.updated()}if(A&&C.key=="tr"){A.trans.updated()}}}}},addtrans:function(E,B,A,I){var F=this.fromId(E.id);var C=$(F.card_id);var G=C.retrieve("bed");if(G){var J=G.trans}if(J.contains(F.el,A)){info("Übersetzung ist schon vorhanden!");return }info(E.id+" - "+B+" - "+A+" - "+I);var H=new Element("li",{id:F.lang+"-"+F.id+"-"+F.el+"_"+B+"_"+A,"class":"ved-t",html:I});info("neu: "+H.id+" - "+B+" - "+A+" - "+I);var D=E.lastChild;H.inject(D,"before");J.addItems(H).hasChanged()},addm:function(J){info("addm "+J);var B=$(J);var Q=B.retrieve("vid");var G=B.retrieve("bed");if(G){var K=G.b.length+1;if(K>3){return false}if(G.isempty(K-1)){info("Wozu? Bedeutung #"+String(K-1)+" ist leer!");return false}var F=B.id+"-"+K;var E=new Element("div",{id:F,"class":"ved-b"});var N=$(B.id+"-1-1-sel");for(var P=1;P<4;P++){var D=F+"-"+P;var S=P;var L=N.clone().set("id",D+"-sel").setStyle("display","").injectInside(E);Select(L,S);var C=new Element(S==3?"input":"textarea",{id:D+"-inp","class":"ved-input hidden key"+P});if(S!=3){C.set({rows:2,style:"height:36px;"})}C.injectInside(E);var I=new Element("div",{id:D+"-pre","class":"ved-preview key"+P,html:ui_voc_empty}).injectInside(E)}var M=new Element("div",{id:F+"-tr"});var A=new Element("div",{id:F+"-"+G.tr_lang+"-tr","class":"ved-tr"}).injectInside(M);var O=new Element("div",{"class":"ved-flag"}).addEvent("dblclick",function(T){showTrans(Q,G.nextlang)}).injectInside(A);var R=(G.tr_lang==B.retrieve("vlang"))?"equal2":"flags/"+G.tr_lang;new Element("img",{src:"/img/"+R+".png",alt:G.tr_lang}).injectInside(O);var H=new Element("ul",{id:F+"-"+G.tr_lang+"-ul","class":"ved-translations"}).injectInside(A);G.trans.addLists(H);M.injectInside(E);E.inject($(B.id+"-"+String(K-1)),"after");G.b.include(E);G.add(F)}}});var cards=new tmx_cards.v;var bedeutungen=new Class({initialize:function(C,A,D,E,G,B){this.card_id=C;if(!$(C)){alert(C+" gibt es nicht!")}this.meat=G;if(this.meat){$(C).addEvent("click",this.edit.bind(this))}this.vlang=D;this.vid=A;this.b=$$("#"+C+" div.ved-b");this.reset_trans(E);this.trans=new XSortables(this.trul,{opacity:0.5,clone:true,handle:"div",card_id:this.card_id,mart:B});if(B<=1){this.trans.detach()}if(!this.meat){return }this.pre=[];for(var F=0;F<this.b.length;F++){this.add(this.b[F].id)}this.initial=this.getAll();this.changes=[]},reset_trans:function(C){this.tr=$$("#"+this.card_id+" div.ved-tr");this.trul=$$("#"+this.card_id+" ul.ved-translations");var B=$$("#"+this.card_id+" div.ved-flag");var E=(this.vlang==C)?this.tr_lang:this.vlang;this.nextlang=E;this.tr_lang=C;var A=this.vid;for(var D=0;D<B.length;D++){B[D].addEvent("dblclick",function(){showTrans(A,E)})}this.lang2=C;if(this.trans){this.trans.elements=[];this.trans.lists=[];this.trans.addLists(this.trul)}},add:function(B){var C=$$("#"+B+" div.ved-preview");for(var A=0;A<C.length;A++){var D=C[A].id;$(D.replace(/-pre/,"-inp")).setStyle("display","none");$(D.replace(/-pre/,"-sel")).addEvent("change",this.changekey.bind(this)).setStyle("display","none")}this.pre.combine(C)},getAll:function(){data=new Array();for(var A=0;A<this.b.length;A++){data.push(this.get(this.b[A].id))}return data},get:function(E){var G=$$("#"+E+" div.ved-preview");fields=new Array();for(var B=0;B<G.length;B++){var H=G[B].id;var D=$(H.replace(/-pre/,"-inp")).value;var C=H.replace(/-pre/,"-sel");if(!$(C)){alert(C+" fehlt!")}var A=$(H.replace(/-pre/,"-sel")).value;if(D&&D!=ui_voc_empty){var F=A<10?"0":"";fields.include(F+A.toString()+D)}}return fields.sort()},getChanges:function(){var C,A,B;this.changes.empty();for(A=0;A<Math.max(this.now.length,this.initial.length);A++){B=(A+1).toString();if(this.now[A]){for(C=0;C<this.now[A].length;C++){if(!this.initial[A]||!this.initial[A].contains(this.now[A][C])){this.changes.push("+"+B+this.now[A][C])}}}if(this.initial[A]){for(C=0;C<this.initial[A].length;C++){if(!this.now[A]||!this.now[A].contains(this.initial[A][C])){this.changes.push("-"+B+this.initial[A][C])}}}}return this.changes.length},isempty:function(A){return !this.get(this.b[A-1].id).length},hasChanged:function(){this.now=this.getAll();var A=this.getChanges();if(A){info("Bedeutungen wurden geändert: "+A);$(this.card_id).fireEvent("changed",["m",this,this.changes])}else{info("keine Änderungen")}},updated:function(){if(this.now){this.initial.empty().extend(this.now);this.now.empty()}this.changes.empty()},changekey:function(F){var H,G,D,E,B,C=F.target;var A=Selected(C);D=$(C.id.replace(/-sel/,"-inp"));E=$(C.id.replace(/-sel/,"-pre"));E.set("class","ved-preview key"+A);if(A==3){if(D.tagName.toLowerCase()=="textarea"){H=D.id;G=D.value;B=new Element("input",{id:H,"class":"ved-input key"+A,value:G});$(B).replaces(D)}else{D.set("class","ved-input key"+A)}}else{if(D.tagName.toLowerCase()=="input"){H=D.id;G=stripTags(D);B=new Element("textarea",{id:H,"class":"ved-input line2 key"+A,html:G});$(B).replaces(D)}else{D.set("class","ved-input key"+A)}}this.hasChanged()},edit:function(E){var A,B=E.target;if(["input","textarea","select","option"].contains(B.tagName.toLowerCase())){return }for(A=0;A<this.pre.length;A++){var D=$(this.pre[A].id.replace(/-pre/,"-sel"));var C=$(this.pre[A].id.replace(/-pre/,"-inp"));if(this.pre[A]==B){this.pre[A].setStyle("display","none");C.value=this.pre[A].innerHTML==ui_voc_empty?"":this.pre[A].innerHTML;D.setStyle("display","block");C.setStyle("display","block");C.focus();window.act_input=C}else{var F=(C.getStyle("display")!="none");D.setStyle("display","none");C.setStyle("display","none");if(F){this.pre[A].innerHTML=stripTags(C)||ui_voc_empty}this.pre[A].setStyle("display","");if(F){this.hasChanged()}}}}});var tmx_chars=new Class({options:{offset:{x:44+5,y:-2}},initialize:function(D,A){var C=this.Failed.bind(this);var B=this.Completed.bind(this);this.ajaxOptions={url:"php/json.php?a=special_chars",onComplete:B,onFailure:C};if(!D){D=""}this.build();if(D){this.show(D,A)}},build:function(){var D=this;this.win=$("special");if(!this.win){var A=$("container").offsetLeft;this.win=new Element("div",{id:"special",styles:{position:"absolute",left:A+20,top:120,"z-index":5000}}).injectInside(document.body);var B=new Element("div",{id:"special-t",text:"Sonderzeichen","class":"card_title",styles:{cursor:"move"}}).injectInside(this.win);var C=new Element("img",{src:"img/close_w.png","class":"x",title:"Fenster schließen",alt:"X"}).addEvent("click",function(){D.fade("out")}).injectInside(this.win);this.contentfr=new Element("div",{id:"special-c"}).injectInside(this.win);this.top=new Element("div",{id:"special-set"}).injectInside(this.contentfr);this.inside=new Element("div",{id:"special-in"}).injectInside(this.contentfr);new Drag.Move(this.win,{handle:B,snap:0,onSnap:function(E){E.addClass("dragging")},onComplete:function(E){E.removeClass("dragging")}});this.fx=new Fx.Tween(this.win,{property:"opacity",link:"cancel",duration:300}).set(0).addEvent("complete",this.faded.bind(this))}},faded:function(){log("xc faded");if(this.win&&!this.visible()){this.win.setStyle("display","none")}},loadset:function(A){this.JSONRequest=new Request.JSON(this.ajaxOptions).get({charset:A})},insert:function(F){F.stop();if(!act_input){return }var C=act_input;var D=this.get("text");if(window.console){console.log("act_input",D,C)}if(!C.tagName){C.insert(D);return }if(document.selection){C.focus();range=document.selection.createRange();range.text=D;range.select();C.focus()}else{if(C.selectionStart||C.selectionStart=="0"){var B=C.selectionStart;var A=C.selectionEnd;var G=B;var E=C.scrollTop;C.value=C.value.substring(0,B)+D+C.value.substring(A,C.value.length);G+=D.length;C.focus();C.selectionStart=G;C.selectionEnd=G;C.scrollTop=E}else{C.value+=D;C.focus()}}},show:function(B,A){if(A){this.position({page:A.getPosition()})}if(B!=this.charset){this.loadset(B)}else{this.fade("in")}},position:function(D){var B=window.getSize(),A=window.getScroll(),E={x:this.win.offsetWidth,y:this.win.offsetHeight},C={x:"left",y:"top"},F={};for(var G in C){F[C[G]]=D.page[G]+this.options.offset[G];if((F[C[G]]+E[G]-A[G])>B[G]){F[C[G]]=D.page[G]-this.options.offset[G]-E[G]}}this.win.setStyles(F);log("styles set")},Failed:function(){alert("failed :-(")},Completed:function(C,A){if(!C){alert("no json: "+A);return }if(C.chars.length){if(C.setname){this.top.innerHTML=C.setname}if(C.charset){this.charset=C.charset}if(C.chars.length){this.inside.empty()}var D=/^x[0-9A-F]*$/;for(var B=0;B<C.chars.length;B++){var E=D.test(C.chars[B])?"&#"+C.chars[B]+";":C.chars[B];new Element("button",{html:E,events:{click:this.insert,mousedown:function(F){F.stop()}}}).injectInside(this.inside)}}if(!this.visible()){this.fade("in")}},visible:function(){return this.win.get("opacity")==1},fade:function(A){if(this.win){if(A=="in"&&this.win.getStyle("display")=="none"){this.win.setStyle("display","block")}this.fx.start(A=="in"?1:0)}},close:function(A){if(A){this.win.setStyles({opacity:0,display:"none"})}else{this.fade("out")}}});var act_input;String.implement({cap:function(){return this.substr(0,1).toUpperCase()+this.substr(1,this.length)}});function scramble(B){log("scramble b: "+B.innerHTML);var A=B.getChildren();if(A.length<2){return }var E=1;do{var D=A.getRandom();var C=A.getRandom();if(D!=C){$(D).dispose().inject($(C),($random(0,1)==0)?"before":"after");E++}}while(E<A.length);log("scramble a: "+B.innerHTML)}function comparePosition(B,A){if(!B){return 1}if(!A){return -1}var D=B.getPosition(),C=A.getPosition();if(D.y!=C.y){return(D.y<C.y)?-1:1}if(D.x!=C.x){return(D.x<C.x)?-1:1}return 0}function JumpToEnd(C){var A=$(C).value.length;if(Browser.Engine.trident){var B=C.createTextRange();B.collapse(true);B.moveEnd("character",A);B.moveStart("character",A);B.select()}else{C.focus();C.setSelectionRange(A,A)}return false}function LimitKeys(A){Array.flatten(arguments).each(function(B){B.addEvent("mouseup",function(){JumpToEnd(this)});B.addEvent("focus",function(){B.setStyle("background-color","#ffffff")});B.addEvent("blur",function(){B.setStyle("background-color","transparent")});B.addEvent((Browser.Engine.trident||Browser.Engine.webkit)?"keydown":"keypress",function(E){if(E&&E.key&&!E.shift){var C=this.get("tmxlsg");var D=this.value;return(D.length<C.length)&&(E.key==C.charAt(D.length))}})})}var Equation=new Class({initialize:function(A){this.seq=false;this.steps=A.getElements(".sol");if(this.steps.length){this.HideSolution()}else{this.steps=false}},clear:function(){if(this.seq){this.seq=$clear(this.seq)}},HideSolution:function(){this.clear();for(var A=0;A<this.steps.length;A++){this.steps[A].setStyle("display","none")}this.hidden=true},ShowStep:function(){var A=true;for(var B=0;B<this.steps.length;B++){if(this.steps[B].getStyle("display")=="none"){this.steps[B].setStyle("display","");this.hidden=false;if(this.steps[B+1]&&this.steps[B+1].get("class")=="eq"){this.steps[B+1].setStyle("display","")}A=false;break}}if(A){this.clear()}},ShowSolution:function(){this.seq=this.ShowStep.periodical(2000,this)},toggleSolution:function(){if(!this.steps){return false}if(this.hidden){this.ShowSolution()}else{this.HideSolution()}}});var tmx_auf=new Class({Implements:[Events,Options],options:{card_id:"",content_class:".card_content",imgdir:site_url+"img/",blockHot:"#ff9933",blockCold:"#666666"},initialize:function(A){this.setOptions(A);this.card=$(this.options.card_id);this.cc=this.card.getElement("div.card_content");this.cardsize=this.cc.getSize();if(!this.cc){alert("not found: "+this.options.card_id)}var D=this.Failed.bind(this);var B=this.Completed.bind(this);this.ajaxOptions={url:"php/json.php?a=check",onComplete:B,onFailure:D};this.addEvent("keyreturn",this.returned.bind(this));var C=this.cc.getStyle("background-color");if(C=="transparent"){C=this.cc.getParent().getStyle("background-color")}if(C=="transparent"){C="#ccc"}this.bgrCol=new Color(C);this.build()},build:function(){this.xeds=[];this.checked=0;this.late=false;this.mch=false;this.choices=[];this.gap=false;this.ActGap=null;this.simple_init();this.sb_init();this.eq_init();this.ltd_init();this.imc_init();this.is_mch();if(this.mch){this.mch.fade("hide");this.mch_scramble();if(this.mch.get("class")=="mch"){this.mch_format()}var A=this.activeFrame();if(!A||this.inFrame(this.mch,A)){this.mch.fade("in")}}else{if(this.is_gap()){this.build_gap()}}this.getTabOrder()},getTabOrder:function(){var A=[];if(this.xeds){A.extend(this.xeds)}if(this.sgaps){A.extend(this.sgaps)}if(this.ltd){A.extend(this.ltd)}if(A.length){A.sort(comparePosition)}this.tabElements=A.length?A:false},getNextTabElement:function(E){if(!this.tabElements){return false}var D=this.tabElements.indexOf(E);log("getNextTabElement index: "+D);if(D===false){return null}var F=null;for(var C=D+1;C<this.tabElements.length;C++){F=this.tabElements[C];var A=F.tagName?F.tagName.toLowerCase():false;var B=(A=="input"&&F.retrieve("done")==1)||(A=="select"&&F.retrieve("solved")==1);if(F&&!B){break}}if(F){log("next el: "+F)}return F},setCheckLink:function(A){if(A&&this.tabElements){this.tabElements.push(A)}},inFrame:function(C,A){var B=C;if(B==this.cc){return 0}while((B=B.parentNode)&&B!=this.cc){if(B==A){return 1}}return 0},activeFrame:function(){var B=this.card.retrieve("frames");if(!B||!B.length){return null}var A=this.card.retrieve("aframe",false);return(A===false)?null:B[A]},frameChanged:function(A){if(this.mch&&this.inFrame(this.mch,A)){this.mch.fade("in")}},focus:function(){if(this.tabElements){var A=this.tabElements[0];log("ex focus() "+A.tagName);(function(){log("ex trying to focus after delay "+A.id+" / "+A.tagName);A.focus()}).delay(200)}},kill:function(){},is_exercise:function(A){var B=this.gap||this.sb||this.multiple||this.ltd;return(A)?B:B||this.mch||this.imc},is_gap:function(){this.gaps=this.cc.getElements(".gap");this.tgaps=this.cc.getElements(".tgap");this.sgaps=this.cc.getElements("select.sgap");if(this.sgaps.length){for(var B=0;B<this.sgaps.length;B++){var A=0;var C=this.sgaps[B].getParent();if(C){A=C.getStyle("font-size")}if(A){this.sgaps[B].setStyles({"font-size":A})}scramble(this.sgaps[B]);this.sgaps[B].selectedIndex=-1;this.sgaps[B].addEvent("keydown",this.sgap_keydown.bind(this))}}else{this.sgaps=false}if(!this.gaps.length){this.gaps=false}if(!this.tgaps.length){this.tgaps=false}return this.gap=(this.gaps||this.tgaps||this.sgaps)},sgap_keydown:function(B){if(B&&B.key){var A=$(B.target);if(B.key=="tab"||B.key=="enter"){B.stop();this.returned(A)}}},imc_init:function(C){this.imc=this.cc.getElements("img.imc");if(!this.imc.length){this.imcs=false;return }this.imcs=this.cc.getElements("div.imcs");if(!this.imcs.length){this.imcs=false}this.baddiv=this.cc.getElement("div.imc")||new Element("div",{display:"none"}).inject(this.cc,"top");this.baddiv.fade("hide").setStyles({"background-color":"#FF3333",display:"block"});this.imc[0].store("sol",1);this.hot=false;this.cc.addEvent("mouseleave",this.imc_cardLeave.bind(this));this.imc_scramble();for(var E=0;E<this.imc.length;E++){this.imc[E].setStyle("display","block").fade("hide");if(this.imcs){this.imcs[E].fade("hide");this.imc[E].store("imcs",this.imcs[E])}this.imc[E].fade(0.25);this.imc[E].addEvents({click:this.imc_selected.bind(this),mouseenter:this.imc_imgEnter.bind(this),mouseleave:this.imc_imgLeave.bind(this)})}this.imc_cb=this.cc.getElement("div.centerbox");var B=this.imc_cb.getSize(),A=(this.cardsize.x-B.x)/2+"px",D=(this.cardsize.y-B.y)/2+"px";this.imc_cb.setStyles({top:D,left:A,color:"#000000"});this.imc_cs=this.cc.getElement("div.centershade")||new Element("div",{"class":"centershade"}).inject(this.imc_cb,"before");this.imc_cs.setStyles({top:D,left:A,height:B.y,width:B.x,opacity:0.9,display:"block"})},imc_imgEnter:function(B){var A=B.target;this.imc_fade(A)},imc_imgLeave:function(B){var A=B.target;if(!B.relatedTarget||(B.relatedTarget.get("class")+"").indexOf("imcs",0)!=0){this.imc_cool(A)}},imc_cardLeave:function(A){this.imc_cool()},imc_cool:function(B){B=B||this.hot;if(B){var A=B.retrieve("imcs");if(A){A.fade(0)}B.fade(0.25);this.hot=false}},imc_fade:function(B){if(B){var A=B.retrieve("imcs");if(A){A.fade(1)}B.fade(1);this.hot=B}},imc_finito:function(){this.cc.removeEvents("mouseleave");var B;for(var A=0;A<this.imc.length;A++){this.imc[A].removeEvents();B=(this.imcs&&this.imcs[A])?this.imcs[A].getElement("span"):false;if(this.imc[A].retrieve("sol")=="1"){if(this.imc[A]!=this.hot){this.imc_fade(this.imc[A])}if(B){B.setStyle("text-decoration","underline")}}else{this.imc[A].fade(0.1)}this.imc[A].setStyle("cursor","default")}},imc_swapClasses:function(B,A){var D="class",C=B.get(D);B.set(D,A.get(D));A.set(D,C)},imc_scramble:function(){if(!this.imc){return false}var D=1;var A=this.imc.length;do{var C=$random(1,A);var B=$random(1,A);if(C!=B){this.imc_swapClasses(this.imc[C-1],this.imc[B-1]);if(this.imcs){this.imc_swapClasses(this.imcs[C-1],this.imcs[B-1])}D++}}while(D<A)},imc_selected:function(B){var A=B.target;this.correct=(A.retrieve("sol")==1);if(!this.correct){this.baddiv.set("class",A.get("class")).fade(0.5);this.imc_cool()}this.imc_finito();this.CheckComplete()},eq_init:function(){var A=this.cc.getElement("table.eq");this.eq=(A)?new Equation(A):false},ltd_init:function(){this.ltd=this.cc.getElements(".limited");if(this.ltd.length){var A=this.ltd_key.bind(this);this.ltd.each(function(F){var D=F.get("tmxlsg");var B,E;var H=F.getParent();if(H){B=H.getStyle("font-size");E=H.getStyle("font-family");if(B){F.setStyle("font-size",B)}if(E){F.setStyle("font-family",E)}}var G=F.offsetHeight;var C=Math.max(2,D.length)*2*G/3;F.setStyles({width:C,visibility:"visible"});F.addEvent("mouseup",function(){if(F.retrieve("done")){return false}JumpToEnd(this)});F.addEvent("focus",function(){if(F.retrieve("done")){return false}F.setStyle("background-color","#ffffff")});F.addEvent("blur",function(){if(F.retrieve("done")){return false}F.setStyle("background-color","transparent")});F.addEvent("keypress",A);F.addEvent("keydown",function(I){return I.key==13||((I.key||I.shift)&&I.code!=37&&I.code!=39)})});this.ltd[0].focus()}else{this.ltd=false}},ltd_key:function(D){if(D&&D.key){var E=$(D.target);if(D.key=="enter"){E.store("good",0);this.correct=false;this.ltd_done(E);this.fireEvent("keyreturn",[E]);return }var A=String.fromCharCode(D.code);if(E&&E.retrieve("done")){return false}if(E&&A){var I=(!E.get("tmxsensitive"));var B=E.get("tmxlsg");var J=E.value;var C=B.charAt(J.length);var F=(J.length<B.length)&&(A==C||(I&&A.toLowerCase()==C.toLowerCase()));var H=E.retrieve("fehler",0);if(F){E.value=J+C;H=0}else{this.checked++;H++;var G=this.bgrCol.mix("#ff0000",50);E.highlight(G.hex)}log("fehler "+H);if(H==3){this.ltd_done(E);return false}if(H){E.store("fehler",H)}if(F&&J+C==B){E.store("good",1);this.ltd_done(E)}return false}}},ltd_solve:function(D){var C=this.bgrCol.mix("#00ff00",50);var B=this.bgrCol.mix("#ff0000",50);var E=D.retrieve("good");var A=D.get("tmxlsg");if(D.value!=A){D.value=A}D.store("done",1);D.tween("background-color",(E)?C.hex:B.hex);D.blur()},ltd_done:function(A){log("ltd_done");this.ltd_solve(A);this.returned(A)},ltd_check:function(){log("ltd_check");for(var A=0;A<this.ltd.length;A++){if(!this.ltd[A].disabled&&!this.ltd[A].retrieve("done")){this.correct=false;this.ltd[A].store("good",0);this.ltd_solve(this.ltd[A])}}},initAudio:function(){log("ex.iA");var B,A=this.cc.getElements(".splayer");if(!A.length){return }this.splayers=[];for(B=0;B<A.length;B++){var D=A[B].getProperty("sample");var C=(D)?[D]:[];this.splayers.push(new smPlayer(this.cc,A[B],C))}},sb_init:function(){this.sb=this.cc.getElements("ul.right");if(this.sb.length){this.sbtype="pairs";this.sbleft=this.cc.getElement("ul.left")}else{this.sb=this.cc.getElements("ul.sb");if(this.sb.length){this.sbtype="sb"}else{this.sb=false}}if(this.sb){for(var C=0;C<this.sb.length;C++){var F=(this.sb[C].get("autocap")=="1");if(window.console){console.log("autocap: ",F)}var E={opacity:0.5,clone:true};if(this.sbtype=="sb"&&F){E=$merge(E,{onSort:this.sb_cap});this.sb[C].store("autocap",1)}this.sb[C].store("sb",new Sortables(this.sb[C],E));this.sb_save(this.sb[C]);this.sb_scramble(this.sb[C]);if(this.sbtype=="sb"&&F){this.sb_cap(this.sb[C])}if(this.sbtype=="sb"){var A=this.sb[C].getStyle("font-size").toInt();do{var B=this.sb[C].offsetWidth;var D=this.sb[C].getParent().offsetWidth;if(B>=D){A=A-2;this.sb[C].setStyle("font-size",A+"px")}}while(B>=D);this.sb[C].setStyle("margin-left",(D-B)/2);log("auto: w="+B+" pw: "+D+" fs: "+A)}}}},sb_scramble:function(C){var F=1;var A=C.getChildren();if(A.length<3){return }var B=C.retrieve("original");do{var E=A.getRandom();var D=A.getRandom();if(E!=D){$(E).dispose().inject($(D),($random(0,1)==0)?"before":"after");F++}}while(F<A.length||B==this.sb_serialize2(C))},sb_unscramble:function(C){var B,A=C.getChildren();var D=(C.get("autocap")=="1");for(B=0;B<A.length;B++){A[B].dispose()}A.sort(function(F,E){return F.retrieve("opos")-E.retrieve("opos")});for(B=0;B<A.length;B++){A[B].inject(C)}if(this.sbtype=="sb"&&D){this.sb_cap(C)}},sb_serialize2:function(A){var B=A.retrieve("sb");return(B)?B.serialize(0,function(C,D){return C.get("text")}):false},sb_cap:function(D,G){if(!D&&!G){return }if(G){D=G}var C=(D.tagName.toLowerCase()=="ul")?D:D.getParent();var A=C.getChildren();for(var B=0;B<A.length;B++){var F=A[B].innerHTML.charAt(0);var E=A[B].retrieve("o");if(B==0||(B==1&&D===A[0])){if(F==F.toLowerCase()){A[B].store("o",A[B].innerHTML);A[B].innerHTML=A[B].innerHTML.cap()}}else{if(E){A[B].innerHTML=E;A[B].store("o",false)}}}},sb_save:function(C){var A=C.getChildren();for(var B=0;B<A.length;B++){A[B].store("opos",B);A[B].setStyle("cursor","pointer")}C.store("original",this.sb_serialize2(C));if(window.console){console.log("sb_save",C.retrieve("original"))}},sb_paint:function(E,H){var B=E.getChildren();if(this.sbtype=="pairs"){var G=this.sbleft.getChildren()}var A=B[0].getStyle("background-color");var C=this.bgrCol.mix("#00ff00",25);var F;for(var D=0;D<B.length;D++){F=(B[D].get("text")==H[D]);if(this.sbtype=="pairs"){G[D].tween("background-color",(F)?C.hex:A)}B[D].tween("background-color",(F)?C.hex:A);B[D].setStyle("cursor","auto")}},sb_check:function(){var F=false;log("sb_check "+this.correct);for(var C=0;C<this.sb.length;C++){var B=this.sb_serialize2(this.sb[C]);var A=this.sb[C].retrieve("sb");A.detach().removeLists(this.sb[C]);delete A;var E=this.sb[C].get("autocap")>0;var D=this.sb[C].retrieve("original").join("");if(window.console){console.log(D,E,D.cap())}if(E){D=D.cap()}if(window.console){console.log("user",B,D,E)}F=(D!=B.join(""));if(F){this.sb_unscramble(this.sb[C]);this.correct=false;log("sb war falsch?!?!")}else{log("sb war richtig!")}this.sb_paint(this.sb[C],B)}},show_xtra:function(){this.xtra.setStyle("display","block");this.xtra_link.setStyle("display","none");return false},simple_init:function(){var B=this.cc.getElement("a.iknew0"),A=this.cc.getElement("a.iknew1");this.simple=B&&A;this.xtra=this.cc.getElement("div.xtra");if(this.xtra){this.xtra_link=this.cc.getElement("a.t-xtra");if(this.xtra_link){this.xtra_link.addEvent("click",this.show_xtra.bind(this))}}if(!this.simple){return }B.addEvent("click",this.simple_selected.bind(this));A.addEvent("click",this.simple_selected.bind(this));this.simple_buttons=this.cc.getElement("div.buttons")},simple_selected:function(B){var A=B.target;this.correct=A.hasClass("iknew1");log("simple_selected correct? "+this.correct);if(!this.correct){if(this.xtra_link){this.xtra_link.setStyle("display","none")}if(this.xtra){this.xtra.setStyle("display","block")}}if(this.simple_buttons){this.simple_buttons.setStyle("display","none")}this.CheckComplete();return false},is_mch:function(){if(!(this.mch=this.cc.getElement("ul"))){return }var A=this.mch.getElements("li");if(A.length<2){this.mch=false;return }var D=A[0].innerHTML.trim();if(D.charAt(0)!="*"){this.mch=false;return }this.mgap=this.cc.getElements("span.mchx");A[0].innerHTML=D.slice(1,D.length);if(this.multiple=D.charAt(1)=="+"||D.charAt(1)=="-"){for(var C=0;C<A.length;C++){D=A[C].innerHTML.trim();A[C].store("sol",(D.charAt(0)=="+")?"+":"-");if(D.charAt(0)=="+"||D.charAt(0)=="-"){A[C].innerHTML=D.slice(1,D.length)}A[C].store("icon",new Element("img",{src:this.options.imgdir+"tick.png","class":"icon"}).inject(A[C],"top"))}}else{A[0].store("sol","+")}if(this.mch.get("class")==""){this.mch.set("class","mch")}this.width=Window.getWidth();if(this.mch.id==""){this.mch.set("id",this.cc.id+"_cul")}var B=this.mch.getNext()||new Element("div",{style:"height:0px"}).inject(this.mch,"after");B.setStyle("clear","both")},mch_scramble:function(){var C,B,F,A=this.mch.getChildren();B=A.length;F=1;do{var E=A.getRandom();var D=A.getRandom();if(E!=D){$(E).dispose().inject($(D),($random(0,1)==0)?"before":"after");F++}}while(F<B+1);this.mch_answers=this.mch.getChildren();_this=this;if(this.multiple){for(C=0;C<B;C++){A[C].addEvents({click:this.mch_selected.bind(this),mouseenter:function(G){new Event(G).stop();this.tween("background-color",_this.mch_C1)},mouseleave:function(G){new Event(G).stop();this.tween("background-color",_this.mch_C0)}})}}else{for(C=0;C<B;C++){A[C].addEvents({click:this.mch_selected.bind(this),mouseenter:function(G){new Event(G).stop();this.tween("background-color",_this.mch_C1);this.setStyle("text-decoration","underline")},mouseleave:function(G){new Event(G).stop();this.setStyle("text-decoration","none");this.tween("background-color",_this.mch_C0)}})}}},mch_format:function(){if(!this.mch){return }this.mch.setStyles({"list-style-type":"none","margin-left":0,padding:0});var F,C=this.mch_getmax("width");var H=this.mch.offsetParent.offsetWidth-30;if(window.console){console.log("aw",H,this.cc.clientWidth)}var E=H/2-8;var D=C>E?H:E;this.mch_C0=this.bgrCol.setBrightness(this.bgrCol.hsb[2]-8).hex;this.mch_C1=this.bgrCol.setBrightness(this.bgrCol.hsb[2]-20).hex;var B=this.mch.getChildren();for(F=0;F<this.mch_answers.length;F++){this.mch_answers[F].setStyles({"margin-right":(D==H||F%2)?0:6,cursor:"pointer",width:D,"float":"left","background-color":this.mch_C0})}if(D<450){this.mch_normalize()}var A=this.mch.getParent();var G=this.mch_answers[0].getStyle("padding-bottom").toInt();while(A.offsetHeight+10>this.cc.clientHeight&&G>0){G--;for(F=B.length-1;F>=0;F--){this.mch_answers[F].setStyles({"padding-top":G,"padding-bottom":G})}}},mch_finito:function(){var B,C,A=this.bgrCol.mix("#00ff00",25);for(B=0;B<this.mch_answers.length;B++){this.mch_answers[B].removeEvents();if(this.mch_answers[B].retrieve("sol")=="+"){C=this.mch_answers[B].get("text");this.mch_answers[B].highlight();this.mch_answers[B].tween("background-color",A.hex);this.mch_answers[B].setStyle("text-decoration","underline")}else{this.mch_answers[B].tween("background-color",this.mch_C0);this.mch_answers[B].setStyle("text-decoration","none")}this.mch_answers[B].setStyle("cursor","default")}if(this.mgap){for(B=0;B<this.mgap.length;B++){this.mgap[B].set("html",C).setStyle("text-decoration","underline");if(this.correct){this.mgap[B].setStyle("background-color",A.hex)}}}},mch_getmax:function(E){var B=this.mch.getChildren();var D,C,A=0;for(D=B.length-1;D>=0;D--){C=B[D].getStyle(E).toInt();if(C>A){A=C}}return A},mch_normalize:function(){var B,A=this.mch_getmax("height");for(B=0;B<this.mch_answers.length;B++){this.mch_answers[B].setStyle("height",A+"px")}},mch_check:function(){var B=this.bgrCol.mix("#00ff00",25);var A=this.bgrCol.mix("#ff0000",20);for(var C=0;C<this.mch_answers.length;C++){this.mch_answers[C].removeEvents();this.mch_answers[C].setStyle("cursor","default");var E=this.mch_answers[C].retrieve("sol")=="+";var D=this.mch_answers[C].retrieve("state",false);if(E!=D){this.mch_answers[C].tween("background-color",B.hex)}else{this.mch_answers[C].tween("background-color",A.hex);this.correct=false}var F=(E)?"tick.png":"cross.png";this.mch_answers[C].retrieve("icon").set("src",this.options.imgdir+F);this.mch_answers[C].setStyle("text-decoration",(E)?"underline":"line-through")}},mch_selected:function(D){var B=D.target;if(this.multiple){var A=B.retrieve("state",false);A=!A;var C=(A)?"cross.png":"tick.png";B.retrieve("icon").set("src",this.options.imgdir+C);B.setStyle("text-decoration",(A)?"line-through":"none");B.store("state",A)}else{this.correct=(B.retrieve("sol")=="+");this.mch_finito();this.CheckComplete()}},returned:function(B){if(window.cards.defaultlink){log("trying to ignore ex:returned");return }var A=this.ltd?this.ltd.length:0;A+=this.xeds?this.xeds.length:0;A+=this.gaps?this.gaps.length:0;A+=this.sgaps?this.sgaps.length:0;log("returned #aufg "+A);if(A==1){this.Check()}else{var C=this.getNextTabElement(B);if(C){C.focus()}}},build_gap:function(){var H,J=this;if(this.gaps.length){this.blockC=this.cc.getElement("div.blocks")||new Element("div",{"class":"blocks"}).inject(this.cc,"bottom");this.b_ul=this.cc.getElement("ul")||new Element("ul").inject(this.blockC,"top");this.blocks=this.b_ul.getChildren();this.maxgapwidth=0;var M;for(H=0;H<this.gaps.length;H++){M=this.gaps[H].offsetWidth;if(M>this.maxgapwidth){this.maxgapwidth=M}}log("maxgapwidth "+this.maxgapwidth);for(H=0;H<this.blocks.length;H++){M=this.blocks[H].offsetWidth;if(window.console){console.log("blocks[i].offsetWidth",M)}if(M>this.maxgapwidth){this.maxgapwidth=M}}if(window.console){console.log("maxgapwidth incl blocks",this.maxgapwidth,this.cc.offsetWidth)}M=this.cc.offsetWidth-20;H=this.maxgapwidth+16;var K=2;K=Math.floor(M/H);log("#blocks p/l: "+K);this.blocksperline=Math.max(K,2);this.blockwidth=Math.floor((M-8*(this.blocksperline-1))/this.blocksperline)}this.images=[];var L=0;var A;if(this.gaps){A=this.gaps[0].getParent();this.gap_fontsize=this.gaps[0].getStyle("font-size");this.gap_fontfamily=A.getStyle("font-family");if(this.gap_fontfamily==this.gaps[0].getStyle("font-family")){this.gap_fontfamily=""}var C=this.gaps[0].getStyle("padding").toInt();this.gap_height=this.gaps[0].offsetHeight;L="1.8em";this.gaps.each(function(S,P){A=S.getParent();if(A){log("ex cont "+P+" container "+A.tagName);A.setStyle("line-height",L)}S.setStyle("background-color","transparent");var Q=S.innerHTML;S.store("xhtml",Q);var R=new Element("li").setProperties({id:J.options.card_id+"bg"+P,html:Q,width:J.blockwidth}).inject(J.b_ul,"top");var O=R.offsetHeight;if(J.lHeight!=O){J.lHeight=O}S.set("html","");J.images[P]=new Element("img",{src:"img/black.png",height:J.gap_height-2*C,"class":"img_gap",width:J.blockwidth,xhtml:Q}).store("gap_padding",C).inject(S);S.store("solved",0)})}if(this.tgaps){if(!L){this.gap_height=this.tgaps[0].offsetHeight||this.tgaps[0].getStyle("height").toInt();L="1.8em";if(this.tgaps.length>1&&this.tgaps[0].tagName.toLowerCase()=="span"){A=this.tgaps[0].getParent();if(A&&A.tagName.toLowerCase()=="td"){A=A.getParent("table")}if(A){A.setStyle("line-height",L)}}}this.tgaps.each(function(W,T){var Q,R,Y=W.get("text").clean();W.store("sol",Y);if(Y.indexOf("|")>-1){Q=Y.split("|")}else{Q=Y.split("; ")}R=Q[0].length/5;if(!R){R=1}var S=(Q[0]!="")?Q[0].substr(0,R):"";if(W.get("showfirst")){W.store("showfirst",1)}if(W.get("center")){W.store("centersol",1)}var c=W.get("dhtml");if(c){W.store("dhtml",c.clean())}var X=W.getStyle("font-size");var V=(W.tagName.toLowerCase()=="div"||W.get("class")!="tgap");W.set("html",Q[0].replace(/ /g,"&nbsp;"));var b=W.getCoordinates();if(V){if(!W.id){W.set("id",J.options.card_id+"tg"+T)}O=W}else{W.set("html","");var d=(W.style.width)?b.width:Math.max(b.width+20,70);var U=b.height;if(W.offsetHeight>0&&b.height>W.offsetHeight&&Browser.Engine.trident){U=W.offsetHeight}var a=(W.style.height||Browser.Engine.gecko)?"auto":"no";var O=new Element("img",{id:J.options.card_id+"tg"+T,src:"img/white.png",width:d,height:U,"class":"img_tgap"}).inject(W)}var Z=(V)?W.getStyle("padding").toInt():0;var P=W.getStyle("font-family");J.xeds[T]=new XEditable(O,{card_id:J.options.card_id,parent_c:J.cc,scrolling:a,hint:S,styles:{fontFamily:P,fontSize:X,padding:Z}});W.store("solved",0)})}if(this.gaps){this.blocks=this.b_ul.getChildren();if(this.blocks.length){this.blockC.setStyle("visibility","hidden");this.Scramble();var E=this.blocks[0].getStyle("background-color");log("blocks bgr: "+E+" // bgr: "+this.bgrCol.hex);var D=E!=""&&E!="transparent"?new Color(E):this.bgrCol.setBrightness(this.bgrCol.hsb[2]-12);var F=D.rgbToHsb();log("brightness of cold: "+F[2]);var N=F[2]<90?{c:"#ffffff",a:40}:{c:"#000000",a:20};this.blockCold=D.hex;this.blockHot=D.mix(N.c,N.a).hex;log(this.blockCold+" => "+this.blockHot);var I=this.blocks[0].getStyle("padding").split(" ");I=I.map(function(O){return(O=="auto")?0:O.toInt()});var B=I[1]+I[3];var G=I[0]+I[2];for(H=this.blocks.length-1;H>=0;H--){if(!this.blocks[H].id){this.blocks[H].id=this.options.card_id+"blk"+H}this.blocks[H].setStyles({height:this.gap_height-G+"px",width:this.blockwidth+"px","font-size":this.gap_fontsize,"background-color":this.blockCold});if(this.gap_fontfamily){this.blocks[H].setStyle("font-family",this.gap_fontfamily)}}this.blockC.setStyle("top",this.cc.getHeight()-this.blockC.clientHeight-8+"px");this.margin=this.blocks[0].getStyle("margin").split(" ");this.margin=this.margin.map(function(O){return(O=="auto")?0:O.toInt()});for(H=this.blocks.length-1;H>=0;H--){this.blocks[H].setStyles({position:"absolute",left:this.blocks[H].offsetLeft-this.margin[3]+"px",top:this.blocks[H].offsetTop-this.margin[0]+"px"});this.blocks[H].setProperties({x:this.blocks[H].offsetLeft-this.margin[3],y:this.blocks[H].offsetTop-this.margin[0]});this.blocks[H].setStyle("margin","0px")}this.blockC.setStyle("width",463);for(H=this.blocks.length-1;H>=0;H--){new Drag.Move(this.blocks[H].id,{droppables:this.images,container:this.cc,onStart:function(O){var P=O.retrieve("host");if(P){P.store("contains",false)}},onDrop:function(P,R){if(!R){P.setStyles({position:"absolute",left:P.getProperty("x")+"px",top:P.getProperty("y")+"px"})}else{var T=R.getPosition(J.blockC);var Q=R.retrieve("gap_padding");P.setStyles({left:T.x-Q+"px",top:T.y-Q+"px"});var S=R.retrieve("contains");if(S){var O=$(S);O.setStyles({position:"absolute",left:O.getProperty("x")+"px",top:O.getProperty("y")+"px"});O.tween("background-color",J.blockCold)}P.tween("background-color",J.blockCold);R.store("contains",P.id);P.store("host",R)}},onEnter:function(O,P){log("trying to fade to "+J.blockHot.hex);O.tween("background-color",J.blockHot)},onLeave:function(O,P){log("trying to fade to "+J.blockCold.hex);O.tween("background-color",J.blockCold)},onBeforeStart:function(Q){var O=100;for(var P=J.blocks.length-1;P>=0;P--){if(Q==J.blocks[P]){J.blocks[P].setStyle("z-index",O+100)}else{J.blocks[P].setStyle("z-index",O+P)}}}})}this.blockC.setStyle("visibility","visible")}}this.openrequests=0},Scramble:function(){var C,B=0,A=this.blocks.length;if(A==0){return false}var D=[];for(C=0;C<A;C++){do{B=$random(0,A-1)}while(D[B]!=null);D[B]=this.blocks[C].innerHTML}for(C=0;C<A;C++){this.blocks[C].innerHTML=D[C]}},Fill:function(C){var D=this.images[C].getProperty("xhtml");var B=this.images[C].retrieve("contains");var A;if(!B){A="#ff6666";this.correct=false;this.gaps[C].store("solved",1)}else{var E=$(B);if(E.innerHTML==D){E.fade("hide");A="#99ff99";this.gaps[C].store("solved",2)}else{this.correct=false;if(this.checked==0){E.tween("background-color","#ff9999");this.tryagain=true;return false}A="#cc6633";this.gaps[C].store("solved",1)}}this.gaps[C].innerHTML=this.gaps[C].retrieve("xhtml");if(this.images[C]){this.images[C].destroy();this.images[C]=null}this.gaps[C].tween("background-color",A);return true},TFill:function(C,D,A){this.tgaps[C].store("solved",1+A);var E=this.tgaps[C].retrieve("dhtml");var B=(A)?this.bgrCol.mix("#00ff00",10):this.bgrCol.mix("#ff0000",10);this.xeds[C].kill();this.tabElements.erase(this.xeds[C]);this.tgaps[C].innerHTML=(E)?E:D;if(E){this.tgaps[C].setStyle("height","auto")}if(this.tgaps[C].retrieve("centersol")){this.tgaps[C].setStyle("text-align","center")}if(this.tgaps[C].getStyle("visibility")=="hidden"){this.tgaps[C].setStyle("visibility","visible")}this.tgaps[C].setStyle("color","#000");this.tgaps[C].tween("background-color",B.hex)},mixColor:function(A){return this.bgrCol.mix(A?"#00ff00":"#ff0000",20).hex},Check:function(){log("Check:: "+this.checked+" / correct: "+this.correct);if(this.openrequests){return }this.tryagain=false;this.correct=true;this.opengaps=0;if(this.ltd){this.ltd_check()}if(this.sgaps){this.sgap_check()}if(this.gaps||this.tgaps){this.gap_check()}if(this.sb){this.sb_check()}if(this.mch&&this.multiple){this.mch_check()}this.checked++;this.CheckComplete()},sgap_check:function(){var C;for(var B=this.sgaps.length-1;B>=0;B--){if(!this.sgaps[B].retrieve("solved")){C=(this.sgaps[B].selectedIndex>-1&&this.sgaps[B].options[this.sgaps[B].selectedIndex].value=="1");if(!C){this.correct=false}var A=this.mixColor(C);if(!C&&!this.checked){this.tryagain=true;this.opengaps++}else{Select(this.sgaps[B],"1");new Element("span",{html:this.sgaps[B].options[this.sgaps[B].selectedIndex].get("html"),display:"inline-block",styles:{width:this.sgaps[B].offsetWidth,"background-color":A}}).inject(this.sgaps[B],"before");this.sgaps[B].setStyle("display","none").store("solved",1)}if(this.sgaps[B].selectedIndex>-1){this.sgaps[B].options[this.sgaps[B].selectedIndex].setStyle("background-color",A)}this.sgaps[B].highlight(A)}}},fixedPunctuation:function(G,F){if(!G){return false}var E=/^¿\s?|[\?\.!,-;]|\s\?$|\s!$/g,B=G.replace(E,""),D;for(var C=0;C<F.length;C++){D=F[C].replace(E,"");if(D==B){return F[C]}}D=F[0];B=G;var H=D.match(/^(¿?)(.+?)(\s?)([!\?\.])$/);var A=B.match(/^(¿?)(.+?)(\s?)([!\?\.])$/);if(H&&A&&H.length==5&&A.length==5){return H[1]+A[2]+H[3]+H[4]}return false},gap_check:function(){var E;for(E=this.gaps.length-1;E>=0;E--){if(!this.gaps[E].retrieve("solved")){if(!this.Fill(E)){this.opengaps++}}}for(E=this.tgaps.length-1;E>=0;E--){if(!this.tgaps[E].retrieve("solved")){var B=this.xeds[E].text();var F=this.tgaps[E].retrieve("sol");var C=this.tgaps[E].retrieve("showfirst");var A=(F.indexOf("|")>-1)?F.split("|"):F.split("; ");var H=this.fixedPunctuation(B,A);if(H){B=H;this.xeds[E].setHTML(H)}if(B==""){this.TFill(E,A[0],false);this.correct=false}else{var D=A.indexOf(B);if(D>-1){this.TFill(E,A[(C)?0:D],true)}else{this.correct=false;if(this.checked==0){this.openrequests++;this.opengaps++;var G=JSON.encode({id:E,input:B,sol:F});new Request.JSON(this.ajaxOptions).get({json:G})}else{this.TFill(E,A[0],false)}}}}}if(this.blocks&&!this.tryagain){for(E=this.blocks.length-1;E>=0;E--){this.blocks[E].fade("out").dispose()}this.blocks.length=0}else{}this.align()},CheckComplete:function(){log("CheckComplete "+this.checked+" / correct: "+this.correct);if(this.openrequests){return }if(!this.opengaps){var A=this.cc.getElements("div.more");A.each(function(C,B){if(C.getStyle("visibility")=="hidden"){C.setStyle("visibility","visible")}C.setStyle("display","block")})}if(this.correct&&this.checked<2){this.feedback(1)}else{if(!this.opengaps){this.feedback(0)}}if(this.eq){this.eq.toggleSolution()}},align:function(){var B,A,F;for(B=this.images.length-1;B>=0;B--){if(this.images[B]){F=this.images[B].getParent();A=this.images[B].retrieve("contains");if(A&&F){var E=$(A);var C=$(F).getCoordinates();var D=E.getCoordinates();if(D.left!=C.left||D.top!=C.top){E.setStyles({left:C.left,top:C.top,width:C.width,height:C.height})}}}}for(B=this.tgaps.length-1;B>=0;B--){if(!this.tgaps[B].retrieve("solved")){this.xeds[B].align()}}},Failed:function(){info("Ajax failed!");this.openrequests--;this.CheckComplete()},Completed:function(B){this.openrequests--;if(B){if(B.score>=30){this.xeds[B.id].setHTML(B.res);this.xeds[B.id].focus();if(B.chint){cards.message(this.options.card_id,B.chint)}}else{var A=B.sol.split("; ");this.TFill(B.id,A[0],false);this.opengaps--;this.align()}}else{alert("Kein Ergebnis :-( "+B)}this.CheckComplete()},feedback:function(A){var C="";var E=(A)?uit.exgood.getRandom():uit.exbad.getRandom();var B=(A)?2:0;log("correct: "+A+" / "+this.correct);if(this.correct&&this.checked==2){B=1;C="late";E="LEIDER ETWAS SP&Auml;T!"}if(!this.simple){var D=new Element("div",{"class":"feedback",html:E}).inject(this.cc,"after").set("slide",{duration:"long",transition:"bounce:out",link:"chain"}).slide("hide").slide("in");(function(){if(D&&D.parentNode){D.set("slide",{transition:"expo:out"}).slide("out")}}).delay(2000)}if(window.cards){cards.feedback(this.options.card_id,B,C)}}});Units=new Class({Implements:[Events,Options],options:{onShow:function(A,B){(B)?A.fade("in"):A.fade("show")},onHide:function(A,B){(B)?A.fade("out"):A.fade("hide")},onToggle:function(A){A.fade("toggle")},showDelay:300,hideDelay:200,m_url:"/pix/uploaded/",dest:"checkres"},initialize:function(A){this.setOptions(A);this.dest=$(this.options.dest)},process:function(A){if(A){this.SetCommands(["o","p","e","x","q","s","c"],[ui("open"),ui("prefs"),ui("edit"),ui("del"),ui("unsub"),ui("subs"),ui("close")]);this.perpage=(A.perpage)?A.perpage:false;this.destid=(A.dest)?A.dest:"checkres";this.search=A.search;this.units=A.units;this.subjects=A.subjects;this.render(1)}},back:function(){var B=$("left");if(B&&B.getStyle("display")=="none"){B.setStyle("display","block")}if(this.search){var C=$("unitopts"),A=$("search");if(C&&A){C.setStyle("display","none").empty();A.setStyle("display","block")}else{json("search")}}else{this.render()}},render:function(B){var A;this.dest=$(this.destid).empty();this.unit_container=this.dest.getElement("div.v2u")||new Element("div",{"class":"v2u"}).injectInside(this.dest);this.lastsubject=false;if(!this.units.length){this.unit_container.innerHTML=ui("nores");return }for(A=0;A<this.units.length;A++){if(this.units[A].subject!=this.lastsubject){this.openSubject(this.units[A].subj)}this.renderUnit(A)}this.closeSubject()},openSubject:function(C){if(!C||C==this.lastsubject){return }if(this.lastsubject){this.closeSubject()}var B=(this.subjects[C].hide)?"clsd":"open";var D=new Element("div",{"class":"v2u-head"}).injectInside(this.unit_container);var A=new Element("a",{href:"#",html:this.subjects[C].display,"class":B});A.addEvent("click",this.ToggleSubject.bind(this,[C,A])).inject(D);if(this.subjects[C].flag){new Element("img",{"class":"",alt:C,src:"/img/flags/"+C+".png"}).inject(A,"bottom")}if(!this.search){new Element("div",{id:"sdu-"+C,"class":"v2u-due",html:this.displayDue(this.subjects[C].due,this.subjects[C].num)}).injectInside(D)}if(this.subjects[C].due&&this.subjects[C].num){new Element("a",{id:"sgo-"+C,"class":"v2u-hex",href:"#",html:ui("learn"),title:ui("hex")}).addEvent("click",this.Execute.bind(this,[0,"ex",C])).injectInside(D)}this.s_container=new Element("div",{id:"tsu_"+C,"class":B}).injectInside(this.unit_container);this.lastsubject=C},closeSubject:function(){if(!this.lastsubject){return }this.s_container=false;this.lastsubject=false},displayDue:function(C,B,A){C=A?'<span class="due" title="'+A+'">'+C:'<span class="due">'+C;return C+' </span><span class="st">'+ui("of")+"</span> "+B+' <span class="st">'+ui("due")+"</span>"},displayRating:function(B,A){return"r: "+B+" ("+A+")"},renderUnit:function(Q){var Y,F=this.units[Q].uid;var C=new Element("div",{id:"tru_"+F,"class":"v2tr"}).inject(this.s_container);C.addEvents({mouseenter:this.enterRow.bind(this),mouseleave:this.leaveRow.bind(this)});var M=new Element("div",{id:"tcu_"+F,"class":"intable",html:"?"}).inject(this.s_container);new Element("img",{src:this.options.m_url+this.units[Q].pic,width:"120px",height:"80px",alt:"","class":"cover"}).injectInside(C);if(this.units[Q].aabb&&this.units[Q].aabb!="-"){new Element("div",{"class":"cat",html:this.units[Q].aabb,title:this.units[Q].area}).inject(C)}var R,B=new Element("div",{id:"um_"+F,"class":"v2main"}).injectInside(C);B.store("cb",M);if(B.hasClass("open")){B.store("open",1);M.setStyle("display","block")}if(this.units[Q].link){R=new Element("a",{"class":"v2uname",html:this.units[Q].name,href:"/unit:"+this.units[Q].link}).inject(B)}else{R=new Element("div",{"class":"v2uname",html:this.units[Q].name}).inject(B)}R.set("title",R.innerHTML);new Element("div",{"class":"v2udesc",html:this.units[Q].desc}).inject(B);new Element("div",{"class":"v2ucom"}).inject(B);var D=this.units[Q].subj=="demo";var W="o";if(this.units[Q].own){W+="e"}else{if(this.units[Q].subs){W+="p"}}W+=(this.units[Q].own)?"x":"s";this.AddCommandLine(B,W,F,Q);var J;if(this.search){var A=this.units[Q].anz-this.units[Q].voc;J=A+' <span class="st"> '+ui("cards")+" + </span>"+this.units[Q].voc+' <span class="st"> '+ui("vocs")+"</span>"}else{Y=this.units[Q].drp+this.units[Q].dfr;var X=(Y)?this.units[Q].drp+" + "+this.units[Q].dfr:"0";var G=(Y)?uit.rp_fr.replace("$1",this.units[Q].drp).replace("$2",this.units[Q].dfr):"";J=this.displayDue(X,this.units[Q].anz,G)}var S='<span class="st">von</span> ';var V=new Element("div",{id:"uf_"+F,"class":"v2info"}).injectInside(C);new Element("div",{id:"i1_"+F,html:J}).injectInside(V);var O=new Element("div",{id:"i2_"+F,html:S}).injectInside(V);if(this.units[Q].rating){var P=new Element("div",{"class":"smallRating",id:"irt_"+F}).setStyle("text-align","center").injectInside(V);var L=this.units[Q].rating*70/100;var U=new Element("span",{"class":"ratingFill"}).setStyles({width:L}).injectInside(P);new Element("span",{"class":"ratingStars",title:this.units[Q].votes+" Bewertungen"}).injectInside(U)}V.addClass((Y)?"due":"notdue");if(this.units[Q].trbo){V.addClass("turbo")}var K=(this.units[Q].gnam)?ui("group")+": "+this.units[Q].gnam:"";var H=this.units[Q].auth;alink=new Element("a",{html:this.units[Q].anam,href:"/user:"+this.units[Q].alink,title:K}).inject(O,"bottom");if(this.search&&this.units[Q].own){return }if(this.search){var N=new Element("a",{id:"go_"+F,"class":"v2go",style:"display:table"}).inject(C);var E=new Element("div",{id:"ux_"+F,"class":"sublink"}).inject(N);E.className=this.units[Q].subs?"sublink mns":"sublink pls";E.innerHTML=(this.units[Q].subs)?ui("unsub"):ui("subs");E.addEvent("click",this.Execute.bind(this,[E,"s",F,Q]));return }var N=new Element("div",{id:"go_"+F,"class":"v2go"}).inject(C);var T=new Element("div",{"class":"v2ex"}).inject(N);if(this.units[Q].anz&&(this.units[Q].ff+Y+this.units[Q].voc)){var E=new Element("a",{id:"ux_"+F,href:"#","class":"ex-ttl"}).inject(T);var I=[];if(D){I.push("dm")}else{if(Y>0){I.push("ex")}if(this.units[Q].voc>5){I.push("sl")}if(this.units[Q].ff){I.push("ff")}if(this.units[Q].voc>30){I.push("lv")}}this.AddCaretPopup(E,I,Q)}else{N.setStyle("display","none")}},ToggleSubject:function(C,B){var A=$("tsu_"+C);if(A){var D=A.className=="open";A.className=(D)?"clsd":"open";B.className=A.className;savePref("cmhide_"+C,(D)?1:0)}ShowChars(C);var E=$(B).getPosition();xchars.win.setStyles({top:E.y});return false},Execute:function(C,E,B,A){switch(E){case"o":this.CollapseUnit(B);break;case"p":case"e":EditUnit(B);break;case"x":DeleteUnit(B+"&h="+this.units[A].hash,this.units[A].name);break;case"s":this.changeSubs(B,this.units[A].name,this.units[A].subs);break;case"ex":var D=(C)?C.retrieve("val"):"ex";if(D=="ff"){jumpTo("hangman:"+this.units[A].link)}else{if(D=="sl"){if(!window.learn){window.learn=new Super({})}closeChars(1);window.learn.load(B)}else{if(D=="lv"){if(!window.lasvegas){window.lasvegas=new Vegas({})}window.lasvegas.play(B,this.units[A].subject)}else{if(D=="ex"){if(typeof (B)=="string"){cards.learn(0,B)}else{cards.learn(B,"")}}else{if(D=="dm"){cards.play(B)}else{alert("ex "+D+" / "+B)}}}}}break;default:alert("You want to execute "+E+" / "+B)}return false},changeSubs:function(C,A,B){if(B){DlgParam=C;Confirm("tru_"+C,"CONFREMU",A,"DoRemoveUnit",C)}else{SubscribeUnit(C,this.search)}},indexOf:function(B){for(var A=0;A<this.units.length;A++){if(this.units[A].uid==B){return A}}return false},updateSubs:function(B,D){var C,A=this.indexOf(B);if(A!==false){this.units[A].subs=D;if(this.search){C=$("ux_"+B);if(C){C.className=D?"sublink mns":"sublink pls";C.innerHTML=(D)?ui("unsub"):ui("subs")}}else{if(!D){$("tcu_"+B).slide("out").empty();$("tru_"+B).slide("out").empty()}}C=$("cls_"+B);if(C){C.innerHTML=(D)?ui("unsub"):ui("subs")}}},CollapseUnit:function(D){var B=$("um_"+D);var C=B.retrieve("open")||false;var A=$("tcu_"+D),F=$("clo_"+D);if(!A){if(window.console){console.log("Fehler: Kein cb!!!")}return }if(A&&A.innerHTML=="?"&&!C){log("CollU: "+A.id);A.empty();json("show_cards&id="+D+"&search="+this.search)}if(C){B.tween("background-color","#ffffff")}else{B.tween("background-color","#f8f8f4")}if(!A.retrieve("fx")){var E=new Fx.Slide(A,{duration:300});E.hide();A.store("fx",1).setStyle("display","block")}A.slide(C?"out":"in");C=!C;B.store("open",C);if(F){F.innerHTML=C?ui("close"):ui("open")}var G=A.getElement("div .vadd");if(G&&A.innerHTML!="?"){if(C){AutoAdd(G)}else{if(addV.list==G){addVCard.detach()}}}return false},SelectMode:function(C){var A=C.target;var B=A.getParent();this.ShowSelected(B,A);var D=B.getPrevious();D.innerHTML=A.innerHTML;D.set("title","");D.store("val",A.retrieve("val"));B.fade("out");D.fireEvent("click")},SelectAction:function(D){var A=D.target;var B=A.getParent();var C=B.retrieve("al");C.innerHTML=A.innerHTML;C.set("title","").store("val",A.retrieve("val"));B.fade("out");C.fireEvent("click")},ShowSelected:function(C,D){var A=C.getChildren();for(var B=0;B<A.length;B++){A[B].className=(A[B]==D)?"selected":"choice"}},SetCommands:function(A,B){this.commands=B.associate(A)},GetUnitId:function(B){if(B){var A=B.split("_");B=(A.length)?A[A.length-1].toInt():0}return(B)?B:false},AddCaretPopup:function(P,A,E){var Q=[ui("super"),ui("learn"),'<img src="/img/freefall/suzie.png" alt=""/> Free Fall',"Las Vegas",ui("dm")];var H=[ui("super"),ui("hex"),ui("hff"),ui("hlv"),ui("hdm")];var D=["sl","ex","ff","lv","dm"];var J=this.GetUnitId(P.id);if(A.length==1){var F=D.indexOf(A[0]);P.innerHTML=Q[F];P.store("val",D[F]).set("title",H[F]).addEvent("click",this.Execute.bind(this,[P,"ex",J]));return }var I=P.getNext();if(!I||I.tagName.toLowerCase()!="a"){I=new Element("a",{href:"#","class":"moreopts"}).inject(P,"after")}var M="p-"+P.id;var K=new Element("ul",{id:M,"class":"pop"}).store("al",P);var L=I.retrieve("pop:enter",this.elementEnter.bind(this,K));var O=I.retrieve("pop:leave",this.elementLeave.bind(this,K));I.addEvents({click:this.toggleActions.bind(this,[K]),mouseenter:L,mouseleave:O});P.addEvent("click",this.Execute.bind(this,[P,"ex",J,E]));K.addEvents({mouseout:O,mouseover:L}).inject(I,"after");var C=false;for(var G=0;G<Q.length;G++){var B=A.indexOf(D[G]);if(B>-1){var N=new Element("li",{html:Q[G],"class":"choice",title:H[G]}).store("val",D[G]).addEvent("click",this.SelectAction.bind(this)).injectInside(K);if(!C){P.set("html",Q[G]).set("title",H[G]).store("val",D[G]);C=N}}}},toggleActions:function(A){this.fireEvent("toggle",[A]);return false},parentRow:function(A){do{if(A.className=="v2tr"||A.className.substr(0,5)=="v2tr "){return A}}while((A=A.parentNode)&&!isBody(A));return null},enterRow:function(B){var A=this.parentRow(B.target);if(A){A.className="v2tr high"}var C=(A&&A.id)?A.id:A.tagName},leaveRow:function(B){var A=this.parentRow(B.target);if(A){A.className="v2tr"}var C=(A&&A.id)?A.id:A.tagName},show:function(A,B){this.fireEvent("show",[A,B])},hide:function(A,B){this.fireEvent("hide",[A,B])},elementEnter:function(A){var B=A.retrieve("pop:timer");$clear(B);B=this.show.delay(this.options.showDelay,this,[A,1]);A.store("pop:timer",B)},elementLeave:function(A){var B=A.retrieve("pop:timer");$clear(B);B=this.hide.delay(this.options.hideDelay,this,[A,1]);A.store("pop:timer",B)},AddExPopup:function(D,A,F){var P=[ui("super"),ui("learn"),'<img src="/img/freefall/suzie.png" alt=""/> Free Fall',"Las Vegas",ui("dm")];var I=[ui("super"),ui("hex"),ui("hff"),ui("hlv"),ui("hdm")];var E=["sl","ex","ff","lv","dm"];var J=this.GetUnitId(D.id);if(A.length==1){var G=E.indexOf(A[0]);D.innerHTML=P[G];D.store("val",E[G]).set("title",I[G]).addEvent("click",this.Execute.bind(this,[D,"ex",J]));return }var M="p-"+D.id;var K=new Element("ul",{id:M,"class":"pop"});var L=D.retrieve("pop:enter",this.elementEnter.bind(this,K));var O=D.retrieve("pop:leave",this.elementLeave.bind(this,K));D.addEvents({click:this.Execute.bind(this,[D,"ex",J,F]),mouseenter:L,mouseleave:O});K.addEvents({mouseout:O,mouseover:L}).inject(D,"after");var C=false;for(var H=0;H<P.length;H++){var B=A.indexOf(E[H]);if(B>-1){var N=new Element("li",{html:P[H]}).store("val",E[H]).set("title",I[H]).addEvent("click",this.SelectMode.bind(this)).injectInside(K);if(!C){D.set("html",P[H]).set("title",I[H]).store("val",E[H]);C=N}}}this.ShowSelected(K,C)},AddCommandLine:function(B,C,A,E){if(!B||!A){return }var G,F,J,D=B.getElement("div.v2ucom")||new Element("div",{"class":"v2ucom"}).inject(B,"bottom");var I=this.show.bind(this,D,0);var K=this.hide.bind(this,D,0);B.addEvents({mouseenter:I,mouseleave:K});D.store("pop:unit",A);for(G=0;G<C.length;G++){J=C.charAt(G);if(G){D.appendText(" | ")}var H=(J=="s"&&this.units[E].subs)?this.commands.q:this.commands[J];F=new Element("a",{href:"#",html:H,id:"cl"+J+"_"+A}).inject(D);F.addEvent("click",this.Execute.bind(this,[F,J,A,E]))}}});if(window.addVCard){window.addVCard=null}var DlgParam;function DeleteUnit(C,A){DlgParam=C;var B=C.split("&");Confirm("tru_"+B[0],"CONFDELU",A,"DoDeleteUnit")}function DoDeleteUnit(A){if(A){AjaxReq("dlg","del_unit&id="+DlgParam,"get")}else{$("dlg").innerHTML="";DlgParam=false}}function DeleteCard(D,C,B,A){DlgParam=D+"&h="+C;if(A){DoDeleteCard(true)}else{Confirm("tr"+D,"CONFDELC",B,"DoDeleteCard",D)}}function DoDeleteCard(A){if(A){AjaxReq("dlg","del_card&x="+DlgParam,"get")}else{$("dlg").innerHTML="";DlgParam=false}}function toggleElement(B,A){A=$(A);if((A.style.display!="block")){if(B){B.className=B.className.replace("toggle","toggle_open")}A.style.display="block"}else{if(B){B.className=B.className.replace("toggle_open","toggle")}A.style.display="none"}return false}function postComment(){var B=$("cmform"),A=CheckInput("cm_","text",1);if(A||!B){return false}jsonp("savecomment",B);return false}var ptDialog=new Class({initialize:function(A){this.backdrop=$("ptd_backdrop")||new Element("div",{id:"ptd_backdrop"}).injectInside(document.body);this.container=$("ptd_cont")||new Element("div",{id:"ptd_cont",html:A}).injectInside(document.body)}});function dialog(A){window.dlg=new ptDialog(A)}_units=new Units();var m_url="http://media.planet-tmx.eu/";var smPlayer=new Class({Implements:Events,songs:Array(),curSong:0,imgdir:m_url+"player/",initialize:function(A,D,C){if(!A){alert("container fehlt!!");return }this.swiffHome=new Element("div",{}).setStyles({position:"absolute",top:1,left:1}).inject($(A));this.obj=new Swiff("/msound.swf",{width:1,height:1,container:this.swiffHome,swLiveConnect:true});this.autoplay=0;if(D&&D.tagName.toLowerCase()=="a"){if(D.href){var B=D.href.split("?");this.autoplay=B.length==2&&B[1]=="auto";C.push(B[0]);if(this.autoplay){A.store("autoplayer",this);log("ap stored! in "+A.id)}}D.href="#"}this.playBtn=D.addEvent("click",this.playToggle.bind(this));this.playBtn.addClass("play");if(C){this.load(C)}},play_delayed:function(A){A=A||1500;var B=this;setTimeout(function(){try{B.play()}catch(C){}},A)},load:function(A){this.reset();for(var B=0;B<A.length;B++){this.songs.push(new Sound(A[B],this,{onComplete:this.onComplete.bind(this)}))}},kill:function(){for(var A=0;A<this.songs.length;A++){this.songs[A].kill()}delete this.obj},reset:function(){this.stop();this.songs=Array();this.curSong=0},play:function(){if(this.songs.length==0){return }this.songs[this.curSong].start(0);this.playBtn.className="splayer stop";this.playing=true},playToggle:function(){if(this.playing){this.stop()}else{this.play()}return false},stop:function(){if(!this.playing){return }this.songs[this.curSong].stop();this.playBtn.className="splayer play";this.playing=false},next:function(A){if(this.songs.length==0){return }this.stop();this.curSong++;if(this.curSong==this.songs.length){this.curSong=0;if(A){return }}var B=this;if(A){setTimeout("_this.play()",1500)}else{this.play()}},onComplete:function(){this.next(true)}});var smallPlayer=new Class({Implements:Events,songs:Array(),curSong:0,imgdir:"img/",initialize:function(A,C,B){if(!A){alert("container fehlt!!");return }this.swiffHome=new Element("div",{}).setStyles({position:"absolute",top:1,left:1}).inject($(A));this.obj=new Swiff(window.m_url+"MooSound.swf",{container:this.swiffHome});this.playBtn=C.addEvent("click",this.playToggle.bind(this));this.playBtn.set("src",this.imgdir+"control_play.png");if(B){this.load(B)}},load:function(A){this.reset();for(var B=0;B<A.length;B++){this.songs.push(new Sound(A[B],this,{onComplete:this.onComplete.bind(this)}))}this.curSong=0},kill:function(){for(var A=0;A<this.songs.length;A++){this.songs[A].kill()}delete this.obj},reset:function(){this.stop();this.songs=Array();this.curSong=0},play:function(){if(this.songs.length==0){return }this.songs[this.curSong].start(0);this.playBtn.setProperty("src",this.imgdir+"control_stop.png");this.playing=true},playToggle:function(){if(this.playing){this.stop()}else{this.play()}},stop:function(){if(!this.playing){return }this.songs[this.curSong].stop();this.playBtn.setProperty("src",this.imgdir+"control_play.png");this.playing=false},next:function(A){if(this.songs.length==0){return }this.stop();this.curSong++;if(this.curSong==this.songs.length){this.curSong=0;if(A){return }}var B=this;if(A){setTimeout("_this.play()",1500)}else{this.play()}},onComplete:function(){this.next(true)}});var Sound=new Class({Implements:[Options,Events],options:{autostart:false,streaming:true,volume:50,pan:0,progressInterval:200,positionInterval:200,onRegister:$empty,onLoad:$empty,onPlay:$empty,onPause:$empty,onStop:$empty,onComplete:$empty,onProgress:$empty,onPosition:$empty,onID3:$empty},initialize:function(B,C,A){this.setOptions(A);this.url=B.replace(/^m:|file:\/\/\/M:/gi,"http://media.planet-tmx.eu");this.id3=new Hash();this.swf=C.obj.object;this.playing=false;this.listeners={};this.filesize=null;this.duration=null;this.pausedAt=0;this.position=0;this.register();this.title=this.options.title},start:function(A){var B=A||this.pausedAt;if(!this.swf.startSound){return }this.swf.startSound(this.url,B,this.options.volume,this.options.pan);this.fireEvent("onPlay");this.pausedAt=0;return this},stop:function(){if(!this.swf.stopSound){return false}this.swf.stopSound(this.url);this.fireEvent("onStop");return this},jumpTo:function(A){$clear(this.listeners.position);this.start(A)},pause:function(){this.swf.stopSound(this.url);this.pausedAt=this.getPosition();this.fireEvent("onPause",this.pausedAt);this.fireEvent("onStop")},setVolume:function(A){this.obj.setVolume(this.url,A);this.options.volume=A;return this},setPan:function(A){this.swf.setPan(this.url,A);this.options.pan=A;return this},getVolume:function(){return this.options.volume},getPan:function(){return this.options.pan},getID3:function(A){return this.id3.get(A)},getBytesLoaded:function(){return this.swf.getBytesLoaded(this.url)},getFilesize:function(){return this.swf.getBytesTotal(this.url)},getPosition:function(){return this.swf.getPosition(this.url)},getDuration:function(){return this.swf.getDuration(this.url)},checkProgress:function(){if($type(this.filesize)!=="number"){this.filesize=this.getFilesize()}var B=this.getBytesLoaded();if($type(B)==="number"&&B!==this.listeners.lastProgress){this.listeners.lastProgress=B;this.fireEvent("onProgress",[B,this.filesize]);if(B==this.filesize){this.fireEvent("onLoad")}}var A=(B==this.filesize)},checkPosition:function(){var A=this.getPosition();this.duration=this.getDuration();if($type(A)==="number"&&A!==this.listeners.lastPosition){this.listeners.lastPosition=A;this.fireEvent("onPosition",[(A/1000).round(),(this.duration/1000).round()]);if(A==this.duration){this.fireEvent("onComplete")}}},register:function(){this.fireEvent("onRegister");if(this.options.streaming===false){this.swf.preloadSound(this.url);this.listeners.progress=this.checkProgress.periodical(this.options.progressInterval,this)}this.addEvents({onLoad:this.onLoad,onComplete:this.onComplete,onStop:this.onStop,onPlay:this.onPlay})},onLoad:function(){$clear(this.listeners.progress)},onComplete:function(){$clear(this.listeners.position);this.listeners.lastPosition=0},onPlay:function(){if(this.options.streaming===true){if(!this.listeners.progress){this.listeners.progress=this.checkProgress.periodical(this.options.progressInterval,this)}}this.playing=true;this.listeners.position=this.checkPosition.periodical(this.options.positionInterval,this)},onStop:function(){$clear(this.listeners.position);if(this.pausedAt===0){this.fireEvent("onPosition",[0,this.duration])}this.playing=false},kill:function(){this.stop();$clear(this.listeners.progress);$clear(this.listeners.position);this.listeners={}}});var XEditable=new Class({Implements:[Events,Options],options:{styles:{fontSize:"100%",fontFamily:"georgia, serif"},hint:"",card_id:"",parent_c:false,scrolling:"no",baseCSS:"html{ height: 100%; cursor: text }      body{ font-family: {FFAM}; font-size:100%; border: 0; margin:0; padding:0; background-color:white }",html:'<html>      <head>      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">      <style>{BASECSS}</style>      </head>      <body></body>      </html>'},initialize:function(B,A){this.setOptions(A);this.gap=$(B);this.gapId=this.gap.getProperty("id");this.card=$(this.options.card_id);this.build();this.keys=[]},kill:function(){if(this.container){$(this.container).destroy()}},setdesignmode:function(){this.doc.designMode="on";if(Browser.Engine.trident4){this.doc=this.win.document}if(!Browser.Engine.trident&&!Browser.Engine.presto){this.execute("styleWithCSS",false,false)}},setstyles:function(){if(this.doc.body){$(this.doc.body).setStyles(this.options.styles)}this.iframe.style.display="block"},getPosition:function(){return this.container.getPosition()},build:function(){this.container=new Element("div",{id:(this.gapId)?this.gapId+"cont":null,"class":"",styles:{position:"absolute"}});this.align();this.container.inject(this.gap.getParent(),"after");this.iframe=new IFrame({id:this.gapId+"xed",border:0,frameborder:0,scrolling:this.options.scrolling,styles:{width:this.gapcoords.width,height:this.gapcoords.height,"border-color":"#000000",padding:this.options.styles.padding+"px"}});this.iframe.inject(this.container,"top");this.win=this.iframe.contentWindow;this.doc=this.win.document;var A=this;var D=this.options.baseCSS.substitute({FFAM:this.options.styles.fontFamily});var C=this.options.html.substitute({BASECSS:D});this.doc.open();this.doc.write(C);this.doc.close();(Browser.Engine.trident)?this.doc.body.contentEditable=true:this.doc.designMode="On";if(!this.win.$family){new Window(this.win)}if(!this.doc.$family){new Document(this.doc)}$(this.doc.body);if(Browser.Engine.gecko&&Browser.Engine.version==18){this.doc.addEvent("focus",function(){A.win.fireEvent("focus").focus()})}if(!(/trident|presto/i).test(Browser.Engine.name)){var B=function(){A.execute("styleWithCSS",false,false);A.win.removeEvent("focus",B)};this.win.addEvent("focus",B)}this.doc.body.setStyles(this.options.styles);if(Browser.Engine.trident){this.iframe.addEvent("focus",this.focused.bind(this))}else{if(Browser.Engine.webkit){this.win.addEvent("focus",this.focused.bind(this))}else{this.doc.addEvent("focus",this.focused.bind(this))}}if(Browser.Engine.webkit){}this.doc.addEvent("keydown",this.handleKeyDown.bind(this))},focused:function(){log("xedfocused");if(window.act_input!=this){window.act_input=this}},align:function(){if(this.gap.getStyle("display")=="none"){this.gap.setStyle("display","block")}var A=this.gap.getOffsetParent();if(!A||A.tagName.toLowerCase()=="th"||A.tagName.toLowerCase()=="td"){A=this.options.parent_c}this.gapcoords=this.gap.getCoordinates(A);if(this.container){this.container.setStyles({left:this.gapcoords.left-this.options.styles.padding,top:this.gapcoords.top-this.options.styles.padding,width:this.gapcoords.width,height:this.gapcoords.height})}},handleKeyDown:function(A){if(window.console&&A.key){console.log("kd",A.key)}if(A.key=="f2"){new Event(A).preventDefault().stopPropagation();if(this.options.hint){this.setHTML("");this.insert(this.options.hint);if(this.doc.body.innerHTML!=this.options.hint){this.doc.body.innerHTML=this.options.hint;this.focus()}}return false}else{if(!A.control){if(A.code==13||A.key=="tab"){A.stop();var B=this.card.retrieve("auf");if(B){B.fireEvent("keyreturn",[this])}return }this.execute("ForeColor",false,"#000000");return }}},text:function(){return this.cleanup(this.doc.body.innerHTML)},setHTML:function(A){this.doc.body.innerHTML=A},selection:function(){if(Browser.Engine.trident){return this.doc.selection.createRange().text}return this.win.getSelection()},createRange:function(){if(Browser.Engine.trident){return this.doc.selection.createRange()}else{var A=this.win.getSelection();if($type(A)){try{return A.getRangeAt(0)}catch(B){return this.doc.createRange()}}else{return this.doc.createRange()}}},insert:function(B){var A=this.createRange();if(typeof document.selection!="undefined"){A.pasteHTML(B);A=document.selection.createRange();A.collapse(false);A.select()}else{A.deleteContents();this.execute("inserthtml",false,B)}},focus:function(){(function(){this.win.focus()}).bind(this).delay(10)},execute:function(C,B,A){if(!this.busy){this.busy=true;this.doc.execCommand(C,B,A);this.busy=false}return false},cleanup:function(A){A=A.replace(/&(lt|gt);/g,function(B,C){return(C=="lt")?"<":">"});A=A.replace(/<\/?[^>]+(>|$)/g,"");A=A.replace(/[\n]+/g,"");A=A.replace(/[\r]+/g,"");A=A.trim();return A}});var mSortables=new Class({Implements:[Events,Options],options:{snap:4,opacity:1,clone:false,revert:false,handle:false,constrain:false},initialize:function(A,B){this.setOptions(B);this.elements=[];this.lists=[];this.idle=true;this.addLists($$($(A)||A));if(!this.options.clone){this.options.revert=false}if(this.options.revert){this.effect=new Fx.Morph(null,$merge({duration:250,link:"cancel"},this.options.revert))}},attach:function(){this.addLists(this.lists);return this},detach:function(){this.lists=this.removeLists(this.lists);return this},addItems:function(){Array.flatten(arguments).each(function(A){this.elements.push(A);this.addpopmenu(A);var B=A.retrieve("sortables:start",this.start.bindWithEvent(this,A));(this.options.handle?A.getElement(this.options.handle)||A:A).addEvent("mousedown",B)},this);return this},addLists:function(){Array.flatten(arguments).each(function(A){this.lists.push(A);this.addItems(A.getChildren());if(this.insertdummy){this.insertdummy(A)}},this);return this},removeItems:function(){var A=[];Array.flatten(arguments).each(function(B){A.push(B);this.elements.erase(B);var C=B.retrieve("sortables:start");(this.options.handle?B.getElement(this.options.handle)||B:B).removeEvent("mousedown",C)},this);return $$(A)},removeLists:function(){var A=[];Array.flatten(arguments).each(function(B){A.push(B);this.lists.erase(B);this.removeItems(B.getChildren())},this);return $$(A)},getClone:function(B,A){if(!this.options.clone){return new Element("div").inject(document.body)}if($type(this.options.clone)=="function"){return this.options.clone.call(this,B,A,this.list)}return A.clone(true).setStyles({margin:"0px",position:"absolute",visibility:"hidden",width:A.getStyle("width")}).inject(this.list).position(A.getPosition(A.getOffsetParent()))},getDroppables:function(){var A=this.list.getChildren();if(!this.options.constrain){A=this.lists.concat(A).erase(this.list)}A.erase(this.placeholders[0]);A.erase(this.placeholders[1]);return A.erase(this.clone).erase(this.element)},insert:function(F,C){var A="inside";if(this.lists.contains(C)){this.list=C;this.drag.droppables=this.getDroppables();var G=C.lastChild;C=G;A="before"}else{A=this.element.getAllPrevious().contains(C)?"before":"after"}if(C.get("class")=="ved-dummy"){A="before"}if(this.element.get("class")!="ved-t"){var D=this.element;this.element=$(this.element).clone();var B=this.element.erase("class").addClass("ved-t").innerHTML;this.element.empty();D.setStyles({left:0,top:0});var E=new Element("div",{html:B}).injectInside(this.element)}this.element.inject(C,A);this.fireEvent("sort",[this.element,this.clone])},start:function(B,A){info("start "+A.tagName+A.innerHTML);if(!this.idle){return }this.idle=false;this.element=A;this.opacity=A.get("opacity");this.list=A.getParent();this.clone=this.getClone(B,A);this.drag=new Drag.Move(this.clone,{snap:this.options.snap,container:this.options.constrain&&this.element.getParent(),droppables:this.getDroppables(),onSnap:function(){B.stop();this.clone.setStyle("visibility","visible");this.element.set("opacity",this.options.opacity||0);this.fireEvent("start",[this.element,this.clone])}.bind(this),onEnter:this.insert.bind(this),onCancel:this.reset.bind(this),onComplete:this.end.bind(this)});this.clone.inject(this.element,"before");this.drag.start(B)},end:function(){this.drag.detach();this.element.set("opacity",this.opacity);if(this.effect){var A=this.element.getStyles("width","height");var B=this.clone.computePosition(this.element.getPosition(this.clone.offsetParent));this.effect.element=this.clone;this.effect.start({top:B.top,left:B.left,width:A.width,height:A.height,opacity:0.25}).chain(this.reset.bind(this))}else{this.reset()}},reset:function(){this.idle=true;this.clone.destroy();this.fireEvent("complete",this.element)},serialize:function(){var C=Array.link(arguments,{modifier:Function.type,index:$defined});var B=this.lists.map(function(D){return D.getChildren().map(C.modifier||function(E){return E.get("id")},this)},this);var A=C.index;if(this.lists.length==1){A=0}return $chk(A)&&A>=0&&A<this.lists.length?B[A]:B}});var XSortables=new Class({Extends:mSortables,initialize:function(A,B){this.mart=B.mart;this.placeholders=[];this.parent(A,B);this.card_id=this.options.card_id;this.content="";if(window.console){console.log("XSortables",this.mart)}if(this.mart>=1){this.initial=this.getAll();this.changes=[]}if(this.mart>=2){this.addEvent("complete",this.complete.bind(this));this.addEvent("sort",this.sorted.bind(this))}},sorted:function(B,F){var A=B.getParent();var C=F.getParent();var D=1+C.getChildren().indexOf(F);var E=1+A.getChildren().indexOf(B);if(A==C){info("innerhalb der Zeile von "+D+" auf "+E)}else{info("von Zeile "+C.id+"/"+D+" nach "+A.id+"/"+E)}},complete:function(A,B){this.hasChanged();if(window.console){console.log("XSortables complete: ",this.changes.length+" Zeilen ge�ndert =&gt; "+JSON.encode(this.changes))}},hasChanged:function(){this.changes=this.getAll();var A=this.getChanges();if(A){info("Liste(n) "+this.content+" wurden ge�ndert!");if(this.card_id){$(this.card_id).fireEvent("changed",["tr",this,{lang2:this.content}])}}else{info("keine &Auml;nderungen")}return A},updated:function(){this.initial.empty().extend(this.changes);this.changes.empty();info("Übersetzungen wurden gespeichert :-)")},getChanges:function(){var A,B=0;for(A=0;A<Math.max(this.changes.length,this.initial.length);A++){if(JSON.encode(this.changes[A])==JSON.encode(this.initial[A])){this.changes[A]="-"}else{B++}}return B},getAll:function(){data=new Array();for(var A=0;A<this.lists.length;A++){data.push(this.get(A))}return data},get:function(B){var C="";var A=this.lists[B].getChildren().map(function(E,D){var F=E.id.split("_");if(E.id&&C!=F[1]){C=F[1]}return(E.id)?F[2]:null});A.splice(A.length-1,1);if(C){this.content=C}return A},remove:function(A){$(A).destroy();this.hasChanged();return false},reqremoval:function(A){A=$(A);if(A.retrieve("waiting")){alert("Bitte warten - Anforderung wurde gesendet!");return }if(window.console){console.log("You suggest to remove "+A.id)}$(A.id+"-pop").setStyle("display","none");var B=decodeId(A.id);if(window.console){console.log("parsed ",B.v1,B.v2,B.m)}A.store("waiting",1);json("req_remtr&v1="+B.v1+"&m="+B.m+"&v2="+B.v2+"&id="+A.id)},contains:function(A,E){A--;if(!this.lists[A]){return }var B=this.lists[A].getChildren();for(var C=0;C<B.length;C++){if(B[C].id){var D=B[C].id.split("_");if(D[2]==E){return C+1}}}return false},addpopmenu:function(B){var F=B.id;var A=F+"-pop";var D=B.innerHTML;B.addClass("ved-t");B.empty();var E=new Element("div",{html:D}).addEvents({mousedown:function(G){hide(A)},mouseleave:function(G){hide(A)},mouseenter:function(G){show(A)}}).injectInside(B);var C=new Element("ul",{id:A,"class":"ved-popup"}).addEvents({mouseout:function(G){hide(A)},mouseover:function(G){show(A)}}).injectInside(B);new Element("li",{html:"Anzeigen"}).addEvent("click",function(){ShowVoc(F)}).injectInside(C);if(this.mart&4){new Element("li",{html:"Entfernen"}).addEvent("click",this.remove.bind(this,[F])).injectInside(C)}else{if(this.mart){new Element("li",{id:F+"-rem",html:"Zum Entfernen vorschlagen"}).addEvent("click",this.reqremoval.bind(this,[F])).injectInside(C)}}},insertdummy:function(A){if(window.console){console.log("insertdummy",this.mart,this.mart&1)}if(this.mart&1){var B=new Element("li",{html:'<a href="#"><img src="/img/plus.png"><a>',"class":"ved-dummy"}).injectInside(A);B.addEvent("click",function(){TransAdd(this);return false});this.placeholders.push(B)}}});