var is_opera=((navigator.userAgent.indexOf("Opera")!=-1))?true:false,tLearn=(is_opera)?'单击学习':'左键点击学习',tUnlearn=(is_opera)?'Shift+单击遗忘':'右键点击遗忘',arrowlist=new Array(),currentClass=false,treeType=false,thash=top.location.hash,thref=(top.location.href.indexOf('#')!=-1)?top.location.href.split('#')[0]:top.location.href,autoFilloOut=(thash.indexOf('=')!=-1)?thash.split('=')[1]:'',classes=['Deathknight','Druid','Hunter','Mage','Paladin','Priest','Rogue','Shaman','Warlock','Warrior','HPetBat','HPetBear','HPetBirdofPrey','HPetBoar','HPetCarrionBird','HPetCat','HPetChimaera','HPetCoreHound','HPetCrab','HPetCrocolisk','HPetDevilsaur','HPetDragonhawk','HPetGorilla','HPetHyena','HPetMoth','HPetNetherRay','HPetRaptor','HPetRavager','HPetRhino','HPetScorpid','HPetSerpent','HPetSilithid','HPetSpider','HPetSpiritBeast','HPetSporebat','HPetTallstrider','HPetTurtle','HPetWarpStalker','HPetWasp','HPetWindSerpent','HPetWolf','HPetWorm'],classesn=['死亡骑士','德鲁伊','猎人','法师','圣骑士','牧师','潜行者','萨满祭司','术士','战士','猎人宠物 - 蝙蝠','猎人宠物 - 熊','猎人宠物 - 猛禽','猎人宠物 - 野猪','猎人宠物 - 食腐鸟','猎人宠物 - 豹','猎人宠物 - 奇美拉','猎人宠物 - 熔岩犬','猎人宠物 - 螃蟹','猎人宠物 - 鳄鱼','猎人宠物 - 魔暴龙','猎人宠物 - 龙鹰','猎人宠物 - 猩猩','猎人宠物 - 土狼','猎人宠物 - 蛾子','猎人宠物 - 虚空鳐','猎人宠物 - 迅猛龙','猎人宠物 - 掠食者','猎人宠物 - 犀牛','猎人宠物 - 蝎子','猎人宠物 - 蛇','猎人宠物 - 异种虫','猎人宠物 - 蜘蛛','猎人宠物 - 灵魂兽','猎人宠物 - 孢子蝠','猎人宠物 - 陆行鸟','猎人宠物 - 海龟','猎人宠物 - 迁跃捕猎者','猎人宠物 - 巨蜂','猎人宠物 - 风蛇','猎人宠物 - 狼','猎人宠物 - 蠕虫'],classesaid=['89526','80218','90354','80525','90353','80284','80394','80906','80583','80767','78962','78958','78298','93149','93150','93151','93152','93153','93154','93155','93156','93157','93158','93159','93160','93161','93162','93163','93164','93165','93166','93167','93168','93169','93170','93171','93172','93173','93174','93175','93176','93177'],classesapath=['2008/0707','2008/0617','2008/0720','2008/0619','2008/0720','2008/0618','2008/0618','2008/0624','2008/0620','2008/0623','2008/0601','2008/0601','2008/0522','2008/0923','2008/0923','2008/0923','2008/0923','2008/0923','2008/0923','2008/0923','2008/0923','2008/0923','2008/0923','2008/0923','2008/0924','2008/0924','2008/0924','2008/0924','2008/0924','2008/0924','2008/0924','2008/0924','2008/0924','2008/0924','2008/0924','2008/0924','2008/0924','2008/0924','2008/0924','2008/0924','2008/0924','2008/0924'],classesskill=['2008/0703/89338','2008/0521/78125','2008/0522/78218','2008/0521/78140','2008/0601/78960','2008/0521/78141','2008/0601/78959','2008/0601/78961','2008/0521/78142','2008/0521/78143',false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],HPet=['Cunning','Tenacity','Ferocity'],HPetClass=['狡诈','坚韧','狂野'],HPetCunning=['Bat','BirdofPrey','Chimaera','Dragonhawk','NetherRay','Ravager','Serpent','Silithid','Spider','Sporebat','WindSerpent'],HPetTenacity=['Bear','Boar','Crab','Crocolisk','Gorilla','Rhino','Scorpid','Turtle','WarpStalker','Worm'],HPetFerocity=['CarrionBird','Cat','CoreHound','Devilsaur','Hyena','Moth','Raptor','SpiritBeast','Tallstrider','Wasp','Wolf'],isHPet=false,isHPet_BM=false,curtree=0,currow=0,curpos=0,treec=new Array(3),treep=new Array(3),treen=new Array(),treee=new Array(3),treet=new Array(3),treel=new Array(3),trees=false,treept=false,oldtrees=false,switchActive=false,tooltipelm=null,tooltipcelm=null,pointlock=71,iconpos=[
62, //size
36, //left
8, //top
30, //arrow width
0, //arrow height
16, //margin
],arrowleft=[],tableheight=false,text_bm='<b style="font-size:14px">野兽掌握</b><br />需要50点野兽掌握系天赋<br /><font style="color:#ffd100">你掌握了野兽训练的真谛，可以驯服稀有宠物，并使你的宠物技能点数提高4点。</font><br /><br />',text_bm_l='<font style="color:#0f0">点击学习</font>',pointsummary=[0,0,''],execLogin=null,knownbaduser=new Array(),knownbadmail=new Array();

function L(A){return A}
function setOpacity(B,A){B.style.opacity=A/10;B.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity="+A*10+")"}
function obj_left(B){if(B){var A=B.offsetLeft;while((B=B.offsetParent)!=null){A+=B.offsetLeft}return A}}
function obj_top(B){if(B){var A=B.offsetTop;while((B=B.offsetParent)!=null){A+=B.offsetTop}return A}}
function arrowlistn(e){var ex=false;for(var i=0;i<arrowlist.length;i++){if(arrowlist[i]==e){ex=true;}}if(!ex){arrowlist.push(e)}}
function IsNumeric(A){if(typeof A=="undefined"){return false}if(A==""){return false}var D="0123456789.-";var C=true;var B;for(i=0;i<A.length&&C==true;i++){B=A.charAt(i);if(D.indexOf(B)==-1){C=false}}return C}
function IsPosInt(A){if(typeof A=="undefined"){return false}if(A==""){return false}var D="0123456789";var C=true;var B;for(i=0;i<A.length&&C==true;i++){B=A.charAt(i);if(D.indexOf(B)==-1){C=false}}return C}
function nl2pnl(B){if(B){var A;B=escape(B);if(B.indexOf("%0D%0A")>-1){A=/%0D%0A/g}else{if(B.indexOf("%0A")>-1){A=/%0A/g}else{if(B.indexOf("%0D")>-1){A=/%0D/g}}}return unescape(B.replace(A,"\n"))}return B}
function nl2br(C){if(C){var B;C=escape(C);if(C.indexOf("%0D%0A")>-1){B=/%0D%0A/g}else{if(C.indexOf("%0A")>-1){B=/%0A/g}else{if(C.indexOf("%0D")>-1){B=/%0D/g}}}var A=unescape(C.replace(B,"<br />"));var A=A.replace(/&lt;br\ \/&gt;/g,"<br />");var A=A.replace(/&lt;table&gt;/g,"<table style='color:#fff' width='100%'>");var A=A.replace(/&lt;\/table&gt;/g,"</table>");var A=A.replace(/&lt;tr&gt;/g,"<tr>");var A=A.replace(/&lt;\/tr&gt;/g,"</tr>");var A=A.replace(/&lt;td&gt;/g,"<td>");var A=A.replace(/&lt;td\ align=right&gt;/g,"<td align=right>");var A=A.replace(/&lt;\/td&gt;/g,"</td>");var A=A.replace(/&lt;strong&gt;/g,"<strong>");var A=A.replace(/&lt;\/strong&gt;/g,"</strong>");var A=A.replace(/&lt;span&gt;/g,"<span style='color:#fff'>");var A=A.replace(/&lt;font class='formula'&gt;/g,"<font class='formula'>");var A=A.replace(/&lt;\/font&gt;/g,"</font>");return A}return C}
function stripnl(B){if(B){var A;B=escape(B);if(B.indexOf("%0D%0A")>-1){A=/%0D%0A/g}else{if(B.indexOf("%0A")>-1){A=/%0A/g}else{if(B.indexOf("%0D")>-1){A=/%0D/g}}}return unescape(B.replace(A,""))}return B}
function htmlspecialchars(A){if(A){A=A.replace(/\"/g,"&quot;");A=A.replace(/</g,"&lt;");A=A.replace(/>/g,"&gt;")}return A}
function uni_unescape(A){return A.replace(/(%u([0-9A-F]{4}))/gi,"&#x$2;")}
function stringFill(C, D){var A="";for(var B=0;B<D;B++){A+=C}return A}
function ajax(B,C,E,A){var D=grabAjaxObj();if(!D){alert("It appears your browser does not support XMLHTTP requests. Some functions may not work correctly.");D=function(){return false};return false}D.onreadystatechange=function(){if(D.readyState==4){if(D.status==200){E(D.responseText)}else{A(D)}}};D.open("POST",B,true);D.setRequestHeader("Content-type","application/x-www-form-urlencoded");D.setRequestHeader("Content-length",C.length);D.setRequestHeader("Connection","close");D.send(C)}
function grabAjaxObj(){if(window.XMLHttpRequest){grabAjaxObj=function(){return new XMLHttpRequest()};return grabAjaxObj()}try{var B=new ActiveXObject("Microsoft.XMLHTTP");grabAjaxObj=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}catch(A){var B=new ActiveXObject("Msxml2.XMLHTTP");grabAjaxObj=function(){return new ActiveXObject("Msxml2.XMLHTTP")}}return B}
function cleanData(A){var A=A.replace(/^\"/g,"");A=A.replace(/\\$/g,"");A=A.replace(/([^\\])\"/g,"$1");A=A.replace(/\\\"/g,'"');A=unescape(A);return A}
function BindArgument(B,A){return function(){return B(A)}}
function getPageSize(){var C,A;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}}var B,D;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 getCookie(A){if(document.cookie.length>0){c_start=document.cookie.indexOf(A+"=");if(c_start!=-1){c_start=c_start+A.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1){c_end=document.cookie.length}return unescape(document.cookie.substring(c_start,c_end))}}return ""}
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 addListener(B,C,D,A){if(window.addEventListener){addListener=function(F,G,H,E){E=E||false;F.addEventListener(G,H,E);return true};return addListener(B,C,D,A)}else{if(window.attachEvent){addListener=function(F,G,H,E){F.attachEvent("on"+G,H);return true};return addListener(B,C,D,A)}else{addListener=function(F,G,H,E){return false};return addListener(B,C,D,A)}}}
function ucFirst(A){var B=A.charAt(0);if (parseInt(A.length)==1){return B.toUpperCase()}else{return B.toUpperCase()+A.slice(1).toLowerCase()}}
function trim(A){return A.replace(/(^\s+)([^\s]*)(\s+$)/,"$2")};
function TalentObj(A,D,E){this.tree=A;this.pos=E;this.row=D;this.talentname=L("Unused");this.desc=L("This talent is currently unused. Click the talent in edit mode to start using it.");this.numRanks=0;this.curRank=0;this.icon="Temp.jpg";this.reqs=new Array();this.type="empty";this.ranks=new Array(6);for(var C=0;C<=5;C++){this.ranks[C]=new Array(11);for(var B=0;B<=10;B++){this.ranks[C][B]=""}}this.treeelm=treee[A];this.butbg=$(this.getID());this.butc=$(this.getID()+"c");this.butb=$(this.getID()+"b");this.butimg=$(this.getID()+"i");this.buticon=$(this.getID()+"ii");if(this.butbg.style.left!=(iconpos[1]+iconpos[0]*(this.getPos()-1)+treel[A])+"px"){this.butbg.style.left=(iconpos[1]+iconpos[0]*(this.getPos()-1)+treel[A])+"px";this.butbg.style.top=(iconpos[2]+iconpos[0]*(this.getRow()-1)+treet[A])+"px"}addListener(this.butb,"click",butclick);addListener(this.butb,"contextmenu",butrclick);addListener(this.butbg,"contextmenu",butclick2);addListener(this.butb,"mouseover",butmouseover);addListener(this.butb,"mouseout",butmouseout);this.redraw(false)}
TalentObj.prototype.setLoc=function setLoc(A,B,C){this.removeReqs();this.tree=A;this.pos=C;this.row=B;this.treeelm=treee[A];this.butbg=$(this.getID());this.butc=$(this.getID()+"c");this.butimg=$(this.getID()+"i");this.buticon=$(this.getID()+"ii");this.butbg.style.left=(iconpos[1]+iconpos[0]*(this.getPos()-1)+treel[A])+"px";this.butbg.style.top=(iconpos[2]+iconpos[0]*(this.getRow()-1)+treet[A])+"px";this.redraw("")};
TalentObj.prototype.getTree=function getTree(){return this.tree};
TalentObj.prototype.getPos=function getPos(){return this.pos};
TalentObj.prototype.getRow=function getRow(){return this.row};
TalentObj.prototype.getType=function getType(){return this.type};
TalentObj.prototype.getDescription=function getDescription(){return this.desc};
TalentObj.prototype.setDescription=function setDescription(A){this.desc=A};
TalentObj.prototype.getTalentname=function getTalentname(){return this.talentname};
TalentObj.prototype.setTalentname=function setTalentname(A){this.talentname=A};
TalentObj.prototype.getNumRanks=function getNumRanks(){return this.numRanks};
TalentObj.prototype.getCurRank=function getCurRank(){return this.curRank};
TalentObj.prototype.getActiveCost=function getActiveCost(){return this.ActiveCost};
TalentObj.prototype.setActiveCost=function setActiveCost(A){this.ActiveCost=A};
TalentObj.prototype.setActiveCostType=function setActiveCostType(A){this.ActiveCostType=A};
TalentObj.prototype.getActiveCostType=function getActiveCostType(){return this.ActiveCostType};
TalentObj.prototype.getActiveCastTime=function getActiveCastTime(){return this.ActiveCastTime};
TalentObj.prototype.setActiveSpellType=function setActiveSpellType(A){this.ActiveSpellType=A};
TalentObj.prototype.getActiveSpellType=function getActiveSpellType(){return this.ActiveSpellType};
TalentObj.prototype.getActiveCastTime=function getActiveCastTime(){return this.ActiveCastTime};
TalentObj.prototype.getActiveCooldown=function getActiveCooldown(){return this.ActiveCooldown};
TalentObj.prototype.setActiveCooldown=function setActiveCooldown(A){this.ActiveCooldown=A};
TalentObj.prototype.getActiveRangeMin=function getActiveRangeMin(){return this.ActiveRangeMin};
TalentObj.prototype.setActiveRangeMin=function setActiveRangeMin(A){this.ActiveRangeMin=A};
TalentObj.prototype.getActiveRangeMax=function getActiveRangeMax(){return this.ActiveRangeMax};
TalentObj.prototype.setActiveRangeMax=function setActiveRangeMax(A){this.ActiveRangeMax=A};
TalentObj.prototype.getActiveReagents=function getActiveReagents(){switch(this.ActiveReagents){case "Soul Shard":this.ActiveReagents="灵魂碎片";break;}return this.ActiveReagents};
TalentObj.prototype.setActiveReagents=function setActiveReagents(A){this.ActiveReagents=A};
TalentObj.prototype.getActiveItemReq=function getActiveItemReq(){switch(this.ActiveItemReq){case "Shields":this.ActiveItemReq="盾牌";break;case "Daggers":this.ActiveItemReq="匕首";break;}return this.ActiveItemReq};
TalentObj.prototype.setActiveItemReq=function setActiveItemReq(A){this.ActiveItemReq=A};
TalentObj.prototype.getActiveStanceReq=function getActiveStanceReq(){return this.ActiveStanceReq};
TalentObj.prototype.setActiveStanceReq=function setActiveStanceReq(A){this.ActiveStanceReq=A};
TalentObj.prototype.getActiveToolReq=function getActiveToolReq(){return this.ActiveToolReq};
TalentObj.prototype.setActiveToolReq=function setActiveToolReq(A){this.ActiveToolReq=A};
TalentObj.prototype.getActiveRequires=function getActiveRequires(){return this.ActiveRequires};
TalentObj.prototype.setActiveRequires=function setActiveRequires(A){this.ActiveRequires=A};
TalentObj.prototype.getIcon=function getIcon(){return this.icon.toLowerCase()};
TalentObj.prototype.setIcon=function setIcon(A){this.icon=A.toLowerCase();this.buticon.style.backgroundImage='url(http://wow.gamespot.com.cn/Atlas/Icons/36-duel/'+this.getIcon()+'.jpg)'};
TalentObj.prototype.setActiveCastTime=function setActiveCastTime(A){if((A==0)&&(this.getActiveSpellType()=="casttime")){this.setActiveSpellType("instant")}this.ActiveCastTime=A};
TalentObj.prototype.setType=function setType(A){A=A.toLowerCase();if(A==this.type){return}if(this.getRow()>7&&treeType=="normal"){A="hidden"}switch(A.toLowerCase()){case "e":case "empty":this.setIcon("Temp.jpg");this.setNumRanks(0);this.setCurRank(0);this.removeReqs();this.setTalentname(L("Unused"));this.setDescription(L("This talent is currently unused. Click the talent in edit mode to start using it."));this.type="empty";break;case "a":case "active":this.setNumRanks(1);this.setCurRank(0);this.type="active";break;case "p":case "passive":this.setCurRank(0);this.type="passive";break;case "h":case "hidden":this.setNumRanks(0);this.setCurRank(0);this.removeReqs();this.type="hidden";break}};
TalentObj.prototype.setCurRank=function setCurRank(A){if(A>this.getNumRanks()){this.curRank=this.getNumRanks()}else{this.curRank=A}};
TalentObj.prototype.setNumRanks=function setNumRanks(A){this.numRanks=A;this.setCurRank(0)};
TalentObj.prototype.setRank=function setRank(C,A,B){this.ranks[C][A]=B};
TalentObj.prototype.getRank=function setRank(B,A){return this.ranks[B][A]};
TalentObj.prototype.getPassiveDesc=function getPassiveDesc(D){if(D<1||D>5){D=1}var B=0;var A=this.desc.indexOf("@",0);while(A!=-1){B++;A=this.desc.indexOf("@",(A+1));if(B>10){return this.desc}}var C=nl2br(htmlspecialchars(this.desc));for (A=0;A<B;A++){C=C.replace(/@/,this.getRank(D,A))}return C};
TalentObj.prototype.getPassiveDescEdit=function getPassiveDescEdit(F){var D=0;var B=this.desc.indexOf("@",0);while(B!=-1){D++;B=this.desc.indexOf("@",(B+1));if(D>10){return this.desc}}var E=nl2br(htmlspecialchars(this.desc));for(B=0;B<D;B++){var C="[";for(var A=1;A<=this.getNumRanks();A++){if(A!=1){C+="|"}if(this.getCurRank()==A){C+="<em>"+this.getRank(A,B)+"</em>"}else{C+=this.getRank(A,B)}}C+="]";E=E.replace(/@/,C)}return E};
TalentObj.prototype.getPassiveRanks=function getPassiveRanks(){var D=0;var C=this.desc.indexOf("@",0);while(C!=-1){D++;C=this.desc.indexOf("@",(C+1));if(D>10){return ""}}var A="";for(var B=0;B<D;B++){for(C=1;C<=this.getNumRanks();C++){if(A!=""){A+="|"}A+=this.getRank(C,B)}}return this.getNumRanks()+A};
TalentObj.prototype.getReqs=function getReqs(A){return this.reqs.join("|")};
TalentObj.prototype.addReq=function addReq(C){this.reqs.push(C);var A=translateSticky(C);var B=A[1];var D=A[2];spawnArrow(this.getTree(),B,D,this.getRow(),this.getPos())};
TalentObj.prototype.isReq=function isReq(B){for(var A=0;A<this.reqs.length;A++){if(this.reqs[A]==B){return true}}return false};
TalentObj.prototype.removeReq=function removeReq(D){for(var B=0;B<this.reqs.length;B++){if(this.reqs[B]!=D){continue}var A=translateSticky(this.reqs[B]);var C=A[1];var E=A[2];removeArrow(this.getTree(),C,E,this.getRow(),this.getPos());this.reqs.slice(B,1);return}};
TalentObj.prototype.removeReqs=function removeReqs(){for(var B=0;B<this.reqs.length;B++){var A=translateSticky(this.reqs[B]);var C=A[1];var D=A[2];removeArrow(this.getTree(),C,D,this.getRow(),this.getPos())}this.reqs=new Array()};
TalentObj.prototype.reqsAreOk=function reqsAreOk(){for(var D=0;D<this.reqs.length;D++){var A=translateSticky(this.reqs[D]);var F=A[1];var G=A[2];if (!treec[this.getTree()][F][G].isMaxRank()){return false}}var E=(treept*(this.getRow()-1));if(E>0){var C=0;for(var D=1;D<this.getRow();D++){for(var B=1;B<=4;B++){C+=parseInt(treec[this.getTree()][D][B].getCurRank())}}if(C<E){return false}}return true};
TalentObj.prototype.addPoint=function addPoint(){if((this.getCurRank()<this.getNumRanks())&&(pointlock==0||((treep[1]+treep[2]+treep[3])<pointlock))){this.setCurRank(this.getCurRank()+1);this.redraw(false);var D=0;var A=getMaxi();for(var C=1;C<=A;C++){for(var B=1;B<=4;B++){D+=parseInt(treec[this.getTree()][C][B].getCurRank())}}treep[this.getTree()]=D;if((pointlock>0)&&((treep[1]+treep[2]+treep[3])>=pointlock)){redrawAll()}else{for(var C=1;C<=A;C++){for(var B=1;B<=4;B++){treec[this.getTree()][C][B].redraw(false)}}}return true}return false};
TalentObj.prototype.subPoint=function subPoint(){if(this.getCurRank()>0){this.setCurRank(this.getCurRank()-1);treep[this.getTree()]--;var C=getMaxi();for(var E=this.getRow();E<=C;E++){for(var D=1;D<=4;D++){if(treec[this.getTree()][E][D].getCurRank()>0&&!treec[this.getTree()][E][D].reqsAreOk()){this.setCurRank(this.getCurRank()+1);treep[this.getTree()]++;for(var B=this.getRow();B<=E;B++){for(var A=1;A<=4;A++){treec[this.getTree()][B][A].redraw(false)}}}else{treec[this.getTree()][E][D].redraw(false)}}}if(pointlock>0&&((treep[1]+treep[2]+treep[3])<pointlock)){redrawAll()}else{this.redraw(false)}return true}return false};
TalentObj.prototype.getReadCost=function getReadCost(){if(this.ActiveCostType=="runes"){var E=this.getActiveCost();var D=E.substring(0,1);var C=E.substring(1,2);var A=E.substring(2,3);var B="";if(parseInt(D)>0){B+='<span class="costrune runeBlood">'+D+'</span>';}if(parseInt(C)>0) {B+='<span class="costrune runeFrost">'+C+'</span>';}if(parseInt(A)>0){B+='<span class="costrune runeUnholy">'+A+'</span>';}return B}else if(this.getActiveCost()=="all"){return "全部"+htmlspecialchars(this.getReadCostType())}else if(this.getActiveCost().indexOf(" + ")!=-1&&this.getActiveCost().indexOf("ps")!=-1){var cost=this.getActiveCost().split(" + ");var c=cost[0];var cps=cost[1].split("ps")[0];return c+""+htmlspecialchars(this.getReadCostType())+", 每秒再消耗"+cps+"点"}else{return htmlspecialchars(this.getActiveCost())+""+htmlspecialchars(this.getReadCostType())}};
TalentObj.prototype.getReadCostType=function getReadCostType(){if(this.ActiveCostType=="procmana"){return L("基础法力值")}if(this.ActiveCostType=="procrmana"){return L("%剩余法力值")}switch(this.ActiveCostType){case "mana":this.ActiveCostType="法力值";break;case "energy":this.ActiveCostType="能量";break;case "rage":this.ActiveCostType="怒气";break;case "focus":this.ActiveCostType="集中值";break;case "runic power":this.ActiveCostType="符文能量";break;}return L(ucFirst(this.ActiveCostType))};
TalentObj.prototype.getReadRange=function getReadRange(){if(this.hasNoRange()){return ""}if(this.ActiveRangeMin.indexOf('-')!=-1||this.ActiveRangeMax.indexOf('-')!=-1){var rEmin=this.ActiveRangeMin.split('-')[0];var rFmin=this.ActiveRangeMin.split('-')[1];var rEmax=this.ActiveRangeMax.split('-')[0];var rFmax=this.ActiveRangeMax.split('-')[1];return '敌方: '+((rEmax==5)?'近战范围':(((rEmin>0)?rEmin+'-':'')+rEmax+'码距离'))+'<br />友方: '+((rFmax==5)?'近战范围':(((rFmin>0)?rFmin+'-':'')+rFmax+'码距离'));}else{if(this.ActiveRangeMin==0&&this.ActiveRangeMax>0){if(this.ActiveRangeMax==5){return "近战范围"}else if(this.ActiveRangeMax==50000){return "无限距离"}else{return this.ActiveRangeMax+L("码距离")}}if(this.ActiveRangeMin==this.ActiveRangeMax){return this.ActiveRangeMax+L("码距离")}return this.ActiveRangeMin+"-"+this.ActiveRangeMax+L("码距离")}};
TalentObj.prototype.getReadCasttime=function getReadCasttime(){if((this.ActiveCastTime==0)&&(this.getActiveSpellType()=="casttime")){this.setActiveSpellType("instant")}if(this.getActiveSpellType()=="n/a"){return ' ';}if(this.getActiveSpellType()=="channeled"){return L("需引导")}if(this.getActiveSpellType()=="nextmelee"){return L("下一次近战攻击")}if(this.getActiveCost()!=0){if(this.getActiveSpellType()=="instant"&&this.getActiveCostType()=="mana"){return L("瞬发法术")}if(this.getActiveSpellType()=="instant"){return L("瞬发")}if(this.ActiveCastTime<60){return this.ActiveCastTime+L("秒施法")}if(this.ActiveCastTime%60==0){return parseInt(this.ActiveCastTime/60)+L("分种施法")}if(parseInt(this.ActiveCastTime%60)<10){return parseInt(this.ActiveCastTime/60)+L("分种")+parseInt(this.ActiveCastTime%60)+L("秒施法")}return parseInt(this.ActiveCastTime/60)+L("分种")+parseInt(this.ActiveCastTime%60)+L("秒施法")}else{if(this.getActiveSpellType()=="instant"){return L("瞬发")}if(this.ActiveCastTime<60){return this.ActiveCastTime+L("秒")}if(this.ActiveCastTime%60==0){return parseInt(this.ActiveCastTime/60)+L("分钟")}if(parseInt(this.ActiveCastTime%60)<10){return parseInt(this.ActiveCastTime/60)+L("分钟")+parseInt(this.ActiveCastTime%60)+L("秒")}return parseInt(this.ActiveCastTime/60)+L("分钟")+parseInt(this.ActiveCastTime%60)+L("秒")}};
TalentObj.prototype.getReadCooldown=function getReadCooldown(){if(this.ActiveCooldown<60){return this.ActiveCooldown+L("秒")}if(this.ActiveCooldown%60==0){return parseInt(this.ActiveCooldown/60)+L("分钟")}if(parseInt(this.ActiveCooldown%60)<10){return parseInt(this.ActiveCooldown/60)+L("分钟")+parseInt(this.ActiveCooldown%60)+L("秒")}return parseInt(this.ActiveCooldown/60)+L("分钟")+parseInt(this.ActiveCooldown%60)+L("秒")};
TalentObj.prototype.doTooltip=function doTooltip(){
    var E='<table width="100%"><tr><td><strong>'+htmlspecialchars(this.talentname)+'</strong></td></tr>';
	var canLearn=false;
    if(this.getNumRanks()>0){
        E+='<tr><td>'+L("等级 ")+this.getCurRank()+"/"+this.getNumRanks()+"</td></tr>"
    }
    var C=(treept*(this.getRow()-1));
    for(var B=0;B<this.reqs.length;B++){
        var A=translateSticky(this.reqs[B]);
        var D=A[1];
        var F=A[2];
        if(!treec[this.getTree()][D][F].isMaxRank()){
            E+='<tr><td class="reqnotmet">需要'+treec[this.getTree()][D][F].getNumRanks()+'点'+htmlspecialchars(treec[this.getTree()][D][F].getTalentname())+"</td></tr>";
			canLearn=false;
		}else{
			canLearn=true;
        }
    }
    if(C!=0){
        if(treep[this.getTree()]<C){
            E+='<tr><td class="reqnotmet">需要'+(treept*(this.getRow()-1))+L("点")+treen[this.getTree()-1]+L("系天赋")+"</td></tr>";
			canLearn=false;
        }else{
			canLearn=true;
		}
    }else{
		canLearn=true;
	}
    if(this.getType()=="active"){
		E+='<tr><td><table width="100%"><tr>';
        if(this.getActiveCost()!=0){
            E+='<td>'+this.getReadCost()+'</td>';
            if(!this.hasNoRange()){
                E+='<td align="right">'+this.getReadRange()+"</td>"
            }
            E+='</tr></table></td></tr><tr><td><table width="100%"><tr>';
            E+='<td>'+this.getReadCasttime()+"</td>";
            if(this.getActiveCooldown()>0){
                E+='<td align="right">'+htmlspecialchars(this.getReadCooldown())+L("冷却时间")+"</td>"
            }
        }else{
            if(this.hasNoRange()){
				if(this.getReadCasttime()!=' '){
					E+='<td>'+this.getReadCasttime()+"</td>";
				}
                if(this.getActiveCooldown()>0){
                    E+='<td align="right">'+htmlspecialchars(this.getReadCooldown())+L("冷却时间")+"</td>"
                }
            }else{
                E+='<td>'+this.getReadRange()+"</td>";
				E+='</tr></table></td></tr><tr><td><table width="100%"><tr>';
                E+='<td>'+this.getReadCasttime()+"</td>";
                if(this.getActiveCooldown()>0){
                    E+='<td align="right">'+htmlspecialchars(this.getReadCooldown())+L("冷却时间")+"</td>"
                }
            }
        }
		E+='</tr></table></td></tr>';
        if(this.getActiveReagents()!=""){
            E+='<tr><td>'+L("材料: ")+uni_unescape(htmlspecialchars(this.getActiveReagents()))+"</td></tr>"
        }
        E+='<div class="clear"></div>';
        if(this.getActiveItemReq()!=""){
            E+='<tr><td>'+"需要"+uni_unescape(htmlspecialchars(this.getActiveItemReq()))+"</td></tr>"
        }
        E+='<div class="clear"></div>';
        if(this.getActiveStanceReq()!=""){
            E+='<tr><td>'+"需要"+uni_unescape(htmlspecialchars(this.getActiveStanceReq()))+"</td></tr>"
        }
        E+='<div class="clear"></div>';
        if(this.getActiveToolReq()!=""){
            E+='<tr><td>'+"工具: "+uni_unescape(htmlspecialchars(this.getActiveToolReq()))+"</td></tr>"
        }
        E+='<tr><td class="desc">'+nl2br(htmlspecialchars(this.desc))+"</td></tr>"
    }else{
        if(this.getType()=="passive"){
			E+='<tr><td class="desc">'+this.getPassiveDesc(this.getCurRank())+"</td></tr>"
        }else{
            E+='<tr><td class="desc">'+nl2br(htmlspecialchars(this.desc))+"</td></tr>"
        }
    }
	E+='</table>';
	if(canLearn){
		var view='left';
		if((this.getCurRank()<this.getNumRanks())&&(pointlock==0||((treep[1]+treep[2]+treep[3])<pointlock))){
			if(this.getCurRank()>0){
				E+='<br />下一级<br />'
				E+='<span class="desc">'+this.getPassiveDesc(this.getCurRank()+1)+"</span><br />"
			}
			if(treep[this.getTree()]>=C){
				E+='<br /><span class="reqmet viewleft">'+tLearn+'</span>';
				view='right';
			}
		}
		if(this.getCurRank()>0){
			E+=((view=='left')?'<br />':'')+'<span class="reqnotmet view'+view+'">'+tUnlearn+'</span>';
		}
	}
	tooltipcelm.innerHTML=E;
    showTooltip(this.butbg);
};
TalentObj.prototype.redrawarrow=function redrawarrow() {
    for (var D=0; D < this.reqs.length; D++) {
        var A=translateSticky(this.reqs[D]);
		var I=this.getTree();
		var H=A[1];
        var F=A[2];
		var req=(this.reqsAreOk())?((pointlock > 0 && ((treep[1] + treep[2] + treep[3]) >= pointlock) && this.getCurRank() == 0)?false:true):false;
    }
	var I=this.getTree();
    var C=this.getRow();
    var A=this.getPos();
    var B=(A - F);
	//var O=(req)?'10':'5';
	if($("arrow" + I + H + F + C + A) || $("arrow" + I + H + F + C + A + "d")) {
		if (B > 0) {
			if (H < C) {
				$("arrow" + I + H + F + C + A).style.backgroundPosition=(req)?"right 15px":"right top";
			} else {
				$("arrow" + I + H + F + C + A).style.backgroundPosition=(req)?"right 15px":"right top";
			}
			//setOpacity($("arrow" + I + H + F + C + A), O);
		}
		if (B < 0) {
			if (H < C) {
				$("arrow" + I + H + F + C + A).style.backgroundPosition=(req)?"left 15px":"left top";
			} else {
				$("arrow" + I + H + F + C + A).style.backgroundPosition=(req)?"left 15px":"left top";
			}
			//setOpacity($("arrow" + I + H + F + C + A), O);
		}
		if (H < C) {
			$("arrow" + I + H + F + C + A + "d").style.backgroundPosition=(req)?"15px bottom":"left bottom";
			//setOpacity($("arrow" + I + H + F + C + A + "d"), O);
		}
	}
}
TalentObj.prototype.redraw=function redraw(B) {
    if (this.getType() == "hidden") {
        this.hideButton();
        this.butc.innerHTML="";
        return
    }
	var tIcon='';
	if (this.getType() == "empty") {
		this.hideButton();
		this.butc.innerHTML="";
		return
	} else {
		this.showButton()
	}
	if (this.reqsAreOk()) {
		if (pointlock > 0 && ((treep[1] + treep[2] + treep[3]) >= pointlock) && this.getCurRank() == 0) {
			this.butimg.style.backgroundPosition="0px 0px";
			this.buticon.style.backgroundPosition='left bottom';
			//setOpacity(this.butbg, 5);
			this.butc.innerHTML="";
		} else {
			if (this.getNumRanks() > 0) {
				this.butc.innerHTML=this.getCurRank() + "/" + this.getNumRanks()
			} else {
				this.butc.innerHTML="X"
			}
			if (this.getCurRank() == this.getNumRanks()) {
				this.butimg.style.backgroundPosition="-220px 0px";
				this.butc.style.color="#FFD100"
			} else {
				this.butimg.style.backgroundPosition="-55px 0px";
				this.butc.style.color="#2EFF00"
			}
			//setOpacity(this.butbg, 10);
			this.buticon.style.backgroundPosition='left top';
		}
	} else {
		this.butimg.style.backgroundPosition="0px 0px";
		//setOpacity(this.butbg, 5);
		this.butc.innerHTML="";
		this.buticon.style.backgroundPosition='left bottom';
	}
	this.redrawarrow();
};
TalentObj.prototype.reposition=function reposition() {
    this.butbg.style.left=(iconpos[1] + iconpos[0] * (this.getPos() - 1) + treel[this.getTree()]) + "px";
    this.butbg.style.top=(iconpos[2] + iconpos[0] * (this.getRow() - 1) + treet[this.getTree()]) + "px";
    for (var B=0; B < this.reqs.length; B++) {
        var A=translateSticky(this.reqs[B]);
        var C=A[1];
        var D=A[2];
        removeArrow(this.getTree(), C, D, this.getRow(), this.getPos());
        spawnArrow(this.getTree(), C, D, this.getRow(), this.getPos())
    }
    this.redraw(false)
};
TalentObj.prototype.showButton=function showButton() {
    this.butbg.style.display=""
};
TalentObj.prototype.hideButton=function hideButton() {
    this.butbg.style.display="none"
};
TalentObj.prototype.hasNoRange=function hasNoRange() {
    return (this.ActiveRangeMin == 0 && this.ActiveRangeMax == 0)
};
TalentObj.prototype.getID=function getID() {
    return "t" + this.tree + "r" + this.row + "p" + this.pos
};
TalentObj.prototype.getShortID=function getShortID() {
    return this.tree + "" + this.row + "" + this.pos
};
TalentObj.prototype.isMaxRank=function isMaxRank() {
    return (this.getCurRank() == this.getNumRanks())
};
TalentObj.prototype.getActiveSave=function getActiveSave() {
    var A=this.getActiveCost();
    A += "|" + this.getActiveCostType();
    A += "|" + this.getActiveSpellType();
    A += "|" + this.getActiveCastTime();
    A += "|" + this.getActiveCooldown();
    A += "|" + this.getActiveRangeMin();
    A += "|" + this.getActiveRangeMax();
    A += "|" + this.getActiveReagents();
    A += "|" + this.getActiveItemReq();
    A += "|" + this.getActiveStanceReq();
    A += "|" + this.getActiveToolReq();
    return htmlspecialchars(A)
};
function spawnArrow(I, H, F, C, A) {
    I=parseInt(I);
    H=parseInt(H);
    F=parseInt(F);
    C=parseInt(C);
    A=parseInt(A);
    if (!checkArrow(I, H, F, C, A, false)) {
        return false
    }
    var E=$("tree" + I);
    var B=(A - F);
    if (B > 0) {
		if($("arrow" + I + H + F + C + A)) {
			$("arrow" + I + H + F + C + A).style.display='block';
		} else {
			var G=E.appendChild(document.createElement("div"));
			if (H < C) {
				G.className="arrowrd";
				G.style.width=iconpos[1]*(B-1)+iconpos[5]+2+iconpos[0]/2+"px"
			} else {
				G.className="arrowr";
				G.style.width=iconpos[1]*(B-1)+iconpos[5]+6+"px"
			}
			G.style.left=obj_left(E)+iconpos[1]+iconpos[0]*F-iconpos[5]-2+"px";
			G.style.top=obj_top(E)+iconpos[2]+iconpos[0]*(H-1)+(iconpos[0]-iconpos[3])/2+"px";
			G.style.height="15px";
			G.id="arrow" + I + H + F + C + A
		}
		arrowlistn("arrow" + I + H + F + C + A);
    }
    if (B < 0) {
		if($("arrow" + I + H + F + C + A)) {
			$("arrow" + I + H + F + C + A).style.display='block';
		} else {
			possideways=B * -1;
			var G=E.appendChild(document.createElement("div"));
			if (H < C) {
				G.className="arrowld";
				G.style.width=iconpos[0]*(possideways-1)+iconpos[5]+1+iconpos[0]/2+"px";
				G.style.left=obj_left(E)+iconpos[0]*(F-1)-iconpos[0]*(possideways-1)-10+"px";
			} else {
				G.className="arrowl";
				G.style.width=iconpos[0]*(possideways-1)+iconpos[5]+6+"px";
				G.style.left=obj_left(E)+iconpos[0]*(F-1)-iconpos[0]*(possideways-1)+iconpos[5]+"px";
			}
			G.style.top=obj_top(E)+iconpos[2]+iconpos[0]*(H-1)+(iconpos[0]-iconpos[3])/2+"px";
			G.style.height="15px"
			G.id="arrow" + I + H + F + C + A
		}
		arrowlistn("arrow" + I + H + F + C + A);
    }
    if (H < C) {
		if($("arrow" + I + H + F + C + A + "d")) {
			$("arrow" + I + H + F + C + A + "d").style.display='block';
		} else {
			var G=E.appendChild(document.createElement("div"));
			G.className="arrowd";
			G.style.left=obj_left(E)+(iconpos[0]-iconpos[3])/2+iconpos[1]+iconpos[0]*(A-1)+"px";
			if (B != 0) {
				G.style.top=obj_top(E)+iconpos[2]+iconpos[0]*(H-1)+iconpos[0]/2+"px";
				G.style.height=iconpos[0]*(C-H-1)+iconpos[5]+(iconpos[0]-iconpos[3])/2+2+"px"
			} else {
				G.style.top=obj_top(E)+iconpos[2]+iconpos[0]*H-iconpos[5]-2+"px";
				G.style.height=iconpos[0]*(C-H-1)+iconpos[5]+5+"px"
			}
			G.style.width="15px";
			G.id="arrow" + I + H + F + C + A + "d"
		}
		arrowlistn("arrow" + I + H + F + C + A + "d");
    }
    var B=(F - A);
    if (B < 0) {
        B *= -1;
        B -= 1;
        for (var D=0; D < B; D++) {
            treec[I][H][F + (B - D)].setType("hidden");
            treec[I][H][F + (B - D)].redraw(false)
        }
    } else {
        B -= 1;
        for (var D=0; D < B; D++) {
            treec[I][H][A - (D - B)].setType("hidden");
            treec[I][H][A - (D - B)].redraw(false)
        }
    }
    if (H < C) {
        if ((F - A) != 0) {
            treec[I][H][A].setType("hidden");
            treec[I][H][A].redraw(false)
        }
        for (D=1; D < (C - H); D++) {
            treec[I][H + D][A].setType("hidden");
            treec[I][H + D][A].redraw(false)
        }
    }
}
function checkArrow(I, H, F, C, A, E) {
    I=parseInt(I);
    H=parseInt(H);
    F=parseInt(F);
    C=parseInt(C);
    A=parseInt(A);
    if (H > C) {
        return false
    }
    if (H == C && F == A) {
        return false
    }
    if ((C - H) > 4) {
        return false
    }
    if (!validArrowTalent(I, H, F)) {
        return false
    }
    if (!validArrowTalent(I, C, A)) {
        if (!E) {
            return false
        }
    }
    var B=(F - A);
    if (B < 0) {
        B *= -1;
        B -= 1;
        var D=0;
        while (D < B) {
            if (canArrow(I, H, F + (B - D))) {
                D++
            } else {
                return false
           }
        }
    } else {
        B -= 1;
        var D=0;
        while (D < B) {
            if (canArrow(I, H, A - (D - B))) {
                D++
            } else {
                return false
            }
        }
    }
    if (H < C) {
        if (!canArrow(I, H, A) && ((F - A) != 0)) {
            return false
        }
        var G=C - H;
        for (D=1; D < G; D++) {
            if (!canArrow(I, (H + D), A)) {
                return false
            }
        }
    }
    return true
}
function removeArrow(I, H, F, C, A) {
    I=parseInt(I);
    H=parseInt(H);
    F=parseInt(F);
    C=parseInt(C);
    A=parseInt(A);
    if (H > C) {
        return false
    }
    if (H == C && F == A) {
        return false
    }
    if ((F - A) != 0) {
        var G=$("arrow" + I + H + F + C + A);
        if (G) {
            var D=G.parentNode;
            D.removeChild(G)
        }
    }
    if (H < C) {
        var G=$("arrow" + I + H + F + C + A + "d");
        if (G) {
            var D=G.parentNode;
            D.removeChild(G)
        }
    }
    var B=(F - A);
    if (B < 0) {
        B *= -1;
        B -= 1;
        for (var E=0; E < B; E++) {
            treec[I][H][F + (B - E)].setType("empty");
            treec[I][H][F + (B - E)].redraw(false)
        }
    } else {
        B -= 1;
        for (var E=0; E < B; E++) {
            treec[I][H][A - (E - B)].setType("empty");
            treec[I][H][A - (E - B)].redraw(false)
        }
    }
    if (H < C) {
        if ((F - A) != 0) {
            treec[I][H][A].setType("empty");
            treec[I][H][A].redraw(false)
        }
        for (E=1; E < (C - H); E++) {
            treec[I][H + E][A].setType("empty");
            treec[I][H + E][A].redraw(false)
        }
    }
}
function canArrow(A, B, C) {
    A=parseInt(A);
    B=parseInt(B);
    C=parseInt(C);
    if (treec[A][B][C].getType() == "active") {
        return false
    }
    if (treec[A][B][C].getType() == "passive") {
        return false
    }
    if (treec[A][B][C].getType() == "hidden") {
        return false
    }
    return true
}
function validArrowTalent(A, B, C) {
    A=parseInt(A);
    B=parseInt(B);
    C=parseInt(C);
    if (treec[A][B][C].getType() == "active") {
        return true
    }
    if (treec[A][B][C].getType() == "passive") {
        return true
    }
    return false
};
function procesData(data) {
		var maxi=getMaxi();
		for (var k=1; k <= trees; k++) {
			for (var i=1; i <= maxi; i++) {
				for (var j=1; j <= 4; j++) {
					treec[k][i][j].setType("empty");
					treec[k][i][j].redraw(false)
				}
			}
		}
		if (data.substr(0, 1) == "c") {
			var firstIndex=data.indexOf("#");
			var thisclass=data.substr(1, (firstIndex - 2));
			var treeType=data.substr((firstIndex - 1), 1);
			setClass(thisclass);
			switch (treeType) {
			case 0:
				treeTypeNormal();
				break;
			case 1:
				treeTypeTBC();
				break;
			case 2:
				treeTypeWotLK();
				break
			}
		}
		var dataarray=data.split("\n");
		for (var i=0; i < dataarray.length; i++) {
			if (dataarray[i].length > 1) {
				procesTalent(dataarray[i])
			}
		}
		for (var i=0; i < dataarray.length; i++) {
			if (dataarray[i].length > 1) {
				procesTalentPreReqs(dataarray[i])
			}
		}
}
function procesTalent(C) {
    var E=/(\d+)#([AP])#\\{0,1}\"(.*)\\{0,1}\"#\\{0,1}\"(.*)\\{0,1}\"#\\{0,1}\"(.*)\\{0,1}\"#([\d|]*)#(.*)#/i.exec(C);
    var B=E[1];
    if (B.length >= 3) {
        var D=translateSticky(E[1]);
        var A=D[0];
        var G=D[1];
        var H=D[2];
        var F=treec[A][G][H];
        F.setType(cleanData(E[2]));
        F.setTalentname(cleanData(E[3]));
        F.setIcon(cleanData(E[4]));
        F.setDescription(cleanData(E[5]));
        if (F.getType() == "active") {
            procesTalentActive(A, G, H, E[7])
        }
        if (F.getType() == "passive") {
            procesTalentPassive(A, G, H, E[7])
        }
        F.redraw(false)
    }
}
function procesTalentPreReqs(C) {
    var E=/(\d+)#([AP])#\\{0,1}\"(.*)\\{0,1}\"#\\{0,1}\"(.*)\\{0,1}\"#\\{0,1}\"(.*)\\{0,1}\"#([\d|]*)#(.*)#/i.exec(C);
    var B=E[0];
    var D=translateSticky(E[1]);
    var A=D[0];
    var F=D[1];
    var G=D[2];
    procesTalentReqs(A, F, G, E[6])
}
function procesTalentReqs(A, D, E, C) {
    if (C.length < 3) {
        return
    }
    var B=C.split("|");
    for (i=0; i < B.length; i++) {
        treec[A][D][E].addReq(B[i])
    }
}
function procesTalentActive(A, E, F, C) {
    var B=C.split("|");
    if (B.length == 11) {
        var D=treec[A][E][F];
        D.setActiveCost(B[0]);
        D.setActiveCostType(B[1]);
        D.setActiveSpellType(B[2]);
        D.setActiveCastTime(B[3]);
        D.setActiveCooldown(B[4]);
        D.setActiveRangeMin(B[5]);
        D.setActiveRangeMax(B[6]);
        D.setActiveReagents(B[7]);
        D.setActiveItemReq(B[8])
        //D.setActiveRequires(B[8])
        D.setActiveStanceReq(B[9])
        D.setActiveToolReq(B[10])
    }
}
function procesTalentPassive(A, F, G, E) {
    if (E.length < 3) {
        treec[A][F][G].setNumRanks(1);
        return
    }
    var C=E.split("|");
    var D=E.substring(0, 1);
    treec[A][F][G].setNumRanks(D);
    C[0]=C[0].substring(1);
    for (var B=0; B < C.length; B++) {
        treec[A][F][G].setRank((parseInt(B % D) + 1), (parseInt(Math.ceil((B + 0.5) / D)) - 1), C[B])
    }
};
function getMaxi() {
    var A=9;
    switch (treeType) {
    case "WotLK":
        return 11;
    case "TBC":
        return 9;
    case "normal":
        return 7
    case "HPet":
        return 6
    }
}
function redrawAll() {
    var B=getMaxi();
    for (var A=1; A <= trees; A++) {
        for (var D=1; D <= B; D++) {
            for (var C=1; C <= 4; C++) {
                treec[A][D][C].redraw(false)
            }
        }
    }
}
function setClass(A) {
    currentClass=A;
	treen=new Array();
    switch (A) {
		case "Deathknight":
			treen=['鲜血','冰霜','邪恶'];
			break;
		case "Druid":
			treen=['平衡','野性战斗','恢复'];
			break;
		case "Hunter":
			treen=['野兽掌握','射击','生存'];
			break;
		case "Mage":
			treen=['奥术','火焰','冰霜'];
			break;
		case "Paladin":
			treen=['神圣','防护','惩戒'];
			break;
		case "Priest":
			treen=['戒律','神圣','暗影'];
			break;
		case "Rogue":
			treen=['刺杀','战斗','敏锐'];
			break;
		case "Shaman":
			treen=['元素战斗','增强','恢复'];
			break;
		case "Warlock":
			treen=['痛苦','恶魔学识','毁灭'];
			break;
		case "Warrior":
			treen=['武器','狂怒','防护'];
			break
    }
	if(A.indexOf('HPet')!=-1) {
		treen=false;
		var i,j;
		for(i=0;i<HPet.length;i++) {
			for(j=0;j<eval('HPet'+HPet[i]).length;j++) {
				if(eval('HPet'+HPet[i])[j] == A.split('HPet')[1]) {
					treen=[HPetClass[i]];
					A='HPet'+HPet[i];
					break;
				}
			}
		}
	}
    for (i=1; i <= treen.length; i++) {
        treee[i].style.backgroundImage="url(images/talent/bg-"+A+"-"+i+".jpg)";
        $('treeheadertext'+i).innerHTML=treen[i-1]+' (0)'
    }
}
function butclick2(A) {
    if (!A) {
        A=event
    }
    if (A.preventDefault) {
        A.preventDefault()
    } else {
        A.returnResult=false
    }
    if (A.stopPropagation) {
        A.stopPropagation()
    } else {
        A.cancelBubble=true
    }
    return false
}
function butmouseover(B) {
    if (!B) {
        B=event
    }
    if (B.target) {
        elm=B.target
    }
    if (B.srcElement) {
        elm=B.srcElement
    }
    var C=translateElmId(elm.id);
    var A=C[0];
    var D=C[1];
    var E=C[2];
    elm=$(treec[A][D][E].getID());//treec[A][D][E].getCurRank()
	$("t"+A+"r"+D+"p"+E+"b").style.backgroundPosition=(treec[A][D][E].reqsAreOk() && (treec[A][D][E].getCurRank() >0 || pointlock == 0 || ((treep[1] + treep[2] + treep[3]) < pointlock)))?"-80px 0px":"-40px 0px";
    treec[A][D][E].doTooltip();
}
function butmouseout(B) {
    if (!B) {
        B=event
    }
    if (B.target) {
        elm=B.target
    }
    if (B.srcElement) {
        elm=B.srcElement
    }
	var C=translateElmId(elm.id);
	var A=C[0];
	var D=C[1];
	var E=C[2];
	$("t"+A+"r"+D+"p"+E+"b").style.backgroundPosition="0px 0px"
    hideTooltip()
}
function schoolHover(C) {
    counts=0;
    countt=0;
    counta=0;
    countp=0;
    var A=getMaxi();
    for (var D=1; D <= A; D++) {
        for (var B=1; B <= 4; B++) {
            counts += parseInt(treec[C][D][B].getCurRank());
            countt += parseInt(treec[C][D][B].getNumRanks());
            if (treec[C][D][B].getType() == "active") {
                counta += 1
            }
            if (treec[C][D][B].getType() == "passive") {
                countp += 1
            }
        }
    }
    treep[C]=counts;
    tooltipcelm.innerHTML="<strong>" + treen[C-1] + "</strong><br />" + L("已在该系投入的点数：") + counts + "<br />" + L("该系总天赋点数：") + countt + "<br />" + L("该系主动天赋数：") + counta + "<br />" + L("该系被动天赋数：") + countp;
    var E=$("treeheader" + C);
    showTooltip(E, true)
}
function hideTooltip() {
    tooltipelm.style.display="none"
}
function showTooltip(F, A) {
    tooltipelm.style.display="";
	var ii=tooltipelm;
	var im=F;
	var offsetY=(navigator.userAgent.indexOf("Safari")!=-1) ? window.pageYOffset : ((document.documentElement.scrollTop)?document.documentElement.scrollTop:document.body.scrollTop);
	var cW=(document.body.clientWidth) ? document.body.clientWidth: window.innerWidth;
	var cH=(document.documentElement.clientHeight) ? document.documentElement.clientHeight:((document.body.clientHeight)?document.body.clientHeight: window.innerHeight);
	var ftop=(A == true)?F.offsetTop+F.offsetHeight:F.offsetTop-ii.offsetHeight+2;
	var fleft=(A == true)?F.offsetLeft:F.offsetLeft+44;
	var fdiv=F;
	while(fdiv.offsetParent) {
		fdiv=fdiv.offsetParent;
		ftop += fdiv.offsetTop;
		fleft += fdiv.offsetLeft;
	}
	ii.style.display='block';
	if(A == true) {
		ii.style.top=ftop+'px';
	} else {
		ii.style.top=ftop+"px";
		if(ftop < obj_top($("tree1")) || ftop < offsetY) { //offsetY
			if(ftop+ii.offsetHeight+44+ii.offsetHeight - offsetY > cH) {
				ii.style.top=cH - ii.offsetHeight + offsetY - 1 + "px";
			} else {
				ii.style.top=ftop+ii.offsetHeight+44+"px";
			}
		}
	}
	if(fleft+ii.offsetWidth>cW) {
		ii.style.left=fleft-ii.offsetWidth-42+'px';
	} else {
		ii.style.left=fleft+'px';
	}
}
function translateElmId(A) {
    A.match(/t(\d+)r(\d+)p(\d+)/);
    return [RegExp.$1, RegExp.$2, RegExp.$3]
}
function translateSlash(A) {
    A.match(/(\d+)\/(\d+)\/(\d+)/);
    return [RegExp.$1, RegExp.$2, RegExp.$3]
}
function translateSticky(A) {
    A.match(/([1|2|3])(\d+)([1|2|3|4])/);
    return [RegExp.$1, RegExp.$2, RegExp.$3]
};
var translator=new Array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z");
function genTalent() {
    tooltipelm=$("tooltipbox");
    tooltipcelm=$("tooltipcontent");
    hideTooltip();
	treep=[0,0,0,0]
	if(isHPet) {
		trees=1;
		treept=3;
		treeType='WotLK';
	} else {
		trees=3;
		treept=5;
		treeType='WotLK';
	}
	if(typeof treec[1] == "undefined") {
		for (var C=1; C <= 3; C++) {
			oldtrees=trees;
			var B=getMaxi();
			treec[C]=new Array(B);
			treep[C]=0;
			treee[C]=$("tree" + C);
			treet[C]=obj_top(treee[C]);
			treel[C]=obj_left(treee[C]);
			var F=$("treeheader" + C);
			var A=$("treeheaderimg" + C);
			addListener(F, "mouseover", BindArgument(schoolHover, C));
			addListener(F, "mouseout", hideTooltip);
			addListener(F, "mouseup", butclick2);
			addListener(F, "mousedown", butclick2);
			addListener(A, "mouseup", BindArgument(ResetTree, C));
			addListener(treee[C], "mouseup", butclick2);
			addListener(treee[C], "mousedown", butclick2);
			addListener(treee[C], "contextmenu", butclick2);
			addListener(treee[C], "mouseover", butclick2);
			addListener(treee[C], "mouseout", butclick2);
			addListener(treee[C], "dragstart", butclick2);
			addListener(treee[C], "selectstart", butclick2);
			for (var E=1; E <= B; E++) {
				treec[C][E]=new Array(4);
				for (var D=1; D <= 4; D++) {
					treec[C][E][D]=new TalentObj(C, E, D)
				}
			}
		}
	} else {
		reposAll2();
	}
	if (treet[1]==0) return;
    setClass(currentClass);
    procesData(eval('taldata_'+currentClass));
	taldate();
	loadBuild();
    updatePointsOverview();
	redrawAll();
	if(autoFilloOut=='') {
		if(isHPet) {
			setPoinLock(16)
		} else {
			setPoinLock(71)
		}
	}
	createBuildLink()
};
function butclick(B) {
    if (!B) {
        B=event
    }
    if (B.target) {
        elm=B.target
    }
    if (B.srcElement) {
        elm=B.srcElement
    }
    var C=translateElmId(elm.id);
    var A=C[0];
    var E=C[1];
    var F=C[2];
    if (treec[A][E][F].getType() == "empty") {
        return false
    }
    if (B.shiftKey == true) {
        treec[A][E][F].subPoint();
        updatePointsOverview(A)
    } else {
        if (treec[A][E][F].reqsAreOk()) {
            treec[A][E][F].addPoint();
            updatePointsOverview(A)
        }
    }
    treec[A][E][F].doTooltip();
	createBuildLink();
    return false
}
function butrclick(B) {
    if (!B) {
        B=event
    }
    if (B.target) {
        elm=B.target
    }
    if (B.srcElement) {
        elm=B.srcElement
    }
    var C=translateElmId(elm.id);
    var A=C[0];
    var E=C[1];
    var F=C[2];
    if (treec[A][E][F].getType() == "empty") {
        return false
    }
	treec[A][E][F].subPoint();
	updatePointsOverview(A)
    treec[A][E][F].doTooltip();
	createBuildLink();
    return false
}
function ResetTrees() {
    var B=getMaxi();
    for (var A=1; A <= 3; A++) {
        treep[A]=0;
        for (var D=1; D <= 11; D++) {
            for (var C=1; C <= 4; C++) {
                treec[A][D][C].setCurRank(0);
                treec[A][D][C].redraw(false)
            }
        }
    }
    updatePointsOverview()
	createBuildLink()
}
function ResetTree(A) {
	treep[A]=0;
	var B=getMaxi();
	for (var D=1; D <= 11; D++) {
		for (var C=1; C <= 4; C++) {
			treec[A][D][C].setCurRank(0);
			treec[A][D][C].redraw(false)
		}
	}
	updatePointsOverview();
	createBuildLink()
}
function redrawAll() {
    var B=getMaxi();
    for (var A=1; A <= trees; A++) {
        treep[A]=0;
        for (var D=1; D <= B; D++) {
            for (var C=1; C <= 4; C++) {
                treep[A] += parseInt(treec[A][D][C].getCurRank())
            }
        }
    }
    for (var A=1; A <= trees; A++) {
        for (var D=1; D <= B; D++) {
            for (var C=1; C <= 4; C++) {
                treec[A][D][C].redraw(false)
            }
        }
    }
    updatePointsOverview()
}
function updatePointsOverview() {
	if(trees==1) {
		pointsummary[0]=treep[1];
		pointsummary[1]=(pointsummary[0]==0)?1:(pointsummary[0]*4+16);
		pointsummary[1]=(isHPet_BM)?((pointsummary[1]<=76)?60:pointsummary[1]-16):pointsummary[1];
		pointsummary[2]='';
		var title=pointsummary[0];
	} else {
		pointsummary[0]=treep[1]+treep[2]+treep[3];
		pointsummary[1]=(pointsummary[0]==0)?1:(pointsummary[0]+9);
		var title=treep[1]+'/'+treep[2]+'/'+treep[3];
		pointsummary[2]=(pointsummary[0]==0)?'':' ('+title+')';
	}
    $("pointsused").innerHTML=pointsummary[0] + pointsummary[2];
    $("levelneeded").innerHTML=pointsummary[1];
	changeDocTitle(classesn[getClassId(currentClass)] + ' (' + title + ')');
    for (var A=1; A <= trees; A++) {
        $("treeheadertext" + A).innerHTML=treen[A-1] + " (" + treep[A] + ")"
    }
}
function loadBuild() {
    if (autoFilloOut.length == 0) {
        return
    }
	var pl=0;
	if(autoFilloOut.substr(1,1)=='B') {
		isHPet_BM=true;
		$('talent_b_bm_t').innerHTML='已学习野兽掌握';
		text_bm_l='<font style="color:#f00">点击遗忘</font>';
	}
    switch (autoFilloOut.charAt(0)) {
		case "9":
			pl=0;
			autoFilloOut=autoFilloOut.substring(1);
			break;
		case "8":
			pl=(isHPet)?11:51;
			autoFilloOut=(isHPet_BM)?autoFilloOut.substring(2):autoFilloOut.substring(1);
			break;
		case "7":
			pl=(isHPet)?13:61;
			autoFilloOut=(isHPet_BM)?autoFilloOut.substring(2):autoFilloOut.substring(1);
			break;
		case "6":
			pl=(isHPet)?16:71;
			autoFilloOut=(isHPet_BM)?autoFilloOut.substring(2):autoFilloOut.substring(1);
			break;
		default:
			pl=0;
			break
    }
	setPoinLock(pl);
    for (var C=(translator.length - 1); C > 1; C--) {
        autoFilloOut=autoFilloOut.replace(translator[C], stringFill("0", C))
    }
    var D="0/0/0";
    for (var C=0; C < autoFilloOut.length; C++) {
        var B=translateSlash(D);
        var A=B[0];
        var E=B[1];
        var F=B[2];
        D=getNext(A, E, F);
        if (D == "") {
            return
        }
        B=translateSlash(D);
        A=B[0];
        E=B[1];
        F=B[2];
        treec[A][E][F].setCurRank(parseInt(autoFilloOut.charAt(C)))
    }
}
function getNext(A, F, G) {
    var C=getMaxi();
    if (A == 0 && F == 0 && G == 0) {
        for (var B=1; B <= trees; B++) {
            for (var E=1; E <= C; E++) {
                for (var D=1; D <= 4; D++) {
                    if (treec[B][E][D].getType() == "passive" || treec[B][E][D].getType() == "active") {
                        return B + "/" + E + "/" + D
                    }
                }
            }
        }
    } else {
        A=Math.min(A, 3);
        A=Math.max(A, 1);
        F=Math.min(F, C);
        F=Math.max(F, 1);
        G=Math.min(G, 4);
        G=Math.max(G, 1);
        for (var B=A; B <= trees; B++) {
            for (var E=1; E <= C; E++) {
                if (A == B && E < F) {
                    continue
                }
                for (var D=1; D <= 4; D++) {
                    if (A == B && F == E && G == D) {
                        continue
                    }
                    if (A == B && F == E && D < G) {
                        continue
                    }
                    if (treec[B][E][D].getType() == "passive" || treec[B][E][D].getType() == "active") {
                        return B + "/" + E + "/" + D
                    }
                }
            }
        }
    }
    return ""
}
function createBuildLink() {
    var C=getMaxi();
    var A="";
    for (var B=1; B <= trees; B++) {
        for (var E=1; E <= C; E++) {
            for (var D=1; D <= 4; D++) {
                if (treec[B][E][D].getType() == "passive" || treec[B][E][D].getType() == "active") {
                    A += treec[B][E][D].getCurRank().toString()
                }
            }
        }
    }
    for (var E=(translator.length - 1); E > 1; E--) {
        A=A.replace(stringFill("0", E), translator[E])
    }
    switch (pointlock) {
		default:
		case 0:
			A="9" + A;
			break;
		case 51:
			A="8" + A;
			break;
		case 61:
			A="7" + A;
			break;
		case 71:
			A="6" + A;
			break
		case 11: // Hunter Pet lv.60
			A="8" + A;
			break;
		case 15: // Hunter Pet Lv.60 + Mastery
			A="8B" + A;
			break;
		case 13: // Hunter Pet lv.70
			A="7" + A;
			break;
		case 17: // Hunter Pet lv.70 + Mastery
			A="7B" + A;
			break;
		case 16: // Hunter Pet lv.80
			A="6" + A;
			break
		case 20: // Hunter Pet lv.80 + Mastery
			A="6B" + A;
			break
    }
	var l=thref+'#'+currentClass+'='+A
	$('talent_l').innerHTML='<a href='+l+'>'+l+'</a>';
}
function setPoinLock(A,R) {
	var lim=(isHPet_BM)?A+4:A;
	if (A > 0 && treep[1] + treep[2] + treep[3] > lim) {
		redrawAll();
		if (treep[1] + treep[2] + treep[3] > lim) {
			warningLock();
			return
		}
	}
	var lvli=(isHPet)?(A*4+16):(A+9);
	var BMshow=(isHPet)?';$(\'talent_b_bm\').style.display=\'block\'':'';
	var BMoff=(isHPet)?';HPet_BM_Off();updatePointsOverview();$(\'talent_b_bm\').style.display=\'none\'':'';
	$("pointlock80").innerHTML='<a href="javascript:?" onclick="setPoinLock('+((isHPet)?'16':'71')+',true)'+BMshow+'">80</a>';
	$("pointlock70").innerHTML='<a href="javascript:?" onclick="setPoinLock('+((isHPet)?'13':'61')+',true)'+BMshow+'">70</a>';
	$("pointlock60").innerHTML='<a href="javascript:?" onclick="setPoinLock('+((isHPet)?'11':'51')+',true)'+BMshow+'">60</a>';
	$("pointlock0").innerHTML='<a href="javascript:?" onclick="setPoinLock(0,true)'+BMoff+'">无限制</a>';
    switch (A) {
		default:
			$('pointlock'+lvli).innerHTML='<b>'+lvli+'</b>';
			break;
		case 0:
			$('pointlock0').innerHTML='<b>无限制</b>';
			break
		case 13:
			$('pointlock70').innerHTML='<b>70</b>';
			break
    }
    pointlock=(isHPet_BM)?A+4:A;
    redrawAll();
	if(R) {
		createBuildLink()
	}
}
function hideAC() {
    var A=$("actext");
    A.style.display="none";
    A=$("achideshow");
    A.innerHTML='(<a href="javascript:showAC()">' + L("show") + "</a>)";
    reposAll()
}
function showAC() {
    var A=$("actext");
    A.style.display="";
    A=$("achideshow");
    A.innerHTML='(<a href="javascript:hideAC()">' + L("hide") + "</a>):";
    reposAll()
}

function reposAll() {
    for (var B=1; B <= trees; B++) {
        treet[B]=obj_top(treee[B]);
        treel[B]=obj_left(treee[B])
    }
    var A=getMaxi();
    for (var B=1; B <= trees; B++) {
        for (var D=1; D <= A; D++) {
            for (var C=1; C <= 4; C++) {
                treec[B][D][C].reposition()
            }
        }
    }
}
function showhideRedirect(A) {
    if (A.value == 1) {
        $("redirecttargetbody").style.display=""
    } else {
        $("redirecttargetbody").style.display="none"
    }
}
function proccesDeleteResParsed(A) {
    switch (A.substr(0, 4)) {
    case "dis:":
    case "err:":
        alert(L("Unable to delete and/or redirect tree: ") + A.substr(4));
        break;
    case "nost":
        alert(L("The redirect target was not found."));
        break;
    case "noal":
        alert(L("You are not allowed to redirect to that tree"));
        break;
    case "dele":
        if (confirm(L("You tree has been successfully deleted. Do you wish to go to the overview page?"))) {
            searchMyTree()
        } else {
            $("treeRatebox").style.display="none"
        }
        break;
    case "redi":
        if (confirm(L("You tree has been successfully redirected. Do you wish to go to the overview page?"))) {
            searchMyTree()
        } else {
            $("treeRatebox").style.display="none"
        }
        break;
    default:
        alert(L("Invalid server responds. Reload the page to see if the request was successful."));
        break
    }
}
function talenttable() {
	$('talent_cv').innerHTML=cver;

	var t='<table id="talent_t" cellSpacing="0" cellPadding="0" border="0"><tr>';
	for(var i=1;i<=3;i++) {
		t += '<td class="talentheader" align="right">'
		t += '<div id="treeheader'+i+'"><b id="treeheadertext'+i+'">'
		t += (i==1)?'请选择职业':'&nbsp;';
		t += '</b><a id="treeheaderimg'+i+'" class="button1" href="javascript:;" style="float:right;margin:4px 6px 0px 0px"><b>重置</b></a></div>'
		t += '</td>'
	}
	t += '</tr><tr>'
	for(i=1;i<=3;i++) {
		t += '<td class="outerbg" id="tree'+i+'">'
		for(var j=1;j<=11;j++) {
			for(var k=1;k<=4;k++) {
				t += '<div class="button" id="t'+i+'r'+j+'p'+k+'"><div class="buttonicon" id="t'+i+'r'+j+'p'+k+'ii"></div><div class="buttonnumber" id="t'+i+'r'+j+'p'+k+'c"></div><div class="buttonborder" id="t'+i+'r'+j+'p'+k+'b"></div><div class="buttonoborder" id="t'+i+'r'+j+'p'+k+'i"></div></DIV>'
			}
		}
		t += '</td>'
	}
	t += '</tr></table>'
	t += '<div id="tooltipbox" style="display:none">'
	t += '<table cellSpacing="0" cellPadding="0" width="100%" border="0">'
	t += '<tbody><tr>'
	t += '<td id="tooltipcontent"></td>'
	t += '<th style="background-position:right top"></th></tr>'
	t += '<tr>'
	t += '<th style="background-position:left bottom"></th>'
	t += '<th style="background-position:right bottom;width:8px"></th></tr></tbody></table></div>'

	document.write(t);
}
function reposAll2() {
    for (var B=1; B <= trees; B++) {
        treet[B]=obj_top(treee[B]);
        treel[B]=obj_left(treee[B])
    }
    var A=getMaxi();
    for (var B=1; B <= trees; B++) {
        for (var D=1; D <= A; D++) {
            for (var C=1; C <= 4; C++) {
				if(treec[B][D][C]) {
					treec[B][D][C].repos()
				}
            }
        }
    }
	warningdivResize();
}
TalentObj.prototype.repos=function repos() {
    this.butbg.style.left=(iconpos[1] + iconpos[0] * (this.getPos() - 1) + treel[this.getTree()]) + "px";
    this.butbg.style.top=(iconpos[2] + iconpos[0] * (this.getRow() - 1) + treet[this.getTree()]) + "px";
    for (var D=0; D < this.reqs.length; D++) {
        var A=translateSticky(this.reqs[D]);
		var I=this.getTree();
		var H=A[1];
        var F=A[2];
    }
	var I=this.getTree();
    var C=this.getRow();
    var A=this.getPos();
    var B=(A - F);
    var E=$("tree" + I);
	if($("arrow" + I + H + F + C + A) || $("arrow" + I + H + F + C + A + "d")) {
		if (B > 0) {
			$("arrow" + I + H + F + C + A).style.left=obj_left(E)+iconpos[1]+iconpos[0]*F-iconpos[5]-2+"px";
			$("arrow" + I + H + F + C + A).style.top=obj_top(E)+iconpos[2]+iconpos[0]*(H-1)+(iconpos[0]-iconpos[3])/2+"px";
		}
		if (B < 0) {
			$("arrow" + I + H + F + C + A).style.top=obj_top(E)+iconpos[2]+iconpos[0]*(H-1)+(iconpos[0]-iconpos[3])/2+"px";
			if (H < C) {
				$("arrow" + I + H + F + C + A).style.left=obj_left(E)+iconpos[0]*(F-1)-iconpos[0]*(possideways-1)-10+"px";
			} else {
				$("arrow" + I + H + F + C + A).style.left=obj_left(E)+iconpos[0]*(F-1)-iconpos[0]*(possideways-1)+iconpos[5]+"px";
			}
		}
		if (H < C) {
			$("arrow" + I + H + F + C + A + "d").style.left=obj_left(E)+(iconpos[0]-iconpos[3])/2+iconpos[1]+iconpos[0]*(A-1)+"px";
			if (B != 0) {
				$("arrow" + I + H + F + C + A + "d").style.top=obj_top(E)+iconpos[2]+iconpos[0]*(H-1)+iconpos[0]/2+"px";
			} else {
				$("arrow" + I + H + F + C + A + "d").style.top=obj_top(E)+iconpos[2]+iconpos[0]*H-iconpos[5]-2+"px";
			}
		}
	}
};
function warningLock(){warningdivShow('错误','不可设置该等级限制，已分配天赋点数过多。','400')}
function gen_tlink(ID){
	document.write('<a id="talent_c'+ID+'" href="#'+classes[ID]+'" onclick="loadTalent(\''+classes[ID]+'\')" onmouseover="tt_t(\''+classesn[ID]+'\')" onmouseout="atlasOline_hi()"><img src="images/icon/c-m/c-'+classes[ID].toLowerCase()+'.gif" /></a>')
}
function HPet_BM_Off(){
	isHPet_BM=false;
	$('talent_b_bm_t').innerHTML='未学习野兽掌握';
	text_bm_l='<font style="color:#0f0">点击学习</font>';
}
function HPet_BM(off){
	if(pointlock!=0){
		if(off||isHPet_BM){
			if(treep[1]<pointlock-4){
				HPet_BM_Off();
				pointlock-=4;
			}else{
				warningLock();
			}
		}else{
			isHPet_BM=true;
			$('talent_b_bm_t').innerHTML='已学习野兽掌握';
			text_bm_l='<font style="color:#f00">点击遗忘</font>';
			pointlock+=4;
			if(treep[1]==pointlock-4){redrawAll();}
		}
		$('atlasoline_iTTc').innerHTML=text_bm+text_bm_l;
	}
}
function hpets_show(){showDiv('hpets');$('hpetlink').style.display='none';}
function hpets_hide(){
	timeDivHide[1]='hpets';
	timeDivHide[0]=setTimeout(function(){
									$(timeDivHide[1]).style.display='none';
									$('hpetlink').style.display='block';
								},300);
}
function taldate(){
	var tdate=eval('taldate_'+currentClass).split('-');
	$('talent_lu').innerHTML=tdate[0]+'年'+tdate[1]+'月'+tdate[2]+'日';
}
function getClassId(c){
	var r='';
	for(var i=0;i<classes.length;i++){
		if(classes[i]==c){r=i;}
	}
	return r;
}
function validHash(){
	var thashv=false;
	thash=thash.substr(1);
	var cl=(thash)?((thash.indexOf('=')!=-1)?thash.split('=')[0]:thash):false;
	if(cl){
		for(var i=0;i<classes.length;i++) {
			if(classes[i]==cl){thashv=true;}
		}
	}
	if(thashv){return cl;}else{return thashv;}
}
function validClass(c){
	var cl=false;
	for(var i=0;i<classes.length;i++) {
		if(classes[i]==c){cl=true;}
	}
	return cl;
}
function clearup(){
	for(var i=1;i<=trees;i++){
		$('treeheadertext'+i).innerHTML=((i==1)?'天赋数据载入中……':'&nbsp;');
		$('tree'+i).style.backgroundImage='url(images/p-b.gif)';
		for(var j=1;j<=getMaxi();j++){
			for(var k=1;k<=4;k++){$('t'+i+'r'+j+'p'+k).style.display='none';}
		}
	}
	for(var i=0;i<arrowlist.length;i++){$(arrowlist[i]).style.display='none';}
	arrowlist=new Array();
	isHPet_BM=false;
	$('hpets').style.display='none';
	$('hpetlink').style.display='block';
	thash='';
	window.frames["comments"].location.replace('about:blank');
}
function pagejump(p){window.scrollTo(0,p)}
function classsubinfo(c){
	var tinfo='<a href="javascript:;" onclick="pagejump('+(tableheight+580)+')">参与评论</a>';
	if(classesskill[getClassId(c)]) {
		tinfo+=' | <a href="http://wow.gamespot.com.cn/'+classesskill[getClassId(c)]+'.shtml" target="_blank">';
		tinfo+=(c=='Deathknight')?'死亡骑士技能详解</a> | <a href="http://wow.gamespot.com.cn/2008/0613/79943.shtml" target="_blank">死亡骑士职业简介':classesn[getClassId(c)]+'技能变动与新增技能';
		tinfo+='</a>';
	}
	if(isHPet){
		tinfo+=' | <a href="http://wow.gamespot.com.cn/hunterpet.shtml" target="_blank">全部宠物数据</a>';
	}
	$('talent_sub').innerHTML=tinfo;
}
function genPetSelection() {
	var t=$('tree1').style.backgroundImage;
		t += '123';
	return t;
}
function loadTalent(c,h){
	clearup();
	isHPet=(c.indexOf('HPet')!=-1)?true:false;
	if(!h){autoFilloOut='';}
	if(isHPet){
		tableheight=375;
		$('talent_t').style.width='300px';
		$('tree1').style.height=tableheight+'px';
		$('treeheader1').style.width='300px';
		for(var i=2;i<=3;i++){
			$('tree'+i).style.height=tableheight+'px';
			$('treeheader'+i).style.display='none';
		}
		$('talent_b_ra').style.display='none';
		$('talent_b_bm').style.display='block';
	}else{
		tableheight=680;
		$('talent_t').style.width='900px';
		$('tree1').style.height=tableheight+'px';
		$('treeheader1').style.width='300px';
		for(var i=2;i<=3;i++){
			$('tree'+i).style.height=tableheight+'px';
			$('treeheader'+i).style.width='300px';
			$('treeheader'+i).style.display='block';
		}
		$('talent_b_bm').style.display='none';
		$('talent_b_ra').style.display='block';
	}
	for(var i=1;i<=3;i++){treel[i]=obj_left($('treeheader'+i));}
	if(currentClass){
		$('talent_c'+getClassId(currentClass)).style.display='block';
		$('talent_ci').src='images/icon/c-l/default.gif';
	}else{
		$('talent_cc').style.display='block'
		$('talent').style.display='block';
		$('cfrighti').style.display='block';
		$('talent_ver').style.display='none';
	}
	if(validClass(c)){
		currentClass=c;
		$('talent_sub').innerHTML='';
		$('talent_c'+getClassId(c)).style.display='none';
		$('talent_ci').src='images/icon/c-l/c-'+c.toLowerCase()+'.gif';
		$('talent_cn').innerHTML=classesn[getClassId(c)];
		$('talent_l').innerHTML='<a href='+thref+'#'+c+'>'+thref+'#'+c+'</a>';
		$('talent_com').style.display='block';
		$('comments').style.height='72px';
		classsubinfo(c);
		window.frames["comments"].location.replace('http://www.gamespot.com.cn/wow/comment/?document_id='+classesaid[getClassId(c)]);
		var talentload=new lJS('utf-8');
		talentload.onsuccess=function(){setTimeout(function(){genTalent()},5);}
		talentload.onfailure=function(){loadTalent(c)}
		talentload.load('data/talent/wotlk_'+c+'.js?'+cver.split('.')[3]+((clbuild[getClassId(c)]!='')?'v'+clbuild[getClassId(c)]:''));
		cmsstat=document.createElement("script");
		cmsstat.type="text/javascript";
		cmsstat.src='http://www.gamespot.com.cn/cms_stat.php?url=http://wow.gamespot.com.cn/'+classesapath[getClassId(c)]+'/'+classesaid[getClassId(c)]+'.shtml&classid=31&subclassid=128&grandsubclassid=0&type=article&username=huxin';
		document.getElementsByTagName("head")[0].appendChild(cmsstat);
	}
}
if(bIE){lCSS("style/talent-ie.css");if(bIE6){lCSS("style/talent-ie6.css")}}
window.onerror=doNothing;
//window.onload=reposAll2;
window.onresize=reposAll2;