function AOLQuizAjax(){var REST_URL="/user-quizzes/REST/";
var XMLHttpFactories=[function(){return new XMLHttpRequest()
},function(){return new ActiveXObject("Msxml2.XMLHTTP")
},function(){return new ActiveXObject("Msxml3.XMLHTTP")
},function(){return new ActiveXObject("Microsoft.XMLHTTP")
}];
function createXMLHTTPObject(){var xmlhttp=false;
for(var i=0;
i<XMLHttpFactories.length;
i++){try{xmlhttp=XMLHttpFactories[i]()
}catch(e){continue
}break
}return xmlhttp
}function xhr(url,method,callback,params){var req=createXMLHTTPObject();
req.open(method,url,true);
if(method=="POST"){req.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
}req.onreadystatechange=function(){if(req.readyState==4){var data=eval("("+req.responseText+")");
callback(data)
}};
req.send(params)
}function get(request,callback){xhr(REST_URL+request,"GET",callback,null)
}function post(request,callback,params){xhr(REST_URL+request,"POST",callback,params)
}this.loadQuiz=function(id,callback){get("getQuiz?id="+id,function(data){callback(wrapQuiz(data))
})
};
this.loadInfiniteQuiz=function(callback,genreId){get("getInfiniteQuiz"+(genreId!=null?"?genre-id="+genreId:""),function(data){callback(wrapQuiz(data))
})
};
this.saveUserScore=function(quizObj,callback){var params="quiz-id="+quizObj.id+"&score="+quizObj.getComputedScore()+"&genre="+quizObj.genreIds[0]+"&correct-count="+quizObj.getTotalCorrectAnswers();
post("saveScore",callback,params)
};
this.getGenres=function(callback){get("getGenres",callback)
};
this.getUser=function(callback){get("getUser",callback)
};
this.getUserScoreResults=function(callback){get("getUserScoreResults",callback)
};
this.getLeaderboard=function(quizId,callback,timeframe){get("getLeaderboard?quiz-id="+quizId+"&timeframe="+timeframe,callback)
};
this.getOverallLeaderboard=function(callback,timeframe){get("getLeaderboard?timeframe="+timeframe,callback)
};
this.getComments=function(quizId,start,limit,callback){get("getComments?quiz-id="+quizId+"&start="+start+"&limit="+limit,callback)
};
this.getRatingForUser=function(quizId,callback){get("getRatingForUser?quiz-id="+quizId,callback)
};
this.addComment=function(quizId,title,text,callback){post("addComment",callback,"quiz-id="+quizId+"&title="+title+"&text="+text)
};
this.addRating=function(quizId,score,callback){post("addRating",callback,"quiz-id="+quizId+"&score="+score)
};
function wrapQuiz(quiz){quiz.currentIndex=0;
quiz.correctMessageIndex=0;
quiz.wrongMessageIndex=0;
for(var i=0;
i<quiz.questions.length;
i++){quiz.questions[i].userAnswer=-1;
quiz.questions[i].elapsedTime=-1
}quiz.getDescription=function(){return this.description
};
quiz.getTotalQuestions=function(){return this.questions.length
};
quiz.nextQuestion=function(){if(!this.isLastQuestion()){this.currentIndex++
}};
quiz.prevQuestion=function(){if(this.currentIndex>0){this.currentIndex--
}};
quiz.getQuestion=function(i){return this.questions[i]
};
quiz.isLastQuestion=function(){return this.currentIndex+1==this.getTotalQuestions()
};
quiz.getCurrentQuestion=function(){return this.questions[this.currentIndex]
};
quiz.getPreviousQuestion=function(){if(this.currentIndex>0){return this.questions[this.currentIndex-1]
}else{return this.questions[this.currentIndex]
}};
quiz.getCurrentIndex=function(){return this.currentIndex
};
quiz.setUserAnswer=function(answer,elapsedTime){this.questions[this.currentIndex].userAnswer=answer;
this.questions[this.currentIndex].elapsedTime=elapsedTime
};
quiz.getComputedScore=function(){var points=this.getCorrectPoints()-this.getWrongPoints()+this.getBonusPoints();
if(points>=0){return points
}else{return 0
}};
quiz.getCurrentQuestionPoints=function(){var question=this.questions[this.currentIndex];
if(question.userAnswer==question.correctAnswer.id){if(question.type=="MULTIPLE"){return"60<span>correct</span>"
}else{if(question.type=="BOOLEAN"){return"30<span>correct</span>"
}}}else{if(question.type=="MULTIPLE"){return"-10<span>incorrect</span>"
}else{if(question.type=="BOOLEAN"){return"-20<span>incorrect</span>"
}}}};
quiz.getCurrentBonusPoints=function(){var question=this.questions[this.currentIndex];
if(question.userAnswer==question.correctAnswer.id){return Math.max((question.elapsedTime),0)+"<span>speed bonus</span>"
}else{return"0<span>speed bonus</span>"
}};
quiz.getWrongPoints=function(){var score=0;
for(var i=0;
i<quiz.questions.length&&quiz.questions[i].userAnswer!=-1;
i++){var question=quiz.questions[i];
if(question.userAnswer!=question.correctAnswer.id){if(question.type=="MULTIPLE"){score+=10
}else{if(question.type=="BOOLEAN"){score+=20
}}}}return score
};
quiz.getCorrectPoints=function(){var score=0;
for(var i=0;
i<quiz.questions.length&&quiz.questions[i].userAnswer!=-1;
i++){var question=quiz.questions[i];
if(question.userAnswer==question.correctAnswer.id){if(question.type=="MULTIPLE"){score+=60
}else{if(question.type=="BOOLEAN"){score+=30
}}}}return score
};
quiz.getBonusPoints=function(){var score=0;
for(var i=0;
i<quiz.questions.length&&quiz.questions[i].userAnswer!=-1;
i++){var question=quiz.questions[i];
if(question.userAnswer==question.correctAnswer.id&&question.elapsedTime!=-1){score+=(question.elapsedTime)
}}return Math.floor(score)
};
quiz.getCorrectAnswerId=function(){return this.questions[this.currentIndex].correctAnswer.id
};
quiz.getTotalCorrectAnswers=function(){var totalCorrectAnswers=0;
for(var i=0;
i<quiz.questions.length&&quiz.questions[i].userAnswer!=-1;
i++){var question=quiz.questions[i];
if(question.userAnswer==question.correctAnswer.id){++totalCorrectAnswers
}}return totalCorrectAnswers
};
quiz.getTotalWrongAnswers=function(){var totalWrongAnswers=0;
for(var i=0;
i<quiz.questions.length&&quiz.questions[i].userAnswer!=-1;
i++){var question=quiz.questions[i];
if(question.userAnswer!=question.correctAnswer.id){++totalWrongAnswers
}}return totalWrongAnswers
};
quiz.getFinalTabData=function(){var obj=new Object();
obj.correctAnswers=this.getTotalCorrectAnswers();
obj.wrongAnswers=this.getTotalWrongAnswers();
obj.computedScore=this.getComputedScore();
obj.bonusPoints=this.getBonusPoints();
obj.correctPoints=this.getCorrectPoints();
obj.wrongPoints=this.getWrongPoints();
return obj
};
quiz.getNextCorrectMessage=function(){var message=this.correctMessages[this.correctMessageIndex];
this.correctMessageIndex=(this.correctMessageIndex+1)%this.correctMessages.length;
return message
};
quiz.getNextWrongMessage=function(){var message=this.wrongMessages[this.wrongMessageIndex];
this.wrongMessageIndex=(this.wrongMessageIndex+1)%this.wrongMessages.length;
return message
};
quiz.getScoringMessage=function(){var score=(this.getTotalCorrectAnswers()/this.getTotalQuestions())*100;
if(score==0){return this.scoringMessages[0]
}else{if(score<60){return this.scoringMessages[1]
}else{if(score<80){return this.scoringMessages[2]
}else{if(score<100){return this.scoringMessages[3]
}else{return this.scoringMessages[4]
}}}}};
return quiz
}}function AOLQuiz(H,b,D){var R=null;
var X=new AOLQuizAjax();
var K=null;
var B=null;
var G=this;
var n=false;
var W=false;
var L=D!=null?D:true;
var O=(b!=null?b:getQueryVariable("quiz-id"));
var a=null;
var U=false;
var T=(O==0);
var m=null;
var C=new Array();
if(L){addEventSimple(window,"load",j)
}this.show=function(){j()
};
this.remove=function(){while(R.childNodes.length>0){R.removeChild(R.lastChild)
}S()
};
this.setPreview=function(s){U=s
};
this.setNextQuestionCallback=function(s){m=s
};
this.addQuizLoadedCallback=function(s){C.push(s)
};
this.getQuiz=function(){return K
};
function j(){R=$$(H);
if(R){loadQuizCSS();
R.className="aolQuiz";
f();
if(T){X.loadInfiniteQuiz(function(s){K=s;
k()
})
}else{X.loadQuiz(O,function(s){K=s;
k()
})
}}}function e(s){W=true;
stopDefaultEvent(s?s:window.event);
X.saveUserScore(K,function(t){B=t;
o();
M()
})
}this.nextQuestion=function(s){stopDefaultEvent(s?s:window.event);
if(m!=null){m(K)
}n=false;
V();
N()
};
this.onUserAnswer=function(s){stopDefaultEvent(s?s:window.event);
n=true;
if(!document.getElementById("aolQuizFacts")){var x=s.target?s.target:s.srcElement;
while(x.tagName!="A"){x=x.parentNode
}var w=x;
var v=h();
var u=v.getMinutes()*60+v.getSeconds();
K.setUserAnswer(x.id,u);
S();
if(!U){$$("aolQuizCorrect").innerHTML=K.getTotalCorrectAnswers();
$$("aolQuizWrong").innerHTML=K.getTotalWrongAnswers();
new AOLQuizScoreAnimator($$("aolQuizScore"),K.getCurrentQuestionPoints(),K.getCurrentBonusPoints(),K.getComputedScore()+"<br><span>quiz total</span>",x.id==K.getCorrectAnswerId())
}if(x.id==K.getCorrectAnswerId()){x.className="awHighlight_r_on"
}else{x.className="awHighlight_w_on"
}removeEventSimple(x,"click",G.onUserAnswer);
for(var t=x.nextSibling;
t!=null&&t.tagName=="A";
t=t.nextSibling){if(t.id!=K.getCorrectAnswerId()){t.className="awHighlight_w_off"
}else{t.className="awHighlight_r_off"
}removeEventSimple(t,"click",G.onUserAnswer)
}for(var t=x.previousSibling;
t!=null&&t.tagName=="A";
t=t.previousSibling){if(t.id!=K.getCorrectAnswerId()){t.className="awHighlight_w_off"
}else{t.className="awHighlight_r_off"
}removeEventSimple(t,"click",G.onUserAnswer)
}setTimeout(function(){q(w)
},1000)
}};
function q(y){var AA=$$("aolQuizBtnMenu");
if(AA!=null){AA.style.display="none"
}var v=null;
for(var AC=y.nextSibling;
AC!=null&&AC.tagName=="A";
){var t=AC;
AC=AC.nextSibling;
t.parentNode.removeChild(t);
if(t.id==K.getCorrectAnswerId()){v=t
}}for(var AC=y.previousSibling;
AC!=null&&AC.tagName=="A";
){var t=AC;
AC=AC.previousSibling;
t.parentNode.removeChild(t);
if(t.id==K.getCorrectAnswerId()){v=t
}}var z=document.createElement("div");
z.className="cl";
var AD=document.createElement("div");
AD.setAttribute("id","aolQuizFacts");
AD.innerHTML=K.getCurrentQuestion().fact;
var w=document.createElement("a");
w.setAttribute("id","showFactsLink");
w.setAttribute("href","#");
w.innerHTML="show question";
addEventSimple(w,"click",I);
var AB=document.createElement("div");
AB.className="btnNextDiv";
if(K.getCurrentQuestion().fact!=""){AB.appendChild(w)
}if(y.id==K.getCorrectAnswerId()){y.parentNode.childNodes[1].innerHTML=K.getNextCorrectMessage()
}else{y.parentNode.childNodes[1].innerHTML=K.getNextWrongMessage();
var x=document.createElement("h4");
x.innerHTML="The Correct Answer is:";
y.parentNode.appendChild(x);
y.parentNode.appendChild(v)
}y.parentNode.appendChild(z);
if(K.getCurrentQuestion().fact!=""){y.parentNode.appendChild(AD)
}if(!K.isLastQuestion()){var s=document.createElement("a");
s.setAttribute("href","#");
s.className="btnB";
s.innerHTML="next question >";
addEventSimple(s,"click",G.nextQuestion);
AB.appendChild(s);
y.parentNode.appendChild(AB)
}else{if(!U){var u=document.createElement("a");
u.setAttribute("href","#");
u.className="btnB";
u.innerHTML="See Your Result >";
addEventSimple(u,"click",e);
AB.appendChild(u);
y.parentNode.appendChild(AB)
}}K.nextQuestion()
}function f(){var z=document.createElement("div");
z.setAttribute("id","aolQuizCounter");
var u=document.createElement("div");
u.setAttribute("id","aolQuizScore");
u.innerHTML="0";
var AA=document.createElement("div");
AA.setAttribute("id","aolQuizTimerSec");
G.quizTimer=document.createElement("span");
G.quizTimer.setAttribute("id","aolQuizTimer");
G.quizTimer.setAttribute("title","Bonus Point Timer");
G.quizTimer.innerHTML="60";
var v=document.createElement("span");
v.setAttribute("id","aolQuizCorrect");
v.setAttribute("title","Correct Answers");
v.innerHTML="0";
var w=document.createElement("span");
w.setAttribute("id","aolQuizWrong");
w.setAttribute("title","Incorrect Answers");
w.innerHTML="0";
var AB=document.createElement("div");
AB.className="cl";
var AF=document.createElement("div");
AF.className="cl";
AA.appendChild(G.quizTimer);
AA.appendChild(v);
AA.appendChild(w);
z.appendChild(u);
z.appendChild(AA);
z.appendChild(AB);
var AG=document.createElement("div");
AG.setAttribute("id","aolQuizBot");
var AE=document.createElement("a");
AE.className="btnG create";
AE.setAttribute("href","/user-quizzes/create");
AE.innerHTML="create your own quiz";
var AD=document.createElement("a");
AD.className="btnG infoBtn";
AD.setAttribute("href","#");
AD.setAttribute("id","aolHelpBtn");
AD.innerHTML="?";
addEventSimple(AD,"click",P);
var AC=document.createElement("a");
AC.className="btnG menu";
AC.setAttribute("id","aolQuizBtnMenu");
AC.setAttribute("href","#");
AC.innerHTML="menu";
addEventSimple(AC,"click",d);
var y=document.createElement("a");
y.className="btnG feedback";
y.setAttribute("href","#");
y.setAttribute("id","aolQuizBtnNotify");
y.innerHTML="Notify";
addEventSimple(y,"click",p);
AG.appendChild(AE);
AG.appendChild(AD);
AG.appendChild(y);
AG.appendChild(AC);
AG.appendChild(AF);
var x=document.createElement("div");
x.setAttribute("id","aolQuestionContainer");
var t=document.createElement("img");
t.setAttribute("src",IMAGE_URL+"/loading.gif");
t.setAttribute("border","0");
x.appendChild(t);
var s=document.createElement("div");
s.setAttribute("id","aolQuizEndCard");
s.style.display="none";
if(!U){R.appendChild(z)
}R.appendChild(x);
R.appendChild(s);
if(!U){R.appendChild(AG)
}}function k(){for(var t=0;
t<K.getTotalQuestions();
t++){var s=K.getQuestion(t);
if(s&&s.image){var u=new Image();
u.src=s.image
}}if($$("aolQuizScore")!=null){$$("aolQuizScore").innerHTML=K.getComputedScore()+"<span>quiz total</span>"
}V();
for(var t=0;
t<C.length;
t++){C[t](G)
}if(!U){F()
}}function F(){var v=$$("aolQuestionContainer");
var s=document.createElement("div");
s.id="aolTimerNotice";
s.style.height=v.offsetHeight+"px";
v.appendChild(s);
var t=document.createElement("div");
t.id="aolTimerNoticeTop";
v.appendChild(t);
var w=document.createElement("div");
w.innerHTML="Answer a question in less than 60 seconds to earn bonus points. <br>The countdown tells you how many points you'll get.";
w.style.margin="10px 60px";
t.appendChild(w);
var u=document.createElement("a");
u.setAttribute("href","#");
u.innerHTML="[x] Closing in 5";
u.id="timerCloseBtn";
t.appendChild(u);
addEventSimple(u,"click",g);
setTimeout(r,1000)
}function r(){var t=$$("timerCloseBtn");
if(t){var s=(t.innerHTML.replace("[x] Closing in ","")-1);
t.innerHTML="[x] Closing in "+s;
if(s>0){t.innerHTML="[x] Closing in "+s;
setTimeout(r,1000)
}else{g()
}}}function g(s){stopDefaultEvent(s?s:window.event);
$$("aolQuestionContainer").removeChild($$("aolTimerNoticeTop"));
$$("aolQuestionContainer").removeChild($$("aolTimerNotice"));
N()
}function I(s){stopDefaultEvent(s?s:window.event);
var u=$$("showFactsLink");
var t=$$("aolQuizFacts");
if(u.innerHTML=="show question"){u.innerHTML="show facts";
t.innerHTML=K.getPreviousQuestion().text
}else{if(u.innerHTML=="show facts"){u.innerHTML="show question";
t.innerHTML=K.getPreviousQuestion().fact
}}}function E(t){stopDefaultEvent(t?t:window.event);
if(quizSNS){var s=$$("aolQuizBtnMenu");
quizSNS.setCallback(function(){if(s!=null){s.className="btnG menu"
}var u=$$("aolQuizScoreDesc").innerHTML="Please wait...";
if(K.isLastQuestion()){setTimeout(e,500)
}else{setTimeout(d,500)
}});
$$("aolQuizScoreDesc").innerHTML="Waiting for user to sign in...";
quizSNS.signIn()
}}function d(t){stopDefaultEvent(t?t:window.event);
var s=$$("aolQuizBtnMenu");
$$("aolQuizBtnNotify").className="btnG feedback";
if(!W&&(s==null||s.className=="btnGOn menu")){V()
}else{if(s.className=="btnG menu"){X.getUserScoreResults(function(u){B=u;
var v=$$("aolQuizEndCard");
while(v.hasChildNodes()){v.removeChild(v.lastChild)
}o();
M()
})
}}}function p(t){stopDefaultEvent(t?t:window.event);
$$("aolHelpBtn").className="btnG infoBtn";
var s=$$("aolQuizBtnNotify");
if(s.className=="btnG feedback"){s.className="btnGOn feedback";
var u=$$("aolQuestionContainer");
if(u.style.display=="none"){u.style.display="";
$$("aolQuizEndCard").style.display="none"
}X.getUser(function(v){if(v.loggedIn){while(u.hasChildNodes()){u.removeChild(u.lastChild)
}u.innerHTML='<div align="right"><a href="#" id="closeButton">CLOSE [X]</a></div><form method="post" action="" id="notifyForm">\n  <strong>Send a notification about</strong><br />\n  <div>\n    <label><input type="radio" name="error" id="inapproperiate" value="inapproperiate" checked="checked"/> Inappropriate Content</label>\n  </div>\n  <strong>Regarding this question or quiz</strong>\n  <br>\n    <textarea name="notifyComment" id="sendmail_comments" cols="45" rows="5" class="field"></textarea>\n  <div id="captcha">&nbsp;</div>\n  <input type="button" class="btnG send" value="Send" name="submitBtn" id="notifySubmit"/>\n  <input type="reset" class="btnG send" value="Clear" name="resetBtn"/>\n  <input id="sendmail_to" type="hidden" value="namestotos2@aol.com" />\n  <input id="sendmail_subject" type="hidden" value="Sports Quizzes Abuse Report" />\n  <input id="sendmail_body" type="hidden" value="" />\n  </form>';
addEventSimple($$("closeButton"),"click",p);
var w=new AOLSendMail("notifySubmit");
w.onError(function(x){if(x.error!="CAPTCHA_RESPONSE"){alert("There was a problem sending email. Please try again later")
}else{alert("Please try typing in the correct letters that appear in the image")
}});
w.onMessageSent(function(){$$("notifyForm").innerHTML='<div style="height:280px; font-size:18px">Message sent successfully.</div>'
});
w.onBeforeSend(function(){$$("sendmail_body").value=l(v.user)
})
}else{u.innerHTML='<div style="height:280px; font-size:18px">You must be signed in to submit notifications regarding this quiz.</div>'
}})
}else{s.className="btnG feedback";
V()
}}function l(s){return"<p><strong>Date:</strong> "+new Date()+"</p>\n<p><strong>Country:</strong> US - English</p>\n<p><strong>URL:</strong> "+K.url+"</p>\n<p><strong>Admin Tool (Sign in as admin user):</strong> http://www.fanhouse.com/user-quizzes/quizzard/"+K.author+"</p>\n<p><strong>Violator:</strong> "+K.author+"</p>\n<p><strong>Violator IP:</strong> "+K.ipAddr+"</p>\n<p><strong>Reporter:</strong> "+s+"</p>\n<p><strong>Reporter Comments:</strong> "+$$("sendmail_comments").value+"</p>"
}function P(t){stopDefaultEvent(t?t:window.event);
$$("aolQuizBtnNotify").className="btnG feedback";
var s=$$("aolHelpBtn");
if(s.className=="btnG infoBtn"){s.className="btnGOn infoBtn";
var u=$$("aolQuestionContainer");
if(u.style.display=="none"){u.style.display="";
$$("aolQuizEndCard").style.display="none"
}while(u.hasChildNodes()){u.removeChild(u.lastChild)
}u.innerHTML='<div id="quizHelp">\n   <div align="right"><a href="#" id="closeButton">CLOSE [X]</a></div>   <h1 class="help">Help on Taking Quizzes</h1>\n   Anybody can take AOL Quizzes. If you\'d like us to store your scores, just    <a href="https://my.screenname.aol.com/_cqr/login/login.psp?sitedomain=fanhouse.com&siteState=OrigUrl%3d'+window.location+'" title="Sign In/Register">Sign In/Register</a> before you take a quiz.<br /><br />\n    Hang on, did you say &quot;scores&quot;?<br />\n      <b>That\'s right ...</b> you get points for your correct answers AND for how quickly you make those answers.<br /><br />\n      What are the points good for? If I load up on points can I trade them in for a new Nintendo Wii?<br />\n      Well, no ... but it\'s kind of fun to watch those points pile up. You won\'t win any fancy prizes, but your top score may make the Leader Board. And isn\'t that prize enough?<br /><br />\n   <b>Quiz Points</b>\n   <div id="quizPoints">\n        <div class="header first">Multiple Choice Questions</div>\n        <div class="correct"><i>+60</i>Correct Answers</div>\n        <div class="wrong"><i>-30</i>Incorrect Answers</div>\n        <div class="header">True or False Questions</div>\n        <div class="correct"><i>+30</i>Correct Answers</div>\n        <div class="wrong"><i>-20</i>Incorrect Answers</div>\n        <div class="header">Speed Bonus (you get bonus points for answering within the 60 second countdown)</div>\n        <div class="correct noback"><i>+60</i>60 seconds</div>\n        <div class="correct noback"><i>+59</i>59 seconds</div>\n        <div class="correct noback"><i>+58</i>58 seconds</div>\n        <div class="correct noback">...</div> \n        <div class="correct noback"><i>+23</i>23 seconds</div>\n    </div>\n    Don\'t worry. If you answer the question after the 60 second countdown ends you still get the base points.\n</div>';
addEventSimple($$("closeButton"),"click",P)
}else{s.className="btnG infoBtn";
V()
}}function c(s){stopDefaultEvent(s?s:window.event);
X.getUserScoreResults(function(t){B=t;
var u=$$("aolQuizEndCard");
while(u.hasChildNodes()){u.removeChild(u.lastChild)
}o();
Z()
})
}function o(){var w=$$("aolQuestionContainer");
var u=$$("aolQuizEndCard");
var AF=$$("aolQuizBot");
var AD=$$("aolQuizBtnMenu");
if(AD!=null){AD.style.display=""
}u.style.display="";
var x=document.createElement("div");
x.setAttribute("id","aolQuizEndCardTab");
if(W){var v=document.createElement("div");
v.setAttribute("id","quizEndCardTabTextTitle");
v.setAttribute("style","padding:6px 0; height: 14px");
v.innerHTML="You have finished the quiz!"
}else{var t=K.getCurrentQuestion();
var v=document.createElement("div");
v.setAttribute("id","quizEndCardTabTextTitle");
v.setAttribute("style","padding:6px 0; height: 14px");
var y=document.createElement("a");
y.setAttribute("href","#");
y.innerHTML="Return to Question #"+(K.getCurrentIndex()+1);
addEventSimple(y,"click",V);
v.appendChild(y)
}var s=document.createElement("ul");
s.className="shadetabs";
var AE=document.createElement("li");
AE.innerHTML='<a href="#">Your Score</a>';
addEventSimple(AE,"click",M);
var AC=document.createElement("li");
AC.innerHTML='<a href="#">More Quizzes</a>';
addEventSimple(AC,"click",Y);
var AB=document.createElement("li");
AB.innerHTML='<a href="#">Share</a>';
addEventSimple(AB,"click",A);
var AA=document.createElement("li");
AA.innerHTML='<a href="#">Snag</a>';
addEventSimple(AA,"click",Q);
var z=document.createElement("li");
z.innerHTML='<a href="#" class="last">Info</a>';
addEventSimple(z,"click",c);
w.style.display="none";
if(AF!=null){AF.lastChild.previousSibling.className="btnGOn menu"
}x.appendChild(v);
x.appendChild(s);
s.appendChild(AE);
s.appendChild(AC);
s.appendChild(AB);
s.appendChild(z);
u.appendChild(x)
}function M(Ac){stopDefaultEvent(Ac?Ac:window.event);
var AN=$$("aolQuizEndCard");
while(AN.childNodes.length>=2){AN.removeChild(AN.lastChild)
}if(W&&AN){AN.firstChild.firstChild.innerHTML="You have finished the quiz!"
}var AA=AN.firstChild.firstChild.nextSibling.childNodes;
for(var AZ=0;
AZ<AA.length;
AZ++){AA[AZ].className=""
}AA[0].className="on";
var AH=K.getFinalTabData();
var u=document.createElement("div");
u.className="cl";
var AL=document.createElement("div");
AL.setAttribute("id","aolQuizTabScore");
var AX=document.createElement("div");
AX.className="oddRow";
var AW=document.createElement("span");
AW.setAttribute("id","pGain");
AW.innerHTML=AH.correctPoints;
var t=document.createElement("span");
t.className="pDesc correct";
t.innerHTML="Number of Correct Answers ";
var AF=document.createElement("span");
AF.setAttribute("id","rNum");
AF.innerHTML="("+AH.correctAnswers+")";
AX.appendChild(AW);
AX.appendChild(t);
AX.appendChild(AF);
var AR=document.createElement("div");
AR.className="evenRow";
var Ab=document.createElement("span");
Ab.setAttribute("id","pLoss");
Ab.className="minus";
Ab.innerHTML="-"+AH.wrongPoints;
var AC=document.createElement("span");
AC.className="pDesc wrong";
AC.innerHTML="Number of Incorrect Answers ";
var AV=document.createElement("span");
AV.setAttribute("id","wNum");
AV.innerHTML="("+AH.wrongAnswers+")";
AR.appendChild(Ab);
AR.appendChild(AC);
AR.appendChild(AV);
var AM=document.createElement("div");
AM.className="oddRow";
var AS=document.createElement("span");
AS.setAttribute("id","bGain");
AS.innerHTML=AH.bonusPoints;
var v=document.createElement("span");
v.className="pDesc time";
v.innerHTML="Speed Bonus ";
AM.appendChild(AS);
AM.appendChild(v);
var AP=document.createElement("div");
AP.className="evenRow";
var x=document.createElement("span");
x.setAttribute("id","pTotal");
x.innerHTML=AH.computedScore;
var Aa=document.createElement("span");
Aa.className="quizTotal";
Aa.innerHTML="Quiz Total ";
AP.appendChild(x);
AP.appendChild(Aa);
var AO=document.createElement("div");
AO.setAttribute("id","aolQuizTabScoreNote");
if(W){var AB=document.createElement("div");
AB.setAttribute("id","cgText");
AB.innerHTML=K.getScoringMessage();
var z=document.createElement("div");
var AE=document.createElement("span");
AE.className="lbText";
var s=document.createElement("span");
s.setAttribute("id","quizStand");
if(B.userInLeaderboard){AE.innerHTML="You made the leader board";
s.innerHTML="<b> #"+B.userPositionInLeaderboard+" this week</b>";
if(a!=null&&a.refresh!=null){a.refresh()
}}else{AE.innerHTML="You did not make the leader board";
s.innerHTML=""
}var AK=document.createElement("div");
var AT=document.createElement("a");
AT.className="btnB";
AT.setAttribute("href","#");
AT.setAttribute("style","margin-left:auto; margin-right:auto");
AT.innerHTML="Take Another Quiz";
addEventSimple(AT,"click",Y);
AK.appendChild(AT);
z.appendChild(AE);
z.appendChild(s);
z.appendChild(AK);
AO.appendChild(AB);
AO.appendChild(z)
}else{var AB=document.createElement("div");
AB.setAttribute("id","cgText2");
AB.className="notFinish";
AB.innerHTML="You have not completed this quiz.";
var AT=document.createElement("a");
AT.setAttribute("href","#");
AT.innerHTML="Finish This Quiz";
AT.className="btnB";
AT.setAttribute("style","margin-left:auto; margin-right:auto");
addEventSimple(AT,"click",V);
var AD=document.createElement("br");
AD.className="noHeight";
AO.appendChild(AB);
AO.appendChild(AT);
AO.appendChild(AD)
}var AG=document.createElement("div");
AG.setAttribute("id","aolQuizTabScoreResult");
var w=document.createElement("div");
w.className="endCardResultMargin";
var AY=document.createElement("span");
AY.setAttribute("id","totalScore");
var AQ=document.createElement("span");
if(B.user.loggedIn){AY.innerHTML=B.userInfo.totalScore;
AQ.innerHTML="Your Total Score (For All Quizzes)"
}else{var AJ=document.createTextNode("You must ");
var AI=document.createTextNode(" to save or view your quiz scores.");
var y=document.createElement("a");
y.setAttribute("href","#");
y.innerHTML="sign in";
addEventSimple(y,"click",E);
AQ.appendChild(AJ);
AQ.appendChild(y);
AQ.appendChild(AI);
AQ.setAttribute("id","aolQuizScoreDesc")
}var AU=document.createElement("br");
AU.className="noHeight";
w.appendChild(AY);
w.appendChild(AQ);
AG.appendChild(w);
AG.appendChild(AU);
AL.appendChild(AX);
AL.appendChild(AR);
AL.appendChild(AM);
AL.appendChild(AP);
AL.appendChild(AO);
AN.appendChild(AL);
AN.appendChild(AG)
}function Y(s){stopDefaultEvent(s?s:window.event);
var t=$$("aolQuizEndCard");
while(t.childNodes.length>=2){t.removeChild(t.lastChild)
}var AA=t.firstChild.firstChild.nextSibling.childNodes;
for(var w=0;
w<AA.length;
w++){AA[w].className=""
}AA[1].className="on";
var x=document.createElement("div");
x.setAttribute("id","aolQuizTabMQ");
if(B.otherQuizzes){for(var AC in B.otherQuizzes){if(B.otherQuizzes[AC].id==K.id){continue
}var u=document.createElement("div");
u.className="qRow";
var v=document.createElement("div");
v.className="qImg";
v.innerHTML='<a class="qTitle" href="/user-quizzes/view-quiz/'+B.otherQuizzes[AC].id+'"><img src="'+B.otherQuizzes[AC].image+'" alt="" border="0"></a>';
var z=document.createElement("div");
z.className="qContent";
if(B.otherQuizzes[AC].questionCount){z.innerHTML+='<a class="qTitle" href="/user-quizzes/view-quiz/'+B.otherQuizzes[AC].id+'">'+B.otherQuizzes[AC].title+"</a>";
z.innerHTML+='<div class="qDesc">'+B.otherQuizzes[AC].description+"</div>";
z.innerHTML+='<div class="qContentL">Questions: <b>'+B.otherQuizzes[AC].questionCount+"</b><br>Difficulty: <b>"+B.otherQuizzes[AC].difficulty+"</b></div>"
}var y=document.createElement("div");
y.className="cl";
u.appendChild(v);
u.appendChild(z);
u.appendChild(y);
x.appendChild(u)
}}var AB=document.createElement("div");
AB.setAttribute("id","aolQuizTabMQSearch");
AB.innerHTML='<a href="/user-quizzes" class="btnG browserQ" target="_blank">Browse All Quizzes</a><form class="tabMQSearch" action="/user-quizzes/hub" name="search" method="get"><input type="text" name="q" onfocus="this.value=\'\'" value="Search Quizzes" size="20" class="quizSearchInput"/><input type="image" src="'+IMAGE_URL+'/btn_submit.gif" style="vertical-align:middle" onclick="this.form.submit()"/></form>';
t.appendChild(x);
t.appendChild(AB)
}function A(w){stopDefaultEvent(w?w:window.event);
var x=$$("aolQuizEndCard");
while(x.childNodes.length>=2){x.removeChild(x.lastChild)
}var v=x.firstChild.firstChild.nextSibling.childNodes;
for(var u=0;
u<v.length;
u++){v[u].className=""
}v[2].className="on";
var t=document.createElement("div");
t.setAttribute("id","aolQuizTabShare");
var s='<form class="dm_form" id="sendmail_form"><div id="errorMessage">&nbsp;</div><div class="form_wrapper"><fieldset><label class="w100 inputselect" for="to">';
s+='<span class="wrapper"><span class="title">To:</span><input class="field" onfocus="this.value=\'\'" id="sendmail_to" name="sendmail_to" value="Enter your friend\'s email address" type="text"></span>';
s+='</label><div class="cl"></div>';
s+='<label class="w100 inputselect" for="subject">';
s+='<span class="wrapper"><span class="title">Subject:</span><input class="field" id="sendmail_subject" name="sendmail_subject" type="text"></span>';
s+='</label><div class="cl"></div>';
s+='<label class="w100 inputselect" for="message">';
s+='<span class="wrapper"><span class="title">Personal Message:</span><textarea class="field" id="sendmail_body" name="sendmail_body" rows="4"></textarea></span>';
s+='</label><div class="cl"></div></fieldset>';
s+='</div><div id="captcha">&nbsp;</div>';
s+='<input type="submit" name="submitBtn" value="Send" class="btnG send"/> <input type="reset" name="resetBtn" value="Clear" class="btnG send"/><br/></form>';
t.innerHTML=s;
x.appendChild(t);
var y=new AOLSendMail("sendmail_form");
y.onError(function(z){if(z.error!="CAPTCHA_RESPONSE"){alert("There was a problem sending email. Please try again later")
}else{alert("Please try typing in the correct letters that appear in the image")
}});
y.onMessageSent(function(){t.innerHTML="Message sent successfully."
});
y.setDataToAppend('<br><br><a href="'+K.url+'">'+K.title+"</a>")
}function Q(w){stopDefaultEvent(w?w:window.event);
var x=$$("aolQuizEndCard");
while(x.childNodes.length>=2){x.removeChild(x.lastChild)
}var v=x.firstChild.firstChild.nextSibling.childNodes;
for(var u=0;
u<v.length;
u++){v[u].className=""
}v[3].className="on";
var t=document.createElement("div");
t.setAttribute("id","aolQuizTabSnag");
var s='<form class="dm_form"><div class="form_wrapper">';
s+='<fieldset><label class="w100 inputselect" for="message"><span class="wrapper"><span class="title">To embed tdhis quiz copy the code below and paste into your web site:</span><textarea class="field" id="message" rows="8"><div><object class="43423432432"><font style=">.dasdsas".....</textarea></span></label><div class="cl"></div></fieldset>';
s+="</div></form>";
s+='<a href="#" class="btnG copy">Copy</a>';
t.innerHTML=s;
x.appendChild(t)
}function Z(){var s=$$("aolQuizEndCard");
while(s.childNodes.length>=2){s.removeChild(s.lastChild)
}var AC=s.firstChild.firstChild.nextSibling.childNodes;
for(var y=0;
y<AC.length;
y++){AC[y].className=""
}AC[3].className="on";
var x=document.createElement("div");
x.setAttribute("id","aolQuizTabInfo");
var z=document.createElement("div");
z.setAttribute("id","aolQuizTabInfoIntro");
z.innerHTML='<span class="bold">About This Quiz</span><br>'+K.getDescription();
var t=document.createElement("div");
t.className="mImg";
t.innerHTML='<img src="'+K.authorPhoto+'" alt="User Photo" width="60" height="60" border="0">';
var AH=document.createElement("div");
AH.className="mInfo";
AH.innerHTML='<span class="mName">Quiz Updated On: </span>'+K.updatedOn;
var v=document.createElement("div");
v.className="mInfo";
v.innerHTML='<span class="mName">Times This Quiz Has Been Taken: </span>'+K.takenCount;
var w=document.createElement("div");
w.className="mInfo";
w.innerHTML='<span class="mName">Average Difficulty: </span>'+K.difficulty;
var AE=document.createElement("div");
AE.className="mInfo";
AE.innerHTML='<span class="mName">Highest Score: </span>'+K.highestScore+" by "+K.highestUser;
var AA=document.createElement("div");
AA.className="mInfo";
var AB=document.createElement("div");
AB.innerHTML='<span class="mName"><a href="/user-quizzes/quizzard/'+K.author+'">'+K.author+"</a></span>";
AA.appendChild(AB);
var AG=document.createElement("div");
AG.className="mInfo";
AG.innerHTML='<span class="mName">Total Quizzes Made: </span>'+K.userStat.quizzesMade;
AA.appendChild(AG);
var AF=document.createElement("div");
AF.className="mInfo";
AF.innerHTML='<span class="mName">Total Quizzes Taken: </span>'+K.userStat.quizzesTaken;
AA.appendChild(AF);
var u=document.createElement("div");
u.innerHTML='<br/><br/><span class="bold">About This Quizzard</span>';
var AD=document.createElement("div");
AD.className="cl";
x.appendChild(z);
x.appendChild(AH);
x.appendChild(v);
x.appendChild(w);
x.appendChild(AE);
x.appendChild(AD);
x.appendChild(u);
x.appendChild(t);
x.appendChild(AA);
x.appendChild(AD);
s.appendChild(x)
}function V(AE){stopDefaultEvent(AE?AE:window.event);
if(W){o();
M();
return 
}var v=$$("aolQuestionContainer");
v.style.display="";
var AL=$$("aolQuizEndCard");
AL.style.display="none";
var y=$$("aolQuizBot");
if(y!=null){y.lastChild.previousSibling.className="btnG menu"
}while(v.hasChildNodes()){v.removeChild(v.lastChild)
}var AD=$$("aolQuizBtnMenu");
if(AD!=null){AD.style.display=""
}var t=K.getCurrentQuestion();
var z=document.createElement("div");
z.className="cl";
var AA=document.createElement("div");
AA.setAttribute("id","question");
var AB=null;
if(t.image){AA.style.width="290px";
AB=document.createElement("div");
AB.setAttribute("id","quizImgArea");
AB.innerHTML='<div class="quizImg"><img src="'+t.image+'" alt="Image Question" border="0"/><br /></div>'
}var AI=document.createElement("div");
AI.setAttribute("id","aolQuestionIndexSec");
AI.innerHTML="Question "+(K.getCurrentIndex()+1)+" ";
var w=document.createElement("span");
w.setAttribute("id","aolQuestionIndex");
var AJ=document.createElement("span");
AJ.setAttribute("id","aolQuestionTotal");
AJ.innerHTML="of "+K.getTotalQuestions();
AI.appendChild(w);
AI.appendChild(AJ);
AA.appendChild(AI);
if(AB){v.appendChild(AB)
}v.appendChild(AA);
v.appendChild(z);
var x=document.createElement("h4");
x.innerHTML=t.text;
AA.appendChild(x);
if(t.type=="MULTIPLE"){for(var AK in t.answers){var u=document.createElement("a");
u.setAttribute("href","#");
u.setAttribute("id",t.answers[AK].id);
u.setAttribute("name","aolQuizUserAnswer");
u.className="awHighlight";
var AH=document.createElement("span");
AH.className="number";
AH.innerHTML=parseInt(AK)+1;
var AC=document.createTextNode(t.answers[AK].text);
var s=document.createElement("span");
s.className="awText";
s.appendChild(AC);
addEventSimple(u,"click",G.onUserAnswer);
u.appendChild(AH);
u.appendChild(s);
AA.appendChild(u)
}}else{if(t.type=="BOOLEAN"){for(var AF=1;
AF>=0;
AF--){var u=document.createElement("a");
u.setAttribute("href","#");
u.setAttribute("id",AF);
u.setAttribute("name","aolQuizUserAnswer");
u.className="awHighlight";
var AH=document.createElement("span");
AH.className="number";
var s=document.createElement("span");
s.className="awText";
if(AF=="1"){AH.innerHTML="T";
s.innerHTML="True"
}else{AH.innerHTML="F";
s.innerHTML="False"
}addEventSimple(u,"click",G.onUserAnswer);
u.appendChild(AH);
u.appendChild(s);
AA.appendChild(u)
}}}if(AB){var AG=AA.childNodes.length-2;
for(var AF=0;
AF<AG;
AF++){AA.childNodes[AF+2].lastChild.style.width="220px"
}}}this.setLeaderboard=function(s){a=s
};
function N(){G.startDate=new Date(new Date().getTime()+61000);
G.timerID=setInterval(J,50)
}function S(){clearInterval(G.timerID)
}function h(){if(G.startDate){var s=new Date();
var u=G.startDate.getTime()-s.getTime();
if(u<0){u=0;
S()
}var t=new Date();
t.setTime(u);
return t
}else{var t=new Date();
t.setTime(0);
return t
}}function J(){var s=h();
var t=s.getMinutes()*60+s.getSeconds();
G.quizTimer.innerHTML=(t<10?"0"+t:t)
}}function AOLQuizLeaderboard(K,B,N){var F=null;
var I=new AOLQuizAjax();
var C=null;
var J=null;
var O=this;
var E=false;
var H=N!=null?N:true;
var L=(B!=null?B:getQueryVariable("quiz-id"));
var G="week";
this.forceTimeframe=false;
if(H){addEventSimple(window,"load",M)
}this.getTimeframe=function(){return G
};
this.show=function(){M()
};
this.remove=function(){while(F.childNodes.length>0){F.removeChild(F.lastChild)
}};
this.refresh=function(){O.show()
};
this.changeTimeframe=function(P){G=P;
O.refresh()
};
var D=function(Q,P){Q.leaderboard=this;
addEventSimple(Q,"click",function(R){stopDefaultEvent(R);
O.forceTimeframe=true;
leaderboard.changeTimeframe(P)
})
};
function M(){loadQuizCSS();
F=$$(K);
if(F){if(L!=null){I.getLeaderboard(L,A,G)
}else{I.getOverallLeaderboard(A)
}}}function A(g){if(!O.forceTimeframe&&g.length==0&&O.getTimeframe()!="all"){if(O.getTimeframe()=="week"){O.changeTimeframe("month")
}else{if(O.getTimeframe()=="month"){O.changeTimeframe("all")
}}}else{O.remove();
F.className="leaderboard rightRailModule";
var e=document.createElement("a");
e.className="snag";
e.setAttribute("href","#");
var X=document.createElement("img");
X.setAttribute("src",IMAGE_URL+"/icon_snag.gif");
X.setAttribute("alt","snag");
e.appendChild(X);
var Q=document.createElement("h3");
if(L==null){Q.innerHTML="Overall Leader Boards"
}else{Q.innerHTML="Leader Board for this Quiz"
}F.appendChild(Q);
var U=document.createElement("div");
U.className="nav";
var b=document.createElement("a");
b.setAttribute("href","#");
if(G=="week"){b.className="on"
}b.innerHTML="This Week";
D(b,"week");
U.appendChild(b);
var a=document.createElement("span");
a.className="divider";
a.innerHTML="|";
U.appendChild(a);
var k=document.createElement("a");
k.setAttribute("href","#");
if(G=="month"){k.className="on"
}k.innerHTML="This Month";
D(k,"month");
U.appendChild(k);
a=document.createElement("span");
a.className="divider";
a.innerHTML="|";
U.appendChild(a);
var R=document.createElement("a");
R.setAttribute("href","#");
if(G=="all"){R.className="on"
}R.innerHTML="All Time";
D(R,"all");
U.appendChild(R);
F.appendChild(U);
var m=document.createElement("br");
m.setAttribute("style","clear: both");
F.appendChild(m);
if(O.getTimeframe()=="all"&&g.length==0){var T=document.createElement("p");
T.className="empty";
T.innerHTML="Nobody has taken this quiz yet. Try it now for a shot at making the leaderboard!";
F.appendChild(T)
}for(var d=0;
d<g.length;
d++){var j=document.createElement("div");
if(d==0){j.className="item first"
}else{j.className="item"
}if(d%2==0){j.className=j.className+" alt"
}var f=document.createElement("div");
f.className="rank";
f.innerHTML=(d+1);
j.appendChild(f);
var W=document.createElement("div");
W.className="image firstOnly";
var Y=document.createElement("img");
Y.setAttribute("src",g[d].photo);
Y.setAttribute("alt","User Image");
Y.setAttribute("width","60");
Y.setAttribute("height","60");
W.appendChild(Y);
j.appendChild(W);
var n=document.createElement("div");
n.className="user";
var P=document.createElement("p");
var V=document.createElement("a");
V.setAttribute("href","/user-quizzes/quizzard/"+g[d].user);
V.className="name";
V.innerHTML=g[d].user;
P.appendChild(V);
m=document.createElement("div");
m.className="clearBlock firstOnly";
m.innerHTML="<!-- -->";
P.appendChild(m);
var h=document.createElement("img");
h.setAttribute("src",IMAGE_URL+"/icon_aim.gif");
h.setAttribute("alt","AIM");
h=document.createElement("img");
h.setAttribute("src",IMAGE_URL+"/icon_onTv.gif");
h.setAttribute("alt","On Television");
n.appendChild(P);
userP2=document.createElement("p");
userP2.innerHTML="Quizzes Taken: "+g[d].quizzesTaken;
P.appendChild(userP2);
j.appendChild(n);
var l=document.createElement("div");
l.className="stats";
var c=document.createElement("p");
c.innerHTML=g[d].formattedScore;
l.appendChild(c);
var S=document.createElement("p");
S.className="firstOnly";
var Z=document.createElement("img");
Z.setAttribute("src",IMAGE_URL+"/img_num1.gif");
Z.setAttribute("alt","Number One");
S.appendChild(Z);
j.appendChild(S);
l.appendChild(S);
j.appendChild(l);
m=document.createElement("div");
m.className="clearBlock";
m.innerHTML="<!-- -->";
j.appendChild(m);
F.appendChild(j)
}}}}function AOLQuizComments(G,B,I){var C=null;
var F=null;
var J=this;
var D=false;
var E=I!=null?I:true;
this.quizId=(B!=null?B:getQueryVariable("quiz-id"));
this.ajax=new AOLQuizAjax();
this.quizContainer=null;
this.commentsPerPage=24;
this.thisPage=1;
if(E){addEventSimple(window,"load",H)
}this.show=function(){H()
};
this.remove=function(){while(J.quizContainer.childNodes.length>0){J.quizContainer.removeChild(J.quizContainer.lastChild)
}};
this.refresh=function(){J.show()
};
this.changePage=function(K){J.thisPage=parseInt(K);
J.refresh()
};
function H(){loadQuizCSS();
J.quizContainer=$$(G);
if(J.quizContainer){start=(J.thisPage-1)*J.commentsPerPage;
J.ajax.getComments(J.quizId,start,J.commentsPerPage,A)
}}function A(S){totalAvailable=S.totalAvailable;
totalPages=Math.ceil(totalAvailable/J.commentsPerPage);
if(totalPages==0){totalPages=1
}startPage=Math.max(1,Math.min(totalPages-4,J.thisPage-2));
endPage=Math.min(totalPages,Math.max(5,J.thisPage+2));
S=S.items;
J.remove();
J.quizContainer.className="module moduleWide quizComments";
var e=document.createElement("a");
e.className="snag";
e.setAttribute("href","#addComment");
e.innerHTML="Add Your Own Comments";
addEventSimple(e,"click",function(m){stopDefaultEvent(m);
var l=document.getElementById("addComment");
if(l){window.scroll(0,l.offsetTop)
}});
J.quizContainer.appendChild(e);
var O=document.createElement("h3");
O.innerHTML="Recent Comments";
J.quizContainer.appendChild(O);
for(var d=0;
d<S.length;
d++){var h=document.createElement("div");
h.className="item";
var f=document.createElement("div");
f.className="avatar";
var k=document.createElement("img");
k.setAttribute("src",S[d].photo);
k.setAttribute("width","48");
k.setAttribute("height","48");
f.appendChild(k);
h.appendChild(f);
var b=document.createElement("div");
b.className="content";
var N=document.createElement("b");
N.className="username";
N.innerHTML=S[d].author;
b.appendChild(N);
var P=document.createElement("span");
P.className="time";
P.innerHTML=S[d].timestamp;
b.appendChild(P);
var c=document.createElement("p");
c.innerHTML=S[d].text;
b.appendChild(c);
h.appendChild(b);
var j=document.createElement("div");
j.className="clearBlock";
j.innerHTML="<!-- -->";
h.appendChild(j);
J.quizContainer.appendChild(h)
}var W=document.createElement("div");
W.setAttribute("id","hubPages");
var g=document.createElement("info");
g.className="info";
g.innerHTML="Total of "+totalAvailable+" comment(s)";
W.appendChild(g);
var L=document.createElement("div");
L.className="arrow";
if(J.thisPage!=totalPages){var R=document.createElement("a");
R.setAttribute("href","#");
R.innerHTML="Next &raquo;";
addEventSimple(R,"click",function(m){var l=m.target?m.target:m.srcElement;
stopDefaultEvent(m);
J.changePage(parseInt(J.thisPage)+1)
});
L.appendChild(R)
}else{L.innerHTML="Next &raquo;"
}W.appendChild(L);
var T=document.createElement("div");
T.className="pages";
for(var d=startPage;
d<=endPage;
d++){var R=document.createElement("a");
R.setAttribute("href","#");
if(d==(J.thisPage)){R.className="on"
}R.innerHTML=d;
R.parentObj=J;
addEventSimple(R,"click",function(m){var l=m.target?m.target:m.srcElement;
stopDefaultEvent(m);
J.changePage(parseInt(l.innerHTML))
});
T.appendChild(R)
}W.appendChild(T);
var M=document.createElement("div");
M.className="arrow";
if(J.thisPage!=1){var R=document.createElement("a");
R.setAttribute("href","#");
R.innerHTML="&laquo; Prev";
addEventSimple(R,"click",function(m){var l=m.target?m.target:m.srcElement;
stopDefaultEvent(m);
J.changePage(parseInt(J.thisPage)-1)
});
M.appendChild(R)
}else{M.innerHTML="&laquo; Prev"
}W.appendChild(M);
var j=document.createElement("div");
j.className="clearBlock";
j.innerHTML="<!-- -->";
W.appendChild(j);
J.quizContainer.appendChild(W);
var c=document.createElement("div");
c.className="post";
var Q=document.createElement("a");
Q.setAttribute("id","addComment");
c.appendChild(Q);
var Y=document.createElement("textarea");
Y.setAttribute("title","Type your own comment here");
Y.setAttribute("rows",4);
Y.setAttribute("cols",75);
Y.setAttribute("id","commentTextarea");
addInputDefaultHandlers(Y);
c.appendChild(Y);
J.quizContainer.appendChild(c);
var V=document.createElement("div");
V.className="notes";
var Z=document.createElement("a");
Z.className="button";
Z.setAttribute("href","#");
Z.innerHTML="Clear";
Z.textarea=Y;
addEventSimple(Z,"click",function(m){var l=m.target?m.target:m.srcElement;
stopDefaultEvent(m);
l.textarea.value=""
});
V.appendChild(Z);
var X=document.createElement("a");
X.className="button";
X.setAttribute("href","#");
X.innerHTML="Add";
addEventSimple(X,"click",J.addCommentHandler);
V.appendChild(X);
var a=document.createElement("span");
a.className="errorMessage";
a.setAttribute("id","quizCommentsError");
V.appendChild(a);
var K=document.createElement("a");
K.setAttribute("href","#");
K.innerHTML="Tips on commenting";
addEventSimple(K,"mouseover",function(l){stopDefaultEvent(l);
$$("commentTips").style.display="block"
});
addEventSimple(K,"mouseout",function(l){stopDefaultEvent(l);
$$("commentTips").style.display="none"
});
V.appendChild(K);
var U=document.createElement("div");
U.setAttribute("id","commentTips");
U.className="tipBlock";
U.innerHTML="<p>- Enter your comments as plain text &mdash; the input form will remember line breaks, but will remove any html formatting to keep all comments uniform.</p><p>-Play nice, and be respectful of other people's comments &mdash; there are many different types of people and opinions in our community!</p>";
V.appendChild(U);
var j=document.createElement("br");
V.appendChild(j);
var j=document.createElement("br");
j.setAttribute("style","clear: both");
V.appendChild(j);
J.quizContainer.appendChild(V)
}this.addCommentHandler=function(K){stopDefaultEvent(K);
if($$("commentTextarea").value!=$$("commentTextarea").title){J.ajax.addComment(J.quizId,"",$$("commentTextarea").value,J.addCommentCallback)
}};
this.addCommentCallback=function(K){if(K.hasError){$$("quizCommentsError").innerHTML=K.message
}else{A(K)
}}
}function AOLQuizScoreAnimator(B,E,D,C,A){setTimeout(function(){B.innerHTML=E;
B.style.backgroundPosition=A?"0 -1588px":"0 -1546px";
setTimeout(function(){B.innerHTML=D;
B.style.backgroundPosition=A?"0 -1588px":"0 -1546px";
setTimeout(function(){B.innerHTML=C;
B.style.backgroundPosition="0 -1502px"
},1500)
},1500)
},0)
}function AOLQuizRating(C,A){var D=this;
var B=false;
this.ajax=new AOLQuizAjax();
this.ratingContainer=null;
this.defaultRating=0;
this.userRating=-1;
A.addQuizLoadedCallback(function(F){E()
});
function E(){D.ratingContainer=$$(C);
loadQuizCSS();
var K=document.createElement("b");
K.setAttribute("id","rating-desc");
K.innerHTML="AVG User Rating";
D.ratingContainer.appendChild(K);
var I=document.createElement("ul");
I.className="rating";
for(var H=0;
H<5;
H++){var F=document.createElement("li");
var J=document.createElement("a");
J.setAttribute("href","#");
J.setAttribute("id","rate-"+(H+1));
addEventSimple(J,"mouseover",D.rateHover);
addEventSimple(J,"mouseout",D.rateOut);
addEventSimple(J,"click",D.rateStar);
F.appendChild(J);
I.appendChild(F)
}D.ratingContainer.appendChild(I);
var G=document.createElement("b");
G.setAttribute("id","rating-error");
G.className="error";
D.ratingContainer.appendChild(G);
D.ajax.getRatingForUser(A.getQuiz().id,D.getRatingCallback);
D.setDefaultRating(D.convertRating(A.getQuiz().rating));
D.rateOut()
}this.convertRating=function(F){return Math.ceil(F>=20?F/20:F)
};
this.getRatingCallback=function(F){if(!F.hasError&&F.rating>-1){D.setUserRating(D.convertRating(F.rating))
}};
this.getLevelFromId=function(F){return parseInt(F.substring(5,6))
};
this.rateHover=function(G){var F=G.target?G.target:G.srcElement;
var H=D.getLevelFromId(F.id);
if(D.userRating==-1){$$("rating-desc").innerHTML="Choose Your Rating";
for(i=1;
i<=5;
i++){if(i<=H){$$("rate-"+i).className="ratingHover"
}else{$$("rate-"+i).className=""
}}}};
this.rateOut=function(){if(D.userRating==-1){$$("rating-desc").innerHTML="AVG User Rating";
for(i=1;
i<=5;
i++){if(i<=D.defaultRating){$$("rate-"+i).className="ratingDefault"
}else{$$("rate-"+i).className=""
}}}};
this.rateStar=function(G){stopDefaultEvent(G);
var F=G.target?G.target:G.srcElement;
$$("rating-error").innerHTML="";
var H=D.getLevelFromId(F.id);
if(D.userRating==-1){D.setUserRating(H);
D.ajax.addRating(A.getQuiz().id,H,D.addRatingCallback)
}};
this.addRatingCallback=function(F){if(F.hasError){$$("rating-error").innerHTML="Please login to rate quizzes.";
D.userRating=-1;
D.rateOut()
}};
this.setDefaultRating=function(F){D.defaultRating=F
};
this.setUserRating=function(F){D.userRating=F;
$$("rating-desc").innerHTML="Your Rating";
for(i=1;
i<=5;
i++){if(i<=D.userRating){$$("rate-"+i).className="ratingHover"
}else{$$("rate-"+i).className=""
}}}
}if(typeof addInputDefaultHandlers!="function"){var addInputDefaultHandlers=function(A){if(A.value.replace(/^\s+|\s+$/g,"")==""){A.value=A.title
}addEventSimple(A,"focus",function(B){var C=B.target?B.target:B.srcElement;
if(C.value==C.title){C.value=""
}});
addEventSimple(A,"blur",function(B){var C=B.target?B.target:B.srcElement;
if(C.value.replace(/^\s+|\s+$/g,"")==""){C.value=C.title
}})
}
}if(typeof addEventSimple!="function"){var addEventSimple=function(C,A,B){if(C.addEventListener){C.addEventListener(A,B,false)
}else{if(C.attachEvent){C.attachEvent("on"+A,B)
}}}
}if(typeof removeEventSimple!="function"){var removeEventSimple=function(C,A,B){if(C.removeEventListener){C.removeEventListener(A,B,false)
}else{if(C.detachEvent){C.detachEvent("on"+A,B)
}}if(A=="click"&&C.href!="javascript:void(0)"){C.setAttribute("href","javascript:void(0)")
}}
}if(typeof stopDefaultEvent!="function"){var stopDefaultEvent=function(A){if(A){if(A.preventDefault){A.preventDefault();
A.stopPropagation()
}else{A.returnValue=false;
A.cancelBubble=true
}}}
}if(typeof $$!="function"){var $$=function(A){if(typeof A=="string"){return document.getElementById(A)
}else{return A
}}
}if(typeof getQueryVariable!="function"){var getQueryVariable=function(A){var C=window.location.search.substring(1);
var D=C.split("&");
for(var B=0;
B<D.length;
B++){var E=D[B].split("=");
if(E[0]==A){return E[1]
}}return""
}
}if(typeof loadQuizCSS!="function"){var loadQuizCSS=function(){var A=document.getElementsByTagName("head")[0];
var C=A.getElementsByTagName("link");
var B=false;
var F=false;
var E=false;
for(var G=0;
G<C.length;
G++){if(C[G].href.indexOf("quiz_module_layout.css")>=0){B=true
}if(C[G].href.indexOf("quiz_module_skin.css")>=0){F=true
}if(C[G].href.indexOf("quiz_module.css")>=0){E=true
}}if(!E){var D=document.createElement("link");
D.href=CDN_HOST+"/css/quiz_module.css";
D.type="text/css";
D.rel="stylesheet";
D.rev="stylesheet";
A.appendChild(D)
}}
};
