function Quiz(B){for(var A in B){this[A]=B[A];}$("div#quiz div#buttons #next").bind("click",{that:this},function(E){var D=E.data.that;var F=$('div#quiz input:radio[name="answer"]:checked').val();D.current=D.questions[D.index].answers[F].value;D.total+=D.current;D.index++;$("div#quiz div#buttons #prev").removeAttr("disabled");$("div#quiz div#buttons #next").attr("disabled","disabled");if(D.index==D.questions.length){var C=D.success();$.get("http://www.naden.de/computerspieler-sind-verbrecher/track.php",{id:D.id,total:D.total,min_value:D.min_value,max_value:D.max_value,len:D.questions.length,r:escape(document.referrer?document.referrer:'')});$("#quiz div#content").hide();$("#quiz div#result div").html(C.message+"<br />"+C.title);$("#quiz div#result a").each(function(){$(this).html($(this).html().replace(/SCORE/,C.percent));});$("#quiz div#result input").each(function(){$(this).val($(this).val().replace(/SCORE/,C.percent));});$("#result").show();}else{D.memory[D.index-1]=F;D.Position(D.index,D.questions.length);D.Show(D.questions[D.index]);$("div#quiz ul li input").each(function(G,H){if(G==D.memory[D.index]){$(this).attr("checked","checked");$("div#quiz div#buttons #next").removeAttr("disabled");}});}});$("div#quiz div#buttons #prev").bind("click",{that:this},function(D){var C=D.data.that;C.index--;C.total-=C.current;if(C.index==0){$("div#quiz div#buttons #prev").attr("disabled","disabled");}$("div#quiz div#buttons #next").removeAttr("disabled");C.Position(C.index,C.questions.length);C.Show(C.questions[C.index]);$("div#quiz ul li input").each(function(E,F){if(E==C.memory[C.index]){$(this).attr("checked","checked");}});});return(this);}Quiz.prototype.Load=function(B){this.current=0;this.total=0;this.index=0;this.memory=[];if(typeof (B)=="string"){$.that=this;$.getJSON(B,function(C){$.each(C,function(D,E){$.that[D]=E;});$("div#quiz h2").html($.that.title);$.that.Position(0,$.that.questions.length);$.that.Show($.that.questions[0]);});}else{for(var A in B){this[A]=B[A];}$("div#quiz h2").html(this.title);this.Position(this.index,this.questions.length);this.Show(this.questions[0]);}};Quiz.prototype.Show=function(A){$("div#quiz #content h3").html(A.question);$("div#quiz ul").empty();$(A.answers).each(function(B,C){$("div#quiz ul").append('<li><input type="radio" name="answer" value="'+B+'" />'+C.title+"</li>");});$("div#quiz ul li input").bind("click",{that:this},function(B){B.data.that.value=this.value;$("div#quiz div#buttons #next").removeAttr("disabled");});};Quiz.prototype.Position=function(B,A){if(B<A){B++;}$("div#quiz div#buttons span").html("[ "+B+" / "+A+" ]");};
