Btv.Templating.Register([{id:"Quiz.MainModule",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');
function View(d)
{
var oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
var blnWaitingCallback = false;
var fncRetry;
oThis.onNextQuestion = new YAHOO.util.CustomEvent("onNextQuestion");
oThis.aSegments = [
{id:"tv", label:"TV&nbsp;Shows", value:2}
,{id:"movie", label:"Movies", value:19}
,{id:"all", label:"Both", value:-1}
];
function DataChangeHandler()
{
function Next()
{
oThis.UpdateTemplates();
oThis.onNextQuestion.fire();
}
if (!blnWaitingCallback) return;
blnWaitingCallback = false;
Btv.Ads.Change(undefined, undefined, true);
var oData = d.DataSupplier.GetData();
var iStarPoints;
if (oData)
{
var oUser = Btv.User.GetUser();
if (oUser)
{
oUser.StarPoints = oData.StarPoints;
Btv.User.LoadHeader();
} 
SetData(oData);
Next();
}
else
{
if (fncRetry) fncRetry();
}
}
d.DataSupplier.onDataChanged.subscribe(DataChangeHandler);
var iCurrentStreak = d.CurrentStreak || 0;
var iBestStreak = d.BestStreak || 0;
var aiInitialQuestionIds, iFirstQuestion;
var iCurrentQuestionIndex = 0;
var iCategoryID = d.CategoryID || -1;
var iCategoryScopeID = d.CategoryScopeID || -1;
var blnChangedContext = true;
var aiBlockedShows = [];
function SetData(oTriviaData)
{
if (blnChangedContext)
{
aiInitialQuestionIds = oTriviaData.InitialQuestionIds;
iFirstQuestion = oTriviaData.NextQuestion.ID;
blnChangedContext = false;
}
Btv.Url.State.SetQueryString(Btv.Trivia.BuildTriviaQS(oTriviaData.NextQuestion.ID, iCategoryID, iCategoryScopeID));
oThis.oCurrentQuestion = oTriviaData.NextQuestion;
oThis.oQuestionSubmittedBy = oTriviaData.NextQuestion.Submitter;
oThis.oLastQuestion = oTriviaData.LastQuestion;
oThis.oLastQuestion.CurrentStreak = iCurrentStreak = (oTriviaData.LastQuestion.IsCorrectAnswer ? (iCurrentStreak + 1) : 0);
oThis.oLastQuestion.BestStreak = iBestStreak = (iCurrentStreak > iBestStreak) ? iCurrentStreak : iBestStreak;
SetDifferentCategoryRegion($(oThis.htIds['differentCategoryRegion']));
}
SetData(d.DataSupplier.GetData());
function GetBonusPoints()
{
var iPotentialStreak = (iCurrentStreak % 7) + 1;
switch (iPotentialStreak)
{
case 3:
return(500);
case 7:
return(1000);
}
return (0);
}
function NextQuestion(type, args)
{
function Timeout()
{
if (blnWaitingCallback && (iCount < 5) && (iAsyncID_local == iAsyncID))
{
Btv.Logging.LoggingQueries.LogData(1000, document.location.href.substr(0, 128), strLogMessage.substr(0, 128));
iTimeout = Math.min(Math.round(iTimeout * 1.5), 30);
Run();
}
}
function Run()
{
if (iCount < 5)
{
iCount++;
Go();
setTimeout(Timeout, iTimeout);
} 
}
function Go()
{
var p_aiInitialQuestionIds = args ? aiInitialQuestionIds : [];
var p_iFirstQuestion = args ? iFirstQuestion : -1;
var p_oCurrentQuestionID = args ? oThis.oCurrentQuestion.ID : -1;
var p_answerID = args ? args[0] : -1;
var p_bonusPoints = args ? (args[1] + GetBonusPoints()) : -1;
var p_iAdjCurrentStreak = iCurrentStreak % 7;
strLogMessage = $F('{0}:{1}:{2}:{3}:{4}:{5}:{6}:{7}:{8}$',
iCategoryID,
iCategoryScopeID,
iFirstQuestion,
p_oCurrentQuestionID,
p_answerID,
p_bonusPoints,
p_iAdjCurrentStreak,
p_aiInitialQuestionIds.join(','),
aiBlockedShows.join(',')
);
blnChangedContext = !args;
blnWaitingCallback = true;
d.DataSupplier.Invoke(
iCategoryID,
iCategoryScopeID,
-1,
aiBlockedShows,
p_aiInitialQuestionIds,
p_iFirstQuestion,
p_oCurrentQuestionID,
p_answerID,
p_bonusPoints,
p_iAdjCurrentStreak
);
}
var strLogMessage;
iAsyncID++;
var iAsyncID_local = iAsyncID;
var iCount = 0;
var iTimeout = 5000;
fncRetry = Run;
Run();
}
var iAsyncID = 0;
function BlockShow(type, args)
{
aiBlockedShows.push(args[0]);
NextQuestion();
}
oThis.TemplateInit = function(id, oTemplate)
{
switch(id)
{
case "currentQuestion":
oTemplate.onSubmitAnswer.subscribe(NextQuestion);
oTemplate.onBlockShow.subscribe(BlockShow);
break;
}
}
oThis.TemplateState = function(id)
{
switch(id)
{
case "currentQuestion":
return(oThis.oCurrentQuestion);
break;
case "lastQuestion":
return({oLastQuestion:oThis.oLastQuestion, fncRate:d.fncRate});
break;
case "questionSubmittedBy":
return({oQuestionSubmittedBy:oThis.oQuestionSubmittedBy, fncWink:d.fncWink});
break;
}
}
oThis.CategoryOptions = new function()
{
var oOptions = this;
var htSets = {};
var aOptions = [];
for (var i=0; i < d.Categories.length; i++)
{
aOptions[i] = ['<option value="', d.Categories[i].ID, '">', d.Categories[i].Title, '</option>'].join('');
if (iCategoryID == d.Categories[i].ID) aOptions[i];
}
oOptions.GetOptionsHTML = function()
{ 
if (!htSets[iCategoryScopeID])
{
var a = ['<option>All Shows</option>'];
for (var i=0; i < aOptions.length; i++)
{
if ((iCategoryScopeID == -1) || (iCategoryScopeID == d.Categories[i].ScopeID))
{
a.push(aOptions[i]);
}
}
//htSets[iCategoryScopeID] = a.join('');
htSets[iCategoryScopeID] = $F('<select onchange="{0}()">{1}</select>', strCategorySelected, a.join(''))
}
return(htSets[iCategoryScopeID]);
}
var blnSuppress = false;
oOptions.ChangeList = function(iScopeID)
{
blnDoInit = false;
iCategoryScopeID = iScopeID;
iCategoryID = -1;
blnSuppress = true;
var s = oOptions.GetOptionsHTML();
$(oThis.htIds.selectCategories).innerHTML = s;
NextQuestion();
blnSuppress = false;
}
oOptions.strChangeList = $R(oOptions.ChangeList);
oOptions.CategorySelected = function()
{
if (blnSuppress) return;
blnDoInit = false;
var options = $(oThis.htIds.selectCategories).childNodes[0].options;
for (var i=0; i < options.length; i++)
{
if (options[i].selected)
{
iCategoryID = options[i].value;
}
}
NextQuestion();
}
oOptions.InitDropDown = function()
{
if (blnDoInit)
{
var options = $(oThis.htIds.selectCategories).childNodes[0].options;
for (var i=0; i < options.length; i++)
{
if (options[i].value == iCategoryID)
{
options[i].selected = true;
}
}
}
}
var strCategorySelected = $R(oOptions.CategorySelected);
var blnDoInit = true;
}
function SetDifferentCategoryRegion(el)
{
if (!el) return;
var blnDifferent = ((iCategoryID != -1) && (iCategoryID != oThis.oCurrentQuestion.CategoryID));
el.style.display = blnDifferent ? 'block' : 'none';
}
oThis.ElementProps = function(id, scope, name, isInit, params, ht)
{
switch(scope)
{
case "segment":
if (iCategoryScopeID == params) ht.attr.checked = 1;
if (isInit) ht.attr.onclick = $F('{0}({1})', oThis.CategoryOptions.strChangeList, params);
break;
case "selectCategories":
if (isInit)
{
ht.innerHTML = oThis.CategoryOptions.GetOptionsHTML();
YAHOO.util.Event.onAvailable(oThis.htIds.selectCategories, oThis.CategoryOptions.InitDropDown);
}
break;
case "differentCategoryRegion":
SetDifferentCategoryRegion(ht);
break;
}
}
Btv.Cst.Registrar.Set('TriviaModule', oThis);
} 
_write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<DIV class=\"add_new_quiz_button\">\n<DIV>\n');var seg;if(o.aSegments  instanceof Array) {for(var seg_index=0; seg_index<o.aSegments .length; seg_index++) {seg = o.aSegments [seg_index];_write(' \n<LABEL><INPUT ');_write(o.Elem('segment.' + seg.id, seg.value));_write(' name=\"radioSegmentGroup\" type=\"radio\" />');_write(seg.label);_write('</LABEL> \n');}} else {for (var seg_index in o.aSegments ) {seg = o.aSegments [seg_index];_write(' \n<LABEL><INPUT ');_write(o.Elem('segment.' + seg.id, seg.value));_write(' name=\"radioSegmentGroup\" type=\"radio\" />');_write(seg.label);_write('</LABEL> \n');}}_write(' \n</DIV>\n<DIV>\nQuestions From: <span ');_write(o.Elem('selectCategories'));_write('>');_write(o.InnerHTML());_write('</span>\n</DIV>\n</DIV>\n<h1>Trivia</h1>\n<DIV class=\"show_page2_module\">\n<DIV class=\"show_page2_module_body\">\n<DIV ');_write(o.Elem('differentCategoryRegion'));_write(' class=\"yellow-module\" style=\"MARGIN: 2px 5px 15px 0px; ');_write(o.Style());_write('\">\n<DIV class=\"yellow-module-top\"><DIV class=\"yellow-module-top-c\"></DIV></DIV>\n<DIV class=\"yellow-module-body\" style=\"text-align:center;\">You have answered all the questions from this show, but keep playing!</div>\n<DIV style=\"CLEAR: both\"></DIV>\n<DIV class=\"yellow-module-bottom\"><DIV class=\"yellow-module-bottom-c\"></DIV></DIV>\n</DIV>\n<div class=\"yellow-module trivia-main-play\">\n<div class=\"yellow-module-top\"><div class=\"yellow-module-top-c\"></div></div>\n<div class=\"yellow-module-body\">\n<DIV class=\"btv_quiz_game_right\">\n');_write(o.RunTemplate('currentQuestion', 'Quiz.Question'));_write('\n</DIV>\n<DIV class=\"btv_quiz_game_left\">\n');_write(o.RunTemplate('lastQuestion', 'Quiz.LastQuestionResults'));_write('\n');_write(o.RunTemplate('questionSubmittedBy', 'Quiz.QuestionSubmittedBy'));_write('\n</DIV>\n<DIV style=\"CLEAR: both\"></DIV>\n</div>\n<div class=\"yellow-module-bottom\"><div class=\"yellow-module-bottom-c\"></div></div>\n</div>\n</DIV>\n</DIV>\n');;return($text.join(""));};_write('\n');_write(Main(new View($data)));_write('\n');}return $text.join("");}},{id:"Quiz.LastQuestionResults",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');
function View(d)
{
var oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
var blnCanRate = true;
oThis.SetState = function(d_)
{
d = d_;
blnCanRate = true;
oThis.UpdateElements();
}
function GetDifficultylabel(flPercent)
{
if (flPercent > 70)
{
return('easy');
}
else if (flPercent > 40)
{
return('medium');
}
else
{
return('hard');
}
}
function RateQuestion(i)
{
if (!blnCanRate) return;
if (Btv.Auth.Login('Rate Trivia Question.', 'To rate a trivia question, register now for BuddyTV.<br/>It\'s fast and free.'))
{
d.fncRate(d.oLastQuestion.ID, i, function(){});
d.oLastQuestion[(i > 0) ? 'PositiveRatingCount' : 'NegativeRatingCount']++;
oThis.UpdateElement('lastQuestionRating');
blnCanRate = false;
}
}
strRateQuestion = $R(RateQuestion);
oThis.ElementProps = function(id, scope, name, isInit, params, ht)
{
switch(scope)
{
case "divMain":
ht.style.display = (d.oLastQuestion.ID == -1) ? 'none' : 'block';
break;
case "imgLastQuestionBadge":
ht.attr.alt = d.oLastQuestion.IsCorrectAnswer ? 'wrong' : 'correct';
ht.attr.src = $F('/quiz/images/{0}.gif', (d.oLastQuestion.IsCorrectAnswer ? 'correct_small' : 'try_again_small'));
break;
case "lastPointsText":
ht.style['color'] = d.oLastQuestion.IsCorrectAnswer ? '#008B47' : '#b50000';
ht.innerHTML = d.oLastQuestion.IsCorrectAnswer ? $F('+{0} pts', d.oLastQuestion.AnswerPoints) : 'no points';
break;
case "LastQuestionDifficulty":
if (d.oLastQuestion.ID != -1)
{
var iTotal = d.oLastQuestion.CorrectCount + d.oLastQuestion.WrongCount;
var flPercent = (iTotal > 0) ? Math.round(100 * d.oLastQuestion.CorrectCount / iTotal) : -1;
ht.innerHTML = (flPercent == -1) ? '' : $F('{0}% got it right<span style=\"display:none;\">\({1}\)</span>', flPercent, GetDifficultylabel(flPercent));
}
break;
case "currentStreakCount":
ht.innerHTML = d.oLastQuestion.CurrentStreak;
break;
case "bestStreakCount":
ht.innerHTML = d.oLastQuestion.BestStreak;
break;
case "divTurkeyStreak":
ht.style.display = ((d.oLastQuestion.CurrentStreak % 7) == 3) ? 'block' : 'none';
break;
case "divCowStreak":
ht.style.display = ((d.oLastQuestion.CurrentStreak > 0) && ((d.oLastQuestion.CurrentStreak % 7) == 0)) ? 'block' : 'none';
break;
case "lastQuestionRating":
if (d.ID != -1)
{
var iRating = d.oLastQuestion.PositiveRatingCount - d.oLastQuestion.NegativeRatingCount;
ht.innerHTML = iRating;
ht.attr.className = (iRating > 0) ? 'quiz_positive' : 'quiz_negative';
}
break;
case "lastQuestionRatingUp":
ht.attr.href = $F('javascript:{0}(1);', strRateQuestion);
break;
case "lastQuestionRatingDown":
ht.attr.href = $F('javascript:{0}(-1);', strRateQuestion);
break;
}
}
}
_write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<div ');_write(o.Elem('divMain'));_write(' style=\"');_write(o.Style());_write('\">\n<DIV class=\"last_question_info\">\n<DIV class=\"last_point_header\">Last Question Results</DIV>\n<DIV class=\"last_question_badge\">\n<IMG ');_write(o.Elem('imgLastQuestionBadge'));_write(' style=\"');_write(o.Style());_write('border-width:0px;\" /> \n<DIV class=\"last_question_badge_info\">\n<DIV class=\"last_point_value\"><STRONG ');_write(o.Elem('lastPointsText'));_write('style=\"');_write(o.Style());_write('\">');_write(o.InnerHTML());_write('</STRONG></DIV>\n<DIV class=\"last_point_diff\" ');_write(o.Elem('LastQuestionDifficulty'));_write('>');_write(o.InnerHTML());_write('</DIV>\n<DIV>Streak: <SPAN style=\"COLOR: #008b47\" ');_write(o.Elem('currentStreakCount'));_write('>');_write(o.InnerHTML());_write('</SPAN></DIV>\n<DIV>Best Streak: <span');_write(o.Elem('bestStreakCount'));_write('>');_write(o.InnerHTML());_write('</span></DIV>\n<div class=\"if_quiz_turkey\" ');_write(o.Elem('divTurkeyStreak'));_write(' style=\"');_write(o.Style());_write('\">\n<img src=\"/quiz/images/quiz_turkey.gif\" />\n<div>Turkey!<br />3 in a row <strong>+500pts</strong></div>\n<div style=\"clear:both;\"></div>\n</div>\n<div class=\"if_quiz_cow\" ');_write(o.Elem('divCowStreak'));_write(' style=\"');_write(o.Style());_write('\">\n<img src=\"/quiz/images/quiz_cow.gif\" />\n<div>Holy Cow!<br />7 in a row <strong>+1000pts</strong></div>\n<div style=\"clear:both;\"></div>\n</div>\n<DIV style=\"CLEAR: both\"></DIV>\n</DIV>\n</DIV>\n<DIV class=\"quiz_ranker\" id=\"DIV2\">\n<SPAN class=\"quiz_rank_text\">Good Question?</SPAN>\n<A class=\"up\" ');_write(o.Elem('lastQuestionRatingUp'));_write('></A>\n<A class=\"down\" ');_write(o.Elem('lastQuestionRatingDown'));_write('></A>\n<SPAN ');_write(o.Elem('lastQuestionRating'));_write(' style=\"COLOR: #00cc00\">');_write(o.InnerHTML());_write('</SPAN>\n</DIV>\n<DIV style=\"CLEAR: both\"></DIV>\n</DIV>\n</div>\n');;return($text.join(""));};_write('\n');_write(Main(new View($data)));_write('\n');}return $text.join("");}},{id:"Quiz.QuestionSubmittedBy",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');
function View(d)
{
var oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.SetState = function(d_)
{
d = d_;
oThis.UpdateElements();
}
function Wink()
{
d.fncWink(d.oQuestionSubmittedBy.UserID, document.location.href, document.title, function F(){})
$(oThis.htIds.lnkWink).innerHTML = 'Done!';
}
oThis.ElementProps = function(id, scope, name, isInit, params, ht)
{
switch(scope)
{
case "imgCreatedBy":
ht.attr.src = Btv.UI.UserImage(d.oQuestionSubmittedBy.Image);
break;
case "lnkCreatedBy":
ht.attr.href = Btv.Links.BuildUserLink(d.oQuestionSubmittedBy.Name);
ht.innerHTML = d.oQuestionSubmittedBy.Name;
break;
case "pointsQuiz":
ht.innerHTML = YAHOO.Btv.String.FormatNumber(d.oQuestionSubmittedBy.QuizPoints);
break;
case "pointsStar":
ht.innerHTML = YAHOO.Btv.String.FormatNumber(d.oQuestionSubmittedBy.StarPoints);
break;
case "lnkWink":
if (isInit)
{
ht.innerHTML = ':-) wink';
ht.attr.href = '#';
ht.attr.onclick = $F('{0}();return(false);', $R(Wink));
}
break;
}
}
}
_write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<DIV class=\"btv_quiz_add_your_own\">\n<DIV class=\"last_point_header\">\nQuestion Added By\n</DIV>\n<DIV class=\"btv_quiz_submitted_by\">\n<IMG ');_write(o.Elem('imgCreatedBy'));_write(' style=\"border-width:0px;\" /> \n<DIV class=\"btv_quiz_submitted_by_info\">\n<DIV>\n<A ');_write(o.Elem('lnkCreatedBy'));_write('>');_write(o.InnerHTML());_write('</A>\n</DIV>\n<DIV><A ');_write(o.Elem('lnkWink'));_write('>');_write(o.InnerHTML());_write('</A></DIV>\n<DIV style=\"display:none;\"><span ');_write(o.Elem('pointsQuiz'));_write('>');_write(o.InnerHTML());_write('</span> quiz pts</DIV>\n<DIV class=\"small2_star_points\" style=\"BACKGROUND-POSITION: left top;display:none;\"><span ');_write(o.Elem('pointsStar'));_write('>');_write(o.InnerHTML());_write('</span> star pts</DIV>\n</DIV>\n<DIV style=\"CLEAR: both\">\n</DIV>\n</DIV>\n<DIV class=\"add_my_question_link\">\n<A href=\"/Quiz/CreateQuestion.aspx\" class=\"context-button\"><span style=\"width:140px;font-size:11px;\">Add/Review My Questions »</span></A> \n</DIV>\n</DIV>\n');;return($text.join(""));};_write('\n');_write(Main(new View($data)));_write('\n');}return $text.join("");}},{id:"Quiz.Question",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');
function View(d)
{
var oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
oThis.onBlockShow = new YAHOO.util.CustomEvent("onBlockShow");
oThis.onSubmitAnswer = new YAHOO.util.CustomEvent("onSubmitAnswer");
var iLastAnswerIndex = -1;
var blnAnswerSubmitting = false;
oThis.SetState = function(d_)
{
for (var i=0; i < d.Answers.length; i++)
{
oThis.DisposeElem('answerLink.' + i);
oThis.DisposeElem('answerText.' + i);
oThis.DisposeElem('answerPost.' + i);
}
oThis.d = d = d_;
$(oThis.htIds.questionContainer).innerHTML = AnswersSection(oThis);
if (oPointsTimer) oPointsTimer.Stop();
oPointsTimer = new PointsTimer(5000);
oThis.UpdateElements();
blnAnswerSubmitting = false;
}
oThis.InformCorrectAnswer = function(id)
{
var i;
for (i=0; i < d.Answers.length; i++)
{
if (d.Answers[i].ID == id) break;
}
if (i != iLastAnswerIndex)
{
SetAnswerInfo(iLastAnswerIndex, " - Incorrect!", "#b50000");
}
SetAnswerInfo(i, " - Correct!", "#009900");
}
function SetAnswerInfo(i, str, strColor)
{
var el = $(oThis.htIds['answerPost.' + i]);
el.innerHTML = str;
el.style.display = "inline";
el.style.color = strColor;
}
function BlockShow()
{
oThis.onBlockShow.fire(d.CategoryID)
}
function SubmitAnswer(i)
{
if (blnAnswerSubmitting) return;
blnAnswerSubmitting = true;
iLastAnswerIndex = i;
oThis.InformCorrectAnswer(d.CorrectAnswer);
oPointsTimer.Stop();
//SetAnswerInfo(i, " - checking answer...", "#000000");
$(oThis.htIds["imgQuestion"]).src = "/images/spin2.gif";
oThis.onSubmitAnswer.fire(d.Answers[i].ID, oPointsTimer.GetPoints());
}
var strSubmitAnswer = $R(SubmitAnswer);
var fncRemoveQuestion = Btv.Ajax.MakeFunction(Btv.Trivia.TriviaQueries, 'RemoveQuestion');
function Report_Click()
{
function F(bln)
{
if (bln)
{
fncRemoveQuestion(id, Function.NoOp);
}
}
var id = d.ID;
if (blnAdminMode)
{
Btv.SimpleDialog.Show('Confirmation', 'Are you sure you want to remove this question?', Btv.SimpleDialog.buttonsYesNo, null, F);
}
else
{
ReportQuestion(d.ID);
}
}
function ReportQuestion(id){
function fnc(){
$(oThis.htIds['lnkReportQuestion']).innerHTML = 'Reported';
}
var oReport = new Btv.Report();
oReport.Report(7, id, fnc);
}
oThis.ElementProps = function(id, scope, name, isInit, params, ht)
{
switch(scope)
{
case "imgQuestion":
ht.attr.src = d.Media ? Btv.UI.FixImage(d.Media) : Btv.UI.CategoryImageSrc(d.CategoryScopeID, d.Image);
ht.attr.alt = d.MediaSource ? d.MediaSource : d.CategoryTitle;
break;
case "lnkQuestionCategory":
ht.attr.href = '/' + d.CategoryUrl;
ht.innerHTML = d.CategoryTitle;
document.title = 'BuddyTV ' + d.CategoryTitle + ' Trivia';
break;
case "lnkBlockCategory":
if (isInit) ht.attr.href = $F('javascript:{0}();', $R(BlockShow));
break;
case "questionText":
ht.innerHTML = d.Text;
break;
case "pointsLabel":
if (isInit) ht.innerHTML = oPointsTimer.GetPoints();
break;
case "answerLink":
var i = parseInt(name);
ht.attr.href = $F('javascript:{0}({1});', strSubmitAnswer, i);
break;
case "answerText":
var i = parseInt(name);
ht.innerHTML = d.Answers[i].Text;
break;
case "answerPost":
if (isInit) ht.style.display = 'none';
break;
case "lnkReportQuestion":
ht.attr.href = $F("javascript:{0}()", $OG(Report_Click));
break;
}
}
var blnAdminMode = false;
function AdminData(blnAdminMode_, oPermissions)
{
if (oThis.htIds["lnkReportQuestion"] && $(oThis.htIds["lnkReportQuestion"]))
{
var bln = blnAdminMode_ && oPermissions.HasPermission(1, 'ManageTrivia');
if (blnAdminMode != bln)
{
blnAdminMode = bln;
$(oThis.htIds["lnkReportQuestion"]).innerHTML = bln ? 'Remove Question' : 'Report Question';
}
}
}
Btv.Admin.Subscribe(AdminData)
function PointsTimer(iDelay)
{
var oPoints = this;
var iInterval;
var iMaxPoints = 100;
var iMinPoints = 10;
var iTotalMilliseconds = 20 * 1000;
var iPoints = iMaxPoints;
var blnStopped = false;
oPoints.GetPoints = function()
{
return(iPoints);
}
oPoints.Start = function()
{
iInterval = iTotalMilliseconds / (iMaxPoints - iMinPoints);
setTimeout(UpdateSlider, iInterval); 
}
oPoints.Stop = function()
{
blnStopped = true;
}
function Redraw()
{ 
var strWidth = (100 * (iPoints / iMaxPoints)) + "%";
if ($(oThis.htIds.pointsLabel))
{
$(oThis.htIds.pointsLabel).innerHTML = iPoints;
$(oThis.htIds.pointsSliderFill).style.width = strWidth;
}
}
function UpdateSlider()
{ 
if (blnStopped) return;
iPoints--;
Redraw();
if (iPoints > iMinPoints) setTimeout(UpdateSlider, iInterval);
}
Redraw()
setTimeout(oPoints.Start, iDelay);
}
var oPointsTimer = new PointsTimer(5000);
}
_write('\n');AnswersSection = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n');if(o.d.Answers instanceof Array) {for(var iAnswer=0; iAnswer<o.d.Answers.length; iAnswer++) {_write(' \n<A ');_write(o.Elem('answerLink.' + iAnswer));_write('><span');_write(o.Elem('answerText.' + iAnswer));_write('>');_write(o.InnerHTML());_write('</span><SPAN class=\"post_answer_result\" ');_write(o.Elem('answerPost.' + iAnswer));_write(' style=\"');_write(o.Style());_write('\"></SPAN></A>\n');}} else {for(var iAnswer in o.d.Answers) {_write(' \n<A ');_write(o.Elem('answerLink.' + iAnswer));_write('><span');_write(o.Elem('answerText.' + iAnswer));_write('>');_write(o.InnerHTML());_write('</span><SPAN class=\"post_answer_result\" ');_write(o.Elem('answerPost.' + iAnswer));_write(' style=\"');_write(o.Style());_write('\"></SPAN></A>\n');}}_write(' \n');;return($text.join(""));};_write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<div>\n<DIV class=\"btv_quiz_image\">\n<DIV class=\"btv_quiz_image_frame\">\n<DIV><SPAN><IMG class=\"btv_quiz_image_img\" ');_write(o.Elem('imgQuestion'));_write(' style=\"border-width:0px;\" /></SPAN></DIV>\n</DIV>\n<A ');_write(o.Elem('lnkQuestionCategory'));_write('>');_write(o.InnerHTML());_write('</A> \n<DIV class=\"report_question\">\n<A class=\"report-question-trivia\" ');_write(o.Elem('lnkReportQuestion'));_write('>Report Question</A>\n<span>/ </span>\n<A ');_write(o.Elem('lnkBlockCategory'));_write('>Block This Show</A>\n</DIV>\n</DIV>\n<DIV class=\"btv_quiz_question\" ');_write(o.Elem('questionText'));_write('>');_write(o.InnerHTML());_write('</DIV>\n<DIV style=\"CLEAR: both\"></DIV>\n<DIV class=\"btv_quiz_timer\">\n<DIV class=\"btv_quiz_timer1\"></DIV>\n<DIV class=\"btv_quiz_timer2\">\n<DIV class=\"btv_points_text\"><SPAN ');_write(o.Elem('pointsLabel'));_write('>');_write(o.InnerHTML());_write('</SPAN>pts</DIV>\n<DIV class=\"btv_points_filler\" ');_write(o.Elem('pointsSliderFill'));_write(' style=\"WIDTH:100%\">&nbsp;</DIV>\n</DIV>\n<DIV class=\"btv_quiz_timer3\"></DIV>\n</DIV>\n<DIV class=\"btv_quiz_answers\" ');_write(o.Elem('questionContainer'));_write('>');_write(AnswersSection(o));_write('</DIV>\n</div>\n');;return($text.join(""));};_write('\n');_write(Main(new View($data)));_write('\n');}return $text.join("");}},{id:"Quiz.StatModule",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');
function View(d)
{
var oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
var isBodyOpen = !d.BodyClosed;
var oBodyTemplate;
var blnBodyDirty = true;
var iCurrentUser = -1;
(function()
{
var out = {};
oThis.RunTemplateSimple(d.TemplateID, d.BodyData || {}, out)
oBodyTemplate = out.value;
var oData = d.DataSupplier.GetData();
if (oData) iCurrentUser = oData.CurrentUserID;
if (oBodyTemplate.SetData) oBodyTemplate.SetData(oData);
})();
function DataChangeHandler()
{
var oData = d.DataSupplier.GetData();
if (oData)
{
iCurrentUser = oData.CurrentUserID;
if (oBodyTemplate.SetData) oBodyTemplate.SetData(oData);
if (d.AutoClose) isBodyOpen = false;
blnBodyDirty = true;
oThis.UpdateElements();
}
}
Btv.Cst.Registrar.Get('TriviaModule', function(o){o.onNextQuestion.subscribe(DataChangeHandler);});
function HeaderClicked()
{
isBodyOpen = !isBodyOpen;
oThis.UpdateElements();
}
function UpdateBody()
{
function F()
{
var el = $(oThis.htIds.divModuleBody);
if (el)
{
el.innerHTML = oBodyTemplate.Run();
el.style.display = 'block';
blnBodyDirty = false;
}
}
if (isBodyOpen && blnBodyDirty)
{
if (oBodyTemplate.MakeReady)
{
oBodyTemplate.MakeReady(F);
}
else
{
F();
}
}
}
oThis.ElementProps = function(id, scope, name, isInit, params, ht)
{
switch(scope)
{
case "divTop":
if (d.HideIfNotLoggedIn) ht.style.display = (iCurrentUser == -1) ? 'none' : 'block';
break;
case "divModuleHeader":
if (isInit) ht.attr.onclick = $F('{0}()', $R(HeaderClicked));
break;
case "moduleHeaderText":
ht.innerHTML = oBodyTemplate.GetTitle();
break;
case "divModuleHeaderArrow":
ht.attr['class'] = $F("stat-module-{0}", isBodyOpen ? 'open' : 'closed');
break;
case "divModuleBody":
if (isBodyOpen)
{
if (blnBodyDirty)
{
if (oBodyTemplate.MakeReady)
{
UpdateBody();
}
else
{
ht.innerHTML = oBodyTemplate.Run();
ht.style.display = 'block';
blnBodyDirty = false;
}
}
else
{
ht.style.display = 'block';
}
}
else
{
ht.style.display = 'none';
}
break;
}
}
}
_write('\n');StatModule = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<DIV class=\"show_page2_module\" ');_write(o.Elem('divTop'));_write(' style=\"');_write(o.Style());_write('\">\n<DIV ');_write(o.Elem('divModuleHeader'));_write(' class=\"show_page2_module_head\">\n<div ');_write(o.Elem('divModuleHeaderArrow'));_write('><H2 ');_write(o.Elem('moduleHeaderText'));_write('>');_write(o.InnerHTML());_write('</H2></div>\n</DIV>\n<DIV ');_write(o.Elem('divModuleBody'));_write(' class=\"show_page2_module_body\" style=\"');_write(o.Style());_write('\">');_write(o.InnerHTML());_write('</DIV>\n</DIV>\n');;return($text.join(""));};_write('\n');_write(StatModule(new View($data)));_write('\n');}return $text.join("");}},{id:"Quiz.StatCategoryChamp",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<div><h3 style=\"padding:0px; margin:0px 0px 10px 0px;\">');_write(o.strTitle);_write('</h3></div>\n<DIV class=\"quiz_my_info\">\n');if(o.Champs.length > 0) {_write(' \n<div>\n<A href=\"');_write(Btv.Links.BuildUserLink(o.Champs[0].Name));_write('\"><IMG src=\"');_write(Btv.UI.UserImage(o.Champs[0].UserImage));_write('\" style=\"border-width:0px\" /></A> \n<DIV class=\"quiz_my_info_info\">\n<DIV class=\"trophy-1\"></DIV>\n<DIV style=\"FONT-SIZE: 20px; MARGIN-BOTTOM: 4px\"><A href=\"');_write(Btv.Links.BuildUserLink(o.Champs[0].Name));_write('\">');_write(o.Champs[0].Name);_write('</A></DIV>\n<DIV><STRONG>');_write(YAHOO.Btv.String.FormatNumber(o.Champs[0].TotalPoints));_write('</STRONG> pts</DIV>\n</DIV>\n</div>\n');}_write(' \n<DIV style=\"CLEAR: both\"></DIV>\n');if(o.Champs instanceof Array) {for(var iChamp=0; iChamp<o.Champs.length; iChamp++) {_write(' \n');if(iChamp > 0) {_write(' \n<DIV class=\"trophy-2-5\">\n<DIV class=\"trophy-2-5-l\">\n<A href=\"');_write(Btv.Links.BuildUserLink(o.Champs[iChamp].Name));_write('\" class=\"trophy-winner-img\"><IMG src=\"');_write(Btv.UI.UserImage(o.Champs[iChamp].UserImage));_write('\" /></A> <A href=\"');_write(Btv.Links.BuildUserLink(o.Champs[iChamp].Name));_write('\">');_write(o.Champs[iChamp].Name);_write('</A> \n</DIV>\n<DIV class=\"trophy-2-5-r\" style=\"BACKGROUND: url(images/trophy-');_write(iChamp+1);_write('.jpg) no-repeat center top\">');_write(YAHOO.Btv.String.FormatNumber(o.Champs[iChamp].TotalPoints));_write('</DIV>\n</DIV>\n');}_write(' \n');}} else {for(var iChamp in o.Champs) {_write(' \n');if(iChamp > 0) {_write(' \n<DIV class=\"trophy-2-5\">\n<DIV class=\"trophy-2-5-l\">\n<A href=\"');_write(Btv.Links.BuildUserLink(o.Champs[iChamp].Name));_write('\" class=\"trophy-winner-img\"><IMG src=\"');_write(Btv.UI.UserImage(o.Champs[iChamp].UserImage));_write('\" /></A> <A href=\"');_write(Btv.Links.BuildUserLink(o.Champs[iChamp].Name));_write('\">');_write(o.Champs[iChamp].Name);_write('</A> \n</DIV>\n<DIV class=\"trophy-2-5-r\" style=\"BACKGROUND: url(images/trophy-');_write(iChamp+1);_write('.jpg) no-repeat center top\">');_write(YAHOO.Btv.String.FormatNumber(o.Champs[iChamp].TotalPoints));_write('</DIV>\n</DIV>\n');}_write(' \n');}}_write(' \n<DIV style=\"CLEAR: both\"></DIV>\n');if(o.RelativeRanks.length > 0) {_write(' \n<DIV>\n<H4>Your Rank Relative to Others</H4>\n');if(o.RelativeRanks instanceof Array) {for(var iRel=0; iRel<o.RelativeRanks.length; iRel++) {_write(' \n<DIV class=\"quiz_get_rankers_odd');if((iRel == o.iCurrentUserIndex)) {_write('this_is_you');}_write('\">\n<span>');_write(YAHOO.Btv.String.FormatNumber(o.RelativeRanks[iRel].Rank));_write('</span>.&nbsp;\n<A href=\"');_write(Btv.Links.BuildUserLink(o.RelativeRanks[iRel].Name));_write('\">');_write(o.RelativeRanks[iRel].Name);_write(' (');_write(YAHOO.Btv.String.FormatNumber(o.RelativeRanks[iRel].TotalPoints));_write(' points) ');if((iRel == o.iCurrentUserIndex)) {_write('<B>- this is you</B>');}_write('</A>\n</DIV>\n');}} else {for(var iRel in o.RelativeRanks) {_write(' \n<DIV class=\"quiz_get_rankers_odd');if((iRel == o.iCurrentUserIndex)) {_write('this_is_you');}_write('\">\n<span>');_write(YAHOO.Btv.String.FormatNumber(o.RelativeRanks[iRel].Rank));_write('</span>.&nbsp;\n<A href=\"');_write(Btv.Links.BuildUserLink(o.RelativeRanks[iRel].Name));_write('\">');_write(o.RelativeRanks[iRel].Name);_write(' (');_write(YAHOO.Btv.String.FormatNumber(o.RelativeRanks[iRel].TotalPoints));_write(' points) ');if((iRel == o.iCurrentUserIndex)) {_write('<B>- this is you</B>');}_write('</A>\n</DIV>\n');}}_write(' \n</DIV>\n');}_write(' \n</DIV>\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain)
{
var oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.GetTitle = function()
{
return("Show Champions");
}
oThis.Run = function()
{
return(fncMain(oThis));
}
oThis.SetData = function(oTriviaData)
{
oThis.Champs = oTriviaData.CategoryLeaders.UserRanks;
oThis.RelativeRanks = oTriviaData.CategoryRanking.UserRanks;
oThis.strTitle = oTriviaData.CategoryLeaders.CategoryTitle
oThis.iCurrentUserIndex = -1;
for (var i=0; i < oThis.RelativeRanks.length; i++)
{
if (oThis.RelativeRanks[i].ID == oTriviaData.CurrentUserID)
{
oThis.iCurrentUserIndex = i;
}
}
}
})($data, Main);
_write('\n');}return $text.join("");}},{id:"Quiz.StatYourRank",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<DIV class=\"quiz_my_info\">\n<IMG src=\"');_write(Btv.UI.UserImage(o.CurrentUser.UserImage));_write('\" style=\"border-width:0px;\" alt=\"');_write(o.CurrentUser.Name);_write('\" /> \n<DIV class=\"quiz_my_info_info\">\n<DIV><A href=\"');_write(Btv.Links.BuildUserLink(o.CurrentUser.Name));_write('\"></A></DIV>\n<DIV style=\"MARGIN-BOTTOM: 11px\">rank: <STRONG style=\"FONT-SIZE: 20px; COLOR: #f36e21\">');_write(YAHOO.Btv.String.FormatNumber(o.CurrentUser.Rank));_write('</STRONG> of <STRONG>');_write(YAHOO.Btv.String.FormatNumber(o.OverallRanking.TotalUsers));_write('</STRONG></DIV>\n<DIV style=\"MARGIN:0px 0px 11px 0px;\"><STRONG style=\"COLOR:#f36e21; font-size:20px;\">');_write(YAHOO.Btv.String.FormatNumber(o.PointsToNextRank()));_write('</STRONG> pts to next rank</DIV>\n<DIV><STRONG style=\"FONT-SIZE: 20px;\">');_write(YAHOO.Btv.String.FormatNumber(o.CurrentUser.TotalPoints));_write('</STRONG> pts (');_write(YAHOO.Btv.String.FormatNumber(o.CurrentUser.TodayPoints));_write(' pts today)</DIV>\n</DIV>\n<DIV style=\"CLEAR: both\"></DIV>\n');if(!o.d.blnHideRelative) {_write('\n<H4>Your Rank Relative to Others</H4>\n');if(o.OverallRanking.UserRanks instanceof Array) {for(var i=0; i<o.OverallRanking.UserRanks.length; i++) {_write(' \n<DIV class=\"quiz_get_rankers_odd');if((i == o.iCurrentUserIndex)) {_write('this_is_you');}_write('\">\n<span>');_write(YAHOO.Btv.String.FormatNumber(o.OverallRanking.UserRanks[i].Rank));_write('</span>.&nbsp;\n<A href=\"');_write(Btv.Links.BuildUserLink(o.OverallRanking.UserRanks[i].Name));_write('\">');_write(o.OverallRanking.UserRanks[i].Name);_write(' (');_write(YAHOO.Btv.String.FormatNumber(o.OverallRanking.UserRanks[i].TotalPoints));_write(' points) ');if((i == o.iCurrentUserIndex)) {_write('<B>- this is you</B>');}_write('</A>\n</DIV>\n');}} else {for(var i in o.OverallRanking.UserRanks) {_write(' \n<DIV class=\"quiz_get_rankers_odd');if((i == o.iCurrentUserIndex)) {_write('this_is_you');}_write('\">\n<span>');_write(YAHOO.Btv.String.FormatNumber(o.OverallRanking.UserRanks[i].Rank));_write('</span>.&nbsp;\n<A href=\"');_write(Btv.Links.BuildUserLink(o.OverallRanking.UserRanks[i].Name));_write('\">');_write(o.OverallRanking.UserRanks[i].Name);_write(' (');_write(YAHOO.Btv.String.FormatNumber(o.OverallRanking.UserRanks[i].TotalPoints));_write(' points) ');if((i == o.iCurrentUserIndex)) {_write('<B>- this is you</B>');}_write('</A>\n</DIV>\n');}}_write(' \n');}_write(' \n</DIV>\n');if(!o.d.blnHideRelative) {_write('\n<DIV style=\"TEXT-ALIGN: right\">\n<A href=\"/Quiz/ViewScores.aspx?type=alltime\">see all »</A>\n</DIV>\n');}_write(' \n');;return($text.join(""));};_write('\n');
new (function(d, fncMain)
{
var oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
oThis.GetTitle = function()
{
return("My Overall Trivia Rank");
}
oThis.Run = function()
{
return(fncMain(oThis));
}
oThis.SetData = function(oTriviaData)
{
oThis.OverallRanking = oTriviaData.OverallRanking;
oThis.iCurrentUserIndex = -1;
for (var i=0; i < oThis.OverallRanking.UserRanks.length; i++)
{
if (oThis.OverallRanking.UserRanks[i].ID == oTriviaData.CurrentUserID)
{
oThis.CurrentUser = oThis.OverallRanking.UserRanks[i];
oThis.iCurrentUserIndex = i;
}
}
}
oThis.PointsToNextRank = function()
{
if (oThis.iCurrentUserIndex > 0)
{
return(oThis.OverallRanking.UserRanks[oThis.iCurrentUserIndex-1].TotalPoints - oThis.OverallRanking.UserRanks[oThis.iCurrentUserIndex].TotalPoints);
}
return(0);
}
})($data, Main);
_write('\n');}return $text.join("");}},{id:"Quiz.StatHighScore",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<DIV class=\"high_scores_highest\">\n<DIV class=\"hall_of_fame_headers\">\n');if(o.CurrentUser && (o.CurrentUser.ID != -1)) {_write('\nYou need <B>');_write(o.PointsToCatch());_write('</B> to catch them\n');}_write(' \n</DIV>\n<A href=\"');_write(Btv.Links.BuildUserLink(o.HighScores.UserRanks[0].Name));_write('\"><IMG style=\"BORDER:0px;\" alt=\"');_write(o.HighScores.UserRanks[0].Name);_write('\" src=\"');_write(Btv.UI.UserImage(o.HighScores.UserRanks[0].UserImage));_write('\" /></A> \n<DIV class=\"high_scores_highest_right\" style=\"FONT-SIZE: 12px; WIDTH: 185px\">\n<DIV>\n1.<A href=\"');_write(Btv.Links.BuildUserLink(o.HighScores.UserRanks[0].Name));_write('\">');_write(o.FormatName(o.HighScores.UserRanks[0].Name));_write('</A>\n</DIV>\n<DIV>\n<B>');_write(o.GetPoints(o.HighScores.UserRanks[0], true));_write(' pts</B> ');_write(o.d.PointsLabel);_write('\n</DIV>\n');if(o.HighScores.TotalUsers != -1) {_write('\n<DIV><B>#1</B> out of ');_write(YAHOO.Btv.String.FormatNumber(o.HighScores.TotalUsers));_write(' players</DIV>\n');}_write(' \n<DIV>\n<A ');_write(o.Elem('lnkWink'));_write('>');_write(o.InnerHTML());_write('</A>&nbsp;<A ');_write(o.Elem('lnkMessage'));_write(' class=\"message_me_link\"><IMG src=\"/tvshow2/images/pro_manage_envelope_small.jpg\" /> message</A>\n</DIV>\n<DIV style=\"TEXT-ALIGN: right\">\n<A href=\"/Quiz/ViewScores.aspx?type=todays\">see all »</A>\n</DIV>\n</DIV>\n<DIV style=\"CLEAR: both\">\n</DIV>\n</DIV>\n<DIV class=\"hall_of_high_scores\">\n');if(o.HighScores.UserRanks instanceof Array) {for(var i=0; i<o.HighScores.UserRanks.length; i++) {_write(' \n');if(i > 0) {_write(' \n<DIV>\n');_write(i+1);_write('. <A href=\"');_write(Btv.Links.BuildUserLink(o.HighScores.UserRanks[i].Name));_write('\">');_write(o.FormatName(o.HighScores.UserRanks[i].Name));_write(' (');_write(o.GetPoints(o.HighScores.UserRanks[i], true));_write(')</A>\n</DIV>\n');}_write(' \n');}} else {for(var i in o.HighScores.UserRanks) {_write(' \n');if(i > 0) {_write(' \n<DIV>\n');_write(i+1);_write('. <A href=\"');_write(Btv.Links.BuildUserLink(o.HighScores.UserRanks[i].Name));_write('\">');_write(o.FormatName(o.HighScores.UserRanks[i].Name));_write(' (');_write(o.GetPoints(o.HighScores.UserRanks[i], true));_write(')</A>\n</DIV>\n');}_write(' \n');}}_write(' \n<DIV style=\"TEXT-ALIGN: right\">\n<A href=\"/Quiz/ViewScores.aspx?type=todays\">see all »</A>\n</DIV>\n</DIV>\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain)
{
var oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
var fncMakeReady;
oThis.GetTitle = function()
{
return(d.HeaderTitle);
}
oThis.Run = function()
{
oThis.Reset();
var s = fncMain(oThis);
return(s);
}
oThis.SetData = function()
{
d.DataSupplier.Clear();
oThis.HighScores = null;
}
oThis.MakeReady = function(fnc)
{
if (oThis.HighScores)
{
fnc();
}
else
{
var oData = d.DataSupplier.GetData();
if (oData)
{
SetHighScoresData(oData);
fnc();
}
else
{
fncMakeReady = fnc;
d.DataSupplier.Invoke(6);
}
}
}
function SetHighScoresData(oHighScoresData)
{
oThis.HighScores = oHighScoresData[d.strDataSet];
oThis.CurrentUser = oHighScoresData.CurrentUser;
}
function DataChangeHandler()
{
var oData = d.DataSupplier.GetData();
if (oData) SetHighScoresData(oData);
if (fncMakeReady)
{
fncMakeReady();
fncMakeReady = null;
}
}
d.DataSupplier.onDataChanged.subscribe(DataChangeHandler);
oThis.FormatName = function(str)
{
return(d.strNameFormat ? $F(d.strNameFormat, str) : str);
}
oThis.GetPoints = function(oRank, blnFormat)
{
var i = oRank[d.strHighScorePointsProperty];
return(blnFormat ? YAHOO.Btv.String.FormatNumber(i) : i);
}
oThis.PointsToCatch = function()
{
var iPoints = oThis.GetPoints(oThis.HighScores.UserRanks[0]) - oThis.GetPoints(oThis.CurrentUser);
return(YAHOO.Btv.String.FormatNumber(iPoints));
}
function Wink()
{
d.fncWink(oThis.HighScores.UserRanks[0].ID, document.location.href, document.title, function F(){})
$(oThis.htIds.lnkWink).innerHTML = 'Done!';
}
oThis.ElementProps = function(id, scope, name, isInit, params, ht)
{
switch(scope)
{
case "lnkWink":
if (isInit)
{
ht.innerHTML = ':-) wink';
ht.attr.href = '#';
ht.attr.onclick = $F('{0}();return(false);', $R(Wink));
}
break;
case "lnkMessage":
if (isInit) ht.attr.href = Btv.Links.BuildMessageLink(oThis.HighScores.UserRanks[0].ID);
break;
}
}
})($data, Main);
_write('\n');}return $text.join("");}},{id:"Quiz.StatEmbed",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<DIV class=\"show_page2_module_body\" style=\"MARGIN: 0px\">\n<TEXTAREA style=\"BORDER: #cccccc 1px solid; PADDING:0px; FONT-SIZE: 11px; MARGIN: 0px; OVERFLOW: hidden; WIDTH: 278px; HEIGHT: 75px\" onclick=\"this.select()\">');_write(TextAreaContents(o));_write('</TEXTAREA> \n</DIV>\n');;return($text.join(""));};_write('\n');TextAreaStyleContents = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('<style type=\"text/css\">.btv_quiz_question{position:relative;font-size:14px;font-weight:bold;margin-top:7px;clear:both;}.btv_quiz_question img{margin-right:5px;}.creat_quiz_block .btv_quiz_question{width:340px;font-size:25px;}.btv_quiz_image{position:relative;width:380px;text-align:center;_margin-right:42px;}.btv_quiz_image_img{display:block;max-height:115px;max-width:199px;height:expression((this.height>120)?120:true);background-position:center center;background-repeat:no-repeat;margin:auto;}.btv_quiz_answers a{display:block;width:345px;font-size:14px;color:#000000!important;border-bottom:1px dashed #00a5e5;padding:4px 0px 4px 28px;background:url(\'http://www.buddytv.com/quiz/images/answer_image.jpg\')center left no-repeat;}.btv_quiz_answers a:hover{background:url(\'http://www.buddytv.com/quiz/images/answer_image_hover.jpg\')center left no-repeat;text-decoration:none;}.btv_quiz_answers{position:relative;width:376px;float:left;}.btv_closedquiz_answers{position:relative;width:455px;float:left;}.btv_closedquiz_answers a{display:block;width:630px;font-size:20px;color:#000000!important;border-bottom:1px dashed #00a5e5;padding:4px 0px 4px 28px;background:url(\'http://www.buddytv.com/quiz/images/answer_image.jpg\')center left no-repeat;}.btv_closedquiz_answers a:hover{background:url(\'http://www.buddytv.com/quiz/images/answer_image_hover.jpg\')center left no-repeat;text-decoration:none;}.btv_quiz_ad{');if(o.oStyles) {if(o.oStyles.FontFamily) {_write('font-family:');_write(o.oStyles.FontFamily);_write(';');}if(o.oStyles.FontFamily) {_write('background-color:');_write(o.oStyles.BackgroundColor);_write(';');}if(o.oStyles.DarkTextColor) {_write('color:');_write(o.oStyles.DarkTextColor);_write(';');}}_write('}.btv_quiz_ad .btv_quiz_question{font-size:15px;text-align:left!important;}.btv_quiz_ad .btv_quiz_question{text-align:left!important;margin-bottom:8px;width:270px;}.btv_quiz_ad .btv_quiz_answers a:hover{background-image:url(\'http://www.buddytv.com/quiz/images/answer_image_hover_small.jpg\');}.btv_quiz_ad .btv_quiz_answers a{font-size:13px;font-weight:bold;padding-left:17px;width:auto;border-bottom:none;background-image:url(\'http://www.buddytv.com/quiz/images/answer_image_small.jpg\');}.btv_quiz_ad .btv_quiz_answers{width:180px;text-align:left!important;}.btv_quiz_ad_left{width:180px!important;float:left!important;text-align:left!important;}.btv_quiz_ad_img,.btv_quiz_ad_img img{width:90px;float:right;display:block;}.btv_quiz_ad_left a img{display:none;}.btv_quiz_ad_img img{border:1px solid #999999;}</style>\n');;return($text.join(""));};_write('\n');TextAreaContents = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write(o.fncTextAreaStyleContents(o));_write('\n<div class=\"btv_quiz_ad\" style=\"width:300px;\">\n<div class=\"btv_quiz_question\">');_write(o.d.Text);_write('</div>\n<div class=\"btv_quiz_ad_img\"><img class=\"btv_quiz_image_img\" src=\"');_write(o.d.Media ? Btv.UI.FixImage(o.d.Media) : Btv.UI.CategoryImageSrc(o.d.CategoryScopeID, o.d.Image));_write('\" alt=\"');_write(o.d.MediaSource ? o.d.MediaSource : o.d.CategoryTitle);_write('\" style=\"border-width:0px;\" /></div>\n<div class=\"btv_quiz_ad_left\">\n<div class=\"btv_quiz_answers\">\n');if(o.d.Answers instanceof Array) {for(var i=0; i<o.d.Answers.length; i++) {_write(' \n<a href=\"http://');_write(Btv.Url.GetHostName(document.location.href));_write('/quiz/quiz.aspx?category=');_write(o.d.CategoryID);_write('&csi=');_write(o.d.CategoryID ? -1 : o.d.CategoryScopeID);_write('&lastquestion=');_write(o.d.ID);_write('&firstquestion=');_write(o.d.ID);_write('&lastanswer=');_write(o.d.Answers[i].ID);_write('&points=100');_write(o.strBrandingParam ? ('&btvbp=' + o.strBrandingParam) : '');_write('\" rel=\"nofollow\">');_write(o.d.Answers[i].Text);_write('</a>\n');}} else {for(var i in o.d.Answers) {_write(' \n<a href=\"http://');_write(Btv.Url.GetHostName(document.location.href));_write('/quiz/quiz.aspx?category=');_write(o.d.CategoryID);_write('&csi=');_write(o.d.CategoryID ? -1 : o.d.CategoryScopeID);_write('&lastquestion=');_write(o.d.ID);_write('&firstquestion=');_write(o.d.ID);_write('&lastanswer=');_write(o.d.Answers[i].ID);_write('&points=100');_write(o.strBrandingParam ? ('&btvbp=' + o.strBrandingParam) : '');_write('\" rel=\"nofollow\">');_write(o.d.Answers[i].Text);_write('</a>\n');}}_write(' \n</div>\n</div>\n<div style=\"clear:both;\"></div>\n</div>\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain, fncTextAreaContents, fncTextAreaStyleContents)
{
var oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.fncTextAreaStyleContents = fncTextAreaStyleContents;
oThis.GetTitle = function()
{
return("Embed this Question");
}
oThis.GetEmbedCode = function()
{
return(fncTextAreaContents(oThis));
}
oThis.Run = function()
{
return(fncMain(oThis));
}
oThis.SetData = function(oTriviaData, oStyles, strBrandingParam)
{
d = oThis.d = oTriviaData.NextQuestion;
oThis.strBrandingParam = strBrandingParam;
oThis.oStyles = oStyles;
}
})($data, Main, TextAreaContents, TextAreaStyleContents);
_write('\n');}return $text.join("");}}]);
