﻿if(location.href.indexOf("yige.net")==-1)parent.location.href="http://www.yige.net/";var typeTxt1=['','A','B','C','D'];var typeTxt2=['','对','错'];var wxp_answertotal=0;var wxp_rightanswertotal=0;var wxp_current=1;Array.prototype.remove=function(from,to){var rest=this.slice((to||from)+1||this.length);this.length=from<0?this.length+from:from;return this.push.apply(this,rest)};function wxpGetQuestion($id){$("#jsy_why_tip").hide();$.get("/ajax/getquestion/"+year+"/"+wxp_subject[$id],function(data){$("#question").html(data);wxpProgress();initMyAnswer()})}function initMyAnswer(){if(wxp_typeid[wxp_current]==1){$("#typeid1").show();$("#typeid2").hide()}else if(wxp_typeid[wxp_current]==2){$("#typeid2").show();$("#typeid1").hide()}$("#myanswer,#rightanswer").html("")}function wxpAnswer($id){wxp_answertotal++;var typeTxt=[];if(wxp_typeid[wxp_current]==1){typeTxt=typeTxt1}else{typeTxt=typeTxt2}$("#myanswer").html(typeTxt[$id]);if($id==wxp_answer[wxp_current]){wxp_rightanswertotal++;$("#rightanswer").html('<span class="right">&nbsp;&nbsp;&nbsp;&nbsp;</span>')}else{$("#rightanswer").html('<span class="wrong">&nbsp;&nbsp;&nbsp;&nbsp;</span>　正确答案：<strong>'+typeTxt[wxp_answer[wxp_current]]+'</strong>')}wxpProgress()}function wxpLastId(){wxp_current--;if(wxp_current<1){wxp_current=1;return}$("#nextid").attr("disabled","");if(wxp_current==1){$("#lastid").attr("disabled","false")}wxpGetQuestion(wxp_current)}function wxpNextId(){wxp_current++;if(wxp_current>subject_count){wxp_current=subject_count;return}$("#lastid").attr("disabled","");if(wxp_current==subject_count){$("#nextid").attr("disabled","false")}wxpGetQuestion(wxp_current)}function wxpProgress(){var s=subject_count/100;var w=Math.round(wxp_current*100/s)/100;var r=wxp_answertotal?(Math.round(wxp_rightanswertotal*10000/wxp_answertotal)/100):0;$("#pinfo").html("进度："+w+"% (正确率"+r+"%)");$("#progressdiv").width(w+"%")}document.onkeydown=function(){if(event.keyCode==37)wxpLastId();if(event.keyCode==39)wxpNextId()};var wxptime=0;function showtime(){wxptime++;var wxp_h=Math.floor(wxptime/3600);var wxp_m=Math.floor((wxptime-wxp_h*3600)/60);var wxp_s=wxptime-wxp_h*3600-wxp_m*60;if((wxp_h+"").length<2)wxp_h="0"+wxp_h;if((wxp_m+"").length<2)wxp_m="0"+wxp_m;if((wxp_s+"").length<2)wxp_s="0"+wxp_s;$("#showtime").html(wxp_h+":"+wxp_m+":"+wxp_s);setTimeout("showtime()",1000)}var t;function wxpgoto($id){if(t!=null)clearTimeout(t);$id=parseInt($id);if($id>0&&$id<=subject_count){wxp_current=$id;t=setTimeout("wxpGetQuestion('"+$id+"')",1000)}if(wxp_current==1){$("#lastid").attr("disabled","false")}else{$("#lastid").attr("disabled","")}if(wxp_current==subject_count){$("#nextid").attr("disabled","false")}else{$("#nextid").attr("disabled","")}}function jsyben(){$.get("/ajax/add_jsy_ben/"+year+"/"+wxp_subject[wxp_current],function(data){alert(data)})}function jsyben_del(){$.get("/ajax/del_jsy_ben/"+year+"/"+wxp_subject[wxp_current],function(data){wxp_typeid.remove(wxp_current);wxp_subject.remove(wxp_current);wxp_answer.remove(wxp_current);subject_count--;if(wxp_current>=subject_count){wxp_current--}wxpGetQuestion(wxp_current);$("#jsyben_count").html(subject_count);alert(data)})}function jsywhy(){$.get("/ajax/get_jsy_why/"+year+"/"+wxp_subject[wxp_current],function(data){$("#jsy_why_tip").html(data).hide().slideDown("show")})}function jsybbs(){if(year=='2010'){window.open("http://www.yige.net/shiti2010-"+wxp_subject[wxp_current])}else{window.open("http://www.yige.net/bbs/thread-"+wxp_subject[wxp_current]+"-1-1.html")}}
