var urlAddress="http://www.chineseteachers.com/";var pageName="ChineseTeachers.com";var whocall=function(){};var sendpara;var balanceTimer;setTimeout("refreshBalance()",10000);var incalling=false;var bookmarklist;var timerforRefresh;var menuoptions={minWidth:50};var menuitems=[{src:"中文",url:"/Teach-Mandarin-Chinese"},{src:"English",url:"/"},{src:"日本語",url:"/learn-Mandarin-Chinese-with-native-Chinese-teachers-in-Japan"},{src:"한글",url:"/learn-Mandarin-Chinese-with-native-Chinese-teachers-in-Korea"},{src:"Bahasa Melayu",url:"/Belajar-Bahasa-Cina-dengan-guru-guru-cina-tempatan-melalui-internet"},{src:"Deutsch",url:"/Lerne-Mandarin-chinesisch-mit-gebuertigen-chinesischen-Lehrern"},{src:"Ελληνικά",url:"/Mathete-Mandarin-Kinezika-me-empeirous-Kinezous-Kathigites"},{src:"Español",url:"/aprende-chino-mandarin-con-profesores-de-chino-nativos"},{src:"Français",url:"/Apprendre-le-Chinois-avec-de-vrais-professeurs-de-Chinois"},{src:"Italiano",url:"/imparare-cinese-mandarino-con-madrelingua-cinesi"},{src:"Svenska",url:"/Lar-Dig-mandarin-med-kinesiska-larare-i-Sverige"},{src:"Others",url:"/learn-chinese-from-which-language.jsp"}];var settings={number:10,degree:5,blankImg:"/jsp/images/start_9.jpg",leftImg:"/jsp/images/start_5.jpg",unleftImg:"/jsp/images/start_8.jpg",rightImg:"/jsp/images/start_7.jpg",unrightImg:"/jsp/images/start_6.jpg",action:true};function createBar(a){$(a).each(function(){var b="";var d=$(this).text().trim();var e="Teacher's score is "+$(this).attr("title").trim()+". This is the average score given by students after the lessons for this teacher.";for(var c=0;c<settings.number;c++){if(c%2==0){if(c>=d){b+='<img src="'+settings.unleftImg+'" width="7" title="'+e+'" />'}else{b+='<img src="'+settings.leftImg+'" width="7"  title="'+e+'"/>'}}else{if(c>=d){b+='<img src="'+settings.unrightImg+'" width="7"  title="'+e+'"/>'}else{b+='<img src="'+settings.rightImg+'" width="7"  title="'+e+'"/>'}}}$(this).html(b).show()})}function contactTeacher(a){$.get("/jsp/student/contact/session.jsp",{pid:a},function(){location.href="/jsp/student/contact/toteacher.jsp"})}function refreshBalance(){clearTimeout(balanceTimer);$.get("/jsp/engcurrentbalance.jsp",function(a){$("#currentbalance").html(a.trim());tb_init("#currentbalance a.thickbox");balanceTimer=setTimeout("refreshBalance()",17000)})}function addbookmarkWithRefresh(a,b){showload();$.get("/bookmarkhandler.do",{method:"add",sid:a,tid:b},function(c){var d=JSON.parse(c);if(d.results!="nothing"){$.jGrowl(d.results)}whocall(true);finishload()})}function removebookmarkWithRefresh(a,b){showload();$.get("/bookmarkhandler.do",{method:"remove",sid:a,tid:b},function(c){var d=JSON.parse(c);if(d.results!="nothing"){$.jGrowl(d.results)}clearTimeout(timerforRefresh);refreshTeacher();finishload()})}function call(a,b){if(!incalling){incalling=true;$.get("/jsp/student/search/checkmoney.jsp",{tid:b},function(c){if(c.trim()==""){opencallpage(a,b)}else{whocall(true);$.jGrowl(c.trim());incalling=false}})}}function opencallpage(a,b){$.get("/jsp/flash/flashcreate.jsp",{tid:b,sid:a},function(c){$("#bbs").attr("href","/jsp/flash/Client3b.jsp?suitid="+c.trim()+"&amp;KeepThis=true&amp;TB_iframe=true&amp;height=520&amp;width=700&amp;modal=true");$("#bbs").click();clearTimeout(timerforRefresh)})}function loginbeforeResult(a){whocall=loginbeforeResult;showload();if(!a){sendpara=$("#fmy").formSerialize()}$.post("/jsp/student/search/resultdata.jsp",sendpara,function(b){$.post("/jsp/student/search/loginBefore/loginbeforedata.jsp",sendpara,function(c){$("#column-right").html(b);$("#resultTeacher").html(c);$("a.tip").cluetip({activation:"click"});finishload()})})}function callResult(a){clearTimeout(timerforRefresh);showload();whocall=callResult;if(!a){sendpara=$("#f").formSerialize()}$.post("/jsp/student/search/resultdata.jsp",sendpara,function(b){$.post("/jsp/student/search/loginAfter/teacherdata_search.jsp",sendpara,function(c){$("#column-right").html(b);$("#resultTeacher").html(c);$("a.tip").cluetip({activation:"click"});finishload()})})}function callLucky(){$.get("/jsp/checkSession.jsp",{type:"student"},function(a){if(a.trim()=="alive"){$.get("/jsp/student/search/checkmoney.jsp",{luckycall:1},function(c){if(c.trim()==""){whocall=function(){};var b=$("#f").formSerialize();$.post("/jsp/student/search/getLuck/getluckteacherdata.jsp?getluck=true",sendpara,function(d){$("#hidediv").html(d);if(getluckyNothing()){$.post("/jsp/student/search/resultdata.jsp?getluck=true",sendpara,function(e){$("#column-right").html(e);$("#resultTeacher").html(d);$("a.tip").cluetip({activation:"click"})})}else{golucky()}})}else{$.jGrowl(c.trim())}})}else{if(a.trim()=="lost"){location.reload()}else{alert(a.trim())}}})}var timesecs=59;function updateSecs(){timesecs--;$("#rsec").text(timesecs+"s")}function updateTeacherInfo(){clearTimeout(timerforUpdatingTeacher);var a=document.title;$.get("/jsp/student/availableTeacher.jsp",function(b){var c=b.trim();if(c==0){$("#tinfo").hide()}else{if(c<10){$("#tinfo").show();$("#tinfo").attr("src","/jsp/images/i/"+c+".gif")}else{$("#tinfo").show();$("#tinfo").attr("src","/jsp/images/i/Over_9.gif")}}if(c==0){if(a.charAt(0)=="("){a=a.substring(a.indexOf(")")+1,a.length);document.title=a}}else{if(a.charAt(0)=="("){a=a.substring(a.indexOf(")")+1,a.length)}document.title="("+c+") "+a}timerforUpdatingTeacher=setTimeout("updateTeacherInfo()",59000)})}var timerforUpdatingTeacher;$(function(){updateTeacherInfo()});function refreshTeacher(){clearTimeout(timerforRefresh);timesecs=59;updateTeacherInfo();$("body").everyTime("1s",updateSecs);whocall(true);timerforRefresh=setTimeout("refreshTeacher()",59000)};