jQuery(document).ready(function(){mathHelpInit()});function mathHelpInit(){for(var c in episodes){var b="";if(episodes[c]["data-type"]=="IMG"){b='<div class=""> <img src="'+episodes[c]["img-url"]+'"/> </div>'}else{b='<div class="tooltipTopic"> '+episodes[c]["text"]+"</div>"}setTooltip(c,b)}showMathHelpTab(ACTIVE_TAB);jQuery("#log_reg_font2").addClass("episode_view_style2");jQuery("#log_reg_font3").addClass("episode_view_style");jQuery("#log_reg_font4").addClass("episode_view_style2");jQuery("#math_help_content_id").fadeIn(400,function(){if(jQuery(".math_help_description_text").height()>0){jQuery("#math_help_content_id").removeClass("align_breadcrumb")}jQuery("#math_help_content_id").removeClass("display_none")});var d=document.getElementById("episodeOrder").value;jQuery("#mycarousel").jcarousel({vertical:true,scroll:1,start:(d<=2)?1:d,initCallback:mycarousel_initCallback});var a=new Array("one","two","three","four","five");for(var c in a){$j("#rate-container #"+a[c]).bind("mouseover",addStar);$j("#rate-container #"+a[c]).bind("mouseout",removeStar);$j("#rate-container #"+a[c]).bind("click",{vote:parseInt(c)+1,uri:TOPIC_URI},rate)}}function onPlayerLoaded(){var a=$j("#userId").val();if(a==0){}}function resumePlayer(){resumeVideo();setEnabledVideo(true)}function pausePlayer(){pauseVideo();setEnabledVideo(false)}function testPlaylist(){continuosPlay=true;alert("Test Playlist - continuosPlay: "+(continuosPlay))}function playPlaylist1(){var a=$j("#userId").val();if(typeof playlist!="undefined"&&continuosPlay==true&&(playlist_index+1)<playlist_max_index){playlist_index=playlist_index+1;if(typeof playlist[playlist_index]!="undefined"){loadVideo(playlist[playlist_index]);if(modVP){modVP.play()}setBrowserTitle(playlist[playlist_index])}}}function playPlaylist(){var a=$j("#userId").val();if(typeof playlist!="undefined"&&continuosPlay==true&&(playlist_index+1)<playlist_max_index){playlist_index=playlist_index+1;if(typeof playlist[playlist_index]!="undefined"){playVideo(playlist[playlist_index]["partner_video_id"],playlist[playlist_index]["episode_id"],playlist[playlist_index]["name"],playlist[playlist_index]["askForTranscript"]);if(playlist_index>=playlist_max_visible){nextEpisodeCarouselFn()}}}}function selectEpisode(b,c){var a="ep-"+c;var d="ep-"+current_epId;if(document.getElementById(d)){$j("#"+d).removeClass("episode-playing");$j("#"+d).addClass("episode")}$j("#"+a).removeClass("episode");$j("#"+a).addClass("episode-playing");current_epId=c;current_videoId=b}function disablePlaylist(){continuosPlay=false}function playVideo(c,e,b,a){if(c!=null){loadVideo(c);selectEpisode(c,e);setBrowserTitle(b);loadConceptProblem(e);var d=$j("#episode-description-title-"+e).val();loadQuestions(e);if(a==1){$j("#transcript_content").html("");$j("#transcriptTab").fadeIn("slow",function(){showMathHelpTab(TRANSCRIPT_TAB);showMathHelpTab(TRANSCRIPT_TAB);loadTranscriptTab(TRANS_TYPE,e)})}else{showMathHelpTab(ANSWER_CHECKER_TAB);$j("#transcriptTab").hide();$j("#transcript_content").html("")}if(typeof(update_more_info)=="function"){update_more_info(e)}trackAction()}}function setBrowserTitle(b){var a=document.getElementById("usePersonalizedTitle");if(a!=null&&a.value==0){document.title=$j("#topicName").val()+" - "+b+" - "+$j("#subjectName").val()+" - Brightstorm"}$j("#currentLinkLabel").html(b)}function showHideInfo(){var a=$j("#moreInfo").html();if(a=="(more info)"){$j("#moreInfo").html("(less info)");$j("#collapseDescription").show()}else{$j("#moreInfo").html("(more info)");$j("#collapseDescription").hide()}}function loadConceptProblem(a){var b="/math-help/ajax/ajax-action/get-problem-concept";var c={episodeId:a};goAjax(b,c,afterLoadConceptProblem)}function afterLoadConceptProblem(jsonedResponse){var response=eval("("+jsonedResponse+")");var title=response.title;var text=response.text;var img_name=response.img_name;var description=response.description;var keywords=response.keywords;var img_src=IMAGE_SERVER_URL+img_name;if(typeof title=="undefined"){$j("#title").html("");$j("#title").hide()}else{$j("#title").html(title);$j("#title").show()}if(typeof img_name!="undefined"&&(img_name!="")){$j("#episode_text").hide();$j("#episode_image").attr("src",img_src);$j("#episode_image").show()}else{if(typeof text!="undefined"){$j("#episode_image").hide();$j("#episode_text").html(text);$j("#episode_text").show()}else{$j("#episode_image").hide();$j("#episode_text").hide()}}if(typeof description=="undefined"){$j("#description").html("")}else{$j("#description").html(description)}if(typeof keywords=="undefined"){$j("#keywords").html("")}else{$j("#keywords").html("Tags: "+keywords)}}function setTooltip(b,a){$j("#ep-"+b).tooltip({delay:0,showURL:false,opacity:1,fade:250,bodyHandler:function(){clearTooltip();return a}})}function mycarousel_initCallback(a){nextEpisodeCarouselFn=function(){a.next()}}function showMathHelpTab(a){showTab(a,MATH_EPISODE_TAB_ID);ACTIVE_TAB=a;if(ACTIVE_TAB==ANSWER_CHECKER_TAB){$j("#"+TAB_PREFIX+MATH_EPISODE_TAB_ID+ACTIVE_TAB).attr("class","answer selected2")}if(typeof closeRTEPopups=="function"){closeRTEPopups()}trackAction()}function rate(a){if(typeof a.data.vote!="undefined"){$j("#rate-big-container").fadeOut("slow",function(){$j("#rate-msg-container").fadeIn()});goAjax("/math-help/ajax/ajax-action/rate",a.data,afterRate)}}function afterRate(a){}function removeStar(){$j("#rate-container").attr("class","")}function addStar(a){if(typeof a.target.id!="undefined"){$j("#rate-container").attr("class",a.target.id)}}function refreshMathway(a){$j("#mathway_content").html(a)}function loginCallback(){goAjax("/math-help/refresh-mathway/calledFrom/math","",refreshMathway);if(!showUpEmail){$j("input[name=emailMe-container]").attr("checked",false);$j("#emailMe-container").css({display:"none"})}if(typeof updatePasteHandler=="function"){updatePasteHandler()}}function clearTooltip(){try{$j("#tooltip").attr("className","")}catch(a){}}function trackAction(a){var b=$j("#currentLinkLabel").text();b=trim(b);b=b.replace(" ","-");var c="concept";switch(ACTIVE_TAB){case QUESTIONS_TAB:c="questions";break;case ANSWER_CHECKER_TAB:c="answer-checker";break;default:break}gaTrackingMathHelp(ONLY_TOPIC_URI,b,c,a)}var loadTranscriptFlag=1;function loadTranscriptTab(d,a){$j("#transcript_content").html($j("#load_questions_msg").html());loadTranscriptFlag=0;var b="/math-help/gettranscripttab";var c={transType:d,episodeId:a};goAjax(b,c,afterLoadTranscriptTab)}function afterLoadTranscriptTab(a){$j("#transcript_content").html(a)};
