var requestHash=new Array();var tagListRequest=0;var featuredQuestionsRequest=1;var controllerUrl="http://localhost:8888/KZPrototype/servlet/KZController";var baseballId="402880830c8fe481010c8fe495c2003c";var footballId="402880830c8fe481010c8fe4954a0001";var recordsId="402881e40c0ade16010c0ade1dcd000c";var MLBId="402881e40c0ade16010c0ade1dfc003d";var pitchersId="402881e40c0ade16010c0ade1dfc004d";var NFLId="402881e40c0ade16010c0ade1dcd0002";var collegeId="402881e40c0ade16010c0ade1ddd0021";var teamstatsId="402881e40c0ade16010c0ade1dcd000b";var currentId="402881e80b82e087010b82e1a5fb000f";var eightiesId="402880830c8fe481010c8fe495ae0021";var basketballId="402880830c8fe481010c8fe495d6005f";var NUM_TAGS=10;var unloadFlag=false;var NODETYPE_ELEMENT=1;var CURRENT_PAGE=1;var QUEST_PER_PAGE=10;var NUM_PAGES=0;var NUM_QUEST=0;var TOTAL_LIST;var FETCH_PAGE=1;var SORT_DIR=0;var lbStPos=1;var lbEndPos=1;var pageNum=1;var globalStatList;var globalUserStats;var rankArray=new Array();var rankChangeArray=new Array();var rankUpdateLock=0;var statsViewedFor=0;var rankViewedFor=0;var PrimaryXTagData;var XMyQuestionList;var month_names=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");function noop(){}var popularity_divs=new Array(0.2,0.2);var b0;var UIConfig=new UIConfig();var PerfMon=new PerfMon();var JSImageGallery=new JSImageGallery();var JSMessageHandler=new JSMessageHandler();var TagTable=new Array(NUM_TAGS);var UIMessage=new JSResourceBundle();var MouseHandler=new MouseEventHandler();var DEBUG_FLAG=false;var PLAYER_LAUNCH_MODE_POPUP_NAME="launch_check_mode";var HOMEPAGEPUBLIC=1;var HOMEPAGEMEMBER=2;var SUBMITQUESTION=3;var PLAYER=4;var MYQUESTIONS=5;var GETTAGLISTFORHOMEPAGEPUBLICSTR="?action=1&userid=1&context="+HOMEPAGEPUBLIC;var GETTAGLISTFORHOMEPAGEMEMBERSTR="?action=1&userid=1&context="+HOMEPAGEMEMBER;var GETFEATUREDTRIVIAFORHOMEPAGEPUBLICSTR="?action=2&userid=1&context="+HOMEPAGEPUBLIC;var GETFEATUREDTRIVIAFORHOMEPAGEMEMBERSTR="?action=2&userid=1&context="+HOMEPAGEMEMBER;var player_currentQuestion;var linkEnabled=false;var launch_url;var pgContext="";var currTagLabel;var FRIENDS_PAGE="friends";var MY_TRIVIA_PAGE="my_trivia";var SUBMIT_TRIVIA_PAGE="submit_trivia";var LEADER_BOARD="leader_board";var lb_tabs=new Array("k-a","f-a","k-w","f-w","k-a-t","f-a-t","k-w-t","f-w-t");var tag_popup_enabled=false;var bcStrForLastPage="";function clone_array(b){var a=new Array();for(i in b){a.push(b[i])}return a}function checkEmailIDs(g){var d="";g=g+",";var a=0;var e=g.length;var f=0;while(a<e){var c=g.indexOf(",",a);if(c==-1){c=e}var b=g.substring(a,c);b=trimString(b);if(b.length>0&&b!=""){if(!validateEmailAddressFormat(b)){d+="Invalid Mail Id: "+b+"<br/>"}}a=c+1}return d}function httpRequest(f,a,c,e,d){if(window.XMLHttpRequest){}else{if(window.ActiveXObject){requestHash[f]=new ActiveXObject("Msxml2.XMLHTTP");if(!request){requestHash[f]=new ActiveXObject("Microsoft.XMLHTTP")}}}if(requestHash[f]){if(a.toLowerCase()!="post"){initReq(f,a,c,e,d)}else{var b=arguments[4];if(b!=null&&b.length>0){initReq(f,a,c,e,d,b)}}}else{alert("Your browser does not permit the use of all of this application's features!")}}function initReq(e,a,c,b,d){try{requestHash[e].onreadystatechange=d;requestHash[e].open(a,c,b);if(a.toLowerCase()=="post"){requestHash[e].setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");requestHash[e].send(arguments[4])}else{requestHash[e].send(null)}}catch(f){alert("The application cannot contact the server at the moment. Please try again in a few seconds.\\nError detail: "+f.message)}}function makeRequest(a){var c=false;if(window.XMLHttpRequest){c=new XMLHttpRequest();if(c.overrideMimeType){c.overrideMimeType("text/xml")}}else{if(window.ActiveXObject){try{c=new ActiveXObject("Msxml2.XMLHTTP")}catch(b){try{c=new ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}}}if(!c){alert("Giving up :( Cannot create an XMLHTTP instance");return false}c.onreadystatechange=function(){alertContents(c);updateUrchin(a)};c.open("GET",a,true);c.send(null)}function updateUrchin(a){if(http_request.readyState==4){if(http_request.status==200){urchinTracker(a)}}}function getNodeValue(b,a){return b.getElementsByTagName(a)[0].firstChild.nodeValue}function getURLParam(e){var d="";var c=window.location.href;if(c.indexOf("?")>-1){var b=c.substr(c.indexOf("?"));var f=b.split("&");for(var a=0;a<f.length;a++){if(f[a].indexOf(e+"=")>-1){var g=f[a].split("=");d=g[1];break}}}return d}function getUser(){var a=document.getElementById("logged-in-user");if(a==undefined){return"john"}else{user=a.value;return(user=="null")?"john":user}}function globalInitialize(context){dwr.engine.setErrorHandler(GlobalErrorHandler);startBeats(context);if(context!="mytrivia"){}var funcString="initialize_"+context+"()";eval(funcString)}function changeChannel(b,a){JSClientService.setCurrentChannel(b,{callback:function(c){document.location.href="/index"}})}function closePopups(b){var a;if(!b){document.getElementById("browse-menu").style.display="none";document.getElementById("browse").className=""}document.getElementById("popup-browse").style.display="none";document.getElementById("popup-search").style.display="none";if((a=document.getElementById("favorites-cloud"))){a.style.display="none"}if((a=document.getElementById("overlay"))){a.style.display="none"}}function browse(c,b){closePopups(true);var a;if((a=document.getElementById("overlay"))){a.style.display="block"}document.getElementById("popup-browse").style.display="block";document.getElementById("popup-browse-category").innerHTML="Browse / "+c;JSBrowseTagSet.initialize(b);return false}function MouseEventHandler(){this.init=init;this.mouseUpAction=new Array();this.mouseDownAction=new Array();this.mouseMoveAction=new Array();this.mouseDown=mouseDown;this.mouseMove=mouseMove;this.mouseUp=mouseUp;this.registerListener=registerListener;function init(){document.onmousedown=this.mouseDown;document.onmousemove=this.mouseMove;document.onmouseup=this.mouseUp;if(window.Event){document.captureEvents(Event.MOUSEDOWN|Event.MOUSEMOVE|Event.MOUSEUP)}}function registerListener(eventName,action){switch(eventName){case"mouseup":var len=this.mouseUpAction.length;this.mouseUpAction[len++]=action;break;case"mousedown":var len=this.mouseDownAction.length;this.mouseDownAction[len++]=action;break;case"mousemove":var len=this.mouseMoveAction.length;this.mouseMoveAction[len++]=action;break}}function mouseDown(e){var i=0;for(i=0;i<MouseHandler.mouseDownAction.length;i++){var func=MouseHandler.mouseDownAction[i];eval(func+"(e)")}}function mouseMove(e){var i=0;for(i=0;i<MouseHandler.mouseMoveAction.length;i++){var func=MouseHandler.mouseMoveAction[i];eval(func+"(e)")}}function mouseUp(e){var i=0;for(i=0;i<MouseHandler.mouseUpAction.length;i++){var func=MouseHandler.mouseUpAction[i];eval(func+"(e)")}}}function clearTextbox(c,b){var a=document.getElementById(c);if(a){a.select();if(b){a.style.color=b}}}function Timer_Ticker(c,e,b){this.displayId=c;this.directionFlag=e;this.displayLabel=b;this.refTime=null;this.serverTime=null;this.localTime=null;this.startTimer=d;this.stopTimer=f;this.updateField=a;this.timer=new JSTimer(this.updateField,UIConfig.getTickerInterval(),this);function d(){var g=this;JSClientConfigService.getServerTime({callback:function(h){g.serverTime=new Date(h);g.localTime=new Date();g.localTime.setTime(g.serverTime.getTime());g.timer.startTimer();g.refTime=UIConfig.getDailyStartTime()}})}function f(){this.timer.stopTimer()}function a(l){l.localTime.setSeconds(l.localTime.getSeconds()+1);var g=l.localTime;var m="";var k=g.getHours();var j=g.getMinutes();var h=g.getSeconds();if(l.directionFlag){m=(k-l.refTime.getHours())+":"+(j-l.refTime.getMinutes())+":"+(h-l.refTime.getSeconds())}else{k=""+((23+l.refTime.getHours())-k)+"";if(k.length==1){k="0"+k}m+=k;m+=":";j=""+((59+l.refTime.getMinutes())-j)+"";if(j.length==1){j="0"+j}m+=j;m+=":";h=""+((59+l.refTime.getSeconds())-h)+"";if(h.length==1){h="0"+h}m+=h}m+=" "+l.displayLabel;document.getElementById(l.displayId).innerHTML=m}}function playAnon(b,c,d){if(c!=""){mode_popup("popup-launch",false,true)}var a="/anonymous?tagName="+c;a+="&channelName="+b;if(d==null||d==undefined){d=-1}a+="&tagId="+d;if(trimString(_campaign)!=""){a+="&campaign="+_campaign}if(trimString(_referer)!=""){a+="&referer="+_referer}if(trimString(_referred_by)!=""){a+="&referred_by="+_referred_by}if(trimString(_anon_user_name)!=""){a+="&playtoken="+_anon_user_name}location.href=a}function modePopup_getPageSize(){var c,a,b,d;if(window.innerHeight&&window.scrollMaxY){c=document.body.scrollWidth;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){c=document.body.scrollWidth;a=document.body.scrollHeight}else{c=document.body.offsetWidth;a=document.body.offsetHeight}}if(self.innerHeight){b=self.innerWidth;d=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){b=document.documentElement.clientWidth;d=document.documentElement.clientHeight}else{if(document.body){b=document.body.clientWidth;d=document.body.clientHeight}}}if(a<d){pageHeight=d}else{pageHeight=a}if(c<b){pageWidth=b}else{pageWidth=c}arrayPageSize=new Array(pageWidth,pageHeight,b,d);return arrayPageSize}function mode_popup(g,d,a){var b=document.getElementById(g);var c=modePopup_getPageSize();if(d){var d=document.getElementById("overlay");d.onclick=function(){};d.style.height=c[1]+"px";d.style.display="block"}b.style.zIndex="-1000";b.style.display="block";if(a){var f=(c[3]/2)-(b.offsetHeight/2);var e=(c[2]/2)-(b.offsetWidth/2);b.style.top=f+"px";b.style.left=e+"px"}b.style.zIndex="1000"}function JSResourceBundle(){this.MsgMap=null;this.loadMessage=loadMessage;this.getMessage=getMessage;this.invite_noemail_key="invite.kz_error_no_emailid";this.invite_noemail_msg="No email-ids have been entered. Please enter a valid email-id.";this.cannot_invite_yourself_key="cannot.invite.yourself";this.cannot_invite_yourself_msg="The following email is linked to your email account:";this.friendship_request_pending_key="friendship.request.pending";this.friendship_request_pending_msg="Your Add to Friends request is pending for the following:";this.friendship_request_ignored_key="friendship.request.ignored";this.friendship_request_ignored_msg="Your Friends request has been ignored";this.cannot_invite_yourself_msg="Cannot invite the following because it's your own email:";this.friend_exists_key="friend.exists";this.friend_exists_msg="You are already friends with the following users:";this.user_account_closed_key="user.account.closed";this.user_account_closed_msg="The following user accounts are invalid:";this.exception_in_invite_key="exception.in.invite";this.exception_in_invite_msg="The following errors occurred in processing invites:";this.send_request_for_friendship_key="sent.friendship.request";this.send_request_for_friendship_msg="Your Add to Friends request has been sent to the following users:";this.loadInvite=loadInvite;this.refreshInviteMsgs=refreshInviteMsgs;this.no_fullname_key="invite.kz_error_no_fullname";this.no_fullname_msg="Please fill out your name in the <b>From</b> field";this.my_tags_cloud_no_tags_key="my_tags.no_tags";this.my_tags_cloud_no_tags_msg="Add your favorite trivia topics through Browse, Search or Popular Tags";this.related_tags_cloud_no_tags_key="related_tags.no_tags";this.related_tags_cloud_no_tags_msg="No related tags found";this.search_cloud_no_tags_key="search.no_tags";this.search_cloud_no_tags_msg="Sorry, no tags found for this search";this.search_global_tags_cloud_no_tags_key="global_tags.no_tags";this.search_global_tags_cloud_no_tags_msg="Sorry, no results found. Please try another search, or browse our selection to see all available topics.";this.player_skipped_key1="player.skipped1";this.player_skipped_key2="player.skipped2";this.player_correct_key="player.correct";this.player_incorrect_key="player.incorrect";this.player_timeout_key1="player.timeout1";this.player_timeout_key2="player.timeout2";this.player_challenge_key1="player.challenge1";this.player_challenge_key2="player.challenge2";this.player_no_more_questions_key1="player.no_more_questions1";this.player_no_more_questions_key2="player.no_more_questions2";this.player_select_option_key="player.select_option";this.player_skip_question_key="player.skip_question";this.player_select_option_title_key="player.select_option.title";this.player_skipped_msg1="Skipped";this.player_skipped_msg2="You chose to skip the question!";this.player_correct_msg="Correct";this.player_incorrect_msg="Incorrect";this.player_timeout_msg1="Timed out";this.player_timeout_msg2="Sorry, Your timer ran out!";this.player_challenge_msg1="Challenged";this.player_challenge_msg2="Your challenge has been submitted.";this.player_no_more_questions_msg1="Wow! You have run through all the question in the current tag!";this.player_no_more_questions_msg2="Please choose another tag to continue playing, or wait a few seconds for recently published questions.";this.player_select_option_msg="Please select a valid option from";this.player_skip_question_msg="Skip question?";this.player_select_option_title_msg="Select valid option!";this.loadPlayer=loadPlayer;this.refreshPlayerMsgs=refreshPlayerMsgs;this.question_already_played_key="question.already_played";this.question_already_played_msg="Already Played";this.no_qns_left_key="no_unplayed_question";this.no_qns_left_msg="You have played all questions for this topic. Please browse or search above to select another topic.";this.question_already_played_all_key="question.already_played_all";this.question_already_played_all_msg="All Questions Played!";this.my_tags_more_tags_key="more.tags_mytags";this.my_tags_more_tags_msg="My Tags";this.popular_tags_more_tags_key="more.tags_populartags";this.popular_tags_more_tags_msg="Popular Tags";this.global_tags_more_tags_key="more.tags_globaltags";this.global_tags_more_tags_msg="Search Results";this.more_tags_help_key="more_tags.help";this.more_tags_help_msg="More Tags Help";this.no_qns_left_title_key="noQ.title";this.no_qns_left_title_msg="No Unplayed Questions";this.loadHome=loadHome;this.refreshHomeMsgs=refreshHomeMsgs;this.mytags_no_tags_key="mytags.no_tags";this.mytags_no_tags_msg="Sorry no tags to add!";this.mytags_no_tags_del_key="mytags.no_tags_del";this.mytags_no_tags_del_msg="Sorry no tags to delete!";this.mytags_no_results_key="mytags.no_results";this.mytags_no_results_msg="Sorry, no results found";this.mytags_add_key="my_tags.add";this.mytags_add_msg="Added {0} to my tags";this.mytags_delete_key="my_tags.delete";this.mytags_delete_msg="Deleted {0} from my tags";this.mytags_mytag_heading_key="my_tags.mytag_heading";this.mytags_mytag_heading_msg="My tags for {0}";this.mytags_availabletag_heading_key="my_tags.availabletag_heading";this.mytags_availabletag_heading_msg="Available tags";this.mytags_help_key="myaccount_mytags.help";this.mytags_help_msg="Here's an easy way to keep track of the tags you like. These will show up on your homepage for quick play.";this.myprofile_email_success_key="myaccount_myprofile.email_success_msg";this.myprofile_email_success_msg="Your email address has been updated successfully!";this.myprofile_email_error_key1="myaccount_myprofile.kz_error_email1";this.myprofile_email_error_msg1="Please enter a valid email address";this.myprofile_email_error_key2="myaccount_myprofile.kz_error_email2";this.myprofile_email_error_msg2="Sorry! Could not update your email address Please try again later";this.myprofile_passwd_success_key="myaccount_myprofile.passwd_success_msg";this.myprofile_passwd_success_msg="Your password has been updated successfully!";this.myprofile_passwd_error_key1="myaccount_myprofile.kz_error_password1";this.myprofile_passwd_error_msg1="The old password is incorrect";this.myprofile_passwd_error_key2="myaccount_myprofile.kz_error_password2";this.myprofile_passwd_error_msg2="Sorry! Could not change your password Please try again later.";this.myprofile_passwdlen_error_key="signup_profile.kz_error_password ";this.myprofile_passwdlen_error_msg="Password should be of minimum 6 characters";this.myprofile_passwdconfirm_error_key="signup_profile.kz_error_cpassword";this.myprofile_passwdconfirm_error_msg="Password is entered incorrectly! Please re-enter your password";this.myprofile_imagetitle_key="myprofile.image.title";this.myprofile_imagetitle_msg="Image Upload";this.publicprofile_success_key="myaccount_publicprofile.message";this.publicprofile_success_msg="Your public profile has been updated successfully";this.mysettings_success_key="myaccount_mysetting_success_msg";this.mysettings_success_msg="Your settings have been saved";this.global_error_key="global_error";this.global_error_msg="Sorry we could not complete this action at the moment. Please try again later.";this.loadMyAccount=loadMyAccount;this.refreshMyAccount=refreshMyAccount;this.form_error_key="form_error";this.form_error_msg="Errors in the form";this.loadSignUp=loadSignUp;this.refreshSignUp=refreshSignUp;this.submit_trivia_form_error_key="submittrivia_step_error";this.submit_trivia_form_error_msg="Errors on the page. Please fill the mandatory fields before proceeding.";this.upload_success_key="submit_trivia.image_upload_success";this.upload_success_msg="Your image has been uploaded successfully";this.draft_success_key="submit_trivia.question_draft_success";this.draft_success_msg="Your question has been saved as a draft";this.new_tag_blank_key="submit_question.kz_error_newtagblank";this.new_tag_blank_msg="Please enter a valid tag";this.new_tag_max_length_key="submit_question.kz_error_newtagmaxlength";this.new_tag_max_length_msg="Tag name cannot be more than {0} characters";this.new_tag_min_length_key="submit_question.kz_error_newtagminlength";this.new_tag_min_length_msg="Tag should be atleast {0} characters";this.submittrivia_mytag_heading_key="submit_trivia.questiontag_heading";this.submittrivia_mytag_heading_msg="Tags";this.submittrivia_availabletag_heading_key="submit_trivia.availabletag_heading";this.submittrivia_availabletag_heading_msg="Search tags";this.submittrivia_help_key="submit_step3.help";this.submittrivia_help_msg="Submit Step3 Help";this.loadSubmitTrivia=loadSubmitTrivia;this.refreshSubmitTrivia=refreshSubmitTrivia;function loadSubmitTrivia(){var target=this;var keys=new Array(this.submit_trivia_form_error_key,this.upload_success_key,this.draft_success_key,this.new_tag_blank_key,this.new_tag_max_length_key,this.new_tag_min_length_key,this.submittrivia_mytag_heading_key,this.submittrivia_availabletag_heading_key,this.submittrivia_help_key);JSClientService.getMessages(keys,{callback:function(datafromServer){refreshSubmitTrivia(target,datafromServer)},async:false})}function refreshSubmitTrivia(me,map){me.MsgMap=map;me.submit_trivia_form_error_msg=me.loadMessage(me.submit_trivia_form_error_key,me.submit_trivia_form_error_msg);me.upload_success_msg=me.loadMessage(me.upload_success_key,me.upload_success_msg);me.draft_success_msg=me.loadMessage(me.draft_success_key,me.draft_success_msg);me.new_tag_blank_msg=me.loadMessage(me.new_tag_blank_key,me.new_tag_blank_msg);me.new_tag_max_length_msg=me.loadMessage(me.new_tag_max_length_key,me.new_tag_max_length_msg);me.new_tag_min_length_msg=me.loadMessage(me.new_tag_min_length_key,me.new_tag_min_length_msg);me.submittrivia_mytag_heading_msg=me.loadMessage(me.submittrivia_mytag_heading_key,me.submittrivia_mytag_heading_msg);me.submittrivia_availabletag_heading_msg=me.loadMessage(me.submittrivia_availabletag_heading_key,me.submittrivia_availabletag_heading_msg);me.submittrivia_help_msg=me.loadMessage(me.submittrivia_help_key,me.submittrivia_help_msg)}function loadSignUp(){var target=this;var keys=new Array(this.form_error_key);JSClientService.getMessages(keys,{callback:function(datafromServer){refreshSignUp(target,datafromServer)}})}function refreshSignUp(me,map){me.MsgMap=map;me.form_error_msg=me.loadMessage(me.form_error_key,me.form_error_msg)}function loadInvite(){var target=this;var keys=new Array(this.invite_noemail_key,this.cannot_invite_yourself_key,this.friendship_request_pending_key,this.friendship_request_ignored_key,this.friend_exists_key,this.user_account_closed_key,this.exception_in_invite_key,this.send_request_for_friendship_key,this.form_error_key);JSClientService.getMessages(keys,{callback:function(datafromServer){refreshInviteMsgs(target,datafromServer)}})}function refreshInviteMsgs(me,map){me.MsgMap=map;me.invite_noemail_msg=me.loadMessage(me.invite_noemail_key,me.invite_noemail_msg);me.cannot_invite_yourself_msg=me.loadMessage(me.cannot_invite_yourself_key,me.cannot_invite_yourself_msg);me.friendship_request_pending_msg=me.loadMessage(me.friendship_request_pending_key,me.friendship_request_pending_msg);me.friendship_request_ignored_msg=me.loadMessage(me.friendship_request_ignored_key,me.friendship_request_ignored_msg);me.friend_exists_msg=me.loadMessage(me.friend_exists_key,me.friend_exists_msg);me.user_account_closed_msg=me.loadMessage(me.user_account_closed_key,me.user_account_closed_msg);me.exception_in_invite_msg=me.loadMessage(me.exception_in_invite_key,me.exception_in_invite_msg);me.send_request_for_friendship_msg=me.loadMessage(me.send_request_for_friendship_key,me.send_request_for_friendship_msg);me.no_fullname_msg=me.loadMessage(me.no_fullname_key,me.no_fullname_msg);me.form_error_msg=me.loadMessage(me.form_error_key,me.form_error_msg)}function loadMyAccount(page){var target=this;var keys=null;switch(page){case"mytags":keys=new Array(this.mytags_no_tags_key,this.mytags_no_results_key,this.mytags_add_key,this.mytags_delete_key,this.mytags_mytag_heading_key,this.mytags_availabletag_heading_key,this.mytags_help_key);break;case"myprofile":keys=new Array(this.myprofile_email_success_key,this.myprofile_email_error_key1,this.myprofile_email_error_key2,this.myprofile_passwd_success_key,this.myprofile_passwd_error_key1,this.myprofile_passwd_error_key2,this.myprofile_passwdlen_error_key,this.myprofile_passwdconfirm_error_key,this.myprofile_imagetitle_key,this.form_error_key);break;case"publicprofile":keys=new Array(this.global_error_key,this.publicprofile_success_key);break;case"mysettings":keys=new Array(this.global_error_key,this.mysettings_success_key);break}JSClientService.getMessages(keys,{callback:function(datafromServer){refreshMyAccount(target,datafromServer,page)},async:false})}function refreshMyAccount(me,map,page){me.MsgMap=map;switch(page){case"mytags":me.mytags_no_tags_msg=me.loadMessage(me.mytags_no_tags_key,me.mytags_no_tags_msg);me.mytags_no_tags_del_msg=me.loadMessage(me.mytags_no_tags_del_key,me.mytags_no_tags_del_msg);me.mytags_no_results_msg=me.loadMessage(me.mytags_no_results_key,me.mytags_no_results_msg);me.mytags_add_msg=me.loadMessage(me.mytags_add_key,me.mytags_add_msg);me.mytags_delete_msg=me.loadMessage(me.mytags_delete_key,me.mytags_delete_msg);me.mytags_mytag_heading_msg=me.loadMessage(me.mytags_mytag_heading_key,me.mytags_mytag_heading_msg);me.mytags_availabletag_heading_msg=me.loadMessage(me.mytags_availabletag_heading_key,me.mytags_availabletag_heading_msg);me.mytags_help_msg=me.loadMessage(me.mytags_help_key,me.mytags_help_msg);break;case"myprofile":me.myprofile_email_success_msg=me.loadMessage(me.myprofile_email_success_key,me.myprofile_email_success_msg);me.myprofile_email_error_msg1=me.loadMessage(me.myprofile_email_error_key1,me.myprofile_email_error_msg1);me.myprofile_email_error_msg2=me.loadMessage(me.myprofile_email_error_key2,me.myprofile_email_error_msg2);me.myprofile_passwd_error_msg1=me.loadMessage(me.myprofile_passwd_error_key1,me.myprofile_passwd_error_msg1);me.myprofile_passwd_error_msg2=me.loadMessage(me.myprofile_passwd_error_key2,me.myprofile_passwd_error_msg2);me.myprofile_passwdlen_error_msg=me.loadMessage(me.myprofile_passwdlen_error_key,me.myprofile_passwdlen_error_msg);me.myprofile_passwdconfirm_error_msg=me.loadMessage(me.myprofile_passwdconfirm_error_key,me.myprofile_passwdconfirm_error_msg);me.myprofile_passwd_success_msg=me.loadMessage(me.myprofile_passwd_success_key,me.myprofile_passwd_success_msg);me.myprofile_imagetitle_msg=me.loadMessage(me.myprofile_imagetitle_key,me.myprofile_imagetitle_msg);me.form_error_msg=me.loadMessage(me.form_error_key,me.form_error_msg);break;case"publicprofile":me.global_error_msg=me.loadMessage(me.global_error_key,me.global_error_msg);me.publicprofile_success_msg=me.loadMessage(me.publicprofile_success_key,me.publicprofile_success_msg);break;case"mysettings":me.global_error_msg=me.loadMessage(me.global_error_key,me.global_error_msg);me.mysettings_success_msg=me.loadMessage(me.mysettings_success_key,me.mysettings_success_msg);break}}function loadHome(){var target=this;var keys=new Array(this.question_already_played_key,this.question_already_played_all_key,this.my_tags_more_tags_key,this.popular_tags_more_tags_key,this.global_tags_more_tags_key,this.no_qns_left_key,this.no_qns_left_title_key,this.more_tags_help_key,this.my_tags_cloud_no_tags_key,this.search_cloud_no_tags_key,this.search_global_tags_cloud_no_tags_key);JSClientService.getMessages(keys,{callback:function(datafromServer){refreshHomeMsgs(target,datafromServer)}})}function refreshHomeMsgs(me,map){me.MsgMap=map;me.question_already_played_msg=me.loadMessage(me.question_already_played_key,me.question_already_played_msg);me.question_already_played_all_msg=me.loadMessage(me.question_already_played_all_key,me.question_already_played_all_msg);me.my_tags_more_tags_msg=me.loadMessage(me.my_tags_more_tags_key,me.my_tags_more_tags_msg);me.popular_tags_more_tags_msg=me.loadMessage(me.popular_tags_more_tags_key,me.popular_tags_more_tags_msg);me.global_tags_more_tags_msg=me.loadMessage(me.global_tags_more_tags_key,me.global_tags_more_tags_msg);me.no_qns_left_msg=me.loadMessage(me.no_qns_left_key,me.no_qns_left_msg);me.no_qns_left_title_msg=me.loadMessage(me.no_qns_left_title_key,me.no_qns_left_title_msg);me.more_tags_help_msg=me.loadMessage(me.more_tags_help_key,me.more_tags_help_msg);me.my_tags_cloud_no_tags_msg=me.loadMessage(me.my_tags_cloud_no_tags_key,me.my_tags_cloud_no_tags_msg);me.search_cloud_no_tags_msg=me.loadMessage(me.search_cloud_no_tags_key,me.search_cloud_no_tags_msg);me.search_global_tags_cloud_no_tags_msg=me.loadMessage(me.search_global_tags_cloud_no_tags_key,me.search_global_tags_cloud_no_tags_msg)}function loadPlayer(){var target=this;var keys=new Array(this.player_skipped_key1,this.player_skipped_key2,this.player_correct_key,this.player_incorrect_key,this.player_timeout_key1,this.player_timeout_key2,this.player_challenge_key1,this.player_challenge_key2,this.player_no_more_questions_key1,this.player_no_more_questions_key2,this.player_select_option_key,this.player_skip_question_key,this.player_select_option_title_key,this.my_tags_more_tags_key,this.popular_tags_more_tags_key,this.global_tags_more_tags_key,this.more_tags_help_key,this.question_already_played_key,this.question_already_played_all_key,this.no_qns_left_key,this.no_qns_left_title_key,this.my_tags_cloud_no_tags_key,this.related_tags_cloud_no_tags_key,this.search_cloud_no_tags_key,this.search_global_tags_cloud_no_tags_key);JSClientService.getMessages(keys,{callback:function(datafromServer){refreshPlayerMsgs(target,datafromServer)}})}function refreshPlayerMsgs(me,map){me.MsgMap=map;me.player_skipped_msg1=me.loadMessage(me.player_skipped_key1,me.player_skipped_msg1);me.player_skipped_msg2=me.loadMessage(me.player_skipped_key2,me.player_skipped_msg2);me.player_correct_msg=me.loadMessage(me.player_correct_key,me.player_correct_msg);me.player_incorrect_msg=me.loadMessage(me.player_incorrect_key,me.player_incorrect_msg);me.player_timeout_msg1=me.loadMessage(me.player_timeout_key1,me.player_timeout_msg1);me.player_timeout_msg2=me.loadMessage(me.player_timeout_key2,me.player_timeout_msg2);me.player_challenge_msg1=me.loadMessage(me.player_challenge_key1,me.player_challenge_msg1);me.player_no_more_questions_msg1=me.loadMessage(me.player_no_more_questions_key1,me.player_no_more_questions_msg1);me.player_no_more_questions_msg2=me.loadMessage(me.player_no_more_questions_key2,me.player_no_more_questions_msg2);me.player_select_option_msg=me.loadMessage(me.player_select_option_key,me.player_select_option_msg);me.player_skip_question_msg=me.loadMessage(me.player_skip_question_key,me.player_skip_question_msg);me.player_select_option_title_msg=me.loadMessage(me.player_select_option_title_key,me.player_select_option_title_msg);me.question_already_played_msg=me.loadMessage(me.question_already_played_key,me.question_already_played_msg);me.question_already_played_all_msg=me.loadMessage(me.question_already_played_all_key,me.question_already_played_all_msg);me.my_tags_more_tags_msg=me.loadMessage(me.my_tags_more_tags_key,me.my_tags_more_tags_msg);me.popular_tags_more_tags_msg=me.loadMessage(me.popular_tags_more_tags_key,me.popular_tags_more_tags_msg);me.global_tags_more_tags_msg=me.loadMessage(me.global_tags_more_tags_key,me.global_tags_more_tags_msg);me.more_tags_help_msg=me.loadMessage(me.more_tags_help_key,me.more_tags_help_msg);me.no_qns_left_msg=me.loadMessage(me.no_qns_left_key,me.no_qns_left_msg);me.no_qns_left_title_msg=me.loadMessage(me.no_qns_left_title_key,me.no_qns_left_title_msg);me.my_tags_cloud_no_tags_msg=me.loadMessage(me.my_tags_cloud_no_tags_key,me.my_tags_cloud_no_tags_msg);me.related_tags_cloud_no_tags_msg=me.loadMessage(me.related_tags_cloud_no_tags_key,me.related_tags_cloud_no_tags_msg);me.search_cloud_no_tags_msg=me.loadMessage(me.search_cloud_no_tags_key,me.search_cloud_no_tags_msg);me.search_global_tags_cloud_no_tags_msg=me.loadMessage(me.search_global_tags_cloud_no_tags_key,me.search_global_tags_cloud_no_tags_msg)}function loadMessage(key,defvalue){var value=this.MsgMap[key];if(value==null){return defvalue}else{return value}}function getMessage(msg,args){var str=eval("UIMessage."+msg);if(args==null){return str}var i=0;for(i=0;i<args.length;i++){var repstr="{"+i+"}";str=str.replace(repstr,args[i])}return str}}function Fader(h,l,a,f,d,b){this.eltList=h;this.interval=d;this.steps=b;this.endFunc=l;this.endTarget=a;this.target=this;this.startStepPct=f;this.type;this.fadeIn=e;this.callEndFnc=k;this.fadeInStep=j;this.findType=g;this.stopTimer=c;this.fadeInTimer=new JSCountdownTimer(this.callEndFnc,this.fadeInStep,this.steps,this.interval/this.steps,this);function e(){this.type=this.findType();if(this.fadeInTimer){this.fadeInTimer.stopCountdown()}if(this.fadeInTimer){this.fadeInTimer.startCountdown()}}function c(){if(this.fadeInTimer){this.fadeInTimer.stopCountdown()}}function k(m){m.endFunc(m.endTarget)}function g(){if(typeof this.eltList[0].filters=="object"){this.type=(((this.eltList[0].filters.length>0&&typeof this.eltList[0].filters.alpha=="object"&&typeof this.eltList[0].filters.alpha.opacity=="number"))||is_ie())?"ie":"none"}else{if(typeof this.eltList[0].style.opacity!="undefined"){this.type="w3c"}else{if(typeof this.eltList[0].style.MozOpacity!="undefined"){this.type="moz"}else{if(typeof this.eltList[0].style.KhtmlOpacity!="undefined"){this.type="khtml"}else{this.type=is_ie()?"ie":"none"}}}}return this.type}function j(o){var m=((this.target.steps-o)/this.target.steps);if((m*100)>this.target.startStepPct){for(var n=0;n<this.target.eltList.length;n++){switch(this.target.type){case"ie":this.target.eltList[n].filters.alpha.opacity=Math.min(Math.round(m*100),100);break;case"khtml":this.target.eltList[n].style.KhtmlOpacity=Math.min(m,1);break;case"moz":this.target.eltList[n].style.MozOpacity=Math.min((m==1?0.9999999:m),0.9999999);break;default:this.target.eltList[n].style.opacity=Math.min((m==1?0.9999999:m),0.9999999)}}}}}function JSSwapper(n,o,c,f,d,q,b){this.eltList=n;this.interval=f;this.steps=d;this.swapFunc=o;this.endTarget=c;this.doneFunc=b;this.startFunc=q;this.target=this;this.type;this.fadeOutTimer;this.fadeInTimer;this.swapFade=h;this.fadeIn=j;this.fadeOut=g;this.callSwapFn=m;this.callDoneFn=a;this.callStartFn=k;this.fadeOutStep=e;this.fadeInStep=p;this.findType=l;this.fadeOutTimer=new JSCountdownTimer(this.callSwapFn,this.fadeOutStep,this.steps,this.interval/this.steps,this);this.fadeInTimer=new JSCountdownTimer(this.callDoneFn,this.fadeInStep,this.steps,this.interval/this.steps,this);function h(){this.type=this.findType();this.callStartFn(this);this.fadeOutTimer.startCountdown()}function j(){this.type=this.findType();this.fadeInTimer=new JSCountdownTimer(noop,this.fadeInStep,this.steps,this.interval/this.steps,this);this.fadeInTimer.startCountdown()}function g(){this.type=this.findType();this.fadeOutTimer=new JSCountdownTimer(noop,this.fadeInStep,this.steps,this.interval/this.steps,this);this.fadeOutTimer.startCountdown()}function l(){if(typeof this.eltList[0].style.opacity!="undefined"){this.type="w3c"}else{if(typeof this.eltList[0].style.MozOpacity!="undefined"){this.type="moz"}else{if(typeof this.eltList[0].style.KhtmlOpacity!="undefined"){this.type="khtml"}else{if(typeof this.eltList[0].filters=="object"){this.type=(((this.eltList[0].filters.length>0&&typeof this.eltList[0].filters.alpha=="object"&&typeof this.eltList[0].filters.alpha.opacity=="number"))||is_ie())?"ie":"none"}else{this.type=is_ie()?"ie":"none"}}}}return this.type}function m(r){r.swapFunc(r.endTarget);window.setTimeout(function(){r.fadeInTimer.startCountdown()},UIConfig.getSwapperFadeWait())}function a(r){if(r.doneFunc){r.doneFunc(r.endTarget)}}function k(r){if(r.startFunc){r.startFunc(r.endTarget)}}function e(t){var r=(t/this.target.steps);for(var s=0;s<this.target.eltList.length;s++){switch(this.target.type){case"ie":this.target.eltList[s].filters.alpha.opacity=Math.round(r*100);break;case"khtml":this.target.eltList[s].style.KhtmlOpacity=r;break;case"moz":this.target.eltList[s].style.MozOpacity=(r==1?0.9999999:r);break;default:this.target.eltList[s].style.opacity=(r==1?0.9999999:r)}}}function p(r){this.target.fadeOutStep(this.target.steps-r)}}function isRapidFireMode(){return(PLAYER_LAUNCH_MODE_POPUP_NAME=="launch_rapid_popup")}function isOneClickSubmitMode(){return(JSPlayer.submitMode==1)}function isPromptMode(){return(PLAYER_LAUNCH_MODE_POPUP_NAME=="launch_check_mode")}function getLaunchModePopupName(a){switch(a){case 2:return"launch_rapid_popup";case 1:return"launch_lounge_popup";case 0:default:return"launch_check_mode"}}function setupLaunchMode(a){switch(a){case 2:PLAYER_LAUNCH_MODE_POPUP_NAME="launch_rapid_popup";break;case 1:PLAYER_LAUNCH_MODE_POPUP_NAME="launch_lounge_popup";break;case 0:default:PLAYER_LAUNCH_MODE_POPUP_NAME="launch_check_mode";break}}function removeAllNodes(b){for(var a=0;a<b.childNodes.length;a++){var c=b.childNodes[a];if(c.parentNode!=undefined){c.parentNode.removeChild(c)}}}function removeAllChildNodes(b){var a=b.cloneNode(false);b.parentNode.replaceChild(a,b);return a}function showWaitingIconInDiv(e){var b=document.getElementById(e);if(b){var d=document.createElement("div");var a=document.createElement("img");a.src="/images/kwanzoo_question_loading.gif";d.appendChild(a);removeAllNodes(b);var c=Math.round((b.scrollHeight-a.height)/2);d.style.textAlign="center";d.style.paddingTop=c+"px";b.appendChild(d)}}function getFirstChildWithId(a,b){var f;if(a.nodeType==NODETYPE_ELEMENT){var e=a.childNodes;for(var c=0;c<e.length;c++){var d=e[c];if(d.nodeType==NODETYPE_ELEMENT){if(d.id==b){return d}else{var a=getFirstChildWithId(d,b);if(a!=undefined){f=a;break}}}}}return f}function utilCopyInnerHtml(b,a){if(b!=undefined){b.innerHTML=(a!=undefined)?a.innerHTML:""}}function breadcrumbStringToBreadcrumb1(b){var a=b.split(",");return breadcrumbStringToBreadcrumb(a[0],a[1],a[2])}function splitBreadcrumb(c){var a=new Array(2);var b=c.lastIndexOf(":");if(b==-1){a[0]=c;return c}else{a[0]=c.substring(0,b);a[1]=c.substring(b+1,c.length);return a}}function breadcrumbStringToBreadcrumb(h,f,d){var e=new Array();var c=-1,b=-1;if((h!=undefined)&&(h!="")){c=h.indexOf('"');b=h.lastIndexOf('"');if(!((c<0)||(b<0)||(b<c))){h=h.substring(c+1,b)}var a=splitBreadcrumb(h);var g=new Object();g.tagLabel=a[0];g.tagUid=parseInt(a[1]);e[0]=g}if((f!=undefined)&&(f!="")){c=f.indexOf('"');b=f.lastIndexOf('"');if(!((c<0)||(b<0)||(b<c))){f=f.substring(c+1,b)}var a=splitBreadcrumb(f);var g=new Object();g.tagLabel=a[0];g.tagUid=parseInt(a[1]);e[1]=g}if((d!=undefined)&&(d!="")){c=d.indexOf('"');b=d.lastIndexOf('"');if(!((c<0)||(b<0)||(b<c))){d=d.substring(c+1,b)}var a=splitBreadcrumb(d);var g=new Object();g.tagLabel=a[0];g.tagUid=parseInt(a[1]);e[2]=g}return e}function timeToDisplayStr(e){var f=Math.floor(e/(3600*24));var d=(f>0)?e%(3600*24):e;var a=Math.floor(d/3600);d=(a>0)?d%3600:d;var c=Math.floor(d/60);d=(c>0)?d%60:d;var b=new String();if(f>0){b=b+f+(((f>1)?" days":" day"));return b}if(a>0){if(b.length>0){b=b+(", ")}b=b+a+(((a>1)?" hours":" hour"));return b}if(c>0){if(b.length>0){b=b+(", ")}b=b+c+(((c>1)?" mins":" min"));return b}if(d>0){if(b.length>0){b=b+(", ")}return b}return b}function trimString(a){a=a.replace(/^\s*(.*)/,"$1");a=a.replace(/(.*?)\s*$/,"$1");return a}function trimFullString(a){return a.replace(/\s+/g," ")}function cloneObj(c){if(typeof(c)!="object"){return c}if(c==null){return c}var b=new Object();for(var a in c){b[a]=cloneObj(c[a])}return b}function isNumber(b){return typeof b=="number"&&isFinite(b)}function isOverflowed(a){return(a.scrollHeight>(a.offsetHeight+a.offsetTop))}function GlobalErrorHandler(b,a){if((b=="Access denied")||(b=="Forbidden")||(a!=null&&a.authentication==null)){window.location.href="/?multilogin=true";return}else{window.location.href="/"}}function JSTimer(g,j,d){this.me=this;this.timerFuncName=g;this.interval=j;this.timeoutId;this.active=false;this.target=d;function c(){if(this.active==false){this.timerInner_()}}function f(){this.runTimerInner_(this)}function b(){this.active=false;window.clearTimeout(this.timeoutId)}function e(k){if(this.active==true){this.me=k;if(d!=undefined){this.timerFuncName(d)}else{this.timerFuncName()}}this.active=true;k.timeoutId=window.setTimeout(function(){k.timerInner_()},this.interval)}function a(){this.stopTimer();this.startTimer()}function h(){return this.active}this.timerInner_=f;this.runTimerInner_=e;this.startTimer=c;this.stopTimer=b;this.resetTimer=a;this.isRunning=h}function JSCountdownTimer(h,f,c,b,e){this.countDownCount=c;this.countDownInterval=b;this.timerFnName=f;this.finishFnName=h;this.target=e;this.counter=0;this.finished=false;this.inFinish=false;this.startCountdown=a;this.stopCountdown=d;this.resumeCountdown=k;this.outerTimerFunction=j;this.outerFinishFunction=g;this.intervalTimer=new JSTimer(this.outerTimerFunction,b,this);this.finishTimer=new JSTimer(this.outerFinishFunction,b,this);function a(){this.counter=0;this.resumeCountdown()}function k(){this.finished=false;this.inFinish=false;this.intervalTimer.startTimer();this.finishTimer.startTimer()}function d(l){if(l==undefined){l=this}l.finishTimer.stopTimer();l.intervalTimer.stopTimer()}function j(l){if(l.inFinish){return}if(!l.finished){l.counter++;l.timerFnName(l.countDownCount-l.counter,l.target)}if(l.counter>=l.countDownCount){l.finished=true;return}}function g(l){if(l.inFinish){return}if(l.finished){l.finished=false;l.stopCountdown(l);l.finishFnName(l.target);l.inFinish=true}}}function Heartbeat(a){this.heartbeatRunning=false;this.hbTimer=null;this.context=a;this.startbeat=b;this.heartbeat=c;function b(){var d=this;this.hbTimer=new JSTimer(function(e){e.heartbeat(e)},UIConfig.getHeartBeatInterval(),d);this.hbTimer.startTimer()}function c(d){if(!d.heartbeatRunning){d.heartbeatRunning=true;var e=d;JSClientService.checkForSession(d.context,{callback:function(f){e.heartbeatRunning=false},timeout:90000,errorHandler:function(g,f){if(f&&f.message=="Timeout"&&f.name=="dwr.engine.timeout"&&g=="Timeout"){e.heartbeatRunning=false;return}if((f!=null&&f.authentication==null)||g=="Access denied"||g==" Invalid reply from server"){window.location.href="/login?multilogin=true;"}}})}}}function UIConfig(){this.CONFIG_TIME_RPQ_DISPLAY_INTERVAL="CONFIG_TIME_RPQ_DISPLAY_INTERVAL";this.CONFIG_TIME_RPQ_UPDATE_INTERVAL="CONFIG_TIME_RPQ_UPDATE_INTERVAL";this.CONFIG_TIME_ADD_BANNERS_DISPLAY_INTERVAL="CONFIG_TIME_ADD_BANNERS_DISPLAY_INTERVAL";this.CONFIG_MIN_QUESTIONS_REMAINING_IN_PLAYER_CACHE_BEFORE_NEXT_FETCH="CONFIG_MIN_QUESTIONS_REMAINING_IN_PLAYER_CACHE_BEFORE_NEXT_FETCH";this.CONFIG_MAX_QUESTIONS_FETCH_FOR_PLAYER_CACHE="CONFIG_MAX_QUESTIONS_FETCH_FOR_PLAYER_CACHE";this.CONFIG_PERCENT_POINTS_PENALTY_FOR_ANSWER_STATS="CONFIG_PERCENT_POINTS_PENALTY_FOR_ANSWER_STATS";this.CONFIG_PERCENT_POINTS_PENALTY_FOR_ELIMINATE2="CONFIG_PERCENT_POINTS_PENALTY_FOR_ELIMINATE2";this.CONFIG_NUM_PLAYERS_FETCH_FOR_LEADER_BOARD_CACHE="CONFIG_NUM_PLAYERS_FETCH_FOR_LEADER_BOARD_CACHE";this.CONFIG_NUM_QUESTIONS_FETCH_FOR_RPQ_PREVIEW_CACHE="CONFIG_NUM_QUESTIONS_FETCH_FOR_RPQ_PREVIEW_CACHE";this.CONFIG_DEFAULT_NUM_QUESTIONS_FET_PREVIEW_VISIBLE="CONFIG_DEFAULT_NUM_QUESTIONS_FET_PREVIEW_VISIBLE";this.CONFIG_MAX_BUCKET_SIZE_FOR_TAG_POPULARITY="CONFIG_MAX_BUCKET_SIZE_FOR_TAG_POPULARITY";this.CONFIG_TIME_RECOMPUTE_TAG_POPULARITY_WITHIN_BUCKET_INTERVAL="CONFIG_TIME_RECOMPUTE_TAG_POPULARITY_WITHIN_BUCKET_INTERVAL";this.CONFIG_MAX_POINTS_FOR_CORRECT_ANSWER_IN_LOUNGE_MODE="CONFIG_MAX_POINTS_FOR_CORRECT_ANSWER_IN_LOUNGE_MODE";this.CONFIG_MIN_ATTEMPTS_FOR_SHOW_ANSWER_STAT="CONFIG_MIN_ATTEMPTS_FOR_SHOW_ANSWER_STAT";this.CONFIG_TIME_FOR_DAILY_START="CONFIG_TIME_FOR_DAILY_START";this.CONFIG_RAPID_MODE_POINTS_MULTIPLIER="CONFIG_RAPID_MODE_POINTS_MULTIPLIER";this.CONFIG_MAX_FET_QN_TEXT_PREVIEW_LENGTH="CONFIG_MAX_FET_QN_TEXT_PREVIEW_LENGTH";this.CONFIG_MAX_RPQ_QN_TEXT_PREVIEW_LENGTH="CONFIG_MAX_RPQ_QN_TEXT_PREVIEW_LENGTH";this.CONFIG_MAX_PAGE_SIXE_FOR_MY_TRIVIA="CONFIG_MAX_PAGE_SIXE_FOR_MY_TRIVIA";this.dCONFIG_TIME_RPQ_DISPLAY_INTERVAL=30;this.dCONFIG_TIME_RPQ_UPDATE_INTERVAL=3600;this.dCONFIG_TIME_ADD_BANNERS_DISPLAY_INTERVAL=15;this.dCONFIG_TIME_LEADER_BANNERS_DISPLAY_INTERVAL=1;this.dCONFIG_MIN_QUESTIONS_REMAINING_IN_PLAYER_CACHE_BEFORE_NEXT_FETCH=5;this.dCONFIG_MAX_QUESTIONS_FETCH_FOR_PLAYER_CACHE=50;this.dCONFIG_PERCENT_POINTS_PENALTY_FOR_ANSWER_STATS=90;this.dCONFIG_PERCENT_POINTS_PENALTY_FOR_ELIMINATE2=90;this.dCONFIG_NUM_PLAYERS_FETCH_FOR_LEADER_BOARD_CACHE=30;this.dCONFIG_NUM_QUESTIONS_FETCH_FOR_RPQ_PREVIEW_CACHE=15;this.dCONFIG_DEFAULT_NUM_QUESTIONS_FET_PREVIEW_VISIBLE=4;this.dCONFIG_MAX_BUCKET_SIZE_FOR_TAG_POPULARITY=25;this.dCONFIG_TIME_RECOMPUTE_TAG_POPULARITY_WITHIN_BUCKET_INTERVAL=86400;this.dCONFIG_MAX_POINTS_FOR_CORRECT_ANSWER_IN_LOUNGE_MODE=5;this.dCONFIG_MIN_ATTEMPTS_FOR_SHOW_ANSWER_STAT=10;this.dCONFIG_TIME_FOR_DAILY_START="0:00:00";this.dCONFIG_RAPID_MODE_POINTS_MULTIPLIER=4;this.dCONFIG_MAX_FET_QN_TEXT_PREVIEW_LENGTH=112;this.dCONFIG_MAX_RPQ_QN_TEXT_PREVIEW_LENGTH=40;this.dCONFIG_MAX_PAGE_SIXE_FOR_MY_TRIVIA=10;this.MaxRelatedTags=10;this.getAnswerFadeInterval=getAnswerFadeInterval;this.getAnswerFadeStepCount=getAnswerFadeStepCount;this.getAnswerFadeStepStart=getAnswerFadeStepStart;this.initializeConfig=initializeConfig;this.loadConfig=loadConfig;this.loadProperty=loadProperty;this.getMostRecentQuestionsAutoRefreshInterval=getMostRecentQuestionsAutoRefreshInterval;this.getRPQCycleInterval=getRPQCycleInterval;this.getFeaturedQuestionsAutoRefreshInterval=getFeaturedQuestionsAutoRefreshInterval;this.getNumberOfTagsToShow=getNumberOfTagsToShow;this.getNumberOfTagsToShowMT=getNumberOfTagsToShowMT;this.getNumberOfTagsToShowRT=getNumberOfTagsToShowRT;this.getNumberOfTagsToShowPT=getNumberOfTagsToShowPT;this.getNumberOfTagsToShowMoreTags=getNumberOfTagsToShowMoreTags;this.getTagListAutoRefreshInterval=getTagListAutoRefreshInterval;this.getRelatedTagLimit=getRelatedTagLimit;this.getCacheFillMargin=getCacheFillMargin;this.getNumFET=getNumFET;this.getUnplayedQnCount=getUnplayedQnCount;this.getPlayerPointsFor=getPlayerPointsFor;this.getLeaderboardNumUsers=getLeaderboardNumUsers;this.getLeaderboardTotalUsers=getLeaderboardTotalUsers;this.getLeaderboardAutoRefreshInterval=getLeaderboardAutoRefreshInterval;this.getMaxRecentQns=getMaxRecentQns;this.getNumImagesInGallery=getNumImagesInGallery;this.getImageGalleryThumbnailWidth=getImageGalleryThumbnailWidth;this.getImageGalleryThumbnailHeight=getImageGalleryThumbnailHeight;this.getLessPercentForStats=getLessPercentForStats;this.getLessPercentForHint=getLessPercentForHint;this.getLessPercentForEliminate2=getLessPercentForEliminate2;this.getRPQFadeInterval=getRPQFadeInterval;this.getRPQFadeStepCount=getRPQFadeStepCount;this.getSwapperFadeWait=getSwapperFadeWait;this.getTimeDelayToShowAnswers=getTimeDelayToShowAnswers;this.getMaxNumberOfTagsToShowForSearch=getMaxNumberOfTagsToShowForSearch;this.getMinAttemptsForShowAnswerStat=getMinAttemptsForShowAnswerStat;this.getHeartBeatInterval=getHeartBeatInterval;this.getTickerInterval=getTickerInterval;this.getSuccessMessageInterval=getSuccessMessageInterval;this.getLaunchUrlDelay=getLaunchUrlDelay;this.getRapidFirePointsMultiplier=getRapidFirePointsMultiplier;this.getDailyStartTime=getDailyStartTime;this.getRPQQnTextPreviewLength=getRPQQnTextPreviewLength;this.getFETQnTextPreviewLength=getFETQnTextPreviewLength;this.getAddBannersDisplayInterval=getAddBannersDisplayInterval;this.getLeaderBannersDisplayInterval=getLeaderBannersDisplayInterval;this.getNumberOfQuestionsToShowMyTrv=getNumberOfQuestionsToShowMyTrv;this.getSubmitTriviaAutoSaveInterval=getSubmitTriviaAutoSaveInterval;this.configNames=new Array(this.CONFIG_TIME_RPQ_DISPLAY_INTERVAL,this.CONFIG_TIME_RPQ_UPDATE_INTERVAL,this.CONFIG_TIME_ADD_BANNERS_DISPLAY_INTERVAL,this.CONFIG_MIN_QUESTIONS_REMAINING_IN_PLAYER_CACHE_BEFORE_NEXT_FETCH,this.CONFIG_MAX_QUESTIONS_FETCH_FOR_PLAYER_CACHE,this.CONFIG_PERCENT_POINTS_PENALTY_FOR_ANSWER_STATS,this.CONFIG_PERCENT_POINTS_PENALTY_FOR_ELIMINATE2,this.CONFIG_NUM_PLAYERS_FETCH_FOR_LEADER_BOARD_CACHE,this.CONFIG_NUM_QUESTIONS_FETCH_FOR_RPQ_PREVIEW_CACHE,this.CONFIG_DEFAULT_NUM_QUESTIONS_FET_PREVIEW_VISIBLE,this.CONFIG_MAX_BUCKET_SIZE_FOR_TAG_POPULARITY,this.CONFIG_TIME_RECOMPUTE_TAG_POPULARITY_WITHIN_BUCKET_INTERVAL,this.CONFIG_MAX_POINTS_FOR_CORRECT_ANSWER_IN_LOUNGE_MODE,this.CONFIG_MIN_ATTEMPTS_FOR_SHOW_ANSWER_STAT,this.CONFIG_TIME_FOR_DAILY_START,this.CONFIG_RAPID_MODE_POINTS_MULTIPLIER,this.CONFIG_MAX_FET_QN_TEXT_PREVIEW_LENGTH,this.CONFIG_MAX_RPQ_QN_TEXT_PREVIEW_LENGTH,this.CONFIG_MAX_PAGE_SIXE_FOR_MY_TRIVIA);this.ConfigMap;this.RPQRefreshInterval=this.dCONFIG_TIME_RPQ_DISPLAY_INTERVAL;this.RPQUpdateInterval=this.dCONFIG_TIME_RPQ_UPDATE_INTERVAL;this.AddBannersDisplayInterval=this.dCONFIG_TIME_ADD_BANNERS_DISPLAY_INTERVAL;this.LeaderBannersDisplayInterval=this.dCONFIG_TIME_LEADER_BANNERS_DISPLAY_INTERVAL;this.CacheFillMargin=this.dCONFIG_MIN_QUESTIONS_REMAINING_IN_PLAYER_CACHE_BEFORE_NEXT_FETCH;this.PlayerCacheSize=this.dCONFIG_MAX_QUESTIONS_FETCH_FOR_PLAYER_CACHE;this.PenaltyAnswerStats=this.dCONFIG_PERCENT_POINTS_PENALTY_FOR_ANSWER_STATS;this.PenalityEliminate2=this.dCONFIG_PERCENT_POINTS_PENALTY_FOR_ELIMINATE2;this.LeaderBoardCacheSize=this.dCONFIG_NUM_PLAYERS_FETCH_FOR_LEADER_BOARD_CACHE;this.RPQ=this.dCONFIG_NUM_QUESTIONS_FETCH_FOR_RPQ_PREVIEW_CACHE;this.FET=this.dCONFIG_DEFAULT_NUM_QUESTIONS_FET_PREVIEW_VISIBLE;this.moreTags=this.dCONFIG_MAX_BUCKET_SIZE_FOR_TAG_POPULARITY;this.MaxPointsForCorrectAnswer=this.dCONFIG_MAX_POINTS_FOR_CORRECT_ANSWER_IN_LOUNGE_MODE;this.MinAttemptsForShowAnswerStat=this.dCONFIG_MIN_ATTEMPTS_FOR_SHOW_ANSWER_STAT;this.taglistAutoRefreshInterval=this.dCONFIG_TIME_RECOMPUTE_TAG_POPULARITY_WITHIN_BUCKET_INTERVAL;this.dailyStartTime=this.dCONFIG_TIME_FOR_DAILY_START;this.rapidModePointsMultiplier=this.dCONFIG_RAPID_MODE_POINTS_MULTIPLIER;this.rpqPreviewLength=this.dCONFIG_MAX_RPQ_QN_TEXT_PREVIEW_LENGTH;this.fetPreviewLength=this.dCONFIG_MAX_FET_QN_TEXT_PREVIEW_LENGTH;this.myTriviaPageSize=this.CONFIG_MAX_PAGE_SIXE_FOR_MY_TRIVIA;function initializeConfig(context){var target=this;JSClientConfigService.loadProperties(this.configNames,{callback:function(dataFromServer){loadConfig(target,context,dataFromServer)}})}function loadConfig(me,context,configMap){var i=0;me.ConfigMap=configMap;me.RPQRefreshInterval=me.loadProperty(me.CONFIG_TIME_RPQ_DISPLAY_INTERVAL,me.dCONFIG_TIME_RPQ_DISPLAY_INTERVAL);me.RPQUpdateInterval=me.loadProperty(me.CONFIG_TIME_RPQ_UPDATE_INTERVAL,me.dCONFIG_TIME_RPQ_UPDATE_INTERVAL);me.CacheFillMargin=me.loadProperty(me.CONFIG_MIN_QUESTIONS_REMAINING_IN_PLAYER_CACHE_BEFORE_NEXT_FETCH,me.dCONFIG_MIN_QUESTIONS_REMAINING_IN_PLAYER_CACHE_BEFORE_NEXT_FETCH);me.PlayerCacheSize=me.loadProperty(me.CONFIG_MAX_QUESTIONS_FETCH_FOR_PLAYER_CACHE,me.dCONFIG_MAX_QUESTIONS_FETCH_FOR_PLAYER_CACHE);me.PenaltyAnswerStats=me.loadProperty(me.CONFIG_PERCENT_POINTS_PENALTY_FOR_ANSWER_STATS,me.dCONFIG_PERCENT_POINTS_PENALTY_FOR_ANSWER_STATS);me.PenalityEliminate2=me.loadProperty(me.CONFIG_PERCENT_POINTS_PENALTY_FOR_ELIMINATE2,me.dCONFIG_PERCENT_POINTS_PENALTY_FOR_ELIMINATE2);me.LeaderBoardCacheSize=me.loadProperty(me.CONFIG_NUM_PLAYERS_FETCH_FOR_LEADER_BOARD_CACHE,me.dCONFIG_NUM_PLAYERS_FETCH_FOR_LEADER_BOARD_CACHE);me.RPQ=me.loadProperty(me.CONFIG_NUM_QUESTIONS_FETCH_FOR_RPQ_PREVIEW_CACHE,me.dCONFIG_NUM_QUESTIONS_FETCH_FOR_RPQ_PREVIEW_CACHE);me.FET=me.loadProperty(me.CONFIG_NUM_QUESTIONS_FETCH_FOR_RPQ_PREVIEW_CACHE,me.dCONFIG_NUM_QUESTIONS_FETCH_FOR_RPQ_PREVIEW_CACHE);me.moreTags=me.loadProperty(me.CONFIG_MAX_BUCKET_SIZE_FOR_TAG_POPULARITY,me.dCONFIG_MAX_BUCKET_SIZE_FOR_TAG_POPULARITY);me.MaxPointsForCorrectAnswer=me.loadProperty(me.CONFIG_MAX_POINTS_FOR_CORRECT_ANSWER_IN_LOUNGE_MODE,me.dCONFIG_MAX_POINTS_FOR_CORRECT_ANSWER_IN_LOUNGE_MODE);me.MinAttemptsForShowAnswerStat=me.loadProperty(me.CONFIG_MIN_ATTEMPTS_FOR_SHOW_ANSWER_STAT,me.dCONFIG_MIN_ATTEMPTS_FOR_SHOW_ANSWER_STAT);me.taglistAutoRefreshInterval=me.loadProperty(me.CONFIG_TIME_RECOMPUTE_TAG_POPULARITY_WITHIN_BUCKET_INTERVAL,me.dCONFIG_TIME_RECOMPUTE_TAG_POPULARITY_WITHIN_BUCKET_INTERVAL);me.dailyStartTime=me.loadProperty(me.CONFIG_TIME_FOR_DAILY_START,me.dCONFIG_TIME_FOR_DAILY_START);me.rapidModePointsMultiplier=me.loadProperty(me.CONFIG_RAPID_MODE_POINTS_MULTIPLIER,me.dCONFIG_RAPID_MODE_POINTS_MULTIPLIER);me.rpqPreviewLength=me.loadProperty(me.CONFIG_MAX_RPQ_QN_TEXT_PREVIEW_LENGTH,me.dCONFIG_MAX_RPQ_QN_TEXT_PREVIEW_LENGTH);me.fetPreviewLength=me.loadProperty(me.CONFIG_MAX_FET_QN_TEXT_PREVIEW_LENGTH,me.dCONFIG_MAX_FET_QN_TEXT_PREVIEW_LENGTH);me.myTriviaPageSize=me.loadProperty(me.CONFIG_MAX_PAGE_SIXE_FOR_MY_TRIVIA,me.dCONFIG_MAX_PAGE_SIXE_FOR_MY_TRIVIA);eval(context+"_initialize()")}function loadProperty(propName,defValue){var config=this.ConfigMap[propName];if(config==null){return defValue}var val=config.currentValue;if(val==null){val=config.defaultValue;if(val==null){return defValue}}return val}function getSubmitTriviaAutoSaveInterval(){return 60000}function getAnswerFadeStepStart(){return 20}function getAnswerFadeInterval(){return 250}function getAnswerFadeStepCount(){return 50}function getMostRecentQuestionsAutoRefreshInterval(){return(this.RPQUpdateInterval*1000)}function getAddBannersDisplayInterval(){return(this.AddBannersDisplayInterval*1000)}function getLeaderBannersDisplayInterval(){return(this.LeaderBannersDisplayInterval*1000)}function getRPQCycleInterval(){return(this.RPQRefreshInterval*1000)}function getFeaturedQuestionsAutoRefreshInterval(){return 10000}function getNumberOfTagsToShow(){return this.moreTags}function getNumberOfTagsToShowMT(){return this.moreTags}function getNumberOfTagsToShowRT(){return this.moreTags}function getNumberOfTagsToShowPT(){return this.moreTags}function getNumberOfTagsToShowMoreTags(){return this.moreTags}function getTagListAutoRefreshInterval(){return(this.taglistAutoRefreshInterval*1000)}function getRelatedTagLimit(){return this.MaxRelatedTags}function getCacheFillMargin(){return this.CacheFillMargin}function getNumFET(){return this.FET}function getUnplayedQnCount(){return this.PlayerCacheSize}function getPlayerPointsFor(timeElapsed){return(isRapidFireMode())?this.MaxPointsForCorrectAnswer*this.getRapidFirePointsMultiplier():this.MaxPointsForCorrectAnswer}function getLeaderboardTotalUsers(){return this.LeaderBoardCacheSize}function getLeaderboardNumUsers(){return 10}function getLeaderboardAutoRefreshInterval(){return 30000}function getMaxRecentQns(){return this.RPQ}function getNumImagesInGallery(){return -1}function getImageGalleryThumbnailWidth(){return 96}function getImageGalleryThumbnailHeight(){return 64}function getMessageAutoRefreshInterval(){return 10000}function getLessPercentForStats(){return(this.PenaltyAnswerStats/100)}function getLessPercentForHint(){return 0.2}function getLessPercentForEliminate2(){return(this.PenalityEliminate2/100)}function getRPQFadeInterval(){return 250}function getRPQFadeStepCount(){return 25}function getSwapperFadeWait(){return 250}function getTimeDelayToShowAnswers(){return 1000}function getMaxNumberOfTagsToShowForSearch(){return -1}function getMinAttemptsForShowAnswerStat(){return this.MinAttemptsForShowAnswerStat}function getDailyStartTime(){return getDateFromFormat(this.dailyStartTime,"H:mm:ss")}function getHeartBeatInterval(){return 600000}function getTickerInterval(){return 1000}function getSuccessMessageInterval(){return 5000}function getLaunchUrlDelay(){return 100}function getRapidFirePointsMultiplier(){return this.rapidModePointsMultiplier}function getRPQQnTextPreviewLength(){return this.rpqPreviewLength}function getFETQnTextPreviewLength(){return this.fetPreviewLength}function getNumberOfQuestionsToShowMyTrv(){return this.myTriviaPageSize}}function createNewPlayURL(c){var b=c.split("/");var d=b[2];var a=b[3];var g=b[4];var f;var e=false;JSClientService.getPlayUrl(d,{callback:function(h){f=h;if(a!=undefined&&parseInt(a)>0){f+="/"+a}if(g!=undefined&&parseInt(g)>=0){f+="/"+g}},async:false,errorHandler:function(j,h){e=true}});if(e){f+="/play-trivia/t/"+d+"/q/"+a+"/m/"+g}return f}function constructPlayerHrefLower(c,b,a){if((c!="player")&&(c!="rt")){return"/play-trivia/"+b+"/"+a}else{if((a!=undefined)&&(a>0)){return"javascript:JSPlayer.requestReceiveQuestionsByQid("+b+","+a+",true, true);"}return"javascript:JSPlayer.loadQnForTag("+b+', "", "");'}}function constructPlayerHref(e,b,a,c){if((a<=0)&&(b<=0)){return"#"}if((a<=0)&&(b>0)){return constructPlayerHrefLower(e,b,a)}var d=constructPlayerHrefLower(e,b,a);return"javascript:checkB4LaunchPlayer("+c+",'"+d+"',"+b+",'"+e+"')"}function checkB4LaunchPlayer(b,c,a,d){var e=this;if((d=="fet")||(d=="rt")||(d=="rpq")||(d=="index")){JSClientService.checkPlayedNAvailable(a,b,{callback:function(h){var g=h[0];var f=h[1];launchIfNotPlayed(g,f,a,d,c,e)}})}else{JSClientService.isPlayed(b,{callback:function(f){launchIfNotPlayed(f,true,a,d,c,e)}})}}function launchAnotherQn(a,c,b){if((c=="player")||(c=="rt")){JSPlayer.fadeI.stopTimer();if(b!=undefined&&b==true){JSPlayer.pauseOff(JSPlayer);return}}if((c=="player")||(c=="rt")){JSPlayer.confirmBeforeSkipping(a)}else{if(b!=true){switchToPlayerHref(c,a,-1,-1)}}}function pauseOffIfPresent(a){if(a=="rt"){JSPlayer.pauseOff(JSPlayer)}}function launchIfNotPlayed(g,e,j,d,c,h){if((d=="player")||(d=="rt")){JSPlayer.pauseOn()}if(g){var f=document.getElementById("selected_context");if(f!=undefined){f.value=d}if(e){setCloseButtonFunction(j);showModalNew("popup-switch","launchAnotherQn",j+", '"+d+"', "+false,"You have already played this question. <br> Do you want to play another question in this category?",true,UIMessage.getMessage("question_already_played_msg",null),true,true,"updateTagClickStat",j)}else{if(d=="rpq"){var b=document.getElementById("rpq-tag-id");var a=parseInt(trimString(b.value));setCloseButtonFunction(j);showModalNew("popup-switch","launchAnotherQn",j+", '"+d+"', "+false,"You have already played this question. <br> Do you want to play another question in this category?",true,null,true,true,"updateTagClickStat",j)}else{setCloseButtonFunction(j);showModalNew("popup-switch","pauseOffIfPresent","'"+d+"'",UIMessage.getMessage("no_qns_left_msg",null),false,null,true,true,"updateTagClickStat",j)}}}else{if((d=="player")||(d=="rt")){JSPlayer.confirmBeforeSkipping(j,"","","","",c)}else{launch_url=c;showModeChangePopup()}}}function switchToPlayerHref(e,c,b,d,a){launch_url="/play-trivia/"+c+"/"+b;showModeChangePopup()}function showModeChangePopup(){if(isPromptMode()){document.getElementById("popup-launch").className="popup select";bry_popup("popup-launch",true,true);return}var a;if(PLAYER_LAUNCH_MODE_POPUP_NAME=="launch_lounge_popup"){document.getElementById("popup-launch-mode").innerHTML="lounge mode";a="launch_lounge_popup"}else{if(PLAYER_LAUNCH_MODE_POPUP_NAME=="launch_rapid_popup"){document.getElementById("popup-launch-mode").innerHTML="rapid-fire mode";a="launch_rapid_popup"}}document.getElementById("popup-launch").className="popup launch";bry_popup("popup-launch",true,true);launchUrl(createNewPlayURL(launch_url),a,false,UIConfig.getLaunchUrlDelay(),false,a+"_cancel()",true)}function checkB4PlayerSwitch_low(j,e,g,f,b){if((e=="player")||(e=="rt")){JSPlayer.pauseOn()}var h=j;if(h==0){if(e=="fet"){var c=document.getElementById("rpq-tag-id");var a=parseInt(trimString(c.value));var d=constructPlayerHref("rpq",a,-1,-1);checkB4LaunchPlayer(-1,d,a,"rpq")}else{setCloseButtonFunction(g);showModalNew("popup-switch","updateTagClickStat",g,UIMessage.getMessage("no_qns_left_msg",null),false,null,true,true)}return}closePopups();switchToPlayerHref(e,g,f,b,h)}function checkB4PlayerSwitch(c,d,a,b){window.scrollTo(0,0);if(c=="fet"){JSClientService.checkPlayedNAvailable(d,b,{callback:function(e){if(e[1]){checkB4PlayerSwitch_low(1,c,d,a,b)}else{checkB4PlayerSwitch_low(0,c,d,a,b)}}})}else{JSClientService.getNumUnplayedQns(d,{callback:function(e){checkB4PlayerSwitch_low(e,c,d,a,b)}})}}function constructHomePageHref(){var a="/index";var b=document.getElementById("anon");if(b!=undefined){b=b.innerHTML}else{b="0"}if(b=="1"){a="/j_acegi_logout"}return a}function switchToHomePage(){location.href=constructHomePageHref()}function setupTagMouseclick(elt,tagId,tagLabel,tagBreadcrumb){elt.onclick=function(){var funcstr='JSPlayer.confirmBeforeSkipping("'+tagId+'", "'+tagLabel+'", '+tagBreadcrumb+")";eval(funcstr)}}function setupTagMouseover(elt,id,breadcrumbStr,position,withRespectTo){if(withRespectTo==undefined||withRespectTo==null){elt.onmouseover=function(){var funcstr='TAG_POPUP.showBCTimer1("'+id+'", document.body, "none", true, 20, 30, "'+position+'",'+breadcrumbStr+")";eval(funcstr)}}else{elt.onmouseover=function(){var funcstr='TAG_POPUP.showBCTimer1("'+id+'", document.getElementById("'+withRespectTo+'"), "none", true, 20, 30, "'+position+'",'+breadcrumbStr+")";eval(funcstr)}}}function setupTagMouseover2(onclickfn,action,elt,id,breadcrumbStr,position,withRespectTo){if(withRespectTo==undefined||withRespectTo==null){elt.onmouseover=function(){var funcstr='showTagPopup("'+onclickfn+'", "'+id+'", document.body, "'+action+'", true, 20, 30, "'+position+'",'+breadcrumbStr+");";kzlog(funcstr);eval(funcstr)}}else{elt.onmouseover=function(){var funcstr='showTagPopup("'+onclickfn+'", "'+id+'", document.getElementById("'+withRespectTo+'"), "'+action+'", true, 20, 30, "'+position+'",'+breadcrumbStr+");";eval(funcstr)}}}function startBeats(a){new Heartbeat(a).startbeat()}function dhtmlLoadScript(a){var b=document.createElement("script");b.src=a;b.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(b)}var refreshMostRecentQuestionsId;var refreshTodaysFeaturedQuestionsId;var refreshTagListId;var refreshMyStatisticsId;var refreshLeaderDashboardId;function index_startAutoRefresh(){new JSTimer(function(a){a.refresh(a)},UIConfig.getMostRecentQuestionsAutoRefreshInterval(),JSRpqFet).startTimer();new JSTimer(function(a){a.refresh(a)},UIConfig.getTagListAutoRefreshInterval(),JSPTagList).startTimer();new JSTimer(function(a){a.refresh(a)},UIConfig.getLeaderboardAutoRefreshInterval(),JSLeaderBoardWrapper).startTimer()}function player_startAutoRefresh(){new JSTimer(function(a){a.refresh(a)},UIConfig.getTagListAutoRefreshInterval(),JSRTagList).startTimer();new JSTimer(function(a){a.refresh(a)},UIConfig.getTagListAutoRefreshInterval(),JSPTagList).startTimer();new JSTimer(function(a){a.refresh(a)},UIConfig.getLeaderboardAutoRefreshInterval(),JSLeaderBoardWrapper).startTimer()}function startRefresh(config,context){UIConfig=config;if(document.getElementById("userid")){document.getElementById("userId").innerHTML=getUser()}JSFet.requestRPQs();eval(context+"_startAutoRefresh()")}function initialize(a){UIConfig.initializeConfig(a)}function readjustPopularTagcloudSize(a,f){var e=document.getElementById("popular_tags");var b=document.getElementById("fet_table");if((b!=undefined)&&(e!=undefined)){var d=b.clientHeight-f;var c=Math.floor((d-2)/18);e.style.minHeight=(18*c+2)+"px";e.style.maxHeight=(18*c+17)+"px";if(e.scrollHeight>(18*c+17)){e.style.height=(18*c+17)+"px"}else{e.style.height="auto"}}}function initPlayMode(){var d=document.getElementById("currentPlayMode");var a=document.getElementById("currentSubmitMode");setupLaunchMode((d)?parseInt(d.innerHTML):0);var e=parseInt(d.innerHTML);var b=(a?parseInt(a.innerHTML):0);var f="";var c="";if(e==1){f="Lounge Mode"}else{if(e==2){f="Rapid-fire Mode"}}if(b==0){c="Off"}else{c="On"}JSPlayer.changedMode="You are playing in "+f+" with 1-click submit "+c}function player_initialize(){UIMessage.loadPlayer();index_init_low();initPlayMode();JSPTagList.initialize();var b=document.getElementById("anon");if(b!=undefined){b=b.innerHTML}else{b="0"}if(b=="0"){getCurrentLeaderboard().initialize()}else{var a=document.getElementById("lb_tab").innerHTML;kzlog("in player: "+a);if(a=="-1"){filter()}else{getCurrentLeaderboard().initialize()}}player_startAutoRefresh();JSPlayer.initialize();JSRTagList.initialize()}function showBrowseMenu(){browseMenuDisplay(true)}function hideBrowseMenu(){browseMenuDisplay(false)}function hideSearchPopup(){document.getElementById("popup-search").style.display="none"}function browseMenuDisplay(a){var c=document.getElementById("browse");var b=document.getElementById("browse-menu");var d=document.getElementById("popup-browse");if(a){c.className="current";b.style.display="block"}else{c.className=(d.style.display=="block")?"current":"";b.style.display=(d.style.display=="block")?"block":"none"}}function index_init_low(){var e=document.getElementById("browse");var c=document.getElementById("browse-menu");var f=document.getElementById("popup-browse");e.onmouseover=showBrowseMenu;e.onmouseout=hideBrowseMenu;e.onclick=hideSearchPopup;var a=document.getElementById("header-search-input");var b=document.getElementById("header-search-button");var d=document.getElementById("popup-search");b.onclick=function(){closePopups();var g=document.getElementById("overlay");if(g!=undefined){g.style.display="block"}d.style.display="block";JSGTagList.searchTags({keyCode:13},"header-search-input",false,false)};a.onfocus=function(){clearTextbox("header-search-input","#333333");return false};a.onkeypress=function(h){var g=(!h)?window.event.keyCode:h.which;if(g==13){closePopups();d.style.display="block";document.getElementById("global_tags").innerHTML="";JSGTagList.searchTags(h,"header-search-input",false,false)}}}function index_initialize(){index_init_low();initPlayMode();JSPTagList.initialize();var b=document.getElementById("anon");if(b!=undefined){b=b.innerHTML}else{b="0"}if(b=="0"){getCurrentLeaderboard().initialize()}else{var a=document.getElementById("lb_tab").innerHTML;kzlog("in index: "+a);if(a=="-1"){filter()}else{getCurrentLeaderboard().initialize()}}startRefreshEngine("index")}function startRefreshEngine(a){startRefresh(UIConfig,a)}function JSShowAddBanners(){this.index=-1;this.limit=6;this.addBannerImages=new Array(6);this.addBannerURLs=new Array(6);this.addBannerImages[0]="/images/Comingsoon300x250-1.jpg";this.addBannerImages[1]="/images/Morechannels300x250-1.jpg";this.addBannerImages[2]="/images/Givefeedback300x250-1.jpg";this.addBannerImages[3]="/images/Comingsoon300x250-2.jpg";this.addBannerImages[4]="/images/Morechannels300x250-2.jpg";this.addBannerImages[5]="/images/Givefeedback300x250-2.jpg";this.addBannerURLs[0]="";this.addBannerURLs[1]="javascript:showChannelSuggestionForm()";this.addBannerURLs[2]="javascript:showFeedbackForm();";this.addBannerURLs[3]="";this.addBannerURLs[4]="javascript:showChannelSuggestionForm()";this.addBannerURLs[5]="javascript:showFeedbackForm();";function a(g){var h=this.index;h=h+1;h=h%this.limit;this.index=h;var d=this.addBannerURLs[h];var c=this.addBannerImages[h];var b="pointer";if(d==""){d="javascript:void(0);";b="default"}var e=document.getElementById("add_banner_img");e.src=c;var f=document.getElementById("add_banner_url");f.href=d;f.style.cursor=b}this.refresh=a}function JSShowLeaderBanners(){this.index=0;this.limit=1;this.leaderBannerImages=new Array(2);this.leaderBannerURLs=new Array(2);this.leaderBannerImages[0]="/images/Favoritemoviesandtv728x90-1.gif";this.leaderBannerImages[1]="/images/Favoritemoviesandtv728x90-2.gif";this.leaderBannerURLs[0]="#";this.leaderBannerURLs[1]="#";function a(f){var g=this.index;g=g+1;g=g%this.limit;this.index=g;var d=this.leaderBannerURLs[g];var c=this.leaderBannerImages[g];var h=document.getElementById("leader_banner_img");h.src=c;var e=document.getElementById("fet-tag-id");var j=document.getElementById("leader_banner_url");if(e.value!=""){var b=parseInt(trimString(e.value));j.href="javascript:checkB4PlayerSwitch('fet',"+b+", -1, -1)";j.style.cursor="pointer"}else{j.href="javascript:void(0);";j.style.cursor="default"}}this.refresh=a}function JSShowLeaderFET(){var b=document.getElementById("fet-tag-id");var d=document.getElementById("leader_banner_url");if(b.value!=""){var c=document.getElementById("leader_banner_img");c.src="/images/Favoritemoviesandtv728x90-1.gif";var a=parseInt(trimString(b.value));d.href="javascript:checkB4PlayerSwitch('fet',"+a+", -1, -1)";d.style.cursor="pointer"}else{d.href="javascript:void(0);";d.style.cursor="default"}}function JSRpqFetWrapper(a,b){this.rpq=a;this.fet=b;this.curr=b;this.refresh=c;this.getCur=e;this.setRpqCur=d;this.setFetCur=f;function c(g){this.curr.refresh(this.curr)}function e(){return this.curr}function d(){this.curr.stopCycle();this.curr=this.rpq;this.curr.initialize()}function f(){this.curr.stopCycle();this.curr=this.fet;this.curr.initialize()}}function getQuestionTextSubStr(e,a,c){if(e==null){return e}if(a<1){return e}if(e.length<=a){return e}var d=a;var b=a/2+1;while(d>=b&&e.charAt(d)!=" "){--d}while(d>=b&&e.charAt(d)==" "){--d}if(d<b){d=b-1}return e.substring(0,d+1)+"..."}function JSRpqFet(ctxt){this.context=ctxt;this.recentQnsURLs=new Array(3);this.slots;this.tagList=new Array();this.recentQuestionList=new Array();this.curIdx=1;this.limit=4;this.refreshedOnce=false;this.cycleDirection=1;this.timer;function initialize(){if(this.timer!=undefined){this.refreshSlots(this.curIdx,3,this,true);this.timer.startTimer()}else{this.requestRPQs()}}function requestRPQs(){if(this.timer!=undefined){this.timer.stopTimer()}var target=this;if(this.context=="rpq"){JSClientService.getRPQs(UIConfig.getMaxRecentQns(),{callback:function(dataFromServer){target.refreshMostRecentQuestionsPlayed(dataFromServer,target)}})}else{if(this.context=="fet"){JSClientService.getFETs(UIConfig.getMaxRecentQns(),{callback:function(dataFromServer){target.refreshMostRecentQuestionsPlayed(dataFromServer,target)}})}else{}}}function clickRecentQnsURL(index){if(index<4){if((this.recentQnsURLs.length>=index-1)&&(this.recentQnsURLs[index-1]!=undefined)){var url=this.recentQnsURLs[index-1];if(url.indexOf("javascript")>=0){eval(url)}else{document.location.href=this.recentQnsURLs[index-1]}}else{var urlid="rpq_fet_href"+index;var url=document.getElementById(urlid).value;if(url.indexOf("javascript")>=0){eval(url)}else{document.location.href=eval(url)}}}}function refreshSlots(start,slots,me,clearUI){me.refreshedOnce=true;if((start>(me.recentQuestionList.length-2))||(start<1)){if(start>(me.recentQuestionList.length-2)){start=1}else{if(start<1){start=me.recentQuestionList.length-2}}}if(clearUI){me.clearRecentQnUI()}me.curIdx=start;if(me.slots==undefined){me.slots=new Array(3)}for(var index=start,ii=0;index<(start+slots);ii++,index++){var question=new Object();if(me.recentQuestionList[index-1]!=undefined){question=me.recentQuestionList[index-1];me.slots[ii]=question}var seconds=0;var date=new Date();var s_date=question.updatedDt;seconds=Math.round((date.getTime()-s_date.getTime())/1000);me.recentQnsURLs[index-start]=constructPlayerHref("index",question.primaryTag.tagUid,question.questionUid,question.questionNumber);var imgelt=document.getElementById("rpq_fet_img"+(index-start+1));imgelt.src=((question.imageUrl==null)||(trimString(question.imageUrl)==""))?question.primaryTag.tagImageUrl:question.imageUrl;var qText=getQuestionTextSubStr(question.questionText,UIConfig.getRPQQnTextPreviewLength());var subQText=(DEBUG_FLAG?("["+index+","+question.questionUid+","+question.questionNumber+"] "):"")+((question.questionText.length>UIConfig.getRPQQnTextPreviewLength()+3)?qText:question.questionText);document.getElementById("rpq_fet_question"+(index-start+1)).innerHTML=subQText;document.getElementById("rpq_fet_ago"+(index-start+1)).innerHTML=timeToDisplayStr(seconds);var totalTags=1;var pTag=question.primaryTag;var tagElem=document.getElementById("rpq_fet_tag"+(index-start+1));if(pTag){tagElem.innerHTML=pTag.tagLabel;tagElem.href="javascript:TAG_POPUP.hideBC2();"+constructPlayerHref("index",pTag.tagUid,question.questionUid,question.questionNumber);setupTagMouseover(tagElem,tagElem.id,pTag.breadcrumbString,"ABSOLUTE");tagElem.onmouseout=function(){TAG_POPUP.hideBCTimer()};tagElem.alt=pTag.tagLabel}else{tagElem.innerHTML="";tagElem.href="#";tagElem.onmouseover=function(){noop()};tagElem.onmouseout=function(){noop()}}}}function refreshMostRecentQuestionsPlayed(QuestionList,me){me.recentQuestionList=QuestionList;refreshSlots(me.curIdx,3,me);if(me.timer==undefined){var swapper=new JSSwapper(me.getRPQEltsToFade(),function(target){target.cycleRPQs()},me,UIConfig.getRPQFadeInterval(),UIConfig.getRPQFadeStepCount(),function(target){target.setArrowsEnabled(false)},function(target){target.setArrowsEnabled(true)});me.timer=new JSTimer(function(){swapper.swapFade()},UIConfig.getRPQCycleInterval(),me)}if(me.timer!=undefined){me.timer.startTimer()}}function clearRecentQnUI(){this.recentQnsURLs[0]="#";document.getElementById("rpq_fet_question1").href="#";document.getElementById("rpq_fet_question1").innerHTML="Who is..";document.getElementById("rpq_fet_question1").innerHTML=2+" seconds ago";this.recentQnsURLs[1]="#";document.getElementById("rpq_fet_question2").href="#";document.getElementById("rpq_fet_question2").innerHTML="What is..";document.getElementById("rpq_fet_question2").innerHTML=5+" seconds ago";this.recentQnsURLs[2]="#";document.getElementById("rpq_fet_question3").href="#";document.getElementById("rpq_fet_question3").innerHTML="How many..";document.getElementById("rpq_fet_question3").innerHTML=10+" seconds ago"}function shiftRight(){this.cycleDirection=-1;if(this.timer!=undefined){this.timer.stopTimer()}var swapper=new JSSwapper(this.getRPQEltsToFade(),function(target){target.shiftRightLow()},this,UIConfig.getRPQFadeInterval(),UIConfig.getRPQFadeStepCount(),function(target){target.setArrowsEnabled(false)},function(target){target.setArrowsEnabled(true)});swapper.swapFade();if(this.timer!=undefined){this.timer.startTimer()}}function shiftRightLow(){refreshSlots(this.curIdx-3,3,this,true)}function shiftLeftLow(){refreshSlots(this.curIdx+3,3,this,true)}function shiftLeft(){this.cycleDirection=1;if(this.timer!=undefined){this.timer.stopTimer()}var swapper=new JSSwapper(this.getRPQEltsToFade(),function(target){target.shiftLeftLow()},this,UIConfig.getRPQFadeInterval(),UIConfig.getRPQFadeStepCount(),function(target){target.setArrowsEnabled(false)},function(target){target.setArrowsEnabled(true)});swapper.swapFade();if(this.timer!=undefined){this.timer.startTimer()}}function refresh(me){if((me.slots!=undefined)&&me.refreshedOnce){me.requestRPQs()}}function checkIfInsideRPQ(){if(document.getElementById("tag_popup_name")){var str=document.getElementById("tag_popup_name").style.left;var start=0;var end=str.indexOf("px");var tag_left=parseInt(str.substring(start,end));str=document.getElementById("tag_popup_name").style.top;end=str.indexOf("px");var tag_top=parseInt(str.substring(start,end));var dim=getAnchorPosition("rpq_fet_box",document.body);var left=dim.x;var ttop=dim.y;var width=document.getElementById("rpq_fet_box").offsetWidth;var height=document.getElementById("rpq_fet_box").offsetHeight;if((tag_left>left)&&(tag_left<(left+width))){if((tag_top>ttop)&&(tag_top<(ttop+height))){TAG_POPUP.hideBC()}}}}function cycleRPQs(){checkIfInsideRPQ();refreshSlots(this.curIdx+(this.cycleDirection*3),3,this,true)}function getRPQEltsToFade(){var elist=new Array();for(var iii=1;iii<4;iii++){elist[iii-1]=document.getElementById("rpq_fet"+iii)}return elist}function setArrowsEnabled(flag){var larrow_e=document.getElementById("rpq_fet_larrow_enabled");var rarrow_e=document.getElementById("rpq_fet_rarrow_enabled");larrow_e.style.display=(flag)?"block":"none";rarrow_e.style.display=(flag)?"block":"none"}function stopCycle(){if(this.timer){this.timer.stopTimer()}}function startCycle(){if(this.timer){this.timer.startTimer()}}this.initialize=initialize;this.requestRPQs=requestRPQs;this.refreshMostRecentQuestionsPlayed=refreshMostRecentQuestionsPlayed;this.clickRecentQnsURL=clickRecentQnsURL;this.refresh=refresh;this.shiftRight=shiftRight;this.shiftLeft=shiftLeft;this.shiftRightLow=shiftRightLow;this.shiftLeftLow=shiftLeftLow;this.refreshSlots=refreshSlots;this.clearRecentQnUI=clearRecentQnUI;this.cycleRPQs=cycleRPQs;this.getRPQEltsToFade=getRPQEltsToFade;this.setArrowsEnabled=setArrowsEnabled;this.stopCycle=stopCycle;this.startCycle=startCycle}function JSFetRT(ctxt){this.context=ctxt;this.featuredQnsURLs=new Array(4);this.refreshedOnce=false;this.tagList=new Array();function refresh(me){if(me.refreshedOnce){me.requestRefreshFetRT(me.tagList)}}function clickFeaturedQnsURL(index){if(index<5){if((this.featuredQnsURLs.length>=index-1)&&(this.featuredQnsURLs[index-1]!=undefined)){document.location.href=this.featuredQnsURLs[index-1]}else{var urlid="fq"+index+"-href";var toeval=document.getElementById(urlid).value;document.location.href=eval(toeval)}}}function getUserFavTagList(){var target=this;JSClientService.getFavoriteTags(UIConfig.getNumberOfTagsToShow(),{callback:function(dataFromServer){updateTagList(dataFromServer,target)}})}function updateTagList(tags,me){me.tagList=tags;me.requestRefreshFetRT(me.tagList)}function requestRefreshFetRT(tagUid,qNumList){PerfMon.start("JSFetRT.requestRefreshFetRT");var target=this;if(this.context=="index"){alert(UIConfig.getNumFET());JSClientService.getFETs(UIConfig.getNumFET(),{callback:function(dataFromServer){refreshFetRT(dataFromServer,target)}})}else{JSClientService.getRTs(tagUid,qNumList,UIConfig.getNumFET(),{callback:function(dataFromServer){refreshFetRT(dataFromServer,target)}})}}function refreshFetRT(QuestionList,me){var fetTagIdElt=document.getElementById("fet-tag-id");var fetTagId=parseInt(trimString(fetTagIdElt.value));PerfMon.end("JSFetRT.requestRefreshFetRT");me.refreshedOnce=true;for(var index=1;index<5;index++){var question=QuestionList[index-1];if(me.context=="index"){me.featuredQnsURLs[index-1]=constructPlayerHref("index",question.primaryTag.tagUid,question.questionUid,question.questionNumber)}else{me.featuredQnsURLs[index-1]=constructPlayerHref("rt",question.primaryTag.tagUid,question.questionUid,question.questionNumber)}var qTags=question.questionTags;var imgelt=document.getElementById("fq-img-"+index);imgelt.src=((question.imageUrl==null)||(trimString(question.imageUrl)==""))?question.primaryTag.tagImageUrl:question.imageUrl;document.getElementById("cq_fet_rt_q"+index+"_question").innerHTML=(question.questionText.length>UIConfig.getFETQnTextPreviewLength()+3)?question.questionText.substring(0,UIConfig.getFETQnTextPreviewLength())+"...":question.questionText;var submit_date=question.updatedDt;var date=new Date();var seconds=Math.round((date.getTime()-submit_date.getTime())/1000);var dd=submit_date.getDate();var mm=submit_date.getMonth();var yy=submit_date.getFullYear();document.getElementById("cq_fet_rt_q"+index+"_added").innerHTML=timeToDisplayStr(seconds);document.getElementById("cq_fet_rt_q"+index+"_from").innerHTML=question.author.displayName;document.getElementById("cq_fet_rt_q"+index+"_kcard").href="/profile/"+question.author.userUid;document.getElementById("cq_fet_rt_q"+index+"_views").innerHTML=question.numberViews;var totalTags=document.getElementById("cq_fet_rt_tt"+index).value;totalTags=Math.min(parseInt(totalTags),5);for(var jj=0;jj<totalTags;jj++){var tagElem=document.getElementById("fq_q"+index+"_tag"+jj);var curtag=qTags[jj];if(curtag!=undefined){tagElem.innerHTML=curtag.tagLabel;if(me.context=="index"){tagElem.href="javascript:TAG_POPUP.hideBC2();"+constructPlayerHref("fet",curtag.tagUid,question.questionUid,question.questionNumber)}else{tagElem.href="javascript:TAG_POPUP.hideBC2();"+constructPlayerHref("rt",curtag.tagUid,question.questionUid,question.questionNumber)}setupTagMouseover(tagElem,tagElem.id,curtag.breadcrumbString,"ABSOLUTE");tagElem.onmouseout=function(){TAG_POPUP.hideBCTimer()};tagElem.name="fq_q"+index+"_"+curtag.tagName;tagElem.alt=curtag.tagLabel}}}}this.requestRefreshFetRT=requestRefreshFetRT;this.refreshFetRT=refreshFetRT;this.clickFeaturedQnsURL=clickFeaturedQnsURL;this.refresh=refresh;this.getUserFavTagList=getUserFavTagList;this.updateTagList=updateTagList}function JSBrowseTagSet(k,b,g){this.initialize=f;this.getTags=q;this.filterTags=d;this.refreshTagSet=n;this.refreshUnplayedSet=o;this.refreshFilterSelect=h;this.createHeaderRow=a;this.createHeaderRowIfReqd=j;this.addTagRow=m;this.addTagCell=l;this.addSeparatorCell=c;this.addSeparatorRow=e;this.firstCategory=b;this.currCategoryUid=-1;this.context=k;this.prefix=g;this.NUM_COLS=2;this.NUM_TAGS_PER_PAGE=-1;this.curHeaderChar="";this.currfilterSelectIds=[];this.clearUnplayedSet=p;function f(r){var s=new Array();if((r!=undefined)&&(r>0)){this.getTags(r)}else{if(this.firstCategory<0){return}this.getTags(this.firstCategory)}}function q(s){this.currCategoryUid=s;var v=this;showWaitingIconInDiv(this.prefix+"tag_browse_result_set_inner");var r=["showRecommendations","prependAllasFilterOption"];var u=false;var t=false;JSClientService.getCategoryBrowseConfigs(s,r,{callback:function(w){if(w[0]=="true"){u=true}if(w[1]=="true"){t=true}},async:false});JSClientService.getFiltersFor(s,{callback:function(w){v.refreshFilterSelect(w,s,t)},async:false});this.filterTags()}function d(){var A=this.currCategoryUid;showWaitingIconInDiv(this.prefix+"tag_browse_result_set_inner");var u=this.currfilterSelectIds;var y=[];for(var t in u){var r=u[t];var x=document.getElementById(r);if(x){var s=parseInt(trimString(x.options[x.selectedIndex].value));if(-1!=s){y.push(s)}}}var v=this;var z=["showRecommendations"];var w=false;JSClientService.getCategoryBrowseConfigs(A,z,{callback:function(B){if(B[0]=="true"){w=true}},async:false});if(w){JSClientService.getTopUnplayedTags(A,y,10,{callback:function(B){v.refreshUnplayedSet(B)}})}else{v.clearUnplayedSet()}JSClientService.getTagsByCategoryAndAssociation(A,y,this.NUM_TAGS_PER_PAGE,{callback:function(B){v.refreshTagSet(B,A)}})}function p(){removeAllChildNodes(document.getElementById(this.prefix+"tag_unplayed_result_set_inner"))}function o(x,r){var w=document.getElementById(this.prefix+"tag_unplayed_result_set_inner");if((x==undefined)||(x.length<=0)){w.innerHTML='<br/><br/><span class="browse_text_tags">Sorry, no topics with unplayed questions found. Please try another category and/or genre </span>';return}else{if(x.length==1){if(x[0].tagLabel=="profile_viewer"){document.getElementById("tag_unplayed_result_set_inner").style.display="none";return}}}if(!w){return}w.innerHTML="";var v=document.createElement("table");v.width="560";v.border="0";v.cellSpacing="0";v.cellPadding="0";var s=document.createElement("tbody");this.curHeaderChar="";var u=this.createHeaderRow("Recommendations for you","300");s.appendChild(u);for(var t=0;t<x.length;){t=this.addTagRow(s,x,t,false)}v.appendChild(s);w.appendChild(v)}function n(w,r){var v=document.getElementById(this.prefix+"tag_browse_result_set_inner");if((w==undefined)||(w.length<=0)){v.innerHTML='<br/><br/><span class="browse_text_tags">Sorry, no topics found. Please try another category and/or genre </span>';return}v.innerHTML="";var u=document.createElement("table");u.width="560";u.border="0";u.cellSpacing="0";u.cellPadding="0";var s=document.createElement("tbody");this.curHeaderChar="";for(var t=0;t<w.length;){t=this.addTagRow(s,w,t,true)}u.appendChild(s);v.appendChild(u)}function j(u,s){var r=u[s];var t=r.tagLabel.charAt(0);if(isNumber(parseInt(t))){t="#"}else{t=t.toUpperCase()}if(t!=this.curHeaderChar){this.curHeaderChar=t;return this.createHeaderRow()}return undefined}function a(v,r,x){var y=document.createElement("tr");var w=document.createElement("td");w.width="100%";w.align="left";w.valign="top";w.className="browse_text_tags";w.colSpan="3";var u=document.createElement("table");var z=document.createElement("tbody");var s=document.createElement("tr");var t=document.createElement("td");u.width=(r?r:"20");u.height=(x?x:"20");u.border="0";u.cellpadding="0";u.cellspacing="0";t.width=(r?r:"20");t.height=(x?x:"20");t.align="left";t.valign="middle";t.className="bgd_browse_alphabet";t.innerHTML=(v==undefined)?this.curHeaderChar:v;s.appendChild(t);z.appendChild(s);u.appendChild(z);w.appendChild(u);y.appendChild(w);return y}function m(v,u,r,x){if(x){var t=this.createHeaderRowIfReqd(u,r);if(t!=undefined){this.addSeparatorRow(v,"10");v.appendChild(t)}}var w=document.createElement("tr");for(var s=0;s<this.NUM_COLS;s++){r=this.addTagCell(w,u,r,"420",x);if(s<this.NUM_COLS-1){if(r>=u.length){this.addSeparatorCell(w,"20");this.addSeparatorCell(w,"270");v.appendChild(w);return r}if(x){var t=this.createHeaderRowIfReqd(u,r);if(t!=undefined){this.addSeparatorCell(w,"20");this.addSeparatorCell(w,"270");v.appendChild(w);this.addSeparatorRow(v,"10");v.appendChild(t);return r}else{this.addSeparatorCell(w,"20")}}else{this.addSeparatorCell(w,"20")}}}v.appendChild(w);return r}function l(E,A,C,u,B){if(C<A.length){var F=A[C];var D=document.createElement("td");D.width=u;D.align="left";D.valign="top";D.className="browse_text_tags";D.style.maxWidth=u+"px";D.style.minWidth=u+"px";var x=document.createElement("a");var z="btag_"+F.tagUid;x.setAttribute("id",z);if(!B){x.style.color="#0171bc"}else{x.style.color="#333333"}x.className="browse_text_tags";x.innerHTML=(F!=undefined)?F.tagLabel:"";if(this.context=="player"){x.href='javascript:TAG_POPUP.hideBC2();javascript:showModal(null,"",false,null, null, null, null, true, null);javascript:JSPlayer.confirmBeforeSkipping("'+F.tagUid+'","'+F.tagLabel+'",'+F.breadcrumbString+")"}else{x.href="javascript:TAG_POPUP.hideBC2();javascript:showModal(null,'',false,null, null, null, null, true, null);javascript:checkB4PlayerSwitch('"+this.context+"',"+F.tagUid+",-1,-1);"}var s=0;var v=F.breadcrumb[0].tagLabel;var w='\\"'+F.breadcrumb[0].tagLabel+":"+F.breadcrumb[0].tagUid+'\\"';for(s=1;s<F.breadcrumb.length;s++){v=v+"."+F.breadcrumb[s].tagLabel;w+=',\\"'+F.breadcrumb[s].tagLabel+":"+F.breadcrumb[s].tagUid+'\\"'}var r=F.breadcrumb.length-1;var t='JSMyTag.addToFaveTag(\\"'+x.id+'\\", \\"'+v+'\\", \\"'+F.breadcrumb[r].tagLabel+'\\", \\"'+this.context+'\\", \\"my_tags\\", \\"m\\", \\"'+x.className+'\\", \\"'+F.tagUid+'\\", \\"'+F.tagLabel+'\\", \\"'+F.popularityValue+'\\", '+w+");TAG_POPUP.hideBC();";var y="play_and_add";setupTagMouseover2(t,y,x,x.id,F.breadcrumbString,"FIXED",this.prefix+"tag_browse_result_set");x.onmouseout=function(){TAG_POPUP.hideBCTimer()};D.appendChild(x);E.appendChild(D)}return C+1}function e(t,s){var u=document.createElement("tr");var r=document.createElement("td");r.height=s;r.colspan=3;r.innerHTML="&nbsp;";u.appendChild(r);t.appendChild(u)}function c(t,s){var r=document.createElement("td");r.width=s;r.style.maxWidth=s+"px";r.style.minWidth=s+"px";r.innerHTML="&nbsp;";t.appendChild(r)}function h(z,C,H){var u=document.getElementById("filters_row");if(u==null){return}u=removeAllChildNodes(u);var w=document.createElement("td");w.style.color="#000000";w.className="browse_text_tags";this.currfilterSelectIds=[];var x="";if(z.length<=0){return}for(var G in z){var B=z[G];if(B==undefined||B==null){continue}var r=B[0];if(r==undefined||r==null){continue}var A=w.cloneNode(false);A.id="select_prompt_"+r;var t="";if(G>0){t=x}A.innerHTML=t+"Select "+r+":";u.appendChild(A);var v="form_select_"+r;var s="filter_select_"+r;this.currfilterSelectIds.push(s);var y=document.createElement("td");var E='<span id="'+v+'"><select style="width:150px;" id="'+s+'" onchange="JSBrowseTagSet.filterTags(); return false;">';if(H){E+='<option value="-1"> All </option>'}var D=B[1];for(var F in D){var I=D[F];if(I.tagUid==undefined||I.tagUid==null){continue}E+='<option value="'+I.tagUid+'" >'+I.tagLabel+"</option>"}E+="</select></span>";y.innerHTML=E;u.appendChild(y)}document.getElementById("mouse_over_msg").colSpan=z.length*2}}function JSTagList(g,f,j){this.timerid;this.context=g;this.whichCloud=f;this.title="More tags";this.reset=j;this.tagList;this.tagUidList;this.resetOnce=false;this.clickedTag="";this.searchInited=false;this.searchResults=new Array();this.initialize=a;this.refresh=c;this.requestRefreshTagList=n;this.refreshTagList=p;this.requestRefreshPopularity=l;this.refreshPopularity=m;this.storeList=h;this.updatePopularity=b;this.compareByLabel=e;this.compareByPopularityDesc=k;this.showMoreTags=d;this.enableMoreLink=q;this.searchTags=r;this.resetSearch=s;this.searchBoxShowHide=t;this.searchHeaderRowShowHide=o;function a(){this.refresh(this)}function b(w){var u=w.length;var y=Math.round((u*popularity_divs[0]));if(y<=0){y=1}var v=Math.round((u*popularity_divs[1]));if(v<=0){v=1}v=y+v;for(var x=0;x<u;x++){if(x<y){if(w[x].popularityValue>0){w[x].popularityValue=2}}else{if(x<v){if(w[x].popularityValue>0){w[x].popularityValue=1}}else{w[x].popularityValue=0}}}w.sort(e)}function k(v,u){return(u.popularityValue-v.popularityValue)}function e(v,u){if(v.tagLabel.charAt(0)<u.tagLabel.charAt(0)){return -1}if(v.tagLabel.charAt(0)>u.tagLabel.charAt(0)){return 1}return 0}function q(v,u){var x=document.getElementById(v+"_more_enabled");var w=document.getElementById(v+"_more_disabled");var y=document.getElementById(v+"_search_box");if(y){y.disabled=!this.searchInited&&!u}if(u){x.style.display="";w.style.display="none"}else{x.style.display="none";w.style.display=""}}function c(u){if(u.reset){u.requestRefreshTagList(u.whichCloud,u.whichCloud)}else{if(!u.resetOnce){u.requestRefreshTagList(u.whichCloud,u.whichCloud);u.resetOnce=true}else{u.requestRefreshPopularity()}}}function n(B,v,C){var z=this;var A=findAbsolutePos(document.getElementById(B));if(this.searchInited&&this.searchResults){this.refreshTagList(this.searchResults,v,z,C,A.x,A.y);return}switch(B){case"popular_tags":JSClientService.getPopularTags(((C!=undefined)&&C)?UIConfig.getNumberOfTagsToShowMoreTags():UIConfig.getNumberOfTagsToShowPT(),{callback:function(E){z.refreshTagList(E,v,z,C,A.x,A.y)}});break;case"my_tags":JSClientService.getFavoriteTags(((C!=undefined)&&C)?UIConfig.getNumberOfTagsToShowMoreTags():UIConfig.getNumberOfTagsToShowMT(),{callback:function(E){JSMyTag.createFavTagsCache(E);z.refreshTagList(fav_tags,v,z,C,A.x,A.y)}});break;case"related_tags":var D=-1;if(JSPlayer!=undefined){D=JSPlayer.currentOpTagId}var y=document.getElementById("play_bc1").innerHTML;var x=document.getElementById("play_bc2").innerHTML;if(x==""||y=="Other"){JSPlayer.relatedTagList=new Array();var u=player_currentQuestion;if(u!=undefined){var w=u.questionTags;w.sort(e);z.refreshTagList(w,v,z,C,A.x,A.y)}return}JSClientService.getRelatedTags(D,((C!=undefined)&&C)?UIConfig.getNumberOfTagsToShowMoreTags():UIConfig.getNumberOfTagsToShowRT(),{callback:function(G){var E=player_currentQuestion;G.sort(e);JSPlayer.relatedTagList=G;if(E!=undefined){var F=E.questionTags;F.sort(e);F=F.concat(G);z.refreshTagList(F,v,z,C,A.x,A.y)}else{z.refreshTagList(G,v,z,C,A.x,A.y)}}});break}}function l(){var u=this;JSClientService.getLatestPopularity(this.tagUidList,{callback:function(v){u.refreshPopularity(v,u.whichCloud,u)}})}function m(z,v,y){var x=v.substr(0,1);for(var w in z){var u=document.getElementById(x+"_"+w);if(u!=undefined){u.setAttribute("class","tag"+parseInt(parseInt(z[w])+1))}}}function h(w){this.tagList=new Array();this.tagUidList=new Array();for(var v=0;v<w.length;v++){var u=w[v];this.tagList[u.tagUid]=u;this.tagUidList[v]=u.tagUid}}function p(u,M,ab,X,J,I){if(ab.searchInited){ab.searchResults=u}if(!ab.searchInited){ab.storeList(u)}var E=M.substr(0,1);TAG_POPUP.hideBCTimer();var W;var N;var R=document.getElementById("anon");if(R!=undefined){R=R.innerHTML}else{R="0"}if(R=="1"&&M=="my_tags"){document.getElementById("my_tags").innerHTML="<span class='text_trivia_question' style='font-size:12px'> Please <a class='bright' style='font-weight:bold;' href='/signup'>signup</a> to add your favourite topics to this area.</span>";return}if(M=="moretags"||M=="global_tags"){W=this.whichCloud;N=((X!=undefined)&&X)?"active_popup_"+M:M;E="z"}else{W=M;N=M}var v=document.getElementById(M);if((X!=undefined)&&(X)){v=initModal(M)}v.innerHTML="";if(u.length<=0){var G=UIMessage.getMessage(((ab.searchInited)?("search_"+M):M)+"_cloud_no_tags_msg",null);if(G==null){G=UIMessage.getMessage(((ab.searchInited)?"search":M)+"_cloud_no_tags_msg",null)}v.innerHTML="<br/><span class='text_trivia_question'>"+G+"</span>";if((X!=undefined)&&(X)){var ae="";ae=this.whichCloud+"_more_tags_msg";showModal(v,UIMessage.getMessage(ae,null),true,null,null,null,null,true,UIMessage.getMessage("more_tags_help_msg",null),(ab.searchInited?"left":undefined))}return}if(ab.searchInited&&(X!=undefined)&&X){var aa=document.createElement("br");var w=document.createElement("span");w.className="text_trivia_question";w.innerHTML="Mouse over a search result below to see how many unplayed questions are available on that topic. Click on the topic to start playing.";v.appendChild(aa);v.appendChild(w);var U=document.createElement("br");var S=document.createElement("br");v.appendChild(U);v.appendChild(S)}var H=new Object();var B=new Object();var L=[];for(var T in u){var ad=u[T];if((ad==undefined)||(ad==null)){continue}if(B[ad.tagName]){continue}L.push(ad);B[ad.tagName]=true}for(var T in L){var ad=L[T];if((ad==undefined)||(ad==null)){continue}if(H[ad.tagLabel]){H[ad.tagLabel]+=1}else{H[ad.tagLabel]=1}}u=L;if(W=="my_tags"){JSMyTag.num_my_tags=u.length}for(var T=0;T<u.length;T++){var ad=u[T];if((ad==undefined)||(ad==null)||(ad.breadcrumb==undefined)||(ad.breadcrumb==null)){continue}if(ad.breadcrumb.length<3){continue}var P=document.createElement("a");var C=0;var Z=ad.breadcrumb[0].tagLabel;var A;if(ad.breadcrumb[2]!=undefined){A=ad.breadcrumb[2].tagLabel}else{A=ad.breadcrumb[1].tagLabel}if(M=="related_tags"&&JSPlayer.currTagLabel==A){continue}var F='\\"'+ad.breadcrumb[0].tagLabel+":"+ad.breadcrumb[0].tagUid+'\\"';var D='\\\\"'+ad.breadcrumb[0].tagLabel+":"+ad.breadcrumb[0].tagUid+'\\\\"';var O="'"+ad.breadcrumb[0].tagLabel+":"+ad.breadcrumb[0].tagUid+"'";for(C=1;C<ad.breadcrumb.length;C++){Z=Z+"."+ad.breadcrumb[C].tagLabel;F=F+',\\"'+ad.breadcrumb[C].tagLabel+":"+ad.breadcrumb[C].tagUid+'\\"';D=D+',\\\\"'+ad.breadcrumb[C].tagLabel+":"+ad.breadcrumb[C].tagUid+'\\\\"';var Y=ad.breadcrumb[C].tagLabel.split("'");O=O+", '"+Y[0];if(Y[1]!=undefined){O=O+"\\'"+Y[1]}O=O+":"+ad.breadcrumb[C].tagUid+"'"}if(T<(u.length-1)){v.appendChild(document.createTextNode(" "))}var V;if(ab.context=="player"){P.href='javascript:TAG_POPUP.hideBC2();javascript:JSPlayer.confirmBeforeSkipping("'+ad.tagUid+'","'+ad.tagLabel+'",'+ad.breadcrumbString+");scrollToTop();";V='javascript:JSPlayer.confirmBeforeSkipping(\\\\"'+ad.tagUid+'\\\\", \\\\"'+ad.tagLabel+'\\\\",'+D+")"}else{P.href="javascript:TAG_POPUP.hideBC2();javascript:checkB4PlayerSwitch('"+this.context+"',"+ad.tagUid+",-1,-1);"}if(X){P.href="javascript:TAG_POPUP.hideBC2();closePopups();javascript:showModal(null,'',false,null, null, null, null, true, null);"+P.href}var z=E+"_"+ad.tagUid;P.setAttribute("id",z);P.innerHTML=((H[ad.tagLabel])&&(H[ad.tagLabel]>1))?(ad.tagLabel+" ("+ad.breadcrumb[(ad.breadcrumb.length>=2)?ad.breadcrumb.length-2:0].tagLabel+")"):ad.tagLabel;var K=ad.breadcrumb.length-1;if(E=="z"){P.className="browse_text_tags";P.style.color="#333333"}else{P.className="tag"+(ad.popularityValue+1)}v.appendChild(P);var ac;var Q;if(W=="popular_tags"||W=="related_tags"||W=="global_tags"){ac='JSMyTag.addToFaveTag(\\"'+P.id+'\\", \\"'+Z+'\\", \\"'+ad.breadcrumb[K].tagLabel+'\\", \\"'+ab.context+'\\", \\"my_tags\\", \\"m\\", \\"'+P.className+'\\", \\"'+ad.tagUid+'\\", \\"'+ad.tagLabel+'\\", \\"'+ad.popularityValue+'\\", '+F+");TAG_POPUP.hideBC();";Q="play_and_add"}else{if(W=="my_tags"){ac='JSMyTag.removeFromFaveTag(\\"'+P.id+'\\", \\"s\\", \\"'+Z+'\\", \\"'+N+'\\");TAG_POPUP.hideBC();';Q="play_and_remove"}}if((X==undefined)||!X){setupTagMouseover2(ac,Q,P,P.id,ad.breadcrumbString,"ABSOLUTE");P.onmouseout=function(){TAG_POPUP.hideBCTimer()}}else{if(W=="my_tags"){setupTagMouseover2(ac,Q,P,P.id,ad.breadcrumbString,"FIXED",v.id)}else{setupTagMouseover2(ac,Q,P,P.id,ad.breadcrumbString,"FIXED",v.id)}P.onmouseout=function(){TAG_POPUP.hideBCTimer()}}}if((X!=undefined)&&(X)){var ae="";ae=this.whichCloud+"_more_tags_msg";showModal(v,UIMessage.getMessage(ae,null),true,null,null,null,null,true,UIMessage.getMessage("more_tags_help_msg",null),(ab.searchInited?"left":undefined))}}function d(u){this.requestRefreshTagList(u,"moretags",true)}function o(v,u){var w=document.getElementById(v);if(w){w.style.display=(u?"":"none");w.style.visibility=(u?"visible":"hidden")}}function t(v,w,x,u){document.getElementById(v).style.display=(u?"":"none");document.getElementById(v).style.visibility=(u?"visible":"hidden");document.getElementById(x).style.display=(u?"none":"");document.getElementById(x).style.visibility=(u?"hidden":"visible");if(u){document.getElementById(w).value="";document.getElementById(w).focus()}}function r(u,A,C,B){var w;if(u){w=u.keyCode}else{if(window.event){w=window.event.keyCode}else{return true}}if(w==13){this.searchHeaderRowShowHide(this.whichCloud+"_header_searchresults_row",true);this.searchInited=true;var v=this;var z=trimString(document.getElementById(A).value);showWaitingIconInDiv(this.whichCloud);if((B!=undefined)&&(B)){var x=initModal(this.whichCloud);var y="";y=this.whichCloud+"_more_tags_msg";showModal(x,UIMessage.getMessage(y,null),true,null,null,null,null,true,UIMessage.getMessage("more_tags_help_msg",null),"left");document.getElementById(A).value=""}JSClientService.searchTags(z,C,"",UIConfig.getMaxNumberOfTagsToShowForSearch(),{callback:function(H){var E=0;var G=H.length;for(var F=0;F<G;F++){var D=H[F];if((D==undefined)||(D==null)){continue}if(D.breadcrumb.length<3){E++}}if(E==G){H=[]}v.refreshTagList(H,v.whichCloud,v,B,0,0)}})}return false}function s(){this.reset=true;this.searchInited=false;showWaitingIconInDiv(this.whichCloud);var u=document.getElementById(this.whichCloud+"_search_box");if(u){u.value=""}this.refresh(this)}}function JSStatistics(){this.requestRefreshMyStatistics=f;this.requestRefreshMyScore=d;var a;var e;function f(){IUserService.getStatisticsDashboardData("402881e40c0ade16010c0ade1f630091",b);a=window.setTimeout(function(){f()},3000)}function b(g){document.getElementById("statsUserName").innerHTML="Name: "+g.user.first_name;document.getElementById("totalPoints").innerHTML="Total Points: "+g.total_points;document.getElementById("pointsAsPlayer").innerHTML="Points as Player: "+g.points_as_player;document.getElementById("pointsAsAuthor").innerHTML="PointsAsAuthor: "+g.points_as_author;document.getElementById("totalSubmittedQuestions").innerHTML="Total Submitted Questions: "+g.num_ques_submitted}function d(){IUserService.getStatisticsDashboardData("402881e40c0ade16010c0ade1f630091",c);e=window.setTimeout(function(){d()},3000)}function c(g){document.getElementById("score").innerHTML=g.points_as_player}}function refreshLeaderDashboard(){document.getElementById("leaderdashboard").innerHTML=new Date().getHours()+":"+new Date().getMinutes()+":"+new Date().getSeconds();refreshBestScoresId=window.setTimeout("refreshLeaderDashboard()",10000)}function processNewQuestion(){var e=document.getElementById("questionText").value;var c=document.getElementById("A").value;var b=document.getElementById("B").value;var a=document.getElementById("C").value;var f=document.getElementById("D").value;var d;if(document.getElementById("answer0").checked){d="A"}if(document.getElementById("answer1").checked){d="B"}if(document.getElementById("answer2").checked){d="C"}if(document.getElementById("answer3").checked){d="D"}QuestionOrganizer.subQues("john",e,d,c,b,a,f)}function previewNewQuestion(){}function JSFactoid(){this.timeoutID=0;this.showFactoid=a;this.hideFactoid=b;function a(c,d){JSPlayer.pauseOn()}function b(){JSPlayer.pauseOff(JSPlayer)}}function JSPlayer(){this.pauseOn=pauseOn;this.pauseOff=pauseOff;this.pauseCount=0;this.userPaused=false;this.resetPause=resetPause;this.resetTotalPause=resetTotalPause;this.pauseHandler=pauseHandler;this.initialize=initialize;this.displayAnswers=displayAnswers;this.refreshQuestions=refreshQuestions;this.requestReceiveQuestions=requestReceiveQuestions;this.requestReceiveQuestionsByQid=requestReceiveQuestionsByQid;this.receiveQuestions=receiveQuestions;this.requestRefreshTag=requestRefreshTag;this.refreshTag=refreshTag;this.displayNextQuestion=displayNextQuestion;this.updateTimeRemaining=updateTimeRemaining;this.startPlayerCountdown=startPlayerCountdown;this.getUserAnswer=getUserAnswer;this.submitAnswer=submitAnswer;this.resetQuestionCache=resetQuestionCache;this.getLatestQStat=getLatestQStat;this.toggleAnswerStat=toggleAnswerStat;this.showUserFeedback=showUserFeedback;this.answerQuestion=answerQuestion;this.updateScoreboard=updateScoreboard;this.updateForCorrect=updateForCorrect;this.updateForWrong=updateForWrong;this.resetShowAnswer=resetShowAnswer;this.loadQnForTag=loadQnForTag;this.handleTimeout=handleTimeout;this.clearQuestion=clearQuestion;this.enableSubmitBtn=enableSubmitBtn;this.toggleShowNoShowStats=toggleShowNoShowStats;this.showLayer=showLayer;this.hideLayers=hideLayers;this.setLayerContent=setLayerContent;this.setLayerContentTagFinish=setLayerContentTagFinish;this.showSwitchTopicLayer=showSwitchTopicLayer;this.pauseCountdownTimer=pauseCountdownTimer;this.updateLayerTimeRemaining=updateLayerTimeRemaining;this.updatePlayerPoints=updatePlayerPoints;this.toggleEliminateTwo=toggleEliminateTwo;this.showAllOptions=showAllOptions;this.hideOptions=hideOptions;this.highlightAnswer=highlightAnswer;this.setHighlight=setHighlight;this.challengeQuestion=challengeQuestion;this.challengeDone=challengeDone;this.popupDone=popupDone;this.confirmBeforeSkipping=confirmBeforeSkipping;this.initChallengePopup=initChallengePopup;this.setChallengeLinkEnabled=setChallengeLinkEnabled;this.resumeCountdownTimer=resumeCountdownTimer;this.startCountdownTimer=startCountdownTimer;this.setCurrentUserSel=setCurrentUserSel;this.alreadyPlayedError=alreadyPlayedError;this.setLayerPositionAndShow=setLayerPositionAndShow;this.challengeCallback=challengeCallback;this.toggleAllCrutches=toggleAllCrutches;this.toggleSubmit=toggleSubmit;this.toggleSkip=toggleSkip;this.togglePause=togglePause;this.getAnswerEltsToFade=getAnswerEltsToFade;this.startPlay=startPlay;this.initOpacity=initOpacity;this.setThumbsUpDown=setThumbsUpDown;this.setThumbsUpImages=setThumbsUpImages;this.getAllElems=getAllElems;this.requestRefreshRelatedTagList=requestRefreshRelatedTagList;this.requestRefreshRelatedTrivia=requestRefreshRelatedTrivia;this.pressCount=0;this.questionCache=new Array();this.questionNumCache=new Array();this.answerArr=new Array("A","B","C","D");this.layers=new Array("waiting","tag_finish","q_transition","error");this.currentPoints=0;this.currentQuestionIndex=0;this.currentQuestionNum=0;this.currentQuestionUid=0;this.currentCorrectResponse;this.currentTrueFalse;this.currentComment;this.currentQuestionText;this.currentThumbsUpDown=false;this.currentThumbsUpDownValue=0;this.submitted=false;this.refreshRelated=false;this.currentTagId;this.currentTagName;this.currentOpTagId;this.currentTag;this.currentOpTag;this.noMoreQuestions=false;this.currentUserSel;this.currentUrl;this.currentTotalAttempts=0;this.rpqTagId;this.countdownTimer;this.layerCountdownTimer;this.delayNextQnTimer;this.delayCurTag;this.displayAnswersTimeoutId;this.timeout=false;this.timeoutHandlerTimer;this.maxCountDownValue=30;this.maxLayerCountdownValue=8;this.countDownInterval=1000;this.countDownCounter=0;this.onTransitionLayer=false;this.cdTimerOn=false;this.seenStats=false;this.seenHint=false;this.eliminate2=false;this.elim1;this.elim2;this.fadeI;this.toggleMode=toggleMode;this.toggleSubmitMode=toggleSubmitMode;this.showToggleMode=showToggleMode;this.changedMode="";this.linkEnabled=false;this.currentMode;this.enableLink=enableLink;this.numUnplayedQ=0;this.submitMode=0;this.showReportQuestion=showReportQuestion;this.hideReportQuestion=hideReportQuestion;this.shareLink=shareLink;this.showShareLink=showShareLink;this.hideshareLinkForm=hideshareLinkForm;this.enablePlayButton=enablePlayButton;this.relatedTagList;this.reportQon=false;this.pauseCalled=false;this.refreshInProg=false;this.displayWaiting=false;this.toggleMode=toggleMode;this.prevTagUid=-1;this.currTagLabel="";function toggleMode(currentMode){if(linkEnabled==false){return}var newMode=-1;if(currentMode==1){newMode=2}else{if(currentMode==2){newMode=1}}if(currentMode==0){return}var pref=new Object();pref[4]=newMode;JSClientService.updateMySettings(pref,{callback:function(dataFromServer){}});document.getElementById("currentPlayMode").innerHTML=newMode;initPlayMode();var modeName="";if(newMode=="1"){modeName="Lounge Mode"}else{if(newMode=="2"){modeName="Rapid Fire Mode"}}var msg="Your Play mode has been changed to "+modeName+". The changes will take effect from next question";JSPlayer.pauseCountdownTimer();displayPopup(msg)}function displayPopup(msg){showModal(initModal("generic_prompt",null,function(modalElt){var msgElt=getFirstChildWithId(modalElt,"active_popup_prompt_message");msgElt.innerHTML=msg}),"",true,"this.resumeCountdownTimer();",null,null,null,true,null)}function initialize(){this.currentTagId=parseInt(document.getElementById("currentTagId").innerHTML);this.prevTagUid=this.currentTagId;this.currentTagName=document.getElementById("currentTagName").innerHTML;this.currentOpTagId=parseInt(document.getElementById("currentOpTagId").innerHTML);this.currentUserId=parseInt(document.getElementById("currentUserId").innerHTML);var anonLimit=document.getElementById("anon_limit");if((anonLimit!=null)&&(anonLimit!=undefined)&&(parseInt(anonLimit.innerHTML)<=0)){return}this.currentCorrectResponse=document.getElementById("currentCorrectResponse").innerHTML;this.currentComment=document.getElementById("currentComment").innerHTML;this.currentQuestionText=document.getElementById("currentQuestionText").innerHTML;this.currentTrueFalse=(document.getElementById("currentTrueFalse").innerHTML=="T");this.currentQuestionNum=parseInt(document.getElementById("currentQuestionNum").innerHTML);this.currentQuestionUid=parseInt(document.getElementById("currentQuestionUid").innerHTML);this.currentTotalAttempts=parseInt(document.getElementById("currentTotalAttempts").innerHTML);this.questionNumCache[0]=this.currentQuestionNum;this.rpqTagId=parseInt(document.getElementById("rpqTagId").innerHTML);this.currentMode=parseInt(document.getElementById("currentPlayMode").innerHTML);this.submitMode=parseInt(document.getElementById("currentSubmitMode").innerHTML);this.numUnplayedQ=parseInt(document.getElementById("num_upq").innerHTML);this.currTagLabel=document.getElementById("play_bc0").innerHTML;if(document.getElementById("play_bc2").innerHTML!=""){this.currTagLabel=document.getElementById("play_bc2").innerHTML}else{if(document.getElementById("play_bc1").innerHTML!=""){this.currTagLabel=document.getElementById("play_bc1").innerHTML}}var cquid=parseInt(document.getElementById("currentQuestionUid").innerHTML);if(cquid>0){JSClientService.getQuestionById(cquid,{callback:function(dataFromServer){player_currentQuestion=dataFromServer},async:false})}this.fadeI=new Fader(this.getAllElems(),function(target){target.startPlay()},this,UIConfig.getAnswerFadeStepStart(),UIConfig.getAnswerFadeInterval(),UIConfig.getAnswerFadeStepCount());updatePlayerPoints(UIConfig.getPlayerPointsFor(0));var existing=window.onresize;window.onresize=function(){JSPlayer.setLayerPositionAndShow();if(existing){existing}};this.countdownTimer=new JSCountdownTimer(function(target){target.handleTimeout(target)},this.updateTimeRemaining,this.maxCountDownValue,this.countDownInterval,this);this.layerCountdownTimer=new JSCountdownTimer(function(target){target.displayNextQuestion(target.currentTag,target.currentUrl);target.currentUrl=""},this.updateLayerTimeRemaining,this.maxLayerCountdownValue,this.countDownInterval,this);if(this.currentTrueFalse){document.getElementById("td_answerc").style.display="none";document.getElementById("td_answerd").style.display="none"}else{document.getElementById("td_answerc").style.display="";document.getElementById("td_answerd").style.display=""}this.initOpacity(this.getAllElems());if(this.currentQuestionUid<0){this.noMoreQuestions=true;this.currentQuestionIndex=0;this.displayNextQuestion();return}else{this.toggleAllCrutches(false);this.toggleSubmit(false);this.toggleSkip(false);this.togglePause(true);var me=this;this.displayAnswersTimeoutId=window.setTimeout(function(){me.displayAnswers()},UIConfig.getTimeDelayToShowAnswers())}var taglist=new Array(this.currentTagId,this.currentOpTagId);this.requestRefreshTag(taglist,false,false)}function showReportQuestion(){this.reportQon=true;if(this.onTransitionLayer){this.pauseOn()}else{if(isRapidFireMode()){this.pauseCalled=true}}document.getElementById("popup-report").style.display="block"}function hideReportQuestion(){this.reportQon=false;if(this.onTransitionLayer){this.pauseOff(this)}document.getElementById("popup-report").style.display="none"}function shareLink(mailids,fullname){JSClientService.sendShareLinkEmails(mailids,fullname,this.currentTagId,this.currTagLabel,{callback:function(dataFromServer){},errorHandler:function(errorMsg,exception){document.getElementById("active_popup_feedback_status_msg").innerHTML=errorMsg}})}function showShareLink(){this.shareLinkon=true;if(this.onTransitionLayer){this.pauseOn()}else{if(isRapidFireMode()){this.pauseCalled=true}}document.getElementById("sharePop").style.display="block";var fName=document.getElementById("first_name").innerHTML;var lName=document.getElementById("last_name").innerHTML;var anon=document.getElementById("anon");if(anon!=undefined){anon=anon.innerHTML}else{anon="0"}var name="";if(anon=="1"){if(fName=="f_anon"&&lName=="l_anon"){name="your first and last name"}else{if(fName=="f_anon"&&lName!="l_anon"&&lName!=""){name=lName}else{if(fName!="f_anon"&&lName=="l_anon"&&fName!=""){name=fName}else{if(fName!="f_anon"&&fName!=""&&lName=="l_anon"&&lName!=""){name=fName+" "+lName}}}}}else{if(fName==""&&lName==""){name="your first and last name"}else{name=fName+" "+lName}}document.getElementById("shareFirstLast").value=trimString(name);document.getElementById("shareEmail").value="enter comma separated email addresses";showMail()}function hideshareLinkForm(){JSPlayer.pauseOff(JSPlayer);document.getElementById("status-msg").style.display="none";document.getElementById("sharePop").style.display="none"}function toggleSubmitMode(){if(this.submitMode==1){this.submitMode=0}else{if(this.submitMode==0){this.submitMode=1}}var pref=new Object();pref[6]=this.submitMode;JSClientService.updateMySettings(pref,{callback:function(dataFromServer){}});document.getElementById("currentSubmitMode").innerHTML=this.submitMode;var msg="Your Submit mode has been changed ";displayPopup(msg)}function showToggleMode(){if(this.linkEnabled==false){return}if(this.currentMode==1){document.getElementById("player-settings-mode").innerHTML="Lounge";document.getElementById("player-settings-lounge").checked=true}else{document.getElementById("player-settings-mode").innerHTML="Rapid-fire";document.getElementById("player-settings-rapid").checked=true}if(this.submitMode==0){document.getElementById("player-settings-click").innerHTML="Off";document.getElementById("player-settings-clickoff").checked=true}else{document.getElementById("player-settings-click").innerHTML="On";document.getElementById("player-settings-clickon").checked=true}document.getElementById("player-settings").style.display="block"}function toggleMode(){document.getElementById("currentPlayMode").innerHTML=this.currentMode;document.getElementById("currentSubmitMode").innerHTML=this.submitMode;var pref=new Object();pref[4]=this.currentMode;pref[6]=this.submitMode;JSClientService.updateMySettings(pref,{callback:function(dataFromServer){initPlayMode()}});document.getElementById("player-settings").style.display="none"}function displayPopup(msg){showModal(initModal("generic_prompt",null,function(modalElt){var msgElt=getFirstChildWithId(modalElt,"active_popup_prompt_message");msgElt.innerHTML=msg}),"",true,null,null,null,null,true,null)}function enableLink(linkid,enable){var link=document.getElementById(linkid);if(enable){this.linkEnabled=true;link.style.textDecoration="none";link.style.cursor="pointer"}else{this.linkEnabled=false;link.style.textDecoration="none";link.style.cursor="default"}}function pauseOn(){if(this.userPaused){return}this.pauseCount++;if(this.pauseCount>1){return}this.pressCount=1;this.togglePause(false);this.pauseCountdownTimer()}function pauseOff(me){if(me.userPaused){return}me.pauseCount--;if(me.pauseCount>0){return}if(me.pauseCount<0){return}me.pressCount=0;me.togglePause(true);if(me.pauseCalled){me.pauseCalled=false}else{}}function resetTotalPause(){this.userPaused=false;this.pressCount=0;this.pauseCount=0;this.pauseCalled=false;this.togglePause(true);this.pauseCountdownTimer()}function enablePlayButton(enable){var link=document.getElementById("transition-play");var pl=document.getElementById("transition-pause");if(enable){link.disabled=0;link.style.textDecoration="none";link.style.cursor="pointer";link.onclick=function(){JSPlayer.resetTotalPause();JSPlayer.enablePlayButton(false);JSPlayer.displayNextQuestion(JSPlayer.currentTag,JSPlayer.currentUrl);JSPlayer.currentUrl="";return false};pl.disabled=0;pl.style.textDecoration="none";pl.style.cursor="pointer";pl.onclick=function(){JSPlayer.pauseHandler();return false}}else{link.disabled=1;link.style.textDecoration="none";link.style.cursor="default";link.onclick=function(){return false};pl.disabled=1;pl.style.textDecoration="none";pl.style.cursor="default";pl.onclick=function(){return false}}}function pauseHandler(){if(!this.cdTimerOn){return}if(this.pressCount==0){this.pauseCountdownTimer();this.togglePause(false);this.pressCount=1;this.pauseCount=1;this.userPaused=true}else{if(this.pauseCalled){this.pauseCalled=false;this.startCountdownTimer()}else{this.resumeCountdownTimer()}this.togglePause(true);this.pressCount=0;this.pauseCount=0;this.userPaused=false}}function getAllElems(){var elist=new Array();var opt=new Array("a","b","c","d");for(var iii=0;iii<opt.length;iii++){elist[iii]=document.getElementById("td_answer"+opt[iii])}return elist}function getAnswerEltsToFade(){var elist=new Array();var opt=(this.currentTrueFalse)?new Array("a","b"):new Array("a","b","c","d");for(var iii=0;iii<opt.length;iii++){elist[iii]=document.getElementById("td_answer"+opt[iii])}return elist}function displayAnswers(){this.initOpacity(this.getAllElems());this.fadeI.fadeIn()}function initOpacity(eList){if(this.fadeI){this.fadeI.stopTimer()}var elemList=eList;for(var iii=0;iii<elemList.length;iii++){if(typeof elemList[iii].style.MozOpacity!="undefined"){elemList[iii].style.MozOpacity=UIConfig.getAnswerFadeStepStart()/100}else{if(typeof elemList[iii].style.KhtmlOpacity!="undefined"){elemList[iii].style.KhtmlOpacity=UIConfig.getAnswerFadeStepStart()/100}else{if(typeof elemList[iii].filters=="object"){if((((elemList[iii].filters.length>0&&typeof elemList[iii].filters.alpha=="object"&&typeof elemList[iii].filters.alpha.opacity=="number"))||is_ie())){elemList[iii].filters.alpha.opacity=UIConfig.getAnswerFadeStepStart()}else{elemList[iii].style.opacity=UIConfig.getAnswerFadeStepStart()/100}}else{if(is_ie()){elemList[iii].filters.alpha.opacity=UIConfig.getAnswerFadeStepStart()}else{elemList[iii].style.opacity=UIConfig.getAnswerFadeStepStart()/100}}}}}}function startPlay(){this.enableLink("toggleMode_link",false);enableLink("toggleMode_link",false);if(!this.currentTrueFalse){this.toggleAllCrutches(true)}this.toggleSubmit(true);this.toggleSkip(true);if(isRapidFireMode()){updateTimeRemaining(30,this,"visible");this.startPlayerCountdown()}if(isOneClickSubmitMode()){document.getElementById("player-answers").className="answers oneclick";document.getElementById("td_answera").onclick=function(){JSPlayer.setCurrentUserSel("A");JSPlayer.submitAnswer(false,"false",JSPlayer,true);return false};document.getElementById("td_answerb").onclick=function(){JSPlayer.setCurrentUserSel("B");JSPlayer.submitAnswer(false,"false",JSPlayer,true);return false};document.getElementById("td_answerc").onclick=function(){JSPlayer.setCurrentUserSel("C");JSPlayer.submitAnswer(false,"false",JSPlayer,true);return false};document.getElementById("td_answerd").onclick=function(){JSPlayer.setCurrentUserSel("D");JSPlayer.submitAnswer(false,"false",JSPlayer,true);return false}}else{document.getElementById("player-answers").className="answers";document.getElementById("td_answera").onclick=function(){JSPlayer.setCurrentUserSel("A");JSPlayer.setHighlight("A","current","");return false};document.getElementById("td_answerb").onclick=function(){JSPlayer.setCurrentUserSel("B");JSPlayer.setHighlight("B","current","");return false};document.getElementById("td_answerc").onclick=function(){JSPlayer.setCurrentUserSel("C");JSPlayer.setHighlight("C","current","");return false};document.getElementById("td_answerd").onclick=function(){JSPlayer.setCurrentUserSel("D");JSPlayer.setHighlight("D","current","");return false}}this.enableLink("toggleMode_link",true)}function setCurrentUserSel(selection){this.currentUserSel=selection}function requestRefreshTag(taglist,reset,display){var target=this;JSClientService.loadTagMapByTagList(taglist,{callback:function(dataFromServer){target.refreshTag(dataFromServer,reset,display,target)}})}function refreshTag(tagmap,reset,display,me){me.currentOpTag=tagmap[me.currentOpTagId];me.currentTag=tagmap[me.currentTagId];me.requestReceiveQuestions(me.currentTag,reset,display)}function requestRefreshRelatedTagList(){JSRTagList.requestRefreshTagList(JSRTagList.whichCloud,JSRTagList.whichCloud)}function requestRefreshRelatedTrivia(tagUid,qNumList){JSFetRT.requestRefreshFetRT(tagUid,qNumList)}function refreshQuestions(){var tag;if(this.currentTag==undefined){tag=new Object();tag.tagUid=this.currentTagId}else{tag=this.currentTag}this.requestReceiveQuestions(tag,false,false)}function requestReceiveQuestionsByQid(tagUid,quid,reset,display){var target=this;JSClientService.loadQuestionForTagNId(quid,tagUid,{callback:function(dataFromServer){var qlist=dataFromServer.qlist;var tag=dataFromServer.tag;target.receiveQuestions(qlist,target,reset,display,tag)}})}function requestReceiveQuestions(tag,reset,display){if(reset||(((this.questionCache.length-this.currentQuestionIndex)<=UIConfig.getCacheFillMargin())&&!this.noMoreQuestions)){var target=this;var playedQns=(reset)?new Array():this.questionNumCache;playedQns[playedQns.length]=this.currentQuestionNum;JSClientService.getUnplayedQnListByTagId(tag.tagUid,playedQns,UIConfig.getUnplayedQnCount(),{callback:function(dataFromServer){target.receiveQuestions(dataFromServer,target,reset,display,tag)}})}}function receiveQuestions(QuestionList,me,reset,display,tag){this.refreshInProg=false;if(QuestionList.length<=0){me.noMoreQuestions=true;if(reset&&display){me.clearQuestion();return}}else{me.noMoreQuestions=false}me.resetQuestionCache(reset);var curlen=me.questionCache.length;for(var i=curlen;i<(QuestionList.length+curlen);i++){var num=QuestionList[i-curlen].questionNumber;me.questionCache[i]=QuestionList[i-curlen];me.questionNumCache[me.questionNumCache.length]=QuestionList[i-curlen].questionNumber}if(this.displayWaiting){this.displayWaiting=false;me.displayNextQuestion(tag);return}if(reset&&display){JSClientService.getPlayUrl(tag.tagUid,{callback:function(url){location.href=url},async:false});return;me.displayNextQuestion(tag,me.currentUrl);me.currentUrl=""}}function resetQuestionCache(reset){var newCache=new Array();var newNumCache=new Array();if(!reset){for(var i=this.currentQuestionIndex;((i>=0)&&(i<this.questionCache.length));i++){newCache[i-this.currentQuestionIndex]=this.questionCache[i];newNumCache[i-this.currentQuestionIndex]=this.questionNumCache[i]}}this.questionCache=newCache;this.questionNumCache=newNumCache;this.currentQuestionIndex=0;this.currentPoints=UIConfig.getPlayerPointsFor(-1)}function getUserAnswer(){return(this.currentUserSel!="")?this.currentUserSel:undefined}function submitAnswer(timeout,skip,me,startTransitionTimer,afterChallenge){if(userAnswer!=undefined){this.initOpacity(this.getAllElems());if(this.fadeI){this.fadeI.stopTimer()}}if(me.currentQuestionUid<0){return false}var userAnswer="";userAnswer=me.getUserAnswer();if((skip!="true")&&!timeout&&(userAnswer==undefined)){var promptt=UIMessage.getMessage("player_select_option_msg",null)+((me.currentTrueFalse)?" A/B":" A/B/C/D");showModalNew("popup-switch","JSPlayer.popupDone","0",promptt,false,UIMessage.getMessage("player_select_option_title_msg",null),true,true);return false}if(this.countdownTimer){this.countdownTimer.stopCountdown()}window.clearTimeout(this.displayAnswersTimeoutId);var timeElapsed=me.maxCountDownValue-me.countDownCounter;if(me.submitted){return false}me.submitted=true;var INCORRECT_OR_DONT_CARE=0;var CORRECT=1;var SKIPPED=2;var CHALLENGED=3;var correct=(me.currentCorrectResponse==userAnswer);if(timeout){me.showUserFeedback(true,INCORRECT_OR_DONT_CARE,timeElapsed,startTransitionTimer);me.answerQuestion("true",userAnswer,correct,timeElapsed,me.seenStats,me.seenHint,me.eliminate2)}else{if(skip=="false"){me.showUserFeedback(false,(correct?CORRECT:INCORRECT_OR_DONT_CARE),timeElapsed,startTransitionTimer);me.answerQuestion(skip,userAnswer,correct,timeElapsed,me.seenStats,me.seenHint,me.eliminate2)}else{if((afterChallenge!=undefined)&&afterChallenge){me.showUserFeedback(false,CHALLENGED,timeElapsed,startTransitionTimer)}else{me.showUserFeedback(false,SKIPPED,timeElapsed,startTransitionTimer)}me.answerQuestion(skip,"",false,timeElapsed,me.seenStats,me.seenHint,me.eliminate2)}}return true}function answerQuestion(skip,userAnswer,correct,timeElapsed,seenStats,seenHint,eliminate2){var ans=new Object();ans.questionNum=this.currentQuestionNum;ans.questionUid=this.currentQuestionUid;if(skip=="true"){ans.skip=true}else{ans.userAns=userAnswer;ans.correct=correct;ans.points=this.currentPoints}var target=this;JSClientService.answerQuestion(ans,this.currentTagId,{callback:function(){target.updateScoreboard(ans)},errorHandler:function(errorMsg,exception){target.alreadyPlayedError(errorMsg,exception,target)}})}function updateScoreboard(answer){var stat=new cloneObj(getCurrentLeaderboard().userstat);var dstat=new cloneObj(getCurrentLeaderboard().dailystat);stat.totalQuestionsPlayed=stat.totalQuestionsPlayed+1;dstat.totalQuestionsPlayed=dstat.totalQuestionsPlayed+1;if(answer.skip||answer.timeout){stat.totalQuestionsSkipped=stat.totalQuestionsSkipped+1;dstat.totalQuestionsSkipped=dstat.totalQuestionsSkipped+1}else{if(answer.correct){stat.points=stat.points+answer.points;dstat.totalPointsScored=dstat.totalPointsScored+answer.points;stat.totalQuestionsCorrect=stat.totalQuestionsCorrect+1;dstat.totalQuestionsCorrect=dstat.totalQuestionsCorrect+1}else{stat.totalQuestionsIncorrect=stat.totalQuestionsIncorrect+1;dstat.totalQuestionsIncorrect=dstat.totalQuestionsIncorrect+1}}var arr=new Array();arr[0]=stat;arr[1]=dstat;getCurrentLeaderboard().refreshUserStat(arr,getCurrentLeaderboard())}function updateForCorrect(points){this.setLayerContent(true,UIMessage.getMessage("player_correct_msg",null),true,points,this.currentComment,false,false,false,false,false,true,false,true)}function updateForWrong(){this.setLayerContent(false,UIMessage.getMessage("player_incorrect_msg",null),true,0,this.currentComment,false,false,false,false,false,true,false,true)}function resetShowAnswer(){this.currentUserSel=""}function alreadyPlayedError(errorStr,exception,me){if(me.onTransitionLayer){me.hideLayers();me.showLayer("blank",true,false,false);me.pauseCountdownTimer();showModal(initModal("generic_prompt",null,function(modalElt){var msgElt=getFirstChildWithId(modalElt,"active_popup_prompt_message");msgElt.innerHTML="Unexpected error! "+errorStr}),"Unexpected error",true,"JSPlayer.displayNextQuestion",null,null,null,true,null)}}function setThumbsUpImages(id,src,msrc){var eid=document.getElementById(id);eid.src=src;if(msrc){eid.onmouseover=function(){eval("JSPlayer.setThumbsUpImages ('"+id+"','"+msrc+"')")};eid.onmouseout=function(){eval("JSPlayer.setThumbsUpImages ('"+id+"','"+src+"')")}}}function setThumbsUpDown(flag){if(flag==this.currentThumbsUpDownValue){return}this.currentThumbsUpDownValue=flag;if(this.currentQuestionUid>=0){JSClientService.setThumbsUpDown(this.currentQuestionUid,flag,this.currentThumbsUpDown,{callback:function(){noop()}});this.currentThumbsUpDown=true}}function setLayerContentTagFinish(msg1,msg2,stopCountdown){if(stopCountdown){this.pauseCountdownTimer()}var p_tag_msg1=document.getElementById("tag_finish_msg1");if(p_tag_msg1){p_tag_msg1.innerHTML=msg1}var p_tag_msg2=document.getElementById("tag_finish_msg2");if(p_tag_msg2){p_tag_msg2.innerHTML=msg2}var p_tag_bc=document.getElementById("tag_finish_label");if(p_tag_bc){p_tag_bc.innerHTML=(this.currentTag?this.currentTag.tagLabel:"")}var p_tag_search=document.getElementById("global_tags_search_box");if(p_tag_search){p_tag_search.className="text_search";p_tag_search.value="Movie, TV show, Actor, Director, Character, Genre"}}function setLayerContent(correct,statusMsg,comments,showUserAnswer,challengeEnabled){var fac="";if(comments&&trimString(comments)!=""){fac=" factoid";document.getElementById("transition-factoid").innerHTML=comments}var player_div=document.getElementById("player");player_div.style.display="none";var transition_div=document.getElementById("transition");if(correct){transition_div.className="correct"+fac}else{transition_div.className="incorrect"+fac}var pl_qn_text=document.getElementById("transition-question");if(pl_qn_text){pl_qn_text.innerHTML=this.currentQuestionText}var pl_answer_text=document.getElementById("transition-answer");var pl_correct_answer_text=document.getElementById("transition-answer-correct");var userAnswer=this.getUserAnswer();pl_answer_text.innerHTML=(userAnswer)?document.getElementById("player_answer"+userAnswer.toLowerCase()).innerHTML:"None";if(this.currentCorrectResponse!=""){pl_correct_answer_text.innerHTML=document.getElementById("player_answer"+this.currentCorrectResponse.toLowerCase()).innerHTML}document.getElementById("transition-share").innerHTML=this.currTagLabel;this.resetPause();this.enablePlayButton(true);transition_div.style.display="block";this.updateLayerTimeRemaining(this.maxLayerCountdownValue,this);document.getElementById("trans_player_breadcrumbs").innerHTML=document.getElementById("player_breadcrumbs").innerHTML;document.getElementById("trans_show_num_upq").innerHTML=document.getElementById("show_num_upq").innerHTML}function setLayerPositionAndShow(name,show){var anchor=getAnchorPosition("player_table",document.body);var x=anchor.x;var y=anchor.y;var player_table=document.getElementById("player_table_outer");var l=document.getElementById("layer");l.style.left=x+"px";l.style.top=y+"px";var lc;if(name){lc=document.getElementById(name+"_layercontent")}else{for(var ii=0;ii<this.layers.length;ii++){var layer=document.getElementById(this.layers[ii]+"_layercontent");if(layer&&layer.style.display!="none"){lc=layer;break}}}if(lc){lc.style.left=x+"px";lc.style.top=y+"px"}if(player_table){l.style.height=player_table.clientHeight+"px";if(lc){lc.style.height=player_table.clientHeight+"px"}}if(show!=undefined){var rating_msg=document.getElementById("rating_msg");if(rating_msg){rating_msg.style.visibility="hidden"}if(show){l.style.display="";l.style.visibility="visible";if(lc){lc.style.display=""}if(lc){lc.style.visibility="visible"}scrollIfNotVisible_lower(y)}else{l.style.display="none";l.style.visibility="hidden";if(lc){lc.style.display="none"}if(lc){lc.style.visibility="visible"}}}}function hideLayers(){for(var ii=0;ii<this.layers.length;ii++){this.showLayer(this.layers[ii],false,false,false)}}function showLayer(name,show,hasTimer,startTimer){if(show){this.onTransitionLayer=true;document.getElementById("rate-up").className="thumb up";document.getElementById("rate-down").className="thumb down";if(hasTimer){this.cdTimerOn=true;if(startTimer&&!(this.reportQon)){this.layerCountdownTimer.stopCountdown()}else{this.pauseCount=1;this.pressCount=1;this.togglePause(false);this.layerCountdownTimer.stopCountdown()}}else{this.cdTimerOn=false}}else{this.layerCountdownTimer.stopCountdown();this.onTransitionLayer=false}}function showUserFeedback(timeout,correct,timeElapsed,startTransitionTimer){if(timeout){this.setLayerContent(false,UIMessage.getMessage("player_timeout_msg1",null),this.currentComment,false,true)}else{switch(correct){case 0:this.setLayerContent(false,UIMessage.getMessage("player_incorrect_msg",null),this.currentComment,true,true);break;case 1:this.setLayerContent(true,UIMessage.getMessage("player_correct_msg",null),this.currentComment,false,true);break;case 2:this.setLayerContent(false,UIMessage.getMessage("player_skipped_msg1",null),this.currentComment,false,true);break;case 3:this.setLayerContent(false,UIMessage.getMessage("player_challenge_msg1",null),this.currentComment,false,false);break}}this.initOpacity(this.getAllElems());if(this.fadeI){this.fadeI.stopTimer()}this.showLayer("q_transition",true,true,startTransitionTimer)}function resetPause(){this.pressCount=0;this.togglePause(true)}function displayNextQuestion(Tag,Url){if(this.noMoreQuestions&&this.currentQuestionUid<0){this.noMoreQuestions=false;this.clearQuestion();return}if(Tag.tagUid!=this.prevTagUid){this.prevTagUid=Tag.tagUid;JSClientService.getPlayUrl(Tag.tagUid,{callback:function(url){location.href=url},async:false});return}var tagRefDone=false;var anonDone=false;var anon=document.getElementById("anon");if(anon!=undefined){anon=anon.innerHTML}else{anon="0"}if((this.currentQuestionIndex>=this.questionCache.length)&&this.noMoreQuestions){this.noMoreQuestions=false;this.clearQuestion();return}if(anon=="1"){JSClientService.updateMaxNumQs({callback:function(dataFromServer){document.getElementById("anon_limit").innerHTML=dataFromServer;if(dataFromServer==0){JSPlayer.clearQuestion("anon");anonDone=true}},async:false})}if(anonDone){return}if((this.currentQuestionIndex>0)&&(this.currentQuestionIndex>=this.questionCache.length)){document.getElementById("transition").style.display="none";document.getElementById("switch").style.display="block";document.getElementById("throw-loading").style.display="block";this.displayWaiting=true;return}if(this.changedMode!=""){document.getElementById("show_mode").innerHTML=this.changedMode;this.changedMode=""}this.numUnplayedQ--;if(this.numUnplayedQ>=0){document.getElementById("par_show_num_upq").style.display=""}if(Tag.tagLabel=="Most Recent Trivia"){document.getElementById("show_num_upq").innerHTML="plenty"}else{document.getElementById("show_num_upq").innerHTML=this.numUnplayedQ}document.getElementById("selected-question-image").style.display="none";this.submitted=false;this.seenStats=false;this.seenHint=false;this.eliminate2=false;this.elim1="";this.elim2="";this.toggleEliminateTwo("noshow");this.currentPoints=UIConfig.getPlayerPointsFor(-1);this.resetShowAnswer();this.toggleAllCrutches(false);this.toggleSubmit(false);this.toggleSkip(false);var me=this;this.countdownTimer.stopCountdown();this.updateTimeRemaining(30,this,"hidden");if((Url!=undefined)&&(trimString(Url)!="")){window.location.href=Url;return}if(this.questionCache.length>0){this.hideLayers();var cQ=this.questionCache[this.currentQuestionIndex];player_currentQuestion=cQ;this.currentTrueFalse=cQ.trueFalse;var bc;if(Tag==undefined){this.currentOpTagId=this.questionCache[this.currentQuestionIndex].primaryTag.tagUid;bc=this.questionCache[this.currentQuestionIndex].primaryTag.breadcrumb;this.requestRefreshRelatedTagList();tagRefDone=true;this.requestRefreshRelatedTrivia(this.currentTagId,this.currentQuestionUid)}else{bc=breadcrumbStringToBreadcrumb1(Tag.breadcrumbString);if((this.currentTagId!=this.currentOpTagId)||(this.refreshRelated)){if((bc[2]!=undefined)&&bc[1].tagLabel!="Other"){this.requestRefreshRelatedTagList();tagRefDone=true;if(this.refreshRelated){this.refreshRelated=false}}else{this.relatedTagList=new Array()}}}if((cQ.imageUrl!=undefined)&&(trimString(cQ.imageUrl)!="")){document.getElementById("selected-question-image").src=cQ.imageUrl}else{if((cQ.videoUrl!=undefined)&&(trimString(cQ.videoUrl)!="")){var so=new SWFObject(cQ.videoUrl,"mymovie","300","150","5","#336699");so.write("player_img")}else{document.getElementById("player_img").innerHTML='<img id="questionImg" src="'+cQ.primaryTag.tagImageUrl+'" class="scale-img" />'}}var mybc="";this.currTagLabel=bc[0].tagLabel;if(bc[1]!=undefined){mybc=mybc+bc[1].tagLabel;this.currTagLabel=bc[1].tagLabel}else{}if(bc[2]!=undefined){mybc=mybc+" > "+bc[2].tagLabel;this.currTagLabel=bc[2].tagLabel}else{}bcStrForLastPage=mybc;document.getElementById("player_breadcrumbs").innerHTML=mybc;document.getElementById("player_breadcrumbs").innerHTML=document.getElementById("trans_player_breadcrumbs").innerHTML;this.updatePlayerPoints(this.currentPoints);document.getElementById("player-timer").innerHTML=this.maxCountDownValue;scrollIfNotVisible(document.getElementById("player_question"));document.getElementById("player_question").innerHTML=cQ.questionText;var ansa=(!cQ.trueFalse)?cQ.answerA:((cQ.answerA=="T")?"True":"False");ansa="A. "+ansa;var ansb=(!cQ.trueFalse)?cQ.answerB:((cQ.answerB=="T")?"True":"False");ansb="B. "+ansb;document.getElementById("player_answera").innerHTML=ansa;document.getElementById("player_answerb").innerHTML=ansb;this.initOpacity(this.getAllElems());document.getElementById("player_q_from").innerHTML=cQ.author.displayName;document.getElementById("answer_stat_link").onclick=function(){JSPlayer.getLatestQStat(cQ.questionUid,"show")};if(cQ.trueFalse){document.getElementById("player_answerc").innerHTML="";document.getElementById("player_answerd").innerHTML="";document.getElementById("td_answerc").style.display="none";document.getElementById("td_answerd").style.display="none"}else{document.getElementById("player_answerc").innerHTML="C. "+cQ.answerC;document.getElementById("player_answerd").innerHTML="D. "+cQ.answerD;document.getElementById("td_answerc").style.display="";document.getElementById("td_answerd").style.display=""}var qTags=cQ.questionTags;var rlist=this.relatedTagList;if(!tagRefDone){qTags.sort(JSRTagList.compareByLabel);qTags=qTags.concat(rlist);JSRTagList.refreshTagList(qTags,JSRTagList.whichCloud,JSRTagList,false,0,0)}var addedElt=document.getElementById("player-added");var curDate=new Date();addedElt.innerHTML=timeToDisplayStr(Math.round(curDate.getTime()/1000-cQ.updatedDt.getTime()/1000));var fromElt=document.getElementById("player_q_from");fromElt.innerHTML=cQ.author.displayName;var aKcard=document.getElementById("player_kcard");aKcard.href="/profile/"+cQ.author.userUid;this.currentQuestionNum=cQ.questionNumber;this.currentQuestionUid=cQ.questionUid;this.currentCorrectResponse=cQ.correctResponse;this.currentComment=cQ.userComment;this.currentTrueFalse=cQ.trueFalse;this.currentTotalAttempts=cQ.totalAttempts;this.currentQuestionText=cQ.questionText;this.currentThumbsUpDown=false;this.currentThumbsUpDownValue=0;if(this.currentQuestionIndex<this.questionCache.length){this.currentQuestionIndex++}if(isOneClickSubmitMode()){document.getElementById("player-answers").className="answers oneclick";if(document.getElementById("player-submit")){document.getElementById("player-submit").style.display="none"}document.getElementById("player-skip").style.right="65px"}else{document.getElementById("player-answers").className="answers";if(document.getElementById("player-submit")){document.getElementById("player-submit").style.display="block"}document.getElementById("player-skip").style.right="26px"}document.getElementById("transition").style.display="none";document.getElementById("throw-loading").style.display="none";document.getElementById("switch").style.display="none";document.getElementById("answer-stats").style.display="none";this.hideReportQuestion();document.getElementById("selected-question-image").style.display="block";document.getElementById("player_q_challenge").style.display="block";document.getElementById("player").style.display="block"}else{this.hideLayers();this.showLayer("waiting",true,false,false);document.getElementById("throw-loading").style.display="block";this.loadQnForTag(this.currentTag.tagUid,"","");return}this.displayAnswersTimeoutId=window.setTimeout(function(){me.displayAnswers()},UIConfig.getTimeDelayToShowAnswers());if((this.questionCache.length-this.currentQuestionIndex)<=UIConfig.getCacheFillMargin()){if(!this.refreshInProg){this.refreshInProg=true;this.refreshQuestions()}}enableLink("toggleMode_link",false)}function clearQuestion(ctx){var anon=0;if(ctx!=undefined&&ctx=="anon"){anon=1}this.submitted=false;this.resetShowAnswer();document.getElementById("player_question").innerHTML="";document.getElementById("player_answera").innerHTML="";document.getElementById("player_answerb").innerHTML="";document.getElementById("player_answerc").innerHTML="";document.getElementById("player_answerd").innerHTML="";this.currentQuestionNum=-1;this.currentQuestionUid=-1;this.currentCorrectResponse="";this.currentComment="";this.currentQuestionText="";this.resetQuestionCache(true);this.currentQuestionIndex=-1;this.hideLayers();this.setLayerContentTagFinish("Congratulations!","You have played all questions for");this.currentTag=new Object();this.currentTag.tagUid=this.rpqTagId;this.showLayer("tag_finish",true,false,false);var tagName=bcStrForLastPage;if(tagName==""){tagName=document.getElementById("play_bc2").innerHTML}this.numUnplayedQ=-1;document.getElementById("par_show_num_upq").style.display="none";document.getElementById("player").style.display="none";document.getElementById("player-switch-tag").innerHTML=tagName;document.getElementById("transition").style.display="none";document.getElementById("switch").className="complete";document.getElementById("family-guy-ad").style.display="none";document.getElementById("vg-perm-ad").style.display="none";if(anon){document.getElementById("player-switch-tag").innerHTML="";var chk=""+document.getElementById("player_breadcrumbs").innerHTML;if(chk.indexOf("TV Show")>=0&&chk.indexOf("Family Guy")>=0){document.getElementById("family-guy-ad").style.display=""}else{if(play_channel_id==2){document.getElementById("vg-perm-ad").style.display=""}else{document.getElementById("switch_msg1").innerHTML="Join Kwanzoo so that you don't get served the same question twice. <br /> It takes about a minute and is absolutely free. Plus, you'll be able to:";document.getElementById("switch_msg2").innerHTML="Save your score<br />Compete for points and prizes<br />Invite friends to play <br />Submit your own trivia <br /><br />";if(document.getElementById("anon_limit").innerHTML==0){document.getElementById("switch_title").style.display="block";document.getElementById("switch_title").innerHTML="<span style='font-weight: bold; font-size: 18px;'> Having fun?</span><br /><br />"}else{document.getElementById("switch_title").style.display="none"}document.getElementById("switch_link").href="/signup";document.getElementById("switch_link").onclick=function(){};document.getElementById("switch_img").src="/images/home-signup.gif";document.getElementById("continue_playing").style.display=""}}}else{document.getElementById("switch_msg1").innerHTML="Congrats! You've finished playing questions for:";document.getElementById("switch_msg2").innerHTML="To play next question, browse or search for your favorite topics above<br />or let Kwanzoo throw something at you";document.getElementById("switch_link").href="#";document.getElementById("switch_title").style.display="none";document.getElementById("switch_link").onclick=function(){JSPlayer.displayNextQuestion(JSPlayer.currentTag)};document.getElementById("switch_img").src="/images/switch-throw.gif";document.getElementById("continue_playing").style.display="none"}document.getElementById("switch").style.display="block"}function showSwitchTopicLayer(){this.resetQuestionCache(true);this.currentQuestionNum=-1;this.currentQuestionUid=-1;this.noMoreQuestions=false;this.currentTag=new Object();this.currentTag.tagUid=this.rpqTagId;var tagName=document.getElementById("player_breadcrumbs").innerHTML;this.numUnplayedQ=-1;document.getElementById("par_show_num_upq").style.display="none";document.getElementById("player-switch-tag").innerHTML=tagName;document.getElementById("switch").className="switch";document.getElementById("transition").style.display="none";document.getElementById("throw-loading").style.display="none";document.getElementById("switch").style.display="block";var anon=document.getElementById("anon");if(anon!=undefined){anon=anon.innerHTML}else{anon="0"}if(anon=="1"){JSClientService.updateMaxNumQs({callback:function(dataFromServer){document.getElementById("anon_limit").innerHTML=dataFromServer;if(dataFromServer==0){JSPlayer.clearQuestion("anon");anonDone=true}},async:false})}}function toggleShowNoShowStats(enabled){}function enableSubmitBtn(){document.getElementById("submit-btn").disabled=false;document.getElementById("submit-instruction").style.display="none"}function startPlayerCountdown(){this.countdownTimer.startCountdown()}function pauseCountdownTimer(){this.layerCountdownTimer.stopCountdown()}function resumeCountdownTimer(){this.layerCountdownTimer.resumeCountdown()}function startCountdownTimer(){this.layerCountdownTimer.startCountdown()}function updateLayerTimeRemaining(countDownCounter,me){document.getElementById("transition-timer").innerHTML=":0"+countDownCounter}function updatePlayerPoints(points){document.getElementById("player_qn_points").innerHTML=points+""}function updateTimeRemaining(countDownCounter,me,visibility){var prefix=":";if(countDownCounter<10){prefix=":0"}document.getElementById("player-timer").innerHTML=prefix+countDownCounter;var doneWidth=Math.round((30-countDownCounter)*10);if(visibility!=undefined){document.getElementById("player-timer").style.visibility=visibility}}function handleTimeout(me){var timerstart=(globalPopupActive==0);me.submitAnswer(true,"false",me,timerstart)}function getLatestQStat(questionId,displayVal){var dval=displayVal;if(dval=="noshow"){this.toggleAnswerStat(undefined,dval,this)}else{var qid=(questionId!=this.currentQuestionUid)?this.currentQuestionUid:questionId;var target=this;JSClientService.getLatestAnswerStat(qid,{callback:function(dataFromServer){toggleAnswerStat(dataFromServer,dval,target)}})}}function toggleAnswerStat(qnStat,displayVal,me){if(displayVal=="noshow"){document.getElementById("answer-stats").style.display="none"}else{if(me.seenStats){return}me.toggleAllCrutches(false);me.seenStats=true;me.currentPoints=me.currentPoints-Math.round(UIConfig.getPlayerPointsFor(-1)*UIConfig.getLessPercentForStats());me.updatePlayerPoints(me.currentPoints);if(player_currentQuestion.trueFalse){document.getElementById("answer-stats").className="boolean"}else{document.getElementById("answer-stats").className="multiple"}document.getElementById("answer-stats").style.display="block"}if(qnStat!=undefined){var totalStat=qnStat.totalTimesAnsweredA+qnStat.totalTimesAnsweredB+qnStat.totalTimesAnsweredC+qnStat.totalTimesAnsweredD;var aPct=(totalStat>0)?Math.round(qnStat.totalTimesAnsweredA*100/totalStat):0;var bPct=(totalStat>0)?Math.round(qnStat.totalTimesAnsweredB*100/totalStat):0;var cPct=(totalStat>0)?Math.round(qnStat.totalTimesAnsweredC*100/totalStat):0;var dPct=(totalStat>0)?Math.round(qnStat.totalTimesAnsweredD*100/totalStat):0;if(player_currentQuestion.trueFalse){var tP;var fP;if(player_currentQuestion.answerA=="T"){tP=Math.round(aPct);fP=Math.round(bPct)}else{tP=Math.round(bPct);fP=Math.round(aPct)}document.getElementById("answer-stats-graph-t").style.width=Math.round(tP)+"%";document.getElementById("answer-stats-percent-t").innerHTML=Math.round(tP)+"%";document.getElementById("answer-stats-graph-f").style.width=Math.round(fP)+"%";document.getElementById("answer-stats-percent-f").innerHTML=Math.round(fP)+"%";return}if(aPct>=0&&aPct<=100){document.getElementById("answer-stats-graph-a").style.width=Math.round(aPct)+"%";document.getElementById("answer-stats-percent-a").innerHTML=Math.round(aPct)+"%"}if(bPct>=0&&bPct<=100){document.getElementById("answer-stats-graph-b").style.width=Math.round(bPct)+"%";document.getElementById("answer-stats-percent-b").innerHTML=Math.round(bPct)+"%"}if(cPct>=0&&cPct<=100){document.getElementById("answer-stats-graph-c").style.width=Math.round(cPct)+"%";document.getElementById("answer-stats-percent-c").innerHTML=Math.round(cPct)+"%"}if(dPct>=0&&dPct<=100){document.getElementById("answer-stats-graph-d").style.width=Math.round(dPct)+"%";document.getElementById("answer-stats-percent-d").innerHTML=Math.round(dPct)+"%"}}}function toggleEliminateTwo(displayVal){if(displayVal=="noshow"){this.showAllOptions()}else{if(this.currentTrueFalse){return}if(this.eliminate2){return}this.toggleAllCrutches(false);var incorrect=new Array();var idx=0;for(var ii=0;ii<this.answerArr.length;ii++){if(this.answerArr[ii]!=this.currentCorrectResponse){incorrect[idx]=this.answerArr[ii];idx++}}var idx1=Math.floor(Math.random()*3+1);var remainingInc=new Array();idx=0;for(var jj=0;jj<incorrect.length;jj++){if(jj!=idx1-1){remainingInc[idx]=incorrect[jj];idx++}}var idx2=Math.floor(Math.random()*2+1);this.hideOptions(incorrect[idx1-1],remainingInc[idx2-1]);this.currentPoints=this.currentPoints-Math.round(UIConfig.getPlayerPointsFor(-1)*UIConfig.getLessPercentForEliminate2());this.updatePlayerPoints(this.currentPoints);this.eliminate2=true}}function toggleSubmit(enable){if(document.getElementById("player-submit")){document.getElementById("player-submit").className=(enable?"":"disabled")}}function toggleSkip(enable){document.getElementById("player-skip").className=(enable?"":"disabled")}function togglePause(enable){var pause=document.getElementById("transition-pause");if(enable){pause.className="normal"}else{pause.className="pressed"}}function toggleAllCrutches(enable){var canShowAnswerStat=(this.currentTotalAttempts>UIConfig.getMinAttemptsForShowAnswerStat());document.getElementById("player-eliminate").className=(enable?"":"disabled");document.getElementById("player-stats").className=((enable&&canShowAnswerStat)?"":"disabled");if(!enable){}}function showAllOptions(){var len=((this.currentTrueFalse)?(this.answerArr.length/2):this.answerArr.length);for(var ii=0;ii<len;ii++){document.getElementById("td_answer"+this.answerArr[ii].toLowerCase()).className="basic_class";document.getElementById("td_answer"+this.answerArr[ii].toLowerCase()).style.visibility="visible";document.getElementById("td_answer"+this.answerArr[ii].toLowerCase()).style.display=""}}function hideOptions(option1,option2){this.elim1=option1.toLowerCase();this.elim2=option2.toLowerCase();document.getElementById("td_answer"+this.elim1).className="no_display";document.getElementById("td_answer"+this.elim1).style.visibility="hidden";document.getElementById("td_answer"+this.elim2).className="no_display";document.getElementById("td_answer"+this.elim2).style.visibility="hidden"}function initChallengePopup(chelt){}function challengeDone(context){if(context!=undefined){if(context==0){if(this.onTransitionLayer){this.displayNextQuestion(this.currentTag)}}else{if(context==1){if(this.onTransitionLayer){this.resetPause();this.resumeCountdownTimer()}}else{}}}}function popupDone(){if(this.onTransitionLayer){this.resetPause();this.layerCountdownTimer.startCountdown()}}function challengeCallback(dataFromServer,me){if(!me.submitted){me.submitAnswer(false,"true",me,true)}else{me.displayNextQuestion(me.currentTag)}}function setChallengeLinkEnabled(flag){}function challengeQuestion(){var i=document.getElementById("cq_select").selectedIndex;var select_reason=document.getElementById("cq_select").options[i].value;var selectRes=parseInt(select_reason);if(selectRes<=0){var errelt=document.getElementById("active_popup_errmsg");if(errelt){errelt.innerHTML="Please select a valid reason!"}return}var desc=trimString(document.getElementById("cq_textarea").value);var me=this;JSClientService.challengeQuestion(this.currentQuestionUid,selectRes,desc,{callback:function(dataFromServer){me.setChallengeLinkEnabled(false)}});document.getElementById("cq_select").selectedIndex=0;document.getElementById("cq_textarea").value="";document.getElementById("player_q_challenge").style.dusplay="none";this.hideReportQuestion();if(!me.submitted){me.submitAnswer(false,"true",me,true,true)}}function confirmBeforeSkipping(tagUid,tagName,bc1,bc2,bc3,url){window.scrollTo(0,0);document.getElementById("tag_finish").style.display="none";var t;JSClientService.getNumUnplayedQns(tagUid,{callback:function(dataFromServer){t=dataFromServer;if(t<=0){setCloseButtonFunction(tagUid);showModalNew("popup-switch","updateTagClickStat",tagUid,UIMessage.getMessage("no_qns_left_msg",null),false,null,true,true);return}closePopups();var elt=document.getElementById("selected_dest_url");if(elt!=undefined){if((url!=undefined)&&(trimString(url)!="")){elt.value=url}else{elt.value=""}}elt=document.getElementById("selected_tag_id");var bc=bc1+((bc2!=undefined)?(","+bc2):"")+((bc3!=undefined)?(","+bc3):"");if(elt!=undefined){elt.value=tagUid+""}else{JSPlayer.loadQnForTag(tagUid,tagName,bc);return}elt=document.getElementById("selected_tag_name");if(elt!=undefined){elt.value=tagName}else{JSPlayer.fadeI.stopTimer();JSPlayer.loadQnForTag(tagUid,tagName,bc);return}elt=document.getElementById("selected_tag_bc");if(elt!=undefined){elt.value=bc}else{JSPlayer.fadeI.stopTimer();JSPlayer.loadQnForTag(tagUid,tagName,bc);return}if(JSPlayer.onTransitionLayer){JSPlayer.pauseCountdownTimer();if((url!=undefined)&&(trimString(url)!="")){JSPlayer.currentUrl=trimString(url)}else{JSPlayer.currentUrl=""}JSPlayer.numUnplayedQ=t;JSPlayer.fadeI.stopTimer();JSPlayer.loadQnForTag(tagUid,tagName,bc)}else{setCloseButtonFunction(tagUid);showModalNew("popup-switch","skipQuestion",t,"The NEXT question will be served from '"+tagName+"'",true,null,true,true,"updateTagClickStat",tagUid)}}})}function loadQnForTag(tagUid,tagName,tagBC){closePopups(false);var willDisplay=JSPlayer.onTransitionLayer;this.refreshRelated=(tagUid!=this.currentTagId);this.currentTagId=tagUid;this.currentOpTagId=tagUid;var taglist=new Array(this.currentTagId,this.currentOpTagId);this.requestRefreshTag(taglist,true,willDisplay)}function highlightAnswer(eltids,rbid,clazz){if(this.currentUserSel==rbid){return}var eltidarr=eltids.split(",");for(var ii=0;ii<eltidarr.length;ii++){var endsWith=eltidarr[ii].charAt(eltidarr[ii].length-1);if((endsWith==this.elim1)||(endsWith==this.elim2)){continue}if(document.getElementById(eltidarr[ii]).style.visibility=="hidden"){continue}if(document.getElementById(eltidarr[ii]).style.display=="none"){continue}document.getElementById(eltidarr[ii]).className=clazz}}function setHighlight(rbid,sel_class,unsel_class){if(this.currentUserSel!=rbid){return}var arr=this.answerArr;var names=new Array();var idx=0;for(var ii=0;ii<arr.length;ii++){if(arr[ii]!=rbid){names[idx]=new Array("td_answer"+arr[ii].toLowerCase());idx++}}for(var ii=0;ii<names.length;ii++){var endsWith=names[ii][0].charAt(names[ii][0].length-1);if((endsWith==this.elim1)||(endsWith==this.elim2)){continue}if(document.getElementById(names[ii][0]).style.visibility=="hidden"){continue}if(document.getElementById(names[ii][0]).style.display=="none"){continue}document.getElementById(names[ii][0]).className=unsel_class}document.getElementById("td_answer"+rbid.toLowerCase()).className=sel_class}}var CURRENT_LEADERBOARD_TYPE=2;function setCurrentLeaderboard(a){CURRENT_LEADERBOARD_TYPE=a}function getCurrentLeaderboardType(){return CURRENT_LEADERBOARD_TYPE}function getCurrentLeaderboardName(){switch(CURRENT_LEADERBOARD_TYPE){case 0:return"Kwanzoo-all time";case 1:return"Friends-all time";case 2:return"Kwanzoo-this week";case 3:return"Friends-this week";default:return"Kwanzoo-this week"}}function getCurrentLeaderboard(){switch(CURRENT_LEADERBOARD_TYPE){case 0:return JSCLeaderBoard;case 1:return JSFLeaderBoard;case 2:return JSWLeaderBoard;case 3:return JSFWLeaderBoard;default:return JSCLeaderBoard}}function JSLeaderBoardWrapper(){this.refresh=a;function a(c){var b=getCurrentLeaderboard();b.refresh(b)}}function JSLeaderBoard(b){this.type=b;this.initialize=l;this.refresh=m;this.requestRefreshStat=o;this.refreshStat=c;this.refreshUserStat=f;this.utilUpdateElt=a;this.toggleWaitStat=n;this.requestNumOnlineFriends=j;this.refreshNumOnlineFriends=e;this.setTrackMe=h;this.getTrackMe=k;this.sortStatList=g;this.sortWeeklyFriendsStatList=d;this.userstat=null;this.dailystat=null;this.refreshedStatOnce=false;this.trackme=false;function k(){return this.trackme}function h(p){this.trackme=p}function l(){lbStPos=1;lbEndPos=1;pageNum=1;m(this)}function m(p){p.requestRefreshStat();p.requestNumOnlineFriends()}function o(){var r=this;var q=document.getElementById("anon");if(q!=undefined){q=q.innerHTML}else{q="0"}JSClientService.getMyCurrentStat({callback:function(s){r.refreshedStatOnce=true;globalUserStats=s[0];f(s,r)}});var p="";if(this.type=="d"){p=getTabIdForLB("k-a");JSClientService.getTopDailyStatList(100,{callback:function(s){c(s,r,0)}})}else{if(this.type=="f"){p=getTabIdForLB("f-a");if(this.trackme){p=getTabIdForLB("f-a-t");JSClientService.getCareerStatListAroundFriends(true,10,{callback:function(s){c(s,r,0)}})}else{JSClientService.getMyFriendsList(100,{callback:function(s){c(s,r,0)}})}}else{if(this.type=="w"){p=getTabIdForLB("k-w");if(this.trackme){p=getTabIdForLB("k-w-t");JSClientService.getWeeklyCareerStatListAroundUser(false,10,{callback:function(s){c(s,r,0)}})}else{JSClientService.getWeeklyTopCareerStatList(100,{callback:function(s){c(s,r,0)}})}}else{if(this.type=="fw"){p=getTabIdForLB("f-w");if(this.trackme){p=getTabIdForLB("f-w-t");JSClientService.getCareerStatListAroundWeeklyFriends(10,{callback:function(s){c(s,r,0)}})}else{JSClientService.getMyWeeklyFriendsList(100,{callback:function(s){c(s,r,0)}})}}else{if(this.type=="c"){p=getTabIdForLB("k-a");if(this.trackme){p=getTabIdForLB("k-a-t");JSClientService.getCareerStatListAroundUser(false,10,{callback:function(s){c(s,r,0)}})}else{JSClientService.getTopCareerStatList(100,{callback:function(s){c(s,r,0)}})}}else{p=getTabIdForLB("k-w");if(this.trackme){p=getTabIdForLB("k-w-t");JSClientService.getWeeklyCareerStatListAroundUser(false,10,{callback:function(s){c(s,r,0)}})}else{JSClientService.getWeeklyTopCareerStatList(100,{callback:function(s){c(s,r,0)}})}}}}}}JSClientService.updatePageState(p,-1,pageNum,"-1",-1,LEADER_BOARD,"-1",{callback:function(s){},async:false})}function d(p,q){var t=q;var u=p[0].points;p[0].rank=q;var s=1;if(p[0].prevRank!=0){p[0].rankChange=p[0].prevRank-p[0].rank}else{p[0].rankChange=p[0].rank-p[0].prevRank}for(var r=1;r<p.length;r++){if(p[r].points==u){p[r].rank=t;s++}else{u=p[r].points;t+=s;p[r].rank=t;s=1}if(p[r].rank!=p[r].prevRank){if(p[r].prevRank!=0){p[r].rankChange=p[r].prevRank-p[r].rank}else{p[r].rankChange=p[r].rank-p[r].prevRank}}else{p[r].rankChange=0}}}function g(p,q){var u=q;var s=p[0].points;p[0].rank=u;var t=1;p[0].rankChange=p[0].prevRank-p[0].rank;for(var r=1;r<p.length;r++){if(p[r].points==s){p[r].rank=u;t++}else{s=p[r].points;u+=t;p[r].rank=u;t=1}if(p[r].rank!=p[r].prevRank){p[r].rankChange=p[r].prevRank-p[r].rank}else{p[r].rankChange=0}}}function c(r,G,u){if(document.getElementById("leader-loading-popular")!=null){document.getElementById("leader-loading-popular").style.display="none"}if(document.getElementById("leader-loading-leader")!=null){document.getElementById("leader-loading-leader").style.display="none"}if(document.getElementById("leader-loading-related")!=null){document.getElementById("leader-loading-related").style.display="none"}if(rankUpdateLock==0){rankUpdateLock=1}else{return}if(r==null){r=globalStatList}else{globalStatList=r}var A=document.getElementById("anon");if(A!=undefined){A=A.innerHTML}else{A="0"}if(getCurrentLeaderboardName()=="Friends-all time"&&A=="0"&&r.length>0){if(getCurrentLeaderboard().trackme==true){g(r,r[0].rank)}else{g(r,1)}}if(getCurrentLeaderboardName()=="Friends-this week"&&A=="0"&&r.length>0){if(getCurrentLeaderboard().trackme==true){d(r,r[0].rank)}else{d(r,1)}}var x=getCurrentLeaderboardName();if(x.indexOf("Kwanzoo")==0&&r.length>0){if(getCurrentLeaderboard().trackme==true){g(r,r[0].rank)}else{g(r,1)}}switch(u){case (0):lbEndPos=lbStPos+UIConfig.getLeaderboardNumUsers()-1;break;case (1):if(lbStPos!=1){lbStPos=lbStPos-UIConfig.getLeaderboardNumUsers();lbEndPos=lbStPos+UIConfig.getLeaderboardNumUsers()-1;pageNum=pageNum-1}break;case (2):if(lbEndPos<r.length){lbStPos=lbEndPos+1;lbEndPos=lbStPos+UIConfig.getLeaderboardNumUsers()-1;pageNum=pageNum+1}break}document.getElementById("leader-from").innerHTML=lbStPos;document.getElementById("leader-to").innerHTML=(lbEndPos>r.length)?r.length:lbEndPos;document.getElementById("leader-of").innerHTML=r.length;document.getElementById("leader-previous").style.display="";document.getElementById("leader-next").style.display="";document.getElementById("leader-text-to").style.display="";document.getElementById("leader-text-of").style.display="";var t;var y;var F;var q;var z=0;if(r.length>0){for(var C=lbStPos;C<=lbEndPos;C++){var E;E=r[C-1];var D=1;z=0;var v="";var p=0;var B="";q=C-(UIConfig.getLeaderboardNumUsers()*(pageNum-1))-1;F=document.getElementById("leader-list-"+q);if(E!=null){v=E.userName;B=E.points;D=E.rank;z=E.rankChange;p=E.userUid;rankArray[v]=E.rank;rankChangeArray[v]=z;document.getElementById("invite-message").style.display="none";F.href="/profile/"+p;if(G&&G.trackme){F.className=E.me?"me":""}else{F.className=""}F.childNodes[2].className=(E.online?"status online":"status offline");if(E.me&&G&&G.trackme){if(A=="0"){F.childNodes[1].innerHTML=D;F.childNodes[3].innerHTML=v}else{F.childNodes[1].innerHTML="?";F.childNodes[3].innerHTML=v+" (save your points to see rank)";F.href="/signup"}}else{F.childNodes[1].innerHTML=D;F.childNodes[3].innerHTML=v}if(E.me&&A=="1"){F.childNodes[1].innerHTML="?";F.childNodes[3].innerHTML="You (save your points to see rank)";F.href="/signup"}F.childNodes[5].innerHTML=B;F.childNodes[4].innerHTML=(z==0)?"":("("+(z>0?"+":(z==0?"":"-"))+Math.abs(z)+")");F.childNodes[4].className=((z>0)?"moved up":((z==0)?"":"moved down"));F.childNodes[0].className=(z<0?"arrow down":((z==0)?"":"arrow up"));if(F.childNodes[0].className==""){F.childNodes[0].innerHTML="&nbsp;&nbsp;"}if(getCurrentLeaderboardName()=="Kwanzoo"){if(!E.me||A=="0"){F.childNodes[4].innerHTML=(z==0)?"":("("+(z>0?"+":(z==0?"":"-"))+Math.abs(z)+")");F.childNodes[4].className=((z>0)?"moved up":((z==0)?"":"moved down"));F.childNodes[0].className=(z<0?"arrow down":((z==0)?"":"arrow up"));if(F.childNodes[0].className==""){F.childNodes[0].innerHTML="&nbsp;&nbsp;"}}else{F.childNodes[4].innerHTML="";F.childNodes[4].className="";F.childNodes[0].className=""}}else{F.childNodes[4].innerHTML=(z==0)?"":("("+(z>0?"+":(z==0?"":"-"))+Math.abs(z)+")");F.childNodes[4].className=((z>0)?"moved up":((z==0)?"":"moved down"));F.childNodes[0].className=(z<0?"arrow down":((z==0)?"":"arrow up"));if(F.childNodes[0].className==""){F.childNodes[0].innerHTML="&nbsp;&nbsp;"}}}else{F.href="javascript:void(0);";F.childNodes[0].className="";F.childNodes[4].className="";F.childNodes[2].className="";F.childNodes[1].innerHTML="";F.childNodes[3].innerHTML="";F.childNodes[5].innerHTML="";F.childNodes[4].innerHTML="";F.className=""}}}else{document.getElementById("leader-from").innerHTML="";document.getElementById("leader-to").innerHTML="";document.getElementById("leader-of").innerHTML="";document.getElementById("leader-text-to").style.display="none";document.getElementById("leader-text-of").style.display="none";document.getElementById("leader-previous").style.display="none";document.getElementById("leader-next").style.display="none";for(var w=0;w<10;w++){F=document.getElementById("leader-list-"+w);F.href="javascript:void(0);";F.childNodes[0].className="";F.childNodes[4].className="";F.childNodes[2].className="";F.childNodes[1].innerHTML="";F.childNodes[3].innerHTML="";F.childNodes[5].innerHTML="";F.childNodes[4].innerHTML="";F.className=""}F=document.getElementById("leader-list-0");if(getCurrentLeaderboardName()=="Friends-all time"||getCurrentLeaderboardName()=="Friends-this week"){document.getElementById("invite-message").style.display="block"}else{document.getElementById("invite-message").style.display="none";F.childNodes[3].innerHTML="<i>Start playing and get on the board!</i>"}}if(r.length==0&&getCurrentLeaderboardName()=="Friends"){q=0;F=document.getElementById("leader-list-"+q);F.href="/profile/"+globalUserStats.userUid;if(G&&G.trackme){F.className=globalUserStats.me?"me":""}else{F.className=""}F.childNodes[2].className=(globalUserStats.online?"status online":"status offline");F.childNodes[3].innerHTML=document.getElementById("hidden-username").value;F.childNodes[5].innerHTML=globalUserStats.points;z=globalUserStats.rankChange;if(A=="0"){F.childNodes[1].innerHTML=1}else{F.childNodes[1].innerHTML="?";F.childNodes[3].innerHTML="You (save your points to see rank)";F.childNodes[4].innerHTML="";F.childNodes[4].className="";F.childNodes[0].className="";F.href="/signup"}var s=1;document.getElementById("leader-from").innerHTML=s;document.getElementById("leader-to").innerHTML=s;document.getElementById("leader-of").innerHTML=s}rankUpdateLock=0}function f(s,u){var v=document.getElementById("anon");if(v!=undefined){v=v.innerHTML}else{v="0"}if(statsViewedFor>0){return}if(u.refreshedStatOnce){u.userstat=s[0];u.dailystat=s[1]}else{return}var t=s[0];var r=s[1];var q=135;var p;if(v=="0"){document.getElementById("stats-rank").innerHTML=t.rank;document.getElementById("next_rank_label").innerHTML="To next rank<br />";document.getElementById("next_rank_label").style.display="block";document.getElementById("stats-next").innerHTML="&nbsp;points";document.getElementById("stats-next").style.display="block";document.getElementById("us_bg_img").style.backgroundImage="";document.getElementById("points-break").style.display="none"}else{document.getElementById("stats-rank").innerHTML='<a href="/signup"><img src="/images/anon-save.gif" alt="" /></a>';document.getElementById("next_rank_label").style.display="none";document.getElementById("stats-next").style.display="none";document.getElementById("us_bg_img").style.backgroundImage="none";document.getElementById("points-break").style.display="block"}if(document.getElementById("stats-points")!=null){document.getElementById("stats-points").innerHTML=t.points;if(t.rankChange!=0){if(v=="0"){document.getElementById("stats-moved").innerHTML="("+((t.rankChange>0)?"+":"-")+Math.abs(t.rankChange)+")"}else{document.getElementById("stats-moved").innerHTML=""}}else{document.getElementById("stats-moved").innerHTML=""}if(v=="0"){document.getElementById("stats-moved").className=(t.rankChange>0)?"moved up":"moved down"}var w=t.pointsToNextRank+"&nbsp;points<br />";document.getElementById("stats-next").innerHTML=w;document.getElementById("stats-correct").innerHTML=t.totalQuestionsCorrect;document.getElementById("stats-wrong").innerHTML=t.totalQuestionsIncorrect;document.getElementById("stats-skips").innerHTML=t.totalQuestionsSkipped;document.getElementById("stats-attempts").innerHTML=t.totalQuestionsCorrect+t.totalQuestionsIncorrect+t.totalQuestionsSkipped;p=t.totalQuestionsPlayed+t.totalQuestionsSkipped;if(p>0){document.getElementById("stats-graph-correct").style.width=(100*t.totalQuestionsCorrect/p)+"%";document.getElementById("stats-graph-wrong").style.width=(100*t.totalQuestionsIncorrect/p)+"%";document.getElementById("stats-graph-skips").style.width=(100*t.totalQuestionsSkipped/p)+"%"}}document.getElementById("stats-level").innerHTML=t.levelName}function n(p){var r=document.getElementById("userstat_wait");var q=document.getElementById("userstats");if(r){if(p==true){r.style.display="none";r.style.visibility="hidden";q.style.display="";q.style.visibility="visible"}else{q.style.display="none";q.style.visibility="hidden";r.style.display="";r.style.visibility="visible"}}}function a(q,r){var p=document.getElementById(q);if(p!=undefined){p.innerHTML=r}}function j(){var p=this;JSClientService.getNumOnlineFriends({callback:function(q){e(q,p)}})}function e(p,q){var r=document.getElementById("leader-online");r.innerHTML=p;r.className=(p>0)?"online":"offline"}}function validateFields(){var b=0;var a=document.getElementById("u_username").value;var c=document.getElementById("u_password").value;clearMsgs();if(trimString(a)==""){b=1}if(trimString(c)==""){b=1}if(b==1){document.getElementById("empty_login").style.display=""}else{document.getElementById("login_loading").style.display="";document.form1.submit()}}function clearMsgs(){if(document.getElementById("empty_login")){document.getElementById("empty_login").style.display="none"}if(document.getElementById("invalid_login")){document.getElementById("invalid_login").style.display="none"}if(document.getElementById("login_loading")){document.getElementById("login_loading").style.display="none"}if(document.getElementById("nouser_flogin")){document.getElementById("nouser_flogin").style.display="none"}if(document.getElementById("invalid_flogin")){document.getElementById("invalid_flogin").style.display="none"}if(document.getElementById("multi_login")){document.getElementById("multi_login").style.display="none"}}function retrieveLogin(){document.getElementById("invalid_flogin").style.display="none";document.getElementById("nouser_flogin").style.display="none";var a=document.getElementById("forlog_email").value;if(validateEmailAddressFormat(a)){document.getElementById("forlog_submit").disabled=true;JSClientLoginService.forgotLogin(a,{callback:function(b){document.getElementById("forlog_submit").disabled=false;document.getElementById("flogin_done").style.display=""},errorHandler:function(c,b){document.getElementById("forlog_submit").disabled=false;document.getElementById("nouser_flogin").style.display=""}})}else{document.getElementById("invalid_flogin").style.display=""}}function forgotLogin(a){clearMsgs();document.getElementById("u_password").value="";document.getElementById("u_rememberme").checked=false;if(a){document.getElementById("form1").style.display="none";document.getElementById("retrieve").style.display="block";document.getElementById("flogin_done").style.display="none"}else{document.getElementById("forlog_email").value="";document.getElementById("form1").style.display="block";document.getElementById("retrieve").style.display="none"}}function displayHeader(){document.getElementById("scoreCard").style.display="block";document.getElementById("guestState").style.display="none";if(document.getElementById("need_login").value=="true"){document.getElementById("userId").href="";document.getElementById("signout").href=""}}function isLoginRequired(){if(document.getElementById("need_login").value=="true"){document.getElementById("scoreCard").style.display="none";document.getElementById("guestState").style.display="block"}else{document.getElementById("scoreCard").style.display="block";document.getElementById("guestState").style.display="none"}}function ajaxLogin(c){document.getElementById("messageId").innerHTML="";document.getElementById("display_status").innerHTML='<font color="white">Signing in ...</font>';var d=document.getElementById("u_name").value;var a=document.getElementById("u_password").value;var b=false;JSClientLoginService.login(d,a,b,true,{callback:function(e){if((c!=undefined)&&(c!="")&&(c!=null)){window.location.href=c}else{window.location.href="/index"}},errorHandler:function(f,e){document.getElementById("display_status").innerHTML="<FONT COLOR='#FF3399'>Invalid Username/Password</font>"}})}function initializeMyQuestions(){JSClientService.getPrimaryTagsForChannel(MQ_TagList);JSClientService.numberMyQuestions(CalPages);JSClientService.getMyQuestions(0,QUEST_PER_PAGE,initialize_cache)}function loadPageDropDown(){for(i=1;i<=NUM_PAGES;i++){var b=document.createElement("OPTION");var c=(i-1)*QUEST_PER_PAGE;var a=i*QUEST_PER_PAGE;b.innerText=c+"-"+a;b.text=c+"-"+a;b.value=i;document.getElementById("pagelist").options.add(b)}}function updatePageDropDown(a){var c=document.getElementById("pagelist");var b;for(b=0;(c!=null)&&(b<c.length);b++){var d=c.item(b).value;if(d==a){c.item(b).selected=true;break}}return}function updatePage(a){var d=CURRENT_PAGE;var f=FETCH_PAGE;CURRENT_PAGE=parseInt(a);var b=CURRENT_PAGE+1;if(b<=FETCH_PAGE){if(CURRENT_PAGE==1){document.getElementById("left_arrow").innerHTML='<img src="/images/401-left-disabled.png">'}else{document.getElementById("left_arrow").innerHTML='<img src="/images/401-left.png" onclick="javascript:loadPrevPage();">'}if(CURRENT_PAGE==NUM_PAGES){document.getElementById("right_arrow").innerHTML='<img src="/images/400-right-disabled.png">'}else{document.getElementById("right_arrow").innerHTML='<img  src="/images/400-right.png" onclick="javascript:loadNextPage();">'}loadPageList(CURRENT_PAGE)}else{var c=(CURRENT_PAGE-FETCH_PAGE)+1;FETCH_PAGE=FETCH_PAGE+c;c=c*QUEST_PER_PAGE;var e=(f)*QUEST_PER_PAGE;JSClientService.getMyQuestions(e,e+c,returnPage)}}function returnPage(a){cache_QuestionList(a);if(CURRENT_PAGE==1){document.getElementById("left_arrow").innerHTML='<img src="/images/401-left-disabled.png">'}else{document.getElementById("left_arrow").innerHTML='<img src="/images/401-left.png" onclick="javascript:loadPrevPage();">'}if(CURRENT_PAGE==NUM_PAGES){document.getElementById("right_arrow").innerHTML='<img src="/images/400-right-disabled.png">'}else{document.getElementById("right_arrow").innerHTML='<img  src="/images/400-right.png" onclick="javascript:loadNextPage();">'}loadPageList(CURRENT_PAGE)}function CalPages(a){NUM_QUEST=a;NUM_PAGES=Math.ceil(NUM_QUEST/QUEST_PER_PAGE);if(NUM_PAGES==0){NUM_PAGES=1}loadPageDropDown()}function getLevel1Name(a){var b=new String(a);var c=b.indexOf(".");if(c==-1){return b}b=b.substring(0,c);return b}function sortQuestionList(){if(SORT_DIR==0){SORT_DIR=1;document.getElementById("sort_dir").src="/images/arrow_up_1.gif"}else{SORT_DIR=0;document.getElementById("sort_dir").src="/images/arrow_dn_1.gif"}XMyQuestionList.reverse();ChangeList()}function ChangeList(){var c;var b=document.getElementById("output1").value;var a=document.getElementById("output2").value;var d=document.getElementById("output3").value;c=changeInPoints(b,XMyQuestionList);c=changeInSkips(a,c);if(d!="-"){c=changeInDate(d,c)}changeInTag(c)}function changeInTag(g){var h="";var b;var e,d,c;for(e=0;e<g.length;e++){for(d=0;d<PrimaryXTagData.length;d++){b=0;var f=getLevel1Name(g[e].primaryTag.tagName);var a=PrimaryXTagData[d].tagName;if(f==a){if(document.getElementById("tag"+d).checked==true){b=1;break}}}if(b==1){h+=refreshList(e,g)}}document.getElementById("myquestion_list").innerHTML=h}function isValid(b){var a="0123456789";if(b==""){alert("Incorrect value entered!");return false}for(i=0;i<b.length;i++){if(a.indexOf(b.charAt(i),0)==-1){alert("Incorrect value entered!");return false}}return true}function y2k(a){return(a<1000)?a+1900:a}function daysElapsed(b,a){var c=Date.UTC(y2k(b.getYear()),b.getMonth(),b.getDate(),0,0,0)-Date.UTC(y2k(a.getYear()),a.getMonth(),a.getDate(),0,0,0);return c/1000/60/60/24}function changeInDate(c,f){var e=isValid(c);if(e==false){return}var b=new Date();var g=new Array(f.length);var d,a=0;for(d=0;d<f.length;d++){var h=daysElapsed(b,f[d].createdDt);if(c==h){g[a]=f[d];a++}}g.length=a;return g}function changeInPoints(c,e){var d=isValid(c);if(d==false){c=0}var f=new Array(e.length);var b,a=0;for(b=0;b<e.length;b++){if(e[b].authorPoints>=c){f[a]=e[b];a++}}f.length=a;return f}function changeInSkips(a,e){var d=isValid(a);if(d==false){a=0}var f=new Array(e.length);var c,b=0;for(c=0;c<e.length;c++){if(e[c].totalTimesSkipped>=a){f[b]=e[c];b++}}f.length=b;return f}function refreshList(d,e){var f;var a;var b;var c;if(getLevel1Name(e[d].primaryTag.tagName)=="Football"){a='<td><img src="/images/icon_football.jpg" alt="'+e[d].primaryTag.tagName+'" title="'+e[d].primaryTag.tagName+'" border="0" class="tag-icon" /></td>'}else{if(getLevel1Name(e[d].primaryTag.tagName)=="Baseball"){a='<td><img src="/images/icon_baseball.gif" alt="'+e[d].primaryTag.tagName+'" title="'+e[d].primaryTag.tagName+'" border="0" class="tag-icon" /></td>'}else{if(getLevel1Name(e[d].primaryTag.tagName)=="Cricket"){a='<td><img src="/images/icon_cricket.jpg" alt="'+e[d].primaryTag.tagName+'" title="'+e[d].primaryTag.tagName+'" border="0" class="tag-icon" /></td>'}else{if(getLevel1Name(e[d].primaryTag.tagName)=="Soccer"){a='<td><img src="/images/icon_soccer.gif" alt="'+e[d].primaryTag.tagName+'" title="'+e[d].primaryTag.tagName+'" border="0" class="tag-icon" /></td>'}else{a='<td><img src="/images/icon_cancel.gif" alt="'+e[d].primaryTag.tagName+'" title="'+e[d].primaryTag.tagName+'" border="0" class="tag-icon" /></td>'}}}}if(e[d].questionStatus=="Submit for Review"){b='<td><img src="/images/icon_check.gif" alt="'+e[d].questionStatus+'" title="'+e[d].questionStatus+'" border="0" class="tag-icon" /></td>';c='<a href="/play?preview=myquestion&qId='+e[d].questionUid+'"TARGET="_blank">'}else{if(e[d].questionStatus=="Published"){b='<td><img src="/images/check.gif" alt="'+e[d].questionStatus+'" title="'+e[d].questionStatus+'" border="0" class="tag-icon" /></td>';c='<a href="/play?preview=myquestion&qId='+e[d].questionUid+'"TARGET="_blank">'}else{if(e[d].questionStatus=="Draft"){b='<td><img src="/images/q_draft.gif" alt="'+e[d].questionStatus+'" title="'+e[d].questionStatus+'" border="0" class="tag-icon" /></td>';c='<a href="submit?preview=true&qId='+e[d].questionUid+'"TARGET="_blank">'}else{if(e[d].questionStatus=="Challenged"){b='<td><img src="/images/q_challenged.gif" alt="'+e[d].questionStatus+'" title="'+e[d].questionStatus+'" border="0" class="tag-icon" /></td>';c='<a href="submit?preview=true&qId='+e[d].questionUid+'"TARGET="_blank">'}else{if(e[d].questionStatus=="Deleted"){b='<td><img src="/images/icon_cancel.gif" alt="'+e[d].questionStatus+'" title="'+e[d].questionStatus+'" border="0" class="tag-icon" /></td>';c='<a href="/play?preview=myquestion&qId='+e[d].questionUid+'"TARGET="_blank">'}else{if(e[d].questionStatus=="Archived"){b='<td><img src="/images/icon_soccer.gif" alt="'+e[d].questionStatus+'" title="'+e[d].questionStatus+'" border="0" class="tag-icon" /></td>';c='<a href="/play?preview=myquestion&qId='+e[d].questionUid+'"TARGET="_blank">'}else{if(e[d].questionStatus=="Duplicate"){b='<td><img src="/images/icon_soccer.gif" alt="'+e[d].questionStatus+'" title="'+e[d].questionStatus+'" border="0" class="tag-icon" /></td>';c='<a href="/play?preview=myquestion&qId='+e[d].questionUid+'"TARGET="_blank">'}else{if(e[d].questionStatus=="Denied Approval"){b='<td><img src="/images/icon_soccer.gif" alt="'+e[d].questionStatus+'" title="'+e[d].questionStatus+'" border="0" class="tag-icon" /></td>';c='<a href="submit?preview=true&qId='+e[d].questionUid+'"TARGET="_blank">'}}}}}}}}f="<tr>"+a+"<td>"+c+e[d].questionText+'</a></td><td class="attribute">'+e[d].authorPoints+'</td><td class="attribute">'+e[d].totalTimesPlayed+'</td><td class="attribute">'+e[d].totalTimesSkipped+"</td><td>"+month_names[e[d].createdDt.getMonth()]+" "+e[d].createdDt.getDate()+", "+e[d].createdDt.getFullYear()+"</td>"+b+"</tr>";return f}function MQ_TagList(b){PrimaryXTagData=b;var a;var c="";for(a=0;a<PrimaryXTagData.length;a++){c+='<input type="checkbox" id="tag'+a+'" checked="checked" value="'+PrimaryXTagData[a].tagUid+'" onclick="javascript:ChangeList();">'+PrimaryXTagData[a].tagLabel+"<br/>"}document.getElementById("primary_taglist").innerHTML+=c}function cache_QuestionList(a){TOTAL_LIST=Array.concat(TOTAL_LIST,a)}function initialize_cache(b){TOTAL_LIST=b;MQ_QuestionList(b);document.getElementById("left_arrow").innerHTML='<img src="/images/401-left-disabled.png">';if(CURRENT_PAGE==NUM_PAGES){document.getElementById("right_arrow").innerHTML='<img src="/images/400-right-disabled.png">'}if(CURRENT_PAGE+1>FETCH_PAGE){FETCH_PAGE++;var c=CURRENT_PAGE*QUEST_PER_PAGE;var a=(CURRENT_PAGE+1)*QUEST_PER_PAGE;JSClientService.getMyQuestions(c,a,cache_QuestionList)}}function MQ_QuestionList(a){XMyQuestionList=a;ChangeList();document.getElementById("sort_dir").src="/images/arrow_dn_1.gif";SORT_DIR=0}function loadPageList(e){var d=new Array(QUEST_PER_PAGE);var f=((CURRENT_PAGE-1)*QUEST_PER_PAGE);var a=CURRENT_PAGE*QUEST_PER_PAGE;var c,b=0;for(c=f;c<a&&c<TOTAL_LIST.length;c++){d[b]=TOTAL_LIST[c];b++}d.length=b;MQ_QuestionList(d)}function loadPrevPage(){if(CURRENT_PAGE==NUM_PAGES){document.getElementById("right_arrow").innerHTML='<img  src="/images/400-right.png" onclick="javascript:loadNextPage();">'}CURRENT_PAGE--;updatePageDropDown(CURRENT_PAGE);if(CURRENT_PAGE==1){document.getElementById("left_arrow").innerHTML='<img src="/images/401-left-disabled.png">'}loadPageList(CURRENT_PAGE)}function loadNextPage(){if(CURRENT_PAGE==1){document.getElementById("left_arrow").innerHTML='<img src="/images/401-left.png" onclick="javascript:loadPrevPage();">'}CURRENT_PAGE++;updatePageDropDown(CURRENT_PAGE);if(CURRENT_PAGE==NUM_PAGES){document.getElementById("right_arrow").innerHTML='<img src="/images/400-right-disabled.png">'}else{if(CURRENT_PAGE+1>FETCH_PAGE){FETCH_PAGE++;var b=CURRENT_PAGE*QUEST_PER_PAGE;var a=(CURRENT_PAGE+1)*QUEST_PER_PAGE;JSClientService.getMyQuestions(b,a,cache_QuestionList)}}loadPageList(CURRENT_PAGE)}function selectAll(){var a;for(a=0;a<PrimaryXTagData.length;a++){document.getElementById("tag"+a).checked=true}ChangeList()}function clearAll(){var a;for(a=0;a<PrimaryXTagData.length;a++){document.getElementById("tag"+a).checked=false}document.getElementById("myquestion_list").innerHTML=""}function JSImageGallery(){this.requestImages=g;this.fetchImages=b;this.refreshImages=a;this.previewImage=c;this.clearPreview=e;this.setSize=f;this.galleryDiv=null;this.getImageId=d;this.getMediaId=h;function h(j){var k=j.substring(0,j.indexOf("."));var l=k+".id";return l}function d(j){var k=j.substring(0,j.indexOf("."));var l=k+".img";return l}function g(){var k=document.serviceform.services.options;var l="all";for(var j=0;j<k.length;j++){if(k[j].selected==true){l=k[j].value}}var m=(this.galleryDiv==null)?document.getElementById("gallery"):this.galleryDiv;m.innerHTML="<div id='srcdiv' onmouseout='JSImageGallery.clearPreview();' onmouseover='JSImageGallery.previewImage(this);' style='float:left; align:center; vertical-align:middle; margin:5px;'><img id='srcimg' src='/images/con-bar3.gif' style='vertical-align: middle;'/><span id='srcid'></span></div>";this.fetchImages(l,document.getElementById("tagnames").value,document.getElementById("description").value)}function b(k,j,m){var l=this;if(m==""){JSClientService.imageGallerySearch(k,j,UIConfig.getNumImagesInGallery(),{callback:function(n){a(n,l)},errorHandler:function(o,n){var p=(l.galleryDiv==null)?document.getElementById("gallery"):l.galleryDiv;p.innerHTML="Cannot find any images for the tags specified!";p.style.display=""}})}else{JSClientService.searchImages(k,j,m,UIConfig.getNumImagesInGallery(),{callback:function(n){a(n,l)},errorHandler:function(o,n){var p=(l.galleryDiv==null)?document.getElementById("gallery"):l.galleryDiv;p.innerHTML="Cannot find any images for the tags specified!";p.style.display=""}})}}function f(l,n,p,o){l.style.width=o.width+"px";l.style.height=o.height+"px";var k=o.width/o.height;var j=o.width/n;var m=o.height/p;if(j>m){l.style.width=n+"px";l.style.height=(n/k)+"px"}else{l.style.height=p+"px";l.style.width=p*k+"px"}}function a(m,q){if(m.length==0){var j=(target.galleryDiv==null)?document.getElementById("gallery"):target.galleryDiv;j.innerHTML="Cannot find any images for the tags specified!";j.style.display="";return}var j=(this.galleryDiv==null)?document.getElementById("gallery"):this.galleryDiv;var p=document.getElementById("srcdiv");var t=document.getElementById("srcimg");var s=document.getElementById("srcid");for(var n=0;n<m.length;n++){var k=m[n];var l=p.cloneNode(true);l.id=n+".div";q.setSize(l,UIConfig.getImageGalleryThumbnailWidth(),UIConfig.getImageGalleryThumbnailHeight(),k);var o=t.cloneNode(true);o.src=k.thumbnailUrl;o.id=n+".img";o.className="scale-img-80";o.origUrl=k.originalUrl;var r=s.cloneNode(true);r.innerHTML=k.mediaUid;r.id=n+".id";removeAllNodes(l);l.appendChild(o);l.appendChild(document.createElement("br"));l.appendChild(r);p.parentNode.appendChild(l)}s.parentNode.removeChild(s);t.parentNode.removeChild(t);p.parentNode.removeChild(p)}function c(m){var k=m.id.substr(0,m.id.indexOf(".div"))+".img";var j=document.getElementById(k);var l=document.getElementById("preview-div");l.innerHTML="<img width='280' height='180' src='"+j.origUrl+"'/>"}function e(){var j=document.getElementById("preview-div");j.innerHTML=""}}function JSMessageHandler(){this.requestRefreshMessages=d;this.refreshMessages=c;this.initMessageHandler=b;this.createMessage=a;function b(){new JSTimer(function(e){e.requestRefreshMessages(e)},UIConfig.getMessageAutoRefreshInterval(),this).startTimer()}function a(){var e=document.create_message_form.userSel.options;var j=new Object();var f=new Array(1);for(var k=0;k<e.length;k++){if(e[k].selected==true){f[k]=parseInt(e[k].value)}}j.user="Kwanzoo User";j.reglink="http://localhost/kzmain/register";var l=document.create_message_form.msgtype;var n=1;for(var k=0;k<l.length;k++){if(l[k].checked==true){n=parseInt(l[k].value);break}}var o=document.create_message_form.templates.options;var m=null;for(var p=0;p<o.length;p++){if(o[p].selected==true){m=parseInt(o[p].value);break}}var h=new Date();var g=new Date();g.setMinutes(g.getMinutes()+3);JSClientService.createMessage(n,m,j,true,g,f,false,"Immediately",h,false,0,{callback:function(q){noop()}})}function d(){MessageProvider.getNewMessages(2,{callback:function(e){c(e)}})}function c(g){for(var e=0;e<3;e++){var f=document.getElementById("msg-"+(e+1));if(f!=undefined){f.innerHTML="This is message "+e}}for(var e=0;e<g.length;e++){var f=document.getElementById("msg-"+(e+1));if(f!=undefined){f.innerHTML=g[e].text}}}}function PerfMon(){this.map=new Object();this.start=d;this.end=b;this.update=c;this.updateHtml=a;function d(f){var e=this.map[f];this.map[f]=new Date().getTime();if(e==undefined){this.updateHtml(f)}}function a(k){var f=document.getElementById("titlerow");if(f==undefined){return}var l=f.cloneNode(true);l.setAttribute("id","row-"+k);var j,g;for(var h=0;h<l.childNodes.length;h++){var e=l.childNodes[h];if((e.attributes==undefined)||(e.attributes.length<=0)){continue}var m=e.getAttribute("id");if(m==undefined){continue}if(m=="titlecol-name1"){j=e}else{if(m=="titlecol-time1"){g=e}}}if(j!=undefined){j.setAttribute("id","col-"+k);j.innerHTML=k}if(g!=undefined){g.setAttribute("id","col-"+k+"-time")}f.parentNode.insertBefore(l,f.nextSibling)}function b(f){var e=this.map[f];if(e!=undefined){var g=new Date();this.map[f]=g.getTime()-e;this.update(f,this.map[f])}}function c(g,f){var e=document.getElementById("col-"+g+"-time");if(e!=undefined){e.innerHTML=f+" ms"}}}function JSProfile(){this.aboutMeNum=200;this.changePassword=false;this.changeEmail=false;this.passwordChange=q;this.passwordChangeUpdate=g;this.passwordChangeCancel=a;this.emailChange=n;this.emailChangeUpdate=b;this.emailChangeCancel=l;this.setDefault=k;this.userImage=p;this.externalImage=e;this.setExternalImage=o;this.save=j;this.cancel=r;this.showZipcode=m;this.getLocation=d;this.enableCheck=h;function h(){document.getElementById("image_check").checked=false}function f(){document.getElementById("status_location").style.display="none";document.getElementById("status_firstname").style.display="none";document.getElementById("status_lastname").style.display="none";document.getElementById("status_gender").style.display="none";document.getElementById("status_country").style.display="none";document.getElementById("status_zipcode").style.display="none";document.getElementById("status_email").style.display="none";document.getElementById("status_password").style.display="none";clearMessages()}function d(){document.getElementById("status_zipcode").style.display="none";document.getElementById("status_location").style.display="none";var s=document.getElementById("user_zip").value;var t=document.getElementById("countries").value;JSClientService.getLocation(t,s,{callback:function(u){document.getElementById("user_loc").value=u;if(u==""){document.getElementById("status_location").style.display=""}}})}function m(t,s){t=trimString(t);document.getElementById("status_location").style.display="none";document.getElementById("status_zipcode").style.display="none";if(t=="US"){document.getElementById("show_zipcode").style.display="";document.getElementById("kz_location").onkeypress=function(){return false};document.getElementById("kz_location").className="location_readonly";if(s!=1){document.getElementById("kz_zipcode").value="";document.getElementById("kz_location").value=""}}else{document.getElementById("show_zipcode").style.display="none";document.getElementById("kz_location").onkeypress=function(){return true};document.getElementById("kz_location").className="location_readwrite";document.getElementById("kz_zipcode").value="";if(s!=1){document.getElementById("kz_location").value=""}}}function r(){window.location="/account"}function j(){f();var s=1;if(this.changePassword==true){if(c()==false){document.getElementById("myacc_mypro_oldpassword").value="";document.getElementById("myacc_mypro_newpassword").value="";document.getElementById("myacc_mypro_newpasswordagain").value="";s=0}else{document.getElementById("changed_opassword").value=document.getElementById("myacc_mypro_oldpassword").value;document.getElementById("changed_npassword").value=document.getElementById("myacc_mypro_newpassword").value}}if(this.changeEmail==true){var t=document.getElementById("kz_email_new").value;if(validateEmailAddressFormat(t)){document.getElementById("changed_email").value=document.getElementById("kz_email_new").value}else{document.getElementById("kz_error_email").innerHTML=UIMessage.getMessage("myprofile_email_error_msg1",null);document.getElementById("status_email").style.display="";s=0}}if(document.getElementById("select_gender").value=="Select"){document.getElementById("status_gender").style.display="";s=0}if(document.getElementById("select_country").value=="Select"){document.getElementById("status_country").style.display="";s=0}if(s!=0){if(!document.getElementById("image_check").checked){s=2;showModal(initModal("auth_image"),UIMessage.getMessage("myprofile_imagetitle_msg",null),true,null,null,null,null,true,null)}}if(s==1){document.form1.submit()}else{if(s==0){showFailureMessage(UIMessage.getMessage("form_error_msg",null));window.scrollTo(0,0)}}}function k(){document.getElementById("image_url").value="default";var v=parseInt(document.getElementById("default_image_width").value);var u=parseInt(document.getElementById("default_image_height").value);var t=document.getElementById("user_image");t.src=document.getElementById("default_image").value;t.onload="";scaleImage(t,v,u,100,100);document.getElementById("ext_image_url").value="";var s=document.getElementById("img_upload");if(s!=undefined){s.value="img_upload"}return}function p(){document.getElementById("image_url").value="";document.getElementById("ext_image_url").value="";document.getElementById("ext_image_url").disabled=true;document.getElementById("filename").disabled=false}function e(){document.getElementById("ext_image_url").disabled=false;document.getElementById("filename").disabled=true}function o(){document.getElementById("image_url").value=document.getElementById("ext_image_url").value;document.getElementById("user_image").src=document.getElementById("ext_image_url").value}function n(){this.changeEmail=true;document.getElementById("status_email").style.display="none";document.getElementById("kz_email_old").value=document.getElementById("kz_email").value;document.getElementById("old_email").style.display="";document.getElementById("kz_email_new").value="";document.getElementById("new_email").style.display="";document.getElementById("save_email").style.display="";document.getElementById("change_email").style.display="none"}function b(){document.getElementById("status_email").style.display="none";var s=document.getElementById("kz_email_new").value;if(validateEmailAddressFormat(s)){var t=this;JSClientService.changeEmail(s,{callback:function(u){document.getElementById("kz_email").value=s;document.getElementById("kz_email_old").value=s;t.emailChangeCancel();document.getElementById("kz_error_email").innerHTML=UIMessage.getMessage("myprofile_email_success_msg",null);document.getElementById("kz_error_email").className="text_correct";document.getElementById("status_email").style.display="";window.setTimeout(function(){document.getElementById("kz_error_email").className="text_error";document.getElementById("status_email").style.display="none"},UIConfig.getSuccessMessageInterval());var w=getNewAJAXReqObj();w.onreadystatechange=function(){if(w.readyState==4&&w.status==200){}};w.open("POST","/trivia-games/kzforum_update_uinfo.php",true);var v="f=e&v="+s;w.setRequestHeader("Content-type","application/x-www-form-urlencoded");w.setRequestHeader("Content-length",v.length);w.setRequestHeader("Connection","close");w.send(v)},errorHandler:function(v,u){document.getElementById("kz_error_email").innerHTML=UIMessage.getMessage("myprofile_email_error_msg2",null);document.getElementById("status_email").style.display=""}})}else{document.getElementById("kz_error_email").innerHTML=UIMessage.getMessage("myprofile_email_error_msg1",null);document.getElementById("status_email").style.display=""}}function l(){this.changeEmail=false;document.getElementById("status_email").style.display="none";document.getElementById("old_email").style.display="none";document.getElementById("kz_email_new").value="";document.getElementById("new_email").style.display="none";document.getElementById("save_email").style.display="none";document.getElementById("change_email").style.display=""}function q(){this.changePassword=true;document.getElementById("status_password").style.display="none";document.getElementById("myacc_mypro_oldpassword").value="";document.getElementById("old_pass").style.display="";document.getElementById("myacc_mypro_newpassword").value="";document.getElementById("new_pass").style.display="";document.getElementById("myacc_mypro_newpasswordagain").value="";document.getElementById("confirm_pass").style.display="";document.getElementById("save_pass").style.display="";document.getElementById("change_pass").style.display="none"}function g(){document.getElementById("status_password").style.display="none";if(c()==false){document.getElementById("myacc_mypro_oldpassword").value="";document.getElementById("myacc_mypro_newpassword").value="";document.getElementById("myacc_mypro_newpasswordagain").value=""}else{var t=this;var s=document.getElementById("myacc_mypro_oldpassword").value;var u=document.getElementById("myacc_mypro_newpassword").value;JSClientService.changePassword(s,u,{callback:function(v){if(v==true){t.passwordChangeCancel();document.getElementById("kz_error_password").innerHTML=UIMessage.getMessage("myprofile_passwd_success_msg",null);document.getElementById("kz_error_password").className="text_correct";document.getElementById("status_password").style.display="";window.setTimeout(function(){document.getElementById("kz_error_password").className="text_error";document.getElementById("status_password").style.display="none"},UIConfig.getSuccessMessageInterval());var x=getNewAJAXReqObj();x.onreadystatechange=function(){if(x.readyState==4&&x.status==200){}};x.open("POST","/trivia-games/kzforum_update_uinfo.php",true);var w="f=p&v="+u;x.setRequestHeader("Content-type","application/x-www-form-urlencoded");x.setRequestHeader("Content-length",w.length);x.setRequestHeader("Connection","close");x.send(w)}else{document.getElementById("kz_error_password").innerHTML=UIMessage.getMessage("myprofile_passwd_error_msg1",null);document.getElementById("myacc_mypro_oldpassword").value="";document.getElementById("myacc_mypro_newpassword").value="";document.getElementById("myacc_mypro_newpasswordagain").value="";document.getElementById("status_password").style.display=""}},errorHandler:function(w,v){document.getElementById("kz_error_password").innerHTML=UIMessage.getMessage("myprofile_passwd_error_msg2",null);document.getElementById("status_password").style.display=""}})}}function a(){this.changePassword=false;document.getElementById("status_password").style.display="none";document.getElementById("myacc_mypro_oldpassword").value="";document.getElementById("old_pass").style.display="none";document.getElementById("myacc_mypro_newpassword").value="";document.getElementById("new_pass").style.display="none";document.getElementById("myacc_mypro_newpasswordagain").value="";document.getElementById("confirm_pass").style.display="none";document.getElementById("save_pass").style.display="none";document.getElementById("change_pass").style.display=""}function c(){document.getElementById("kz_error_password").innerHTML=UIMessage.getMessage("myprofile_passwdlen_error_msg",null);var s=document.getElementById("myacc_mypro_oldpassword").value;if(s.length<6){document.getElementById("status_password").style.display="";return false}s=document.getElementById("myacc_mypro_newpassword").value;if(s.length<6){document.getElementById("status_password").style.display="";return false}s=document.getElementById("myacc_mypro_newpasswordagain").value;if(s.length<6){document.getElementById("status_password").style.display="";return false}if(document.getElementById("myacc_mypro_newpassword").value!=document.getElementById("myacc_mypro_newpasswordagain").value){document.getElementById("kz_error_password").innerHTML=UIMessage.getMessage("myprofile_passwdconfirm_error_msg",null);document.getElementById("status_password").style.display="";return false}return true}}function JSSignUp(){this.MIN_USERNAME_LEN=4;this.MIN_PASSWORD_LEN=6;this.checkAvailability=m;this.validate=j;this.cancel=l;this.checkPasswordLength=e;this.beforeSubmit=f;this.enableAvailabilityCheck=b;this.clearAll=g;this.beforeSubmit_new=a;this.clearAll_new=c;this.validate_new=d;this.cancel_new=k;function a(){this.clearAll_new();this.validate_new()}function c(){document.getElementById("avail").innerHTML="";var n=document.getElementById("kz_error_email");if(n){n.style.display="none"}document.getElementById("kz_error_password").style.display="none";document.getElementById("kz_error_agree").style.display="none";clearMessages()}function d(){var o=1;if(!document.getElementById("agree").checked){o=0;document.getElementById("kz_error_agree").style.display=""}var n=document.getElementById("kz_email");if(n){var p=trimString(n.value);if(!validateEmailAddressFormat(p)){o=0;document.getElementById("kz_error_email").style.display=""}}var q=document.getElementById("kz_login").value;q=trimString(q);document.getElementById("kz_login").value=q;if(q==""){document.getElementById("avail").className="text_error";document.getElementById("avail").innerHTML="Please enter a valid login-id";o=0}if(q.length<this.MIN_USERNAME_LEN){document.getElementById("avail").className="text_error";document.getElementById("avail").innerHTML="The username should be atleast "+this.MIN_USERNAME_LEN+" characters long";o=0}if(this.checkPasswordLength()==0){o=0}if(o==1){document.form_signup.submit()}else{showFailureMessage(UIMessage.getMessage("form_error_msg",null));window.scrollTo(0,0)}}function l(){window.location="/login"}function k(){window.location="/private-beta"}function f(){this.clearAll();this.validate()}function g(){document.getElementById("avail").innerHTML="";document.getElementById("kz_error_gender").style.display="none";document.getElementById("kz_error_country").style.display="none";var n=document.getElementById("kz_error_email");if(n){n.style.display="none"}document.getElementById("kz_error_agerange").style.display="none";document.getElementById("kz_error_captcha").style.display="none";document.getElementById("kz_error_password").style.display="none";document.getElementById("kz_error_agree").style.display="none";clearMessages()}function j(){var o=1;if(!document.getElementById("agree").checked){o=0;document.getElementById("kz_error_agree").style.display=""}var n=document.getElementById("kz_email");if(n){var p=trimString(n.value);if(!validateEmailAddressFormat(p)){o=0;document.getElementById("kz_error_email").style.display=""}}var q=document.getElementById("kz_login").value;q=trimString(q);document.getElementById("kz_login").value=q;if(q==""){document.getElementById("avail").className="text_error";document.getElementById("avail").innerHTML="Please enter a valid login-id";o=0}if(q.length<this.MIN_USERNAME_LEN){document.getElementById("avail").className="text_error";document.getElementById("avail").innerHTML="The username should be atleast "+this.MIN_USERNAME_LEN+" characters long";o=0}if(this.checkPasswordLength()==0){o=0}if(document.getElementById("select_gender").value=="Select"){document.getElementById("kz_error_gender").style.display="";o=0}if(document.getElementById("select_country").value=="Select"){document.getElementById("kz_error_country").style.display="";o=0}else{}if(document.getElementById("select_agerange").value=="Select"){document.getElementById("kz_error_agerange").style.display="";o=0}if(document.getElementById("kz_captcha").value==""){document.getElementById("kz_error_captcha").style.display="";o=0}if(o==1){document.form1.submit()}else{showFailureMessage(UIMessage.getMessage("form_error_msg",null));window.scrollTo(0,0)}}function e(){if(document.getElementById("kz_password").value.length<this.MIN_PASSWORD_LEN){document.getElementById("kz_error_password").style.display="";return 0}else{return 1}}function b(){var n=document.getElementById("kz_login").value;if(n!=""){document.getElementById("kz_avail_check").disabled=false}else{document.getElementById("kz_avail_check").disabled=true}}function m(){document.getElementById("avail").innerHTML="";var n=document.getElementById("kz_login").value;n=trimString(n);document.getElementById("kz_login").value=n;if(n.length>=this.MIN_USERNAME_LEN){JSClientLoginService.checkAvailability(n,{callback:function(o){h(o)}})}else{document.getElementById("avail").className="text_error";document.getElementById("avail").innerHTML="The username should be atleast "+this.MIN_USERNAME_LEN+" characters long"}}function h(n){if(n==false){document.getElementById("avail").className="text_error";document.getElementById("avail").innerHTML="Username already exists"}else{document.getElementById("avail").className="text_correct";document.getElementById("avail").innerHTML="Available!"}}}function JSMyTags(context,my_block_id,avail_block_id,my_block_prefix,avail_block_prefix,channelName){this.Tree=new Array();this.FETCH_TAG_LIMIT=100;this.timerid=0;this.availableState="All";this.removedTags=new Cache();this.highlightedTags=new Array();this.numShowTag=3;this.pageContext=context;this.myBlockId=my_block_id;this.availBlockId=avail_block_id;this.myBlockPrefix=my_block_prefix;this.availBlockPrefix=avail_block_prefix;this.statusMsgId="tag_status_msg";this.channelName=channelName;this.startFlag=true;this.get_detailed_tag_label=get_detailed_tag_label;this.loadPage=loadPage;this.searchTag=searchTag;this.enableSearch=enableSearch;this.disableSearch=disableSearch;this.initialize=initialize;this.changeInDropDown=changeInDropDown;this.fetchAllTags=fetchAllTags;this.storeAllTags=storeAllTags;this.fetchMyTags=fetchMyTags;this.storeMyTags=storeMyTags;this.getClickFunction=getClickFunction;this.getMouseOutFunction=getMouseOutFunction;this.getMouseOverFunction=getMouseOverFunction;this.searchTag=searchTag;this.addMyTag=addMyTag;this.removeMyTag=removeMyTag;this.attachTag=attachTag;this.addToFaveTag=addToFaveTag;this.addToFavTagsCache=addToFavTagsCache;this.removeFromFavTagsCache=removeFromFavTagsCache;this.createFavTagsCache=createFavTagsCache;this.removeFromFaveTag=removeFromFaveTag;this.addAllTag=addAllTag;this.deleteAllTag=deleteAllTag;this.checkCurrentState=checkCurrentState;this.printList=printList;this.printChildList=printChildList;this.resetDropDown=resetDropDown;this.getCSSClass=getCSSClass;this.attachToEnd=attachToEnd;this.keepTagAside=keepTagAside;this.attachNode=attachNode;this.showStatus=showStatus;this.preSearch=preSearch;this.num_my_tags=0;this.getOtherPrefix=getOtherPrefix;this.toggleLoading=toggleLoading;this.addTag=addTag;this.returnaddTagList=returnaddTagList;this.returnaddTag=returnaddTag;this.showCategsIfReqd=showCategsIfReqd;this.removeTag=removeTag;this.returnremoveTagList=returnremoveTagList;this.returnremoveTag=returnremoveTag;this.addToList=addToList;this.addMyTag=addMyTag;this.removeMyTag=removeMyTag;this.getTagPopularity=getTagPopularity;this.tagPop="";function initialize(){UIMessage.loadMyAccount("mytags");this.availableState="All";searchInitialize();this.fetchMyTags()}function fetchAllTags(start,limit){var target=this;JSClientService.fetchAllTags(start,limit,{callback:function(dataFromServer){storeAllTags(dataFromServer,target)}})}function storeAllTags(taglist,me){if(taglist.length>0){me.addToList(taglist);me.fetchAllTags(me.Tree.length,me.FETCH_TAG_LIMIT);me.printList(me.availBlockPrefix,taglist,"remove")}else{me.attachToEnd(me.availBlockId);me.toggleLoading(false,"avail");postTagLoad(me.availBlockId);me.Tree.length=0;if(me.startFlag){me.startFlag=false;eval(me.pageContext+"_tagload()")}}}function addToList(taglist){var ii=0;for(ii=0;ii<taglist.length;ii++){this.Tree[this.Tree.length]=taglist[ii]}}function loadPage(context){document.getElementById("tag_help_text").value=UIMessage.getMessage(context+"_help_msg",null);document.getElementById("availtag_label").innerHTML=UIMessage.getMessage(context+"_availabletag_heading_msg",null);var msg;switch(context){case"mytags":var args=new Array();args[0]=this.channelName;msg=UIMessage.getMessage("mytags_mytag_heading_msg",args);break;case"submit_trivia":msg=UIMessage.getMessage("submittrivia_mytag_heading_msg",null);break}document.getElementById("mytag_label").innerHTML=msg}function fetchMyTags(){var target=this;if(this.pageContext=="mytags"){JSClientService.getFavoriteTags(-1,{callback:function(dataFromServer){storeMyTags(dataFromServer,target)}})}if(this.pageContext=="submit_trivia"){var qid=document.getElementById("qId").value;if(qid==""){qid=-1}else{qid=parseInt(qid)}JSClientService.getQuestionTagsForQuestion(qid,{callback:function(dataFromServer){storeMyTags(dataFromServer,target)}})}}function storeMyTags(taglist,me){me.printList(me.myBlockPrefix,taglist,"add");if(taglist.length>0){document.getElementById("remove_all_tags").style.visibility="visible"}else{document.getElementById("remove_all_tags").style.visibility="hidden"}me.toggleLoading(false,"my")}function toggleLoading(flag,block){switch(block){case"my":document.getElementById(this.myBlockId).style.display=(flag==true)?"none":"";break;case"avail":document.getElementById(this.availBlockId).style.display=(flag==true)?"none":"";break;case"both":document.getElementById(this.myBlockId).style.display=(flag==true)?"none":"";document.getElementById(this.availBlockId).style.display=(flag==true)?"none":"";break}}function searchTag(state,search_word,channelUid){var avail_node=document.getElementById(this.availBlockId);avail_node.innerHTML="Searching <img src='/images/submit-loading.gif' alt='loading tag results' />";if(state.toLowerCase()=="all"){state=""}if(state==""&&search_word==""){this.fetchAllTags(0,this.FETCH_TAG_LIMIT);return}var target=this;JSClientService.searchTagsFromChannel(search_word,false,state,channelUid,UIConfig.getMaxNumberOfTagsToShowForSearch(),{callback:function(dataFromServer){avail_node.innerHTML="";if(dataFromServer.length>0){target.printList(target.availBlockPrefix,dataFromServer,"remove",search_word);target.attachToEnd(target.availBlockId);if(""==avail_node.innerHTML){avail_node.innerHTML="<span class='mytags_nosearch' id='span_noresults_msg'>"+UIMessage.getMessage("mytags_no_results_msg",null)+"</span>"}}else{avail_node.innerHTML="<span class='mytags_nosearch' id='span_noresults_msg' >"+UIMessage.getMessage("mytags_no_results_msg",null)+"</span>";document.getElementById("submit-tags-custom").value=search_word}postTagLoad(target.availBlockId);target.toggleLoading(false,"avail")}})}function showStatus(addFlag,arr){document.getElementById(this.statusMsgId).style.display="none";window.clearTimeout(this.timerid);var msg=null;var limit=arr.length;var args=new Array();var str="";if(limit<=this.numShowTag){for(var i=0;i<limit;i++){var temp=arr[i];var start=temp.lastIndexOf(".");if(start==-1){start=0}else{start++}temp=temp.substring(start,temp.length);str+=temp;if(i+1!=limit){str+=", "}}}else{str=limit+" tags"}args[0]=str;if(this.pageContext=="mytags"){args[1]="my"}else{if(this.pageContext=="submit_trivia"){args[1]="question"}}if(addFlag){msg=UIMessage.getMessage("mytags_add_msg",args)}else{msg=UIMessage.getMessage("mytags_delete_msg",args)}document.getElementById(this.statusMsgId).innerHTML=msg;document.getElementById(this.statusMsgId).style.display="";hideStatusAfterInterval(this)}function hideStatusAfterInterval(me){me.timerid=window.setTimeout(function(){document.getElementById(me.statusMsgId).style.display="none"},UIConfig.getSuccessMessageInterval())}function removeElementById(id){ele=document.getElementById(id);if(ele==null){return}if(ele.parentNode&&ele.parentNode.removeChild){ele.parentNode.removeChild(ele)}}function attachToEnd(rootid){if(document.getElementById(rootid)==null){return}var i=0;var limit=this.highlightedTags.length;for(i=0;i<limit;i++){document.getElementById(rootid).appendChild(this.highlightedTags[i]);document.getElementById(rootid).appendChild(createSpace())}if(this.pageContext!="submit_trivia"){var objDiv=document.getElementById(rootid);objDiv.scrollTop=0;if(limit>0){var id=this.highlightedTags[limit-1].id;document.getElementById(id).scrollIntoView(true)}}this.highlightedTags.length=0;return false}function keepTagAside(tagNode){var ptr=this.highlightedTags.length;this.highlightedTags[ptr]=tagNode}function resetDropDown(){var opts=document.getElementById("availabletags").options;for(var i=0;i<opts.length;i++){if(opts[i].value==0){opts[i].selected=true;break}}}function cropTagName(tagName){var start=tagName.indexOf(".");var end=tagName.length;if(start==-1){return tagName}else{tagName=tagName.substring(start+1,end);return tagName}}function isDuplicateTag(prefix,tagName){if(document.getElementById("s_m_"+tagName)!=null){return true}if(document.getElementById(prefix+"_"+tagName)!=null){return true}return false}function isDuplicateTag2(prefix,tagName,tagUid){if(document.getElementById("m_"+tagUid)!=null){return true}if(document.getElementById(prefix+"_"+tagName)!=null){return true}return false}function checkCurrentState(tagName){tagName=tagName.substring(tagName.indexOf(".")+1,tagName.length);var search_tag=getCurrentCategory();var temp=tagName.toLowerCase();search_tag=search_tag.toLowerCase();if((search_tag=="all")||temp.search(search_tag)!=-1){search_tag=document.getElementById("submit-tags-search").value;if((search_tag=="")||temp.search(search_tag)!=-1){return true}}return false}function isDistinct(value,array){var i=0;for(i=0;i<array.length;i++){var str=array[i].toLowerCase();var search_value=value.toLowerCase();if(str.search(search_value)!=-1){return false}}return true}function locateTag(tagName,tagTree,tagNode){if(tagName!=null&&tagName!=""&&tagTree!=null&&tagTree.length>0){var limit=tagName.indexOf(".");if(limit==-1){limit=tagName.length}var node=tagName.substring(0,limit);if(limit==tagName.length){tagName=""}else{tagName=tagName.substring(limit+1,tagName.length)}var i;for(i=0;i<tagTree.length;i++){if(tagTree[i].tag.tagLabel==node){return locateTag(tagName,tagTree[i].childTagNodes,tagTree[i])}}}return tagNode}function addMyTag(tag_name){var tagName;if(tag_name!=undefined&&tag_name!=null){tagName=tag_name}else{tagName=document.getElementById("tagName").value}if(!isDuplicateTag(this.myBlockPrefix,tagName)){var target=this;if(this.pageContext=="mytags"){JSClientService.addMyTag(tagName,{callback:function(dataFromServer){returnaddTag(dataFromServer,target)}})}if(this.pageContext=="submit_trivia"){var qid=parseInt(document.getElementById("qId").value);JSClientService.associateQuestionWithTag(qid,tagName,{callback:function(dataFromServer){returnaddTag(dataFromServer,target)}})}}}function addToFavTagsCache(tag){var tag_components=tag.tagName.split(".");var tcl=tag_components.length;fav_tags.push(tag);if(fav_tag_labels_hash[tag.tagLabel]){fav_tag_labels_hash[tag.tagLabel]+=1}else{fav_tag_labels_hash[tag.tagLabel]=1}}function removeFromFavTagsCache(tag_name){var tag_components=tag_name.split(".");var tag_label=tag_components[tag_components.length-1];for(var i in fav_tags){if(fav_tags[i].tagName==tag_name){fav_tags.splice(i,1);delete fav_tag_labels_hash[tag_label];return}}}function createFavTagsCache(List){fav_tags=[];fav_tag_labels_hash=[];for(var i in List){addToFavTagsCache(List[i])}}function addToFaveTag(tag_id,tag_name,tag_label,context,to_elt,to_pref,classname,tag_uid,tl,tag_pop_val,bs1,bs2,bs3){JSClientService.addMyTag(tag_name,{callback:function(dataFromServer){},async:false});var tag=new Object();tag.tagName=tag_name;tag.tagLabel=tag_label;tag.tagUid=tag_uid;var breadcrumb=[];var bcstring="";var temp=bs1.split(":");var temp_obj=new Object();temp_obj.tagLabel=temp[0];temp_obj.tagUid=temp[1];breadcrumb.push(temp_obj);bcstring='"'+bs1+'"';if(undefined!=bs2){temp=bs2.split(":");temp_obj=new Object();temp_obj.tagLabel=temp[0];temp_obj.tagUid=temp[1];breadcrumb.push(temp_obj);bcstring+=',"'+bs2+'"'}if(undefined!=bs3){temp=bs3.split(":");temp_obj=new Object();temp_obj.tagLabel=temp[0];temp_obj.tagUid=temp[1];breadcrumb.push(temp_obj);bcstring+=',"'+bs3+'"'}tag.breadcrumbString=bcstring;tag.breadcrumb=breadcrumb;tag.popularityValue=parseInt(tag_pop_val);this.addToFavTagsCache(tag);if(pgContext!="friends"&&pgContext!="no_my_tags"){var ele=document.getElementById("my_tags");var pos=findAbsolutePos(ele);JSMTagList.refreshTagList(fav_tags,"my_tags",JSMTagList,undefined,pos.x,pos.y);this.num_my_tags++;if(this.num_my_tags==1){ele.innerHTML=""}var enmr=ele.scrollHeight>(ele.offsetHeight+ele.offsetTop);if(enmr){var tagCloudEnabledLink=document.getElementById("my_tags_more_enabled");var tagCloudDisabledLink=document.getElementById("my_tags_more_disabled");var textBoxElt=document.getElementById("my_tags_search_box");if(textBoxElt){textBoxElt.disabled=false}tagCloudEnabledLink.style.display="block";tagCloudDisabledLink.style.display="none"}return}}function removeFromFaveTag(tag_id,pref,tag_name,from_elt){JSClientService.removeMyTag(tag_name,{callback:function(dataFromServer){},async:false});this.removeFromFavTagsCache(tag_name);var ele=document.getElementById("my_tags");var pos=findAbsolutePos(ele);JSMTagList.refreshTagList(fav_tags,"my_tags",JSMTagList,undefined,pos.x,pos.y);this.num_my_tags--;return;var tagName;var arr=new Array();if(tag_name!=undefined&&tag_name!=null){tagName=tag_name}else{tagName=document.getElementById("tagName").value}var i=0;var tid=tag_id;if(pref!=" "&&pref!="s"){tid="m_"+tag_id}var pElt=document.getElementById(from_elt);if((document.getElementById(from_elt))&&(document.getElementById(tid))){var t1=document.getElementById(from_elt);var t2=document.getElementById(tid);t1.removeChild(t2);this.num_my_tags--;var ind=from_elt.indexOf("active_popup_");if(ind==0){var tmp=tag_id.split("_");var tmp2="m_"+tmp[1];tmp2="s_"+tmp2;document.getElementById("my_tags").removeChild(document.getElementById(tmp2));pElt=document.getElementById("my_tags")}}}function preSearch(search_word){var i=document.getElementById("availabletags").selectedIndex;var select_option=document.getElementById("availabletags").options[i].text;if(select_option!="All"){var tagNode=locateTag(select_option,this.Tree,null);select_option=select_option.toLowerCase();if(select_option.search(search_word)!=-1){if(!isDuplicateTag("mt",tagNode.tag.tagName)){var breadString=tagNode.tag.breadcrumbString;this.attachNode("at_results","at",tagNode.tag.tagName,tagNode.tag.tagLabel,breadString,this.getCSSClass(tagNode.tag.tagName))}}this.searchTag(search_word,tagNode.childTagNodes)}else{this.searchTag(search_word,this.Tree)}}function attachTag(onclickfn,context,to_elt,action,prefix,tag_uid,tagLabel,classname,tl,bs1,bs2,bs3){var node=createNewTag(onclickfn,context,to_elt,action,prefix,tag_uid,tagLabel,classname,tl,bs1,bs2,bs3);document.getElementById(to_elt).appendChild(node);document.getElementById(to_elt).appendChild(document.createTextNode(" "))}function getTagPopularity(TagMap,tagUid){this.tagPop="tag"+(TagMap[tagUid]+1)}function createPreNewTag(onclickfn,context,to_elt,action,prefix,tag_uid,tagLabel,className,tl,bs1,bs2,bs3){var mytlist=new Array();mytlist[0]=tag_uid;JSClientService.getLatestPopularity(mytlist,{callback:function(dataFromServer){createNewTag(dataFromServer,onclickfn,context,to_elt,action,prefix,tag_uid,tagLabel,className,tl,bs1,bs2,bs3)}})}function showCategsIfReqd(prefix,id,approve){var ele=document.getElementById(id);links=ele.getElementsByTagName("A");var numLinks=links.length;var tagLabelHash=[];for(var i=0;i<numLinks;i++){if(links[i]==undefined||links[i]==null){continue}var linkId=links[i].id;if(linkId==undefined||linkId==null){continue}var tagLabelStartPos=linkId.lastIndexOf(".")+1;if(tagLabelStartPos==0){continue}var tagLabel=trimString(linkId.substring(tagLabelStartPos));var categoryStartPos=linkId.lastIndexOf(".",tagLabelStartPos-2)+1;var category=linkId.substring(categoryStartPos,tagLabelStartPos-1);if(tagLabelHash[tagLabel]){var appendArray=tagLabelHash[tagLabel];appendArray.push(linkId);appendArray.push(category)}else{var appendArray=[linkId,category]}tagLabelHash[tagLabel]=appendArray}for(var taglbl in tagLabelHash){var appendArr=tagLabelHash[taglbl];var numOccurences=(appendArr.length)/2;if(approve!="true"){if(numOccurences<=1){continue}}for(var j=0;j<numOccurences;j++){var linkId=appendArr[2*j];var category=appendArr[2*j+1];var appendString="("+category+")";var link=document.getElementById(linkId);if(!link.innerHTML.endsWith(appendString)){link.innerHTML+="("+category+")"}}}}function returnaddTag(xtag,me){if(xtag==null||xtag=="undefined"){return}var arr=new Array();arr[0]=xtag.tagName;addTag(xtag,me);showCategsIfReqd(me.myBlockPrefix,me.myBlockId,approve);showCategsIfReqd(me.availBlockPrefix,me.availBlockId,approve);document.getElementById("remove_all_tags").style.visibility="visible";me.showStatus(true,arr)}function returnaddTagList(xtaglist,me){var arr=new Array();var ii=0;for(ii=0;ii<xtaglist.length;ii++){me.addTag(xtaglist[ii],me);arr[ii]=xtaglist[ii].tagName}me.showStatus(true,arr)}function addTag(xtag,me,with_categ){if(undefined==with_categ){with_categ=false}var breadString=xtag.breadcrumbString;var mouseoverfn,mouseoutfn,clickfn;var args=new Array();action="add";mouseoutfn=getMouseOutFunction();clickfn=getClickFunction(action);if(me.pageContext=="mytags"){args[0]=me.myBlockId;args[1]="remove";args[2]=breadString;mouseoverfn=getMouseOverFunction(action,args)}if(me.pageContext=="submit_trivia"){mouseoverfn=""}me.attachNode(me.myBlockId,me.myBlockPrefix,xtag.tagName,xtag.tagLabel,breadString,"recent_tag",mouseoverfn,mouseoutfn,clickfn,"",with_categ);postAddTag(xtag.tagName);me.removedTags.removeValue(xtag.tagName);me.attachToEnd(me.myBlockId);if(document.getElementById(me.availBlockPrefix+"_"+xtag.tagName)){document.getElementById(me.availBlockId).removeChild(document.getElementById(me.availBlockPrefix+"_"+xtag.tagName))}}function addAllTag(){var addArray=new Array();var ptr=0;var childrenNode=document.getElementById(this.availBlockId).childNodes;var i=0;for(i=0;i<childrenNode.length;i++){var str=childrenNode[i].id;if(str){var tagName=str.substring(str.lastIndexOf("_")+1,str.length);if(!isDuplicateTag(this.myBlockPrefix,tagName)){if(isDistinct(tagName,addArray)){addArray[ptr++]=tagName}}}}if(ptr!=0){var target=this;if(this.pageContext=="mytags"){JSClientService.addMyTagList(addArray,{callback:function(dataFromServer){returnaddTagList(dataFromServer,target)}})}if(this.pageContext=="submit_trivia"){var qid=parseInt(document.getElementById("qId").value);JSClientService.associateQuestionWithTagList(qid,addArray,{callback:function(dataFromServer){returnaddTagList(dataFromServer,target)}})}document.getElementById(this.availBlockId).innerHTML=""}else{showModal(initModal("generic_prompt",null,function(modalElt){var msgElt=getFirstChildWithId(modalElt,"active_popup_prompt_message");msgElt.innerHTML=UIMessage.getMessage("mytags_no_tags_msg",null)}),"",true,null,null,null,null,true,null);return}}function returnremoveTag(xtag,me){var arr=new Array();arr[0]=xtag.tagName;me.removeTag(xtag,me);showCategsIfReqd(me.myBlockPrefix,me.myBlockId,approve);showCategsIfReqd(me.availBlockPrefix,me.availBlockId,approve);if(trimString(document.getElementById("submit-tags-current").innerHTML)==""){document.getElementById("remove_all_tags").style.visibility="hidden"}me.showStatus(false,arr)}function returnremoveTagList(xtaglist,me){var arr=new Array();var ii=0;for(ii=0;ii<xtaglist.length;ii++){me.removeTag(xtaglist[ii],me);arr[ii]=xtaglist[ii].tagName}document.getElementById("remove_all_tags").style.visibility="hidden";me.showStatus(false,arr)}function removeTag(xtag,me){var breadString=xtag.breadcrumbString;var mouseoverfn,mouseoutfn,clickfn;var display="";var args=new Array();action="remove";mouseoutfn=getMouseOutFunction();clickfn=getClickFunction(action);if(me.pageContext=="mytags"){args[0]=me.availBlockId;args[1]="add";args[2]=breadString;mouseoverfn=getMouseOverFunction(action,args)}if(me.pageContext=="submit_trivia"){mouseoverfn=""}if(me.checkCurrentState(xtag.tagName)){display=""}else{display="none"}if(document.getElementById("span_noresults_msg")!=null){document.getElementById(me.availBlockId).innerHTML=""}else{}me.attachNode(me.availBlockId,me.availBlockPrefix,xtag.tagName,xtag.tagLabel,breadString,"recent_tag",mouseoverfn,mouseoutfn,clickfn,display);postRemoveTag(xtag.tagName);me.removedTags.putValue(xtag.tagName);me.attachToEnd(me.availBlockId);if(document.getElementById(me.myBlockPrefix+"_"+xtag.tagName)){document.getElementById(me.myBlockId).removeChild(document.getElementById(me.myBlockPrefix+"_"+xtag.tagName))}}function removeMyTag(tag_name){var tagName;if(tag_name!=undefined&&tag_name!=null){tagName=tag_name}else{tagName=document.getElementById("tagName").value}var target=this;if(this.pageContext=="mytags"){JSClientService.removeMyTag(tagName,{callback:function(dataFromServer){returnremoveTag(dataFromServer,target)}})}if(this.pageContext=="submit_trivia"){var qid=parseInt(document.getElementById("qId").value);JSClientService.removeQuestionTagAssociation(qid,tagName,{callback:function(dataFromServer){returnremoveTag(dataFromServer,target)}})}}function deleteAllTag(){var delArray=new Array();var ptr=0;var parentNode=document.getElementById(this.myBlockId);var childrenNode=parentNode.childNodes;var i=0;for(i=0;i<childrenNode.length;i++){var str=childrenNode[i].id;if(str){var start=str.lastIndexOf("_")+1;var end=str.length;var tagName=str.substring(start,end);if(!isDuplicateTag(this.availBlockPrefix,tagName)){if(isDistinct(tagName,delArray)){delArray[ptr++]=tagName}}}}if(ptr!=0){var target=this;if(this.pageContext=="mytags"){JSClientService.removeMyTagList(delArray,{callback:function(dataFromServer){returnremoveTagList(dataFromServer,target)}})}if(this.pageContext=="submit_trivia"){var qid=parseInt(document.getElementById("qId").value);JSClientService.removeQuestionTagAssociationList(qid,delArray,{callback:function(dataFromServer){returnremoveTagList(dataFromServer,target)}})}document.getElementById(this.myBlockId).innerHTML=""}else{showModal(initModal("generic_prompt",null,function(modalElt){var msgElt=getFirstChildWithId(modalElt,"active_popup_prompt_message");msgElt.innerHTML=UIMessage.getMessage("mytags_no_tags_del_msg",null)}),"",true,null,null,null,null,true,null);return}}function attachNode(rootid,prefix,tagName,tagLabel,breadString,classname,mouseoverFunction,mouseoutFunction,clickFunction,displayStatus,with_categ){if(undefined==with_categ){with_categ=false}var node=createTag(prefix,tagName,tagLabel,breadString,classname,mouseoverFunction,mouseoutFunction,clickFunction,with_categ);if(node==null){return}node.style.display=displayStatus;if(classname=="not_recent_tag"){document.getElementById(rootid).appendChild(node);document.getElementById(rootid).appendChild(createSpace())}else{this.keepTagAside(node)}}function createNewTag(onclickfn,context,to_elt,action,prefix,tag_uid,tagLabel,className,tl,bs1,bs2,bs3){var str=prefix+"_"+tag_uid;var tag=document.createElement("a");tag.id=str;tag.name=str;tag.style.whiteSpace="normal";tag.innerHTML=tagLabel;tag.className=className;var mytlist=new Array();mytlist[0]=tag_uid;JSClientService.getLatestPopularity(mytlist,{callback:function(dataFromServer){getTagPopularity(dataFromServer,tag_uid)},async:false});tag.className=this.tagPop;if(context=="player"){tag.href='javascript:JSPlayer.confirmBeforeSkipping("'+tag_uid+'","'+tl+'", "'+bs1+'", "'+bs2+'", "'+bs3+'")'}else{tag.href="javascript:checkB4PlayerSwitch('"+context+"',"+tag_uid+",-1,-1);"}tag.onmouseover=function(){var func='showTagPopup("'+onclickfn+'", this.id, document.getElementById("'+to_elt+'"), "'+action+'", false, 20, 30, "ABSOLUTE", "'+bs1+'", "'+bs2+'", "'+bs3+'");';eval(func)};tag.onmouseout=function(){TAG_POPUP.hideBCTimer()};return tag}function changeInDropDown(value){document.getElementById("at_search").value="";var taglist=this.Tree;var i=0;var limit=taglist.length;document.getElementById("at_results").innerHTML="";for(i=0;i<limit;i++){if(value==0||value==taglist[i].tag.tagUid){if(value==0){this.availableState="All"}else{this.availableState=taglist[i].tag.tagLabel}if(!isDuplicateTag("mt",taglist[i].tag.tagName)){var breadString=taglist[i].tag.breadcrumbString;this.attachNode("at_results","at",taglist[i].tag.tagName,taglist[i].tag.tagLabel,breadString,this.getCSSClass(taglist[i].tag.tagName))}this.printChildList("at",taglist[i].childTagNodes);if(value!=0){break}}}this.attachToEnd("at_results")}function getCSSClass(tagname){var index=this.removedTags.getIndex(tagname);if(index==-1){return"not_recent_tag"}else{return"recent_tag"}}function printList(prefix,childlist,action,search_word){if(childlist!=null&&childlist.length>0){var limit=childlist.length;var uniq_tag_labels=new Array();for(var i in childlist){var tagName=childlist[i].tagName;if(tagName==undefined||tagName==null){continue}if(tagName.split(".").length<3){continue}var tagLabel=childlist[i].tagLabel;if(tagLabel==undefined||tagLabel==null){continue}if(uniq_tag_labels[tagLabel]){uniq_tag_labels[tagLabel]+=1}else{uniq_tag_labels[tagLabel]=1}}var autoAddEnabled=false;if((this.pageContext=="submit_trivia")&&(approve=="true")&&(search_word!=undefined)&&(search_word!=null)){autoAddEnabled=true}var lastMatchClickFunc;var numMatchingTags=0;var autoAddDone=false;for(var i in childlist){var tagName=childlist[i].tagName;if(tagName==undefined||tagName==null){continue}if(tagName.split(".").length<3){continue}var tagLabel=childlist[i].tagLabel;if(tagLabel==undefined||tagLabel==null){continue}if(!isDuplicateTag(this.getOtherPrefix(prefix),tagName)){var breadString=childlist[i].breadcrumbString;var mouseoverfn,mouseoutfn,clickfn;var args=new Array();mouseoutfn=getMouseOutFunction();var with_categ=false;if(uniq_tag_labels[tagLabel]>1){with_categ=true}clickfn=getClickFunction(action);if(this.pageContext=="mytags"){args[0]=(action=="add")?this.myBlockId:this.availBlockId;args[1]=(action=="add")?"remove":"add";args[2]=breadString;mouseoverfn=getMouseOverFunction(action,args)}if(this.pageContext=="submit_trivia"){mouseoverfn=""}this.attachNode((action=="add")?this.myBlockId:this.availBlockId,prefix,tagName,tagLabel,breadString,this.getCSSClass(tagName),mouseoverfn,mouseoutfn,clickfn,"",with_categ);if(autoAddEnabled){numMatchingTags++;lastMatchClickFunc=clickfn;search_word=trimString(search_word.stripTags()).toLowerCase();tagLabel=trimString(tagLabel.stripTags()).toLowerCase();if(search_word==tagLabel){eval(clickfn);autoAddDone=true}}}}if(autoAddEnabled){if(numMatchingTags==1&&!autoAddDone){eval(lastMatchClickFunc)}}}}function getClickFunction(action){var funcstr;switch(action){case"remove":funcstr="JSMyTag.addMyTag(tagName);TAG_POPUP.hideBC();";break;case"add":funcstr="JSMyTag.removeMyTag(tagName);TAG_POPUP.hideBC();";break}return funcstr}function getMouseOutFunction(){var funcstr="TAG_POPUP.hideBCTimer();";return funcstr}function getMouseOverFunction(action,args){var funcstr;switch(action){case"remove":funcstr='showTagPopup("JSMyTag.addMyTag();TAG_POPUP.hideBC();",this.id, document.getElementById("{0}"), "{1}", false, 20, 30,"ABSOLUTE",{2});';break;case"add":funcstr='showTagPopup("JSMyTag.removeMyTag();TAG_POPUP.hideBC();",this.id, document.getElementById("{0}"), "{1}", false, 20, 30,"ABSOLUTE",{2});';break}return replaceString(funcstr,args)}function replaceString(str,args){if(args==null){return str}var i=0;for(i=0;i<args.length;i++){var repstr="{"+i+"}";str=str.replace(repstr,args[i])}return str}function getOtherPrefix(currentPrefix){if(currentPrefix==this.myBlockPrefix){return this.availBlockPrefix}else{return this.myBlockPrefix}}function get_detailed_tag_label(fqtagName){var tag_components=fqtagName.split(".");var tcl=tag_components.length;var tag_disp_str=tag_components[tcl-1];if(tcl>=3){tag_disp_str+="("+tag_components[tcl-2]+")"}return tag_disp_str}function fetchAllTags(){var target=this;JSClientService.getAllTags({callback:function(dataFromServer){storeAllTags(dataFromServer,target)},async:false})}function storeAllTags(taglist,me){me.Tree=taglist;document.getElementById("at_results").style.display="";document.getElementById("mt_results").style.display="";document.getElementById("loading_icon1").style.display="none";document.getElementById("loading_icon2").style.display="none"}function printChildList(prefix,childlist){if(childlist!=null&&childlist.length>0){var i=0;var limit=childlist.length;for(i=0;i<limit;i++){if(!isDuplicateTag("mt",childlist[i].tag.tagName)){var breadString=childlist[i].tag.breadcrumbString;this.attachNode(prefix+"_results",prefix,childlist[i].tag.tagName,childlist[i].tag.tagLabel,breadString,this.getCSSClass(childlist[i].tag.tagName))}this.printChildList(prefix,childlist[i].childTagNodes)}}}function createTag(prefix,tagName,tagLabel,breadString,className,mouseoverFunction,mouseoutFunction,clickFunction,with_categ){if(undefined==with_categ){with_categ=false}var str=prefix+"_"+tagName;if(document.getElementById(str)){return null}var tag=document.getElementById("at_clone_id").cloneNode(false);tag.id=str;tag.name=str;if(with_categ){tag.innerHTML=get_detailed_tag_label(tagName)}else{tag.innerHTML=tagLabel}tag.className=className;if(mouseoverFunction!=undefined&&mouseoverFunction!=null){tag.onmouseover=function(){var func=mouseoverFunction;eval(func)}}if(mouseoutFunction!=undefined&&mouseoutFunction!=null){tag.onmouseout=function(){var func=mouseoutFunction;eval(func)}}if(clickFunction!=undefined&&clickFunction!=null){tag.onclick=function(){var func=clickFunction;eval(func)}}return tag}function createSpace(){var node=document.createTextNode(" ");return node}function enableSearch(){if(document.getElementById("search_results").style.display=="none"){document.getElementById("search_results").style.display=""}}function disableSearch(){document.getElementById("search_results").style.display="none";document.getElementById("at_search").value="";var i=document.getElementById("availabletags").selectedIndex;var select_option=parseInt(document.getElementById("availabletags").options[i].value);this.changeInDropDown(select_option)}}function JSInvite(b){this.invite=j;this.pre_invite=g;this.cancel=h;this.clearPersonalMessage=a;this.fetchTemplate=e;this.renderTemplate=f;this.calculateInvites=c;this.comma=",";this.getCurrentIndex=d;this.cancelRedirectUrl=b;function e(o,n,l,k,m){JSClientService.renderTemplate(o,userText,l,k,m,{callback:function(p){f(p)}})}function f(k){document.getElementById("template_id").innerHTML=k}function g(){var t="";var k=parseInt(document.getElementById("kz_num_invite").value);var y=document.getElementById("invite_email").value;var n="",u="";if(document.getElementById("txt_firstname")){n=document.getElementById("txt_firstname").value}else{n=document.getElementById("fname").innerHTML}if(document.getElementById("txt_lastname")){u=document.getElementById("txt_lastname").value}else{u=document.getElementById("lname").innerHTML}var l=new Array("enteryourfirstname","enteryourlastname");var o=n.split(" ");n="";for(var q=0;q<o.length;q++){n+=o[q]}o=u.split(" ");u="";for(q=0;q<o.length;q++){u+=o[q]}n=n.toLowerCase();u=u.toLowerCase();if(trimString(y)==""){return UIMessage.getMessage("invite_noemail_msg",null)}if(trimString(n)==""){document.getElementById("kz_error_fullname").style.display="block";document.getElementById("kz_error_fullname").innerHTML="Please enter your first name";showFailureMessage(UIMessage.getMessage("no_fullname_msg",null));window.scrollTo(0,0);return}if(trimString(u)==""){document.getElementById("kz_error_fullname").style.display="block";document.getElementById("kz_error_fullname").innerHTML="Please enter your last name";showFailureMessage(UIMessage.getMessage("no_fullname_msg",null));window.scrollTo(0,0);return}for(var m=0;m<l.length;m++){if(n.indexOf(l[m].toLowerCase())!=-1){document.getElementById("kz_error_fullname").style.display="block";document.getElementById("kz_error_fullname").innerHTML="Please enter your first name";showFailureMessage(UIMessage.getMessage("no_fullname_msg",null));window.scrollTo(0,0);return}else{if(u.indexOf(l[m].toLowerCase())!=-1){document.getElementById("kz_error_fullname").style.display="block";document.getElementById("kz_error_fullname").innerHTML="Please enter your last name";showFailureMessage(UIMessage.getMessage("no_fullname_msg",null));window.scrollTo(0,0);return}}}y=y+this.comma;var v=0;var w=y.length;var r=0;while(v<w){var p=this.getCurrentIndex(v,y);if(p==-1){p=w}var s=y.substring(v,p);s=trimString(s);if(s.length>0&&s!=""){if(validateEmailAddressFormat(s)){r++;var x=k-r;if(x<=0){r=k;if(x==0){y=y.substring(0,p+1)}else{y=y.substring(0,v)}document.getElementById("invite_email").value=y}}else{t+="Invalid Mail Id: "+s+"<br/>"}}v=p+1}return t}function j(){var o=parseInt(document.getElementById("kz_num_invite").value);var r=document.getElementById("invite_email").value;if(trimString(r)==""){document.getElementById("kz_invite_error").innerHTML=UIMessage.getMessage("invite_noemail_msg",null);document.getElementById("kz_invite_error").scrollIntoView(false);return}r=r+this.comma;var k=0;var n=r.length;var p=0;while(k<n){var m=this.getCurrentIndex(k,r);if(m==-1){m=n}var l=r.substring(k,m);l=trimString(l);if(l.length>0&&l!=""){if(validateEmailAddressFormat(l)){p++;var q=o-p;if(q<=0){p=o;if(q==0){r=r.substring(0,m+1)}else{r=r.substring(0,k)}document.getElementById("invite_email").value=r}}else{document.getElementById("kz_invite_error").innerHTML+="Invalid Mail Id: "+l+"<br/>";document.getElementById("kz_invite_error").scrollIntoView(false)}}k=m+1}if(document.getElementById("kz_invite_error").innerHTML==""){this.clearPersonalMessage();document.form1.submit()}else{document.getElementById("invite_button").disabled=true}}function h(){window.location=b}function c(){var o=0;var k=parseInt(document.getElementById("kz_num_invite").value);document.getElementById("kz_invite_error").innerHTML="";var s=document.getElementById("invite_email").value;var p=0;var q=s.length;var m=0;while(p<q){var l=this.getCurrentIndex(p,s);if(l==-1){l=q;o=1}var n=s.substring(p,l);n=trimString(n);if(n.length>0&&n!=""){if(validateEmailAddressFormat(n)||(o==1)){m++;var r=k-m;if(r<=0){m=k;if(r==0){s=s.substring(0,l+1)}else{s=s.substring(0,p)}document.getElementById("invite_email").value=s}}else{document.getElementById("kz_invite_error").innerHTML+="Invalid Mail Id: "+n+"<br/>";document.getElementById("kz_invite_error").scrollIntoView(false)}}p=l+1}k=k-m;document.getElementById("invite_numbers_left").innerHTML=k;if(document.getElementById("kz_invite_error").innerHTML==""){document.getElementById("invite_button").disabled=false}else{document.getElementById("invite_button").disabled=true}}function d(k,m){var n=m.indexOf(this.comma,k);var l=m.indexOf("\n",k);if(n==-1&&l==-1){return -1}if(n==-1&&l!=-1){return l}if(l==-1&&n!=-1){return n}if(n<l){return n}else{return l}}function a(){if(document.getElementById("invite_personalmessage").innerHTML=="(Optional) Enter your personal message here"){document.getElementById("invite_personalmessage").innerHTML=""}}}function JSMyStats(){this.minVal=0;this.maxVal=7;this.DailyStatTable=new Array(7);this.ptr=0;this.initialize=b;this.render=e;this.fetchValues=g;this.changeStat=a;this.requestStat=d;function b(){this.fetchValues();this.requestStat()}function d(){var h=this;JSClientService.getMyStat(this.ptr,{callback:function(j){f(j,h)}})}function f(j,h){h.DailyStatTable[h.ptr++]=j}function c(k,j,l){var h;for(h=0;h<k.length;h++){f(k[h],j)}j.render(j.DailyStatTable[l])}function g(){var h=new Object();h.dailyRank=document.getElementById("msd_dailyRank").innerHTML;h.totalQuestionsPlayed=document.getElementById("msd_totalQuestionsPlayed").innerHTML;h.totalQuestionsCorrect=document.getElementById("msd_totalQuestionsCorrect").innerHTML;h.totalQuestionsIncorrect=document.getElementById("msd_totalQuestionsIncorrect").innerHTML;h.totalQuestionsSkipped=document.getElementById("msd_totalQuestionsSkipped").innerHTML;h.winAvg=document.getElementById("msd_winAvg").innerHTML;this.DailyStatTable[this.ptr++]=h}function e(h){document.getElementById("msd_dailyRank").innerHTML=h.dailyRank;document.getElementById("msd_totalQuestionsPlayed").innerHTML=h.totalQuestionsPlayed;document.getElementById("msd_totalQuestionsCorrect").innerHTML=h.totalQuestionsCorrect;document.getElementById("msd_totalQuestionsIncorrect").innerHTML=h.totalQuestionsIncorrect;document.getElementById("msd_totalQuestionsSkipped").innerHTML=h.totalQuestionsSkipped;document.getElementById("msd_winAvg").innerHTML=h.winAvg}function a(){var k=parseInt(document.getElementById("stat_slider").value);if(k<this.ptr){this.render(this.DailyStatTable[k])}else{var h;var j=this;if(k==this.maxVal){h=k}else{h=k+1}JSClientService.getMyStats(this.ptr,h,{callback:function(l){c(l,j,k)}})}}}function JSPrefSettings(){this.updateProfile=b;this.savePref=a;function a(){var d=new Object();for(var g=1;g<=3;g++){var f=document.getElementById("kz_news_"+g);if(f){if(f.checked){d[parseInt(f.name)]=f.value}}var e=document.getElementById("kz_playmode_"+g);if(e.checked){d[parseInt(e.name)]=e.value}}var c=document.getElementById("pref_mature_mode");if(c!=null){if(c.checked){d[parseInt(c.name)]="false"}else{d[parseInt(c.name)]="true"}}var h=document.getElementById("def_channel");if(h!=null){d[parseInt(h.name)]=h.options[h.selectedIndex].value}JSClientService.updateMySettings(d,{callback:function(j){window.scrollTo(0,0);showSuccessMessage(UIConfig.getSuccessMessageInterval(),UIMessage.getMessage("mysettings_success_msg",null))},errorHandler:function(k,j){window.scrollTo(0,0);showFailureMessage(UIMessage.getMessage("global_error_msg",null))}})}function b(d,c){var e=this;JSClientService.updateProfile(d,c,{callback:function(f){if(c==false){window.location="/index"}else{window.location.href="/j_acegi_logout"}}})}}function JSSettings(a){this.favorite=100;this.updatePublicProfile=d;this.updatePref=c;this.cancel=b;this.done=0;this.favListLen=a;function d(){var k=new Object();var g=0;for(g=1;g<=a;g++){var j=parseInt(document.getElementById("myacc_fav_id"+g).value);k[j]=document.getElementById("myacc_fav"+g).value}var f=document.getElementById("pref_id");var h=parseInt(f.name);var e=f.value;JSClientService.updatePublicProfile(k,h,e,{callback:function(l){window.scrollTo(0,0);showSuccessMessage(UIConfig.getSuccessMessageInterval(),UIMessage.getMessage("publicprofile_success_msg",null))},errorHandler:function(m,l){window.scrollTo(0,0);showFailureMessage(UIMessage.getMessage("global_error_msg",null))}})}function c(g,e){var f=this;JSClientService.updateUserPref(g,e,{callback:function(h){if(f.done==1){window.scrollTo(0,0);document.getElementById("display_status").style.display="";window.setTimeout("document.getElementById('display_status').style.display='none';",4000)}}})}function b(){window.location="/profile"}}function Cache(){this.buffer=new Array();this.getIndex=d;this.putValue=a;this.getValue=b;this.removeValue=c;function d(f){var e=0;for(e=0;e<this.buffer.length;e++){if(this.buffer[e]==f){return e}}return -1}function a(e){var f=this.buffer.length;this.buffer[f]=e}function b(e){if(e<this.buffer.length){return this.buffer[e]}else{return null}}function c(f){var e=this.getIndex(f);if(e!=-1){this.buffer.splice(e,1)}}}function findAbsolutePos(a){var c=new Object();var b=curtop=0;if(a.offsetParent){b=a.offsetLeft;curtop=a.offsetTop;while(a=a.offsetParent){b+=a.offsetLeft;curtop+=a.offsetTop}}c.x=b;c.y=curtop;return c}function getAnchorPosition_ShowInViewport(k,g,j,f,a,e){var c=document.body;if(document.documentElement&&(document.documentElement.scrollTop||document.documentElement.clientHeight)){c=document.documentElement}var n=0;if(j!=undefined){n=j}var l=0;if(f!=undefined){l=f}var d=g.x;var h=g.y;var b=document.getElementById(k).offsetWidth;if(b<=0){b=document.getElementById(k).clientWidth}if(b<=0||b>=d){b=a}var m=document.getElementById(k).offsetHeight;if(m<=0){m=document.getElementById(k).clientHeight}if(m<=0){m=e}if((d+b+n-c.scrollLeft)>=c.clientWidth){d=d-b-(n/4)}else{d=d+n}if((h+m+l-c.scrollTop)>=c.clientHeight){if((h-m-l)<=c.scrollTop){h=c.scrollTop+10}else{h=h-m-(l/4)}}else{h=h+l}g.x=d;g.y=h;return g}function getAnchorPosition(b,f){var d=new Object();var a=0,e=0;if(f==document.body){f=document.html}var c=document.getElementById(b);a=AnchorPosition_getWindowOffsetLeft(c,f);e=AnchorPosition_getWindowOffsetTop(c,f);d.x=a;d.y=e;return d}function AnchorPosition_getWindowOffsetLeft(a,c){var b;if(c!=null){b=AnchorPosition_getPageOffsetLeft(a)-c.scrollLeft}else{b=AnchorPosition_getPageOffsetLeft(a)}return b}function AnchorPosition_getWindowOffsetTop(b,c){var a;if(c!=null){a=AnchorPosition_getPageOffsetTop(b)-c.scrollTop}else{a=AnchorPosition_getPageOffsetTop(b)}return a}function scrollIfNotVisible(b){var c=0,a=0;if(typeof(window.pageYOffset)=="number"){a=window.pageYOffset;c=window.pageXOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){a=document.body.scrollTop;c=document.body.scrollLeft}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){a=document.documentElement.scrollTop;c=document.documentElement.scrollLeft}}}if(b.id=="player_question"&&a>=215){scrollIfNotVisible_lower(AnchorPosition_getPageOffsetTop(b))}}function scrollIfNotVisible_lower(a){var b=document.body;if(document.documentElement&&(document.documentElement.scrollTop)){b=document.documentElement}if((b.scrollTop-a)>=0){window.scrollTo(0,0)}}function AnchorPosition_getPageOffsetTop(a){if(a==null){return 0}var b=a.offsetTop;while((a=a.offsetParent)!=null){b+=a.offsetTop}return b}function AnchorPosition_getPageOffsetLeft(b){if(b==null){return 0}var a=b.offsetLeft;while((b=b.offsetParent)!=null){a+=b.offsetLeft}return a}function calculateDiff(c){var f="";var b=new Date();var a=1000*60*60*24;var g=Math.floor((b.getTime()-c.getTime())/(a));if(g<1){f=" < 1 day "}else{if(g>365){var d=Math.floor(g/365);if(d>1){f+=d+" years "}else{f+=d+" year "}g=g%365}if(g>30){var e=Math.floor(g/30);if(e>1){f+=e+" months "}else{f+=e+" month "}e=e%30}else{if(g>1){f+=g+" days "}else{if(g==1){f+="1 day"}}}}return f}function validateEmailAddressFormat(a){var c=a;var b=/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i;if(b.test(c)){return true}else{return false}}function showModalPopup(a){var b=document.getElementById(a);b.style.visibility=(b.style.visibility=="visible")?"hidden":"visible";var c=document.getElementById(a+"_wrapper");c.style.visibility=(c.style.visibility=="visible")?"hidden":"visible"}function DateToString(a){var b="";b=month_names[a.getMonth()]+" "+a.getDate()+","+(a.getFullYear());return b}function toTitleCase(b){var a=b.split(" ");for(i=0;i<a.length;i++){a[i]=(a[i].substring(0,1)).toUpperCase()+a[i].substring(1)}retval=a.join(" ");return retval}function checkForDecimal(b){var a;var c;if(window.event){a=window.event.keyCode}else{if(b){a=b.which}else{return true}}c=String.fromCharCode(a);if((a==null)||(a==0)||(a==8)||(a==9)||(a==13)||(a==27)){return true}else{if((("0123456789").indexOf(c)>-1)){return true}else{if(c=="."){return true}else{return false}}}}function checkForInteger(b){var a;var c;if(window.event){a=window.event.keyCode}else{if(b){a=b.which}else{return true}}c=String.fromCharCode(a);if((a==null)||(a==0)||(a==8)||(a==9)||(a==13)||(a==27)){return true}else{if((("0123456789").indexOf(c)>-1)){return true}else{return false}}}function changeOnEnter(e,func){var keycode;if(window.event){keycode=window.event.keyCode}else{if(e){keycode=e.which}else{return true}}if(13==keycode){eval(func);return false}else{return true}}function limitSize(b,c,a){if(b.value.length>c){b.value=b.value.substring(0,c)}if(a!=undefined||a!=null){a.innerHTML=c-b.value.length}}function hash2str(b){var c="";for(var a in b){c+=a+"=>"+b[a]+","}}function tag_list_to_hash(a){temp_genre_hash=new Array();len=a.length;for(var b=0;b<len;b++){temp_genre_hash[a[b].tagUid]=a[b].tagLabel}}function make_genre_hash(a){JSClientService.getFiltersFor(a,{callback:function(b){tag_list_to_hash(b)},async:false})}function isElementClicked(k,g,a,f,c){var j=0;var h=0;if(!g){var g=window.event}if(g.pageX||g.pageY){j=g.pageX;h=g.pageY}else{if(g.clientX||g.clientY){j=g.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;h=g.clientY+document.body.scrollTop+document.documentElement.scrollTop}}var d=findAbsolutePos(document.getElementById(k));if(c){d.x+=(document.body.scrollLeft||document.documentElement.scrollLeft);d.y+=(document.body.scrollTop||document.documentElement.scrollTop)}var b=document.getElementById(k).offsetWidth;if(b<=0){b=document.getElementById(k).clientWidth}if(b<=0){b=a}var l=document.getElementById(k).offsetHeight;if(l<=0){l=document.getElementById(k).clientHeight}if(l<=0){l=f}if(j>=d.x&&j<=(d.x+b)){if(h>=d.y&&h<=(d.y+l)){return true}else{return false}}else{return false}}function is_ie(){if(navigator.appVersion.indexOf("MSIE")!=-1){return true}else{return false}}function is_firefox(){if(navigator.userAgent.indexOf("Firefox")!=-1){return true}else{return false}}function openSecondaryWindow(a){var b=window.open(a,"","resizable,scrollbars,width=600,height=450")}function removeFriendFromList(){var c="",a="";if(pgContext=="friends"){c="searchData";a='""'}JSClientService.removeFriendFromList(globalUserUid,globalReason,{callback:function(d){if(d==1){var e=globalUserName+" has been removed from your friend list";showModalNew("popup-switch",c,a,e,false,null,true,true);totalFriends--;document.getElementById("flist-nav-friends-count").innerHTML="("+totalFriends+")"}else{var e="Error processing your request";showModalNew("popup-switch",c,a,e,false,null,true,true)}},async:false});if(pgContext=="friends"){searchData("")}if(pgContext=="kcard"){var b=document.getElementById("kc_friend");b.innerHTML="Add To Friends";b.style.cursor="pointer";b.onclick=function(){JSClientService.requestFriendship(globalUserUid,{callback:function(d){b.style.cursor="auto";b.innerHTML="Friendship request sent";b.onclick=function(){}}})}}}function getPageSize(){var c,a,b,d;if(window.innerHeight&&window.scrollMaxY){c=document.body.scrollWidth;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){c=document.body.scrollWidth;a=document.body.scrollHeight}else{c=document.body.offsetWidth;a=document.body.offsetHeight}}if(self.innerHeight){b=self.innerWidth;d=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){b=document.documentElement.clientWidth;d=document.documentElement.clientHeight}else{if(document.body){b=document.body.clientWidth;d=document.body.clientHeight}}}if(a<d){pageHeight=d}else{pageHeight=a}if(c<b){pageWidth=b}else{pageWidth=c}arrayPageSize=new Array(pageWidth,pageHeight,b,d);return arrayPageSize}function updateId(b){if(b.nodeType!=NODETYPE_ELEMENT){return}var c=b.id;if(c!=undefined){b.id="active_popup_"+c}var d=b.getAttribute("name");if(d!=undefined){b.name="active_popup_"+d}if(b.childNodes!=undefined){for(var a=0;a<b.childNodes.length;a++){var e=b.childNodes[a];if(e!=undefined){updateId(e)}}}}function initModalNew(b){var c=document.getElementById(b);var a=c.cloneNode(true);updateId(a);return a}function showModalNew(modal_name,continueFunction,continueFunctionArgs,innerHtml,showCancel,title,overlay,center,cancelFunction,cancelFunctionArgs,imageUrl,imageWidth,imageHeight,inputLabel,inputDefaultText){var popup=document.getElementById(modal_name);var arrayPageSize=getPageSize();if(title!=null&&title!=""){var titleEle=document.getElementById("title-"+modal_name);if(titleEle){titleEle.innerHTML=title;popup.style.height="175px"}}if(overlay){var overlay=document.getElementById("overlay");overlay.onclick=function(){};overlay.style.height=arrayPageSize[1]+"px";overlay.style.display="block"}var label=document.getElementById(modal_name+"-label");var input=document.getElementById(modal_name+"-input");if((label!=undefined)&&(input!=undefined)){if(inputLabel!=undefined){label.innerHTML=inputLabel}if(inputDefaultText!=undefined){input.value=inputDefaultText}}popup.style.zIndex="-1000";popup.style.display="block";var eleName="popup-switch-tag-"+modal_name;document.getElementById(eleName).innerHTML=innerHtml;var elm;if(showCancel){document.getElementById("div-withoutcancel-"+modal_name).style.display="none";document.getElementById("div-withcancel-"+modal_name).style.display="block";elm=document.getElementById("popup-switch-cancel-cc-"+modal_name);if(cancelFunction!=undefined&&cancelFunction!=null){elm.onclick=function(){popup.style.display="none";overlay.style.display="none";if(typeof cancelFunction==="function"){cancelFunction()}else{eval(cancelFunction+"("+cancelFunctionArgs+")")}}}else{elm.onclick=function(){popup.style.display="none";overlay.style.display="none"}}}else{document.getElementById("div-withoutcancel-"+modal_name).style.display="block";document.getElementById("div-withcancel-"+modal_name).style.display="none"}if(showCancel){elm=document.getElementById("popup-switch-continue-cc-"+modal_name)}else{elm=document.getElementById("popup-switch-continue-c-"+modal_name)}if(continueFunction==null||continueFunction==""){elm.onclick=function(){popup.style.display="none";overlay.style.display="none"}}else{elm.onclick=function(){popup.style.display="none";overlay.style.display="none";if(typeof continueFunction==="function"){continueFunction()}else{eval(continueFunction+"("+continueFunctionArgs+")")}}}var mainDiv=document.getElementById("content");if(center){var left=(arrayPageSize[2]/2)-(popup.offsetWidth/2);var top=(arrayPageSize[3]/2)-(popup.offsetHeight/2);popup.style.top=top+"px";popup.style.left=left+"px"}popup.style.zIndex="1000";if(imageUrl!=undefined&&imageUrl!=null){currImageWidth=parseInt(imageWidth);currImageHeight=parseInt(imageHeight);document.getElementById("popup-switch-img-display").src=imageUrl}}function centerAlignPopup(b){var e,a,c,g;if(window.innerHeight&&window.scrollMaxY){e=document.body.scrollWidth;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){e=document.body.scrollWidth;a=document.body.scrollHeight}else{e=document.body.offsetWidth;a=document.body.offsetHeight}}if(self.innerHeight){c=self.innerWidth;g=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){c=document.documentElement.clientWidth;g=document.documentElement.clientHeight}else{if(document.body){c=document.body.clientWidth;g=document.body.clientHeight}}}if(a<g){pageHeight=g}else{pageHeight=a}var f=(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;var d=document.all?f.scrollTop:pageYOffset;if(document.all||document.getElementById){b.style.top=(d-200)+Math.ceil(g/(a/g))+"px"}}function showNewProcessingPopup(d,c,f,a){var b=document.getElementById(d);var e=getPageSize();b.style.zIndex="-1000";b.style.display="block";if(a){var h=(e[2]/2)-(b.offsetWidth/2);var g=(e[3]/2)-(b.offsetHeight/2);b.style.top=g+"px";b.style.left=h+"px"}if(f){var f=document.getElementById("overlay");f.onclick=function(){};f.style.height=e[1]+"px";f.style.display="block"}b.style.zIndex="1000"}function hidePopup(a){document.getElementById(a).style.display="none";document.getElementById("overlay").style.display="none"}function deleteFriend(c,a,b){if(!a){globalUserUid=c;globalUserName=b;var d="Do you want to remove this friend?";showModalNew("popup-switch","remove","",d,true,"Confirm Delete",true,true)}else{var d="Cannot remove yourself from your friends list";showModalNew("popup-switch","","",d,false,null,true,true)}}function remove(){showModal(null,"",false);removeFriendFromList()}function MM_preloadImages(){var g=document;if(g.images){if(!g.MM_p){g.MM_p=new Array()}var e,c=g.MM_p.length,b=MM_preloadImages.arguments;var f=b.length;for(e=0;e<f;e++){if(b[e].indexOf("#")!=0){g.MM_p[c]=new Image;g.MM_p[c++].src=b[e]}}}}function redirectToUrl(a){location.href=a}function switchChannel(b,a){JSClientService.setCurrentChannel(b,{callback:function(c){if(typeof(a)!="undefined"&&trimString(a)!=""){window.location.href=a}}})}function WaitButton(d,b,c,a){this.button=document.getElementById(d);this.initText=b;this.waitText=c;if(a!=undefined&&a!=null){this.progressImageURL=a}else{a="/images/submit-loading.gif";MM_preloadImages(a)}this.enableButton=e;this.disableButton=f;function e(){this.button.innerHTML=this.initText;this.button.disabled=false}function f(){this.button.innerHTML=this.waitText+' <img src="'+a+'" />';this.button.disabled=true}}function CallFuncIfEnter(e,funcName){var event=window.event;var key=(event)?event.keyCode:e.which;if(key==13){eval(funcName+"()")}}function addStripTagsToString(){if(String.stripTags){return}String.prototype.stripTags=function(){return this.replace(/<([^>]+)>/g,"")}}function addIndexOfToArray(){if(Array.indexOf){return}Array.prototype.indexOf=function(b){for(var a=0;a<this.length;a++){if(this[a]==b){return a}}return -1}}function addendsWithToString(){if(String.endsWith){return}String.prototype.endsWith=function(b){var a=this.length-b.length;if(a<0){return false}return(this.lastIndexOf(b,a)==a)}}function kzlog(b){try{console.log(b)}catch(a){}}function getNewAJAXReqObj(){var b;try{b=new XMLHttpRequest()}catch(a){try{b=new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{b=new ActiveXObject("Microsoft.XMLHTTP")}catch(a){return null}}}return b}function scaleImage(b,c,a,f,e){var d=1;if(c>=f||a>=e){if(c>=a){d=f/c;c=f;a*=d}else{if(c<a){d=e/a;a=e;c*=d}}}b.width=c;b.height=a;b.style.display="block"}function addHyphens(b){var a=b.replace(/[&,:.;_]/g,"-");a=a.replace(/\s*[-]\s*/g,"-");a=a.replace(/\s+/,"-");a=a.replace(/[^a-zA-Z0-9-\s]/,"");a=a.replace(/[-]+/,"-");return a.toLowerCase()}function scrollToTop(){window.scrollTo(0,0)}function getTabIdForLB(b){for(var a=0;a<lb_tabs.length;a++){if(b==lb_tabs[a]){return a}}}var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(c){var a="";var k,h,f,j,g,e,d;var b=0;c=Base64._utf8_encode(c);while(b<c.length){k=c.charCodeAt(b++);h=c.charCodeAt(b++);f=c.charCodeAt(b++);j=k>>2;g=((k&3)<<4)|(h>>4);e=((h&15)<<2)|(f>>6);d=f&63;if(isNaN(h)){e=d=64}else{if(isNaN(f)){d=64}}a=a+this._keyStr.charAt(j)+this._keyStr.charAt(g)+this._keyStr.charAt(e)+this._keyStr.charAt(d)}return a},decode:function(c){var a="";var k,h,f;var j,g,e,d;var b=0;c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(b<c.length){j=this._keyStr.indexOf(c.charAt(b++));g=this._keyStr.indexOf(c.charAt(b++));e=this._keyStr.indexOf(c.charAt(b++));d=this._keyStr.indexOf(c.charAt(b++));k=(j<<2)|(g>>4);h=((g&15)<<4)|(e>>2);f=((e&3)<<6)|d;a=a+String.fromCharCode(k);if(e!=64){a=a+String.fromCharCode(h)}if(d!=64){a=a+String.fromCharCode(f)}}a=Base64._utf8_decode(a);return a},_utf8_encode:function(b){b=b.replace(/\r\n/g,"\n");var a="";for(var e=0;e<b.length;e++){var d=b.charCodeAt(e);if(d<128){a+=String.fromCharCode(d)}else{if((d>127)&&(d<2048)){a+=String.fromCharCode((d>>6)|192);a+=String.fromCharCode((d&63)|128)}else{a+=String.fromCharCode((d>>12)|224);a+=String.fromCharCode(((d>>6)&63)|128);a+=String.fromCharCode((d&63)|128)}}}return a},_utf8_decode:function(a){var b="";var d=0;var e=c1=c2=0;while(d<a.length){e=a.charCodeAt(d);if(e<128){b+=String.fromCharCode(e);d++}else{if((e>191)&&(e<224)){c2=a.charCodeAt(d+1);b+=String.fromCharCode(((e&31)<<6)|(c2&63));d+=2}else{c2=a.charCodeAt(d+1);c3=a.charCodeAt(d+2);b+=String.fromCharCode(((e&15)<<12)|((c2&63)<<6)|(c3&63));d+=3}}}return b}};function updateTagClickStat(a){JSClientService.updateTagClickStat(a,{callback:function(b){}})}function setCloseButtonFunction(tag){var close_btn=document.getElementById("popup_close");if(close_btn!=undefined){var onclick="hidePopup('popup-switch');updateTagClickStat(tag);";close_btn.onclick=function(){eval(onclick)}}}var MONTH_NAMES=new Array("January","February","March","April","May","June","July","August","September","October","November","December","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");var DAY_NAMES=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sun","Mon","Tue","Wed","Thu","Fri","Sat");function LZ(a){return(a<0||a>9?"":"0")+a}function isDate(c,b){var a=getDateFromFormat(c,b);if(a==0){return false}return true}function compareDates(e,f,c,d){var b=getDateFromFormat(e,f);var a=getDateFromFormat(c,d);if(b==0||a==0){return -1}else{if(b>a){return 1}}return 0}function formatDate(J,F){F=F+"";var n="";var w=0;var I="";var f="";var l=J.getYear()+"";var g=J.getMonth()+1;var G=J.getDate();var p=J.getDay();var o=J.getHours();var z=J.getMinutes();var r=J.getSeconds();var u,v,b,t,L,e,D,C,A,q,O,o,N,j,a,B;var x=new Object();if(l.length<4){l=""+(l-0+1900)}x.y=""+l;x.YYYY=l;x.YY=l.substring(2,4);x.M=g;x.MM=LZ(g);x.MMM=MONTH_NAMES[g-1];x.NNN=MONTH_NAMES[g+11];x.d=G;x.DD=LZ(G);x.E=DAY_NAMES[p+7];x.EE=DAY_NAMES[p];x.H=o;x.HH=LZ(o);if(o==0){x.h=12}else{if(o>12){x.h=o-12}else{x.h=o}}x.hh=LZ(x.h);if(o>11){x.K=o-12}else{x.K=o}x.k=o+1;x.KK=LZ(x.K);x.kk=LZ(x.k);if(o>11){x.a="PM"}else{x.a="AM"}x.m=z;x.mm=LZ(z);x.s=r;x.ss=LZ(r);while(w<F.length){I=F.charAt(w);f="";while((F.charAt(w)==I)&&(w<F.length)){f+=F.charAt(w++)}if(x[f]!=null){n=n+x[f]}else{n=n+f}}return n}function _isInteger(c){var b="1234567890";for(var a=0;a<c.length;a++){if(b.indexOf(c.charAt(a))==-1){return false}}return true}function _getInt(f,d,e,c){for(var a=c;a>=e;a--){var b=f.substring(d,d+a);if(b.length<e){return null}if(_isInteger(b)){return b}}return null}function getDateFromFormat(w,p){w=w+"";p=p+"";var v=0;var l=0;var r="";var f="";var u="";var h,g;var b=new Date();var j=b.getYear();var t=b.getMonth()+1;var s=1;var d=b.getHours();var q=b.getMinutes();var n=b.getSeconds();var k="";while(l<p.length){r=p.charAt(l);f="";while((p.charAt(l)==r)&&(l<p.length)){f+=p.charAt(l++)}if(f=="YYYY"||f=="YY"||f=="y"){if(f=="YYYY"){h=4;g=4}if(f=="YY"){h=2;g=2}if(f=="y"){h=2;g=4}j=_getInt(w,v,h,g);if(j==null){return 0}v+=j.length;if(j.length==2){if(j>70){j=1900+(j-0)}else{j=2000+(j-0)}}}else{if(f=="MMM"||f=="NNN"){t=0;for(var o=0;o<MONTH_NAMES.length;o++){var e=MONTH_NAMES[o];if(w.substring(v,v+e.length).toLowerCase()==e.toLowerCase()){if(f=="MMM"||(f=="NNN"&&o>11)){t=o+1;if(t>12){t-=12}v+=e.length;break}}}if((t<1)||(t>12)){return 0}}else{if(f=="EE"||f=="E"){for(var o=0;o<DAY_NAMES.length;o++){var m=DAY_NAMES[o];if(w.substring(v,v+m.length).toLowerCase()==m.toLowerCase()){v+=m.length;break}}}else{if(f=="MM"||f=="M"){t=_getInt(w,v,f.length,2);if(t==null||(t<1)||(t>12)){return 0}v+=t.length}else{if(f=="DD"||f=="d"){s=_getInt(w,v,f.length,2);if(s==null||(s<1)||(s>31)){return 0}v+=s.length}else{if(f=="hh"||f=="h"){d=_getInt(w,v,f.length,2);if(d==null||(d<1)||(d>12)){return 0}v+=d.length}else{if(f=="HH"||f=="H"){d=_getInt(w,v,f.length,2);if(d==null||(d<0)||(d>23)){return 0}v+=d.length}else{if(f=="KK"||f=="K"){d=_getInt(w,v,f.length,2);if(d==null||(d<0)||(d>11)){return 0}v+=d.length}else{if(f=="kk"||f=="k"){d=_getInt(w,v,f.length,2);if(d==null||(d<1)||(d>24)){return 0}v+=d.length;d--}else{if(f=="mm"||f=="m"){q=_getInt(w,v,f.length,2);if(q==null||(q<0)||(q>59)){return 0}v+=q.length}else{if(f=="ss"||f=="s"){n=_getInt(w,v,f.length,2);if(n==null||(n<0)||(n>59)){return 0}v+=n.length}else{if(f=="a"){if(w.substring(v,v+2).toLowerCase()=="am"){k="AM"}else{if(w.substring(v,v+2).toLowerCase()=="pm"){k="PM"}else{return 0}}v+=2}else{if(w.substring(v,v+f.length)!=f){return 0}else{v+=f.length}}}}}}}}}}}}}}if(v!=w.length){return 0}if(t==2){if(((j%4==0)&&(j%100!=0))||(j%400==0)){if(s>29){return 0}}else{if(s>28){return 0}}}if((t==4)||(t==6)||(t==9)||(t==11)){if(s>30){return 0}}if(d<12&&k=="PM"){d=d-0+12}else{if(d>11&&k=="AM"){d-=12}}var a=new Date(j,t-1,s,d,q,n);return a}function parseDate(h){var f=(arguments.length==2)?arguments[1]:false;generalFormats=new Array("y-M-d","MMM d, y","MMM d,y","y-MMM-d","d-MMM-y","MMM d");monthFirst=new Array("M/d/y","M-d-y","M.d.y","MMM-d","M/d","M-d");dateFirst=new Array("d/M/y","d-M-y","d.M.y","d-MMM","d/M","d-M");var b=new Array("generalFormats",f?"dateFirst":"monthFirst",f?"monthFirst":"dateFirst");var g=null;for(var e=0;e<b.length;e++){var a=window[b[e]];for(var c=0;c<a.length;c++){g=getDateFromFormat(h,a[c]);if(g!=0){return new Date(g)}}}return null}function PopupWindow_getXYPosition(a,c){var b;if(this.type=="WINDOW"){b=getAnchorWindowPosition(a)}else{b=getAnchorPosition(a,c)}this.x=b.x;this.y=b.y}function PopupWindow_setSize(b,a){this.width=b;this.height=a}function PopupWindow_populate(a){this.contents=a;this.populated=false}function PopupWindow_setUrl(a){this.url=a}function PopupWindow_setWindowProperties(a){this.windowProperties=a}function PopupWindow_refresh(){if(this.divName!=null){if(this.use_gebi){document.getElementById(this.divName).innerHTML=this.contents}else{if(this.use_css){document.all[this.divName].innerHTML=this.contents}else{if(this.use_layers){var a=document.layers[this.divName];a.document.open();a.document.writeln(this.contents);a.document.close()}}}}else{if(this.popupWindow!=null&&!this.popupWindow.closed){if(this.url!=""){this.popupWindow.location.href=this.url}else{this.popupWindow.document.open();this.popupWindow.document.writeln(this.contents);this.popupWindow.document.close()}this.popupWindow.focus()}}}function PopupWindow_showPopup(d,g,e,c){if(!e){e=0}if(!c){c=0}document.getElementById(this.divName).style.display="";this.getXYPosition(d,g);var b=getAnchorPosition_ShowInViewport(this.divName,this,this.offsetX,this.offsetY,e,c);var f=b.x;var a=b.y;if(this.divName!=null){document.getElementById(this.divName).style.left=f+"px";document.getElementById(this.divName).style.top=a+"px";document.getElementById(this.divName).style.visibility="visible"}this.balloonActive=true}function PopupWindow_hidePopup(){if(this.divName!=null){this.balloonActive=false;closeBalloon(this.divName)}}function PopupWindow_isClicked(c){if(this.divName!=null){if(this.use_layers){var d=c.pageX;var b=c.pageY;var a=document.layers[this.divName];if((d>a.left)&&(d<a.left+a.clip.width)&&(b>a.top)&&(b<a.top+a.clip.height)){return true}else{return false}}else{if(document.all){var a=window.event.srcElement;while(a.parentElement!=null){if(a.id==this.divName){return true}a=a.parentElement}return false}else{if(this.use_gebi&&c){var a=c.originalTarget;while(a.parentNode!=null){if(a.id==this.divName){return true}a=a.parentNode}return false}}}return false}return false}function PopupWindow_hideIfNotClicked(a){if(this.balloonActive&&this.autoHideEnabled&&!isElementClicked(this.divName,a,200,182,false)){this.hidePopup()}}function PopupWindow_autoHide(){this.autoHideEnabled=true}function PopupWindow_hidePopupWindows(c){for(var a=0;a<popupWindowObjects.length;a++){if(popupWindowObjects[a]!=null){var b=popupWindowObjects[a];b.hideIfNotClicked(c)}}}function PopupWindow_attachListener(){MouseHandler.registerListener("mouseup","PopupWindow_hidePopupWindows")}function PopupWindow(){if(!window.popupWindowIndex){window.popupWindowIndex=0}if(!window.popupWindowObjects){window.popupWindowObjects=new Array()}if(!window.listenerAttached){}this.index=popupWindowIndex++;popupWindowObjects[this.index]=this;this.divName=null;this.popupWindow=null;this.width=220;this.height=0;this.populated=false;this.visible=false;this.autoHideEnabled=false;this.contents="";this.url="";this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";if(arguments.length>0){this.type="DIV";this.divName=arguments[0]}else{this.type="WINDOW"}this.use_gebi=false;this.use_css=false;this.use_layers=false;if(document.getElementById){this.use_gebi=true}else{if(document.all){this.use_css=true}else{if(document.layers){this.use_layers=true}else{this.type="WINDOW"}}}this.offsetX=0;this.offsetY=0;this.balloonActive=false;this.getXYPosition=PopupWindow_getXYPosition;this.populate=PopupWindow_populate;this.setUrl=PopupWindow_setUrl;this.setWindowProperties=PopupWindow_setWindowProperties;this.refresh=PopupWindow_refresh;this.showPopup=PopupWindow_showPopup;this.hidePopup=PopupWindow_hidePopup;this.setSize=PopupWindow_setSize;this.isClicked=PopupWindow_isClicked;this.autoHide=PopupWindow_autoHide;this.hideIfNotClicked=PopupWindow_hideIfNotClicked}if(typeof deconcept=="undefined"){var deconcept=new Object()}if(typeof deconcept.util=="undefined"){deconcept.util=new Object()}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object()}deconcept.SWFObject=function(n,b,o,e,k,l,g,f,d,m){if(!document.getElementById){return}this.DETECT_KEY=m?m:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(n){this.setAttribute("swf",n)}if(b){this.setAttribute("id",b)}if(o){this.setAttribute("width",o)}if(e){this.setAttribute("height",e)}if(k){this.setAttribute("version",new deconcept.PlayerVersion(k.toString().split(".")))}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true}if(l){this.addParam("bgcolor",l)}var a=g?g:"high";this.addParam("quality",a);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var j=(f)?f:window.location;this.setAttribute("xiRedirectUrl",j);this.setAttribute("redirectUrl","");if(d){this.setAttribute("redirectUrl",d)}};deconcept.SWFObject.prototype={useExpressInstall:function(a){this.xiSWFPath=!a?"expressinstall.swf":a;this.setAttribute("useExpressInstall",true)},setAttribute:function(a,b){this.attributes[a]=b},getAttribute:function(a){return this.attributes[a]},addParam:function(b,a){this.params[b]=a},getParams:function(){return this.params},addVariable:function(b,a){this.variables[b]=a},getVariable:function(a){return this.variables[a]},getVariables:function(){return this.variables},getVariablePairs:function(){var c=new Array();var b;var a=this.getVariables();for(b in a){c[c.length]=b+"="+a[b]}return c},getSWFHTML:function(){var b="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath)}b='<embed type="application/x-shockwave-flash" src="'+this.getAttribute("swf")+'" width="'+this.getAttribute("width")+'" height="'+this.getAttribute("height")+'" style="'+this.getAttribute("style")+'"';b+=' id="'+this.getAttribute("id")+'" name="'+this.getAttribute("id")+'" ';var f=this.getParams();for(var e in f){b+=[e]+'="'+f[e]+'" '}var d=this.getVariablePairs().join("&");if(d.length>0){b+='flashvars="'+d+'"'}b+="/>"}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath)}b='<object id="'+this.getAttribute("id")+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getAttribute("width")+'" height="'+this.getAttribute("height")+'" style="'+this.getAttribute("style")+'">';b+='<param name="movie" value="'+this.getAttribute("swf")+'" />';var c=this.getParams();for(var e in c){b+='<param name="'+e+'" value="'+c[e]+'" />'}var a=this.getVariablePairs().join("&");if(a.length>0){b+='<param name="flashvars" value="'+a+'" />'}b+="</object>"}return b},write:function(b){if(this.getAttribute("useExpressInstall")){var a=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(a)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title)}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var c=(typeof b=="string")?document.getElementById(b):b;c.innerHTML=this.getSWFHTML();return true}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"))}}return false}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var f=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var a=navigator.plugins["Shockwave Flash"];if(a&&a.description){f=new deconcept.PlayerVersion(a.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."))}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var b=1;var c=3;while(b){try{c++;b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+c);f=new deconcept.PlayerVersion([c,0,0])}catch(d){b=null}}}else{try{var b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(d){try{var b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");f=new deconcept.PlayerVersion([6,0,21]);b.AllowScriptAccess="always"}catch(d){if(f.major==6){return f}}try{b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(d){}}if(b!=null){f=new deconcept.PlayerVersion(b.GetVariable("$version").split(" ")[1].split(","))}}}return f};deconcept.PlayerVersion=function(a){this.major=a[0]!=null?parseInt(a[0]):0;this.minor=a[1]!=null?parseInt(a[1]):0;this.rev=a[2]!=null?parseInt(a[2]):0};deconcept.PlayerVersion.prototype.versionIsValid=function(a){if(this.major<a.major){return false}if(this.major>a.major){return true}if(this.minor<a.minor){return false}if(this.minor>a.minor){return true}if(this.rev<a.rev){return false}return true};deconcept.util={getRequestParameter:function(c){var d=document.location.search||document.location.hash;if(c==null){return d}if(d){var b=d.substring(1).split("&");for(var a=0;a<b.length;a++){if(b[a].substring(0,b[a].indexOf("="))==c){return b[a].substring((b[a].indexOf("=")+1))}}}return""}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var b=document.getElementsByTagName("OBJECT");for(var c=b.length-1;c>=0;c--){b[c].style.display="none";for(var a in b[c]){if(typeof b[c][a]=="function"){b[c][a]=function(){}}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs)};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true}}if(!document.getElementById&&document.all){document.getElementById=function(a){return document.all[a]}}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;