var BUILD_VERSION_TIMESTAMP="${BUILD_VERSION_TIMESTAMP}";var ENV="prod";var IMAGE_SERVER="static-1.livemocha.com";var IS_IMAGE_SERVER_LOCALHOST="false";var IMAGE_SERVER_ALIAS_COUNT=3;var S3_DEFAULT_BUCKET="static.livemocha.com";function os(){var A=navigator.platform.toLowerCase();if(A.indexOf("win")!=-1){return"win"}else{if(A.indexOf("mac")!=-1){return"mac"}else{if(A.indexOf("unix")!=-1){return"unix"}else{if(A.indexOf("linux")!=-1){return"linux"}else{return A}}}}}var OPERATING_SYSTEM=os();function IsIE(){return(navigator.appName=="Microsoft Internet Explorer")}function versionFile(A){return(A)}function getUrlHashByte(B){var A=B.length;var D=0;for(var C=0;C<A;C++){D^=B.charCodeAt(C)}return D}function imgSrc(C,A){var E=getVersionFile(C);if(typeof A=="undefined"){A=true}if(C.substring(0,3)=="s3/"||C.substring(0,21)=="default-profile-image"){if(ENV=="prod"||ENV=="stage"){var H=Math.floor(Math.random()*3+1);E=window.location.protocol+"//ptr"+H+"."+ENV+".cf.livemocha.com/"+C}else{E=window.location.protocol+"//stage.static.livemocha.com.s3.amazonaws.com/"+C}}else{var D=(C.substring(0,4)=="/img"||C.substring(0,4)=="/css"||C.substring(0,3)=="/js");if(D&&window.location.protocol=="http"&&(ENV=="prod"||ENV=="stage")){var F=Math.floor(Math.random()*2+1);E=window.location.protocol+"//ptr"+F+"."+ENV+".cf.livemocha.com/"+BUILD_SVN_REVISION+C}else{if(IMAGE_SERVER&&C.substring(0,7)!="http://"){var B=getUrlHashByte(C);var G;if(!IS_IMAGE_SERVER_LOCALHOST&&IMAGE_SERVER_ALIAS_COUNT>0){G="ptr"+(B%IMAGE_SERVER_ALIAS_COUNT)+"."+IMAGE_SERVER}else{if(IS_IMAGE_SERVER_LOCALHOST){G=window.location.host}else{G=IMAGE_SERVER}}E=window.location.protocol+"//"+G+C}}}return(A)?('"'+E+'"'):E}function is_cookies_on(A){if(navigator.cookieEnabled==0){error_div=$("error-block").rows[0].cells[0];error_div.innerHTML=A;$("error-block").setStyle({backgroundColor:"#FF0000"});return false}return true}function trim(A){return A.replace(/^\s+|\s+$/g,"")}function toggle_div(B,A){Element.toggle(B);$(A).src=($(A).src.match("/img/expand.gif"))?"/img/collapse.gif":"/img/expand.gif"}function up_launchChat(A){window.open("/userplane/wc_frames?initialRoom="+A,"UserplaneChatWindow","width=728,height=545,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=1")}function populateScenario(div_id,id){var scenario_picker=document.getElementById("scenario_picker");var scenarioID=id||scenario_picker.value;var url="/exercises/get_scenario_content/"+scenarioID;var request=new Ajax.Request(url,{method:"get",onSuccess:function(transport){var response=transport.responseText;var exerciseDatum=eval("("+response+")");var statements=eval("("+exerciseDatum.ExerciseDatum.content+")");var div=document.getElementById(div_id);for(var i=div.childNodes.length-1;i>=0;i--){div.removeChild(div.childNodes[i])}for(var i=0;i<statements.length;i++){var statement=statements[i];var name=statement["name"];var text=statement["text"];var row=document.createElement("tr");var nameCell=document.createElement("td");var nameTextNode=document.createTextNode(name+": ");var textCell=document.createElement("td");var textTextNode=document.createTextNode(text);nameCell.className="name";textCell.className="text";textCell.appendChild(textTextNode);nameCell.appendChild(nameTextNode);row.appendChild(nameCell);row.appendChild(textCell);div.appendChild(row)}},onFailure:function(){alert("something went wrong...")}})}function showId(A){if(document.getElementById(A)){document.getElementById(A).style.display="inline"}}function hideId(A){if(document.getElementById(A)){document.getElementById(A).style.display="none"}}function add_lang(A,E,C){var D,B;for(D=0;D<C;D++){cur_div=(E+D);if(document.getElementById(cur_div).style.display=="none"){document.getElementById(cur_div).style.display="inline";for(B=D+1;B<C;B++){if(document.getElementById(E+B).style.display=="none"){return }}document.getElementById(A).style.display="none";return }}alert("num_langs: "+C)}function resetSelect(A){var B=A.options;B[0].selected=true}function remove_lang(C,E,B,D,G,F,A){hideId(E+A);resetSelect(document.getElementById(B+A));resetSelect(document.getElementById(D+A));if(document.getElementById(C).style.display=="none"){document.getElementById(C).style.display="inline"}}function limit_text(B,A){if($(B).value.length>A){$(B).value=$(B).value.substring(0,A)}}function selectRating(E,A,C){if(C==0){$(E+"_ratingImage_0").src=imgSrc("/img/no_star_1.gif",false)}else{$(E+"_ratingImage_0").src=imgSrc("/img/no_star_0.gif",false)}for(var B=1;B<=5;B++){var D=document.getElementById(E+"_ratingImage_"+B);if(B<=C){D.src=imgSrc("/img/star_1.gif",false)}else{D.src=imgSrc("/img/star_0.gif",false)}}}function renderRating(D,A){myrating=$(A).value;$(D+"_ratingImage_0").src=imgSrc("/img/no_star_0.gif",false);for(var B=1;B<=5;B++){var C=document.getElementById(D+"_ratingImage_"+B);if(B<=myrating){C.src=imgSrc("/img/star_1.gif",false)}else{C.src=imgSrc("/img/star_0.gif",false)}}}function submitRating(A,E,D,B){$(A).value=B;var C=new Ajax.Request(E,{method:"post",parameters:{rating:(B/5)},onSuccess:function(G){var F=G.responseText;$(D).innerHTML=F}})}function render_category_rating(B,D){var C=document.getElementById(D+"0");if(B=="0"){C.src=imgSrc("/img/no_star_1.gif",false)}else{C.src=imgSrc("/img/no_star_0.gif",false)}for(var A=1;A<=5;A++){C=document.getElementById(D+A);if(A<=B){C.src=imgSrc("/img/star_1.gif",false)}else{C.src=imgSrc("/img/star_0.gif",false)}}}function render_category_rating_value(A,C){var B=document.getElementById(A).value;render_category_rating(B,C)}function set_category_rating(B,A){document.getElementById(A).value=B}function dotdotdothelper(B,C,D){var A=C;for(i=0;i<D;i++){A+="."}document.getElementById(B).innerHTML=A;if(D>=3){run="dotdotdothelper('"+B+"', '"+C+"', 1)"}else{D++;run="dotdotdothelper('"+B+"', '"+C+"', "+D+")"}if(dotdotdotrunning){setTimeout(run,333)}else{document.getElementById(B).innerHTML=""}}var dotdotdotrunning;function dotdotdot(A,B){dotdotdotrunning=true;dotdotdothelper(A,B,1)}function stopdotdotdot(){dotdotdotrunning=false}function show_terms_conditions(){document.getElementById("cover_sheet").style.display="block";document.getElementById("termsandconditions").style.display="block"}function hide_terms_conditions(){document.getElementById("cover_sheet").style.display="none";document.getElementById("termsandconditions").style.display="none"}function add_profile_preview_listener(A,B,C){enable_profile_tooltip(A,"profile_link_"+B,C)}function enable_profile_tooltip(B,A,C){if(IsIE()){Event.observe(A,"mouseover",function(F){var E=Event.element(F);Event.stopObserving(A,"mouseover",arguments.callee,false);init_profile_prototip(B,A,C);var D=document.createEventObject();E.fireEvent("onmouseover",D)},false)}else{init_profile_prototip(B,A,C)}}function init_profile_prototip(B,A,D){var C="/profiles/preview/"+B+"/"+A;if(D){C+="/"+D}new Tip(A,{ajax:{url:C},hideAfter:0.5,hideOn:false,style:"profile-preview"})}function add_friend(B,A,E,D){var C=new Ajax.Request("/buddies/connect/"+A,{asynchronous:true,evalScripts:true,onLoading:function(F){document.getElementById("message_"+B).innerHTML=E},onComplete:function(G,F){document.getElementById("message_"+B).innerHTML=D},onFailure:function(){alert("Fail to add friend...")}})}function remove_friend(B,A,F,E,C){if(!confirm(C)){return false}var D=new Ajax.Request("/buddies/remove/"+A,{asynchronous:true,evalScripts:true,onLoading:function(G){document.getElementById("message_"+B).innerHTML=F},onComplete:function(H,G){document.getElementById("message_"+B).innerHTML=E},onFailure:function(){alert("Fail to add friend...")}})}function is_numeric(A){return(String(A).search(/^\d+$/)!=-1)}function is_url(A){return(String(A).search(/^(http|https|ftp):\/\/[a-z0-9\/:_\-_\.\?\$,;~=#&%\+]/i)!=-1)}function is_email(A){return A.match(/(^([a-z0-9][a-z0-9_\-\.\+]*)@([a-z0-9][a-z0-9\.\-]{0,63}\.(com|org|net|biz|info|name|net|pro|aero|coop|museum|[a-z]{2,4}))$)/i)}function openExerciseHelper(A){if(document.getElementById(A).value==true){showId(A)}else{return }}function openExercise(A){document.getElementById(A).value=true;setTimeout('openExerciseHelper("'+A+'")',500)}function closeExercise(A){document.getElementById(A).value=false;if(document.getElementById(A).style.display!="none"){hideId(A);setTimeout("closeExercise('"+A+"');",100)}}function findContainingElement(B,A){while(!(B.nodeType==1&&B.tagName==A)){B=B.parentNode}return B}function ajaxReplaceElement(B,A){new Ajax.Updater(B,A,{asynchronous:true,method:"get",evalScripts:true,requestHeaders:["X-Update","middle-column"]})}var funcs=[];function runOnLoad(B,D,C){var A=new Object();A.func=B;A.params=D;if(C!=null&&C){funcs.unshift(A)}else{funcs.push(A)}}var onLoadRunner=function(){while(funcs.length>0){var A=funcs.shift();try{A.func(A.params)}catch(B){}}};if(window.addEventListener){window.addEventListener("load",onLoadRunner,false)}else{if(window.attachEvent){window.attachEvent("onload",onLoadRunner)}else{window.onLoad=onLoadRunner}}var unload_funcs=[];function runOnUnload(A){unload_funcs.push(A)}var onUnloadRunner=function(){while(unload_funcs.length>0){f=unload_funcs.shift();try{f()}catch(A){}}};if(window.addEventListener){window.addEventListener("unload",onUnloadRunner,false)}else{if(window.attachEvent){window.attachEvent("onunload",onUnloadRunner)}else{window.onunload=onUnloadRunner}}function set_feedback_property(A,B){if(this.feedbackProperties==null){this.feedbackProperties=new Object()}this.feedbackProperties[A]=B}function serialize_feedback_properties(){if(this.feedbackProperties==null){this.feedbackProperties=new Object()}var A="";for(key in this.feedbackProperties){A+=key+": "+this.feedbackProperties[key]+";\n"}return A}function getBrowserInfo(){var B=navigator.appName;var D=navigator.appCodeName;var A=navigator.platform;var E=screen.width+" x "+screen.height;var F="unknown";if(navigator.language){F=navigator.language}else{if(navigator.userLanguage){F=navigator.userLanguage}}if(AC_FL_RunContent==0||DetectFlashVer==0){alert("This page requires AC_RunActiveContent.js.")}var C=GetSwfVer();return"browser: "+B+" "+D+", os: "+A+", screen: "+E+", language: "+F+", flash: "+C}function submit_feedback(A){$feedbackProperties=serialize_feedback_properties();$feedbackProperties+="\n"+getBrowserInfo();new Ajax.Request("/site_feedbacks/submit_feedback",{method:"post",parameters:{url:location.href,properties:$feedbackProperties},asynchronous:true,onComplete:function(C,B){if(A){A()}}})}function lmTrace(B,A){if(IsIE()){return }switch(B){case"info":console.info(A);break;case"warn":console.warn(A);break;case"debug":console.debug(A);break;default:console.info(A)}}function open_abuse_report_form(A,E,C,D){var B="/abuse_reports/message_form/"+A+"/"+E+"/"+C;Modalbox.show(B,{title:D,overlayClose:false,width:520,afterLoad:function(){}})}function validate_message_box_core(A,D,B,E){if(D>B){var C=document.getElementById("max_length_message");A.innerHTML=C.value+D+"/"+B;return false}else{if(E!=undefined&&!E&&D==0){var C=document.getElementById("empty_message");A.innerHTML=C.value;return false}else{A.innerHTML="";return true}}}function validate_message_box(D,C,E){var B=document.getElementById(D);var A=document.getElementById("msg_length_"+D);return validate_message_box_core(A,B.value.length,C,E)}function find_by_id_globally(B){var A=function(C,H){try{var E=C.$(H);if(E){return E}}catch(G){return null}for(var D=0;D<C.frames.length;D++){var F=C.frames[D];E=A(F,H);if(E){return E}}return null};return A(top,B)}function listMemberSubmissions(searchBy,id,excludeSubmissionId,spanSize,limit){var limitStr="";if(typeof (limit)!="undefined"){limitStr="/limit:"+limit}var url="/submissions/list_member_submissions/search_by:"+searchBy+"/id:"+id+"/exclude_submission_id:"+excludeSubmissionId+"/span_size:"+spanSize+limitStr;new Ajax.Request(url,{method:"get",evalScripts:true,onSuccess:function(transport){var text=transport.responseText;document.getElementById("member_submissions").innerHTML=text;text.extractScripts().map(function(script){return eval(script.replace("<!--","").replace("// -->",""))}.bind(window))},onFailure:function(transport){document.getElementById("member_submissions").innerHTML=""}})}function listSimilarExercises(F,E,B,D,A){var C="/exercises/list_similar_exercises/lang_code:"+F+"/type:"+E+"/exclude_id_type:"+B+"/exclude_id:"+D;if(A!=undefined&&A!=null){C+="/span_size:"+A}new Ajax.Request(C,{method:"get",evalScripts:true,onSuccess:function(H){var G=H.responseText;document.getElementById("similar_exercises").innerHTML=G},onFailure:function(G){document.getElementById("similar_exercises").innerHTML=""}})}function flashResize(A,C,B){var D=document.getElementById(A);D.style.height=B+"px";D.style.marginTop=(C-B)+"px"}function render_top_commenter_img(A){runOnLoad(function(){var C=$("top_commenter_img_"+A);var B=$("profile_img_"+A);if(C){C.clonePosition(B);C.style.display="block";C.style.left=(C.offsetLeft+(B.offsetWidth-16-7))+"px";C.style.top=C.offsetTop+7+"px";C.style.height="16px";C.style.width="16px"}})}function show_popup_div(A){if(IsIE()&&$("status1012")){$("status1012").style.display="none"}$(A).style.display="block"}function hide_popup_div(A){if(IsIE()&&$("status1012")){$("status1012").style.display="block"}$(A).style.display="none"}var online_buddies_ready=function(A){if(A.responseText.length<20){return }$("online-buddies").innerHTML=A.responseText;show_popup_div("online-buddies",0)};function get_online_friends(A){disp=$("online-buddies").style.display;if(disp==""||disp=="none"){new Ajax.Request("/buddies/online_buddies/"+A,{onSuccess:online_buddies_ready})}}window.get_width=function(){if(document.documentElement&&document.documentElement.clientWidth){return document.documentElement.clientWidth}if(document.body&&document.body.clientWidth){return document.body.clientWidth}return window.innerWidth};window.get_height=function(){if(document.documentElement&&document.documentElement.clientHeight){return document.documentElement.clientHeight}if(document.body&&document.body.clientHeight){return document.body.clientHeight}return window.innerHeight};var WMEventStream={report_event:function(E,D,A,C){if(!D){return }if(!A){return }if(!C){C=""}var B="/webmessenger_event_stream/report_event/event_name:"+E+"/cur_user_id:"+D+"/other_user_id:"+A+"/note:"+C;new Ajax.Request(B,{onSuccess:function(F){},onFailure:function(){}})}};function reset_image(){new Ajax.Updater("user_image","/profiles/reset_image")}function reportCompletedExerciseCommon(E,C,B){var A;if(E){A="/lessonPlan/reportCompletedExercisePractice/"}else{A="/lessonPlan/reportCompletedExercise/"}var G=new Array();for(var D in C){if((typeof C[D])!="function"||D=="url"||D=="exerciseDatumId"||D=="exerciseId"){G[D]=C[D]}}G["url"]=location.href;if($("submit_button")!=undefined&&$("submit_button")!=null){$("submit_button").onclick=null}var F=new Ajax.Request(A,{method:"post",parameters:G,onSuccess:function(H){B(H.responseText)},onFailure:function(){alert(errorMessage)}})}var IMSession=function(){var A=function(E,F){for(var C in F){var D=F[C];if(!D){return }}var B="/i_m_sessions/"+E+"/";for(var C in F){var D=F[C];B+=C+":"+D+"/"}new Ajax.Request(B,{onSuccess:function(G){},onFailure:function(){}})};return{notified:function(C,B){A("notified",{notified_user_id:C,other_user_id:B})},clicked_yes:function(C,B){A("clicked_yes",{clicking_user_id:C,other_user_id:B})},clicked_no:function(C,B){A("clicked_no",{clicking_user_id:C,other_user_id:B})},closed_window:function(C,B){A("closed_window",{closing_user_id:C,other_user_id:B})}}}();function append_request_parameter(A,B,C){if(A.indexOf("?")==-1){A+="?"}else{A+="&"}return A+B+"="+C}function flashGetMovie(A){return(window[A]?window[A]:document[A])}function flashCleanupByObject(B){B.style.display="none";for(var A in B){if(typeof B[A]=="function"){B[A]=function(){}}}B.removeNode(true)}function flashCleanupByName(B){var A=flashGetMovie(B);flashCleanupByObject(A)}function displayPremiumCourseAdvertisement(C,D){var B="premium-course-advertisement";if($(B)){var A="/premium_courses/advertisement/"+C+"/"+D;new Ajax.Updater(B,A)}}function displayTravelCrashCourseAdvertisement(C){var B="travel-crash-course-advertisement";if($(B)){var A="/travel_crash_courses/advertisement/"+C;new Ajax.Updater(B,A)}}function addClass(A,B){if(!A.className){A.className=B}else{newClassName=A.className;newClassName+=" ";newClassName+=B;A.className=newClassName}}function removeClass(A,B){if(!A.className){return }else{A.className=A.className.replace(" "+B,"");A.className=A.className.replace(B+" ","");A.className=A.className.replace(B,"")}}function getQueryParam(E){var D=unescape(E);var B=new RegExp("[?&]"+D+"(?:=([^&]*))?","i");var A=B.exec(window.location.search);var C=null;if(A!=null){C=decodeURI(A[1])}return C}function setCookie(B,C,A){var D=new Date();D.setDate(D.getDate()+A);document.cookie=B+"="+escape(C)+((A==null)?"":";expires="+D.toGMTString())}function getVersionArray(){return new Object()}function getVersionFile(A){var B=getVersionArray();if(A!=null){if(B.hasOwnProperty(A)){return B[A]}else{return A}}}var pageTracker;function getGATracker(C,B){try{pageTracker=B._getTracker(C)}catch(A){}}function gaTrackPageview(A){if(A){try{pageTracker._trackPageview(A)}catch(B){}}else{try{pageTracker._trackPageview()}catch(B){}}}function gaTrackEvent(C,E,A,D){if(!A){try{pageTracker._trackEvent(C,E)}catch(B){}}else{if(!D){try{pageTracker._trackEvent(C,E,A)}catch(B){}}else{try{pageTracker._trackEvent(C,E,A,D)}catch(B){}}}}function gaSetVar(B){try{pageTracker._setVar(B)}catch(A){}}function gaTrackTrans(B,L,M,G,A,J,C,E,F,N,D,K,I){try{pageTracker._addTrans(B,L,M,G,A,J,C,E);pageTracker._addItem(B,F,N,D,K,I);pageTracker._trackTrans()}catch(H){}}function client_bench_marker(A,B){this.profiler_times=new Array();this.profiler_keys=new Array();this.profiler_array_size=0;this.benchmark_name=A;this.request_id=B;this.start_time=start_time;this.mark_time=mark_time;this.stop_time=stop_time;this.send_marks=send_marks;this.print_in_browser=print_in_browser;this.microtime=microtime}function start_time(){this.profiler_keys[this.profiler_array_size]=this.benchmark_name+"_client_start";this.profiler_times[this.profiler_array_size]=this.microtime();this.profiler_array_size++}function mark_time(A){this.profiler_keys[this.profiler_array_size]=this.benchmark_name+"_client_"+A;this.profiler_times[this.profiler_array_size]=this.microtime();this.profiler_array_size++}function stop_time(){this.profiler_keys[this.profiler_array_size]=this.benchmark_name+"_client_stop";this.profiler_times[this.profiler_array_size]=this.microtime();this.profiler_array_size++}function send_marks(A,B){if(A){this.mark_time("page_loaded")}if(this.profiler_keys.length>0){$("request_id").value=this.request_id;$("benchmark_name").value=this.benchmark_name;$("BenchMarkingKeys").value=Object.toJSON(this.profiler_keys);$("BenchMarkingTimeStamps").value=Object.toJSON(this.profiler_times);var C="/BenchMarking/process_timestamps";var D=Form.serialize(document.BenchMarkingForm);new Ajax.Request(C,{method:"post",parameters:D})}if(B){this.print_in_browser()}}function print_in_browser(){if(this.profiler_keys.length>0){var G=this.profiler_times[0].split(" ");var D=parseFloat(G[0])+parseFloat(G[1]);document.write("<b>"+this.profiler_keys[0]+": at ("+this.profiler_times[0]+")</b> "+0+"<br />");var E=D;var F=0;for(var A=1;A<this.profiler_array_size;A++){var C=this.profiler_times[A].split(" ");F=parseFloat(C[0])+parseFloat(C[1]);var B=F-E;document.write("<b>"+this.profiler_keys[A]+": at ("+this.profiler_times[A]+")</b> "+B+"<br />");E=F}B=F-D;document.write("<b>Overall time:</b> "+B+"<br />")}}function microtime(B){var A=new Date().getTime()/1000;var C=parseInt(A,10);return(B)?A:(Math.round((A-C)*1000)/1000)+" "+C}