/* World of Warcraft Recruit By Talent Widget
 * by Rob G (Mottie) 2010
 * http://mottie.guildportal.com
 * Dual licensed under the MIT or GPL Version 2.
 */
var talents = {"root": [{
  "name"  : "Death Knight",
  "objnm" : "deathknight",
  "icon"  : "http://www.axiomfiles.com/Files/278466/icon_class_deathknight.png",
  "color" : "#c41f3b",
  "tree1" : [ "Blood", "http://www.axiomfiles.com/Files/278466/icon_deathknight_blood.png" ],
  "tree2" : [ "Frost", "http://www.axiomfiles.com/Files/278466/icon_deathknight_frost.png" ],
  "tree3" : [ "Unholy", "http://www.axiomfiles.com/Files/278466/icon_deathknight_unholy.png" ]
 },{
  "name"  : "Druid",
  "objnm" : "druid",
  "icon"  : "http://www.axiomfiles.com/Files/278466/icon_class_druid.png",
  "color" : "#ff7d0a",
  "tree1" : [ "Balance", "http://www.axiomfiles.com/Files/278466/icon_druid_balance.png" ],
  "tree2" : [ "Feral", "http://www.axiomfiles.com/Files/278466/icon_druid_feral.png" ],
  "tree3" : [ "Restoration", "http://www.axiomfiles.com/Files/278466/icon_druid_restoration.png" ]
 },{
  "name"  : "Hunter",
  "objnm" : "hunter",
  "icon"  : "http://www.axiomfiles.com/Files/278466/icon_class_hunter.png",
  "color" : "#abd473",
  "tree1" : [ "Beast Mastery", "http://www.axiomfiles.com/Files/278466/icon_hunter_beast_mastery.png" ],
  "tree2" : [ "Marksmanship", "http://www.axiomfiles.com/Files/278466/icon_hunter_marksmanship.png" ],
  "tree3" : [ "Survival", "http://www.axiomfiles.com/Files/278466/icon_hunter_survival.png" ]
 },{
  "name"  : "Mage",
  "objnm" : "mage",
  "icon"  : "http://www.axiomfiles.com/Files/278466/icon_class_mage.png",
  "color" : "#69ccf0",
  "tree1" : [ "Arcane", "http://www.axiomfiles.com/Files/278466/icon_mage_arcane.png" ],
  "tree2" : [ "Fire", "http://www.axiomfiles.com/Files/278466/icon_mage_fire.png" ],
  "tree3" : [ "Frost", "http://www.axiomfiles.com/Files/278466/icon_mage_frost.png" ]
 },{
  "name"  : "Paladin",
  "objnm" : "paladin",
  "icon"  : "http://www.axiomfiles.com/Files/278466/icon_class_paladin.png",
  "color" : "#f58cba",
  "tree1" : [ "Holy", "http://www.axiomfiles.com/Files/278466/icon_paladin_holy.png" ],
  "tree2" : [ "Protection", "http://www.axiomfiles.com/Files/278466/icon_paladin_protection.png" ],
  "tree3" : [ "Retribution", "http://www.axiomfiles.com/Files/278466/icon_paladin_retribution.png" ]
 },{
  "name"  : "Priest",
  "objnm" : "priest",
  "icon"  : "http://www.axiomfiles.com/Files/278466/icon_class_priest.png",
  "color" : "#ffffff",
  "tree1" : [ "Discipline", "http://www.axiomfiles.com/Files/278466/icon_priest_discipline.png" ],
  "tree2" : [ "Holy", "http://www.axiomfiles.com/Files/278466/icon_priest_holy.png" ],
  "tree3" : [ "Shadow", "http://www.axiomfiles.com/Files/278466/icon_priest_shadow.png" ]
 },{
  "name"  : "Rogue",
  "objnm" : "rogue",
  "icon"  : "http://www.axiomfiles.com/Files/278466/icon_class_rogue.png",
  "color" : "#fff569",
  "tree1" : [ "Assassination", "http://www.axiomfiles.com/Files/278466/icon_rogue_assassination.png" ],
  "tree2" : [ "Combat", "http://www.axiomfiles.com/Files/278466/icon_rogue_combat.png" ],
  "tree3" : [ "Subtlety", "http://www.axiomfiles.com/Files/278466/icon_rogue_subtlety.png" ]
 },{
  "name"  : "Shaman",
  "objnm" : "shaman",
  "icon"  : "http://www.axiomfiles.com/Files/278466/icon_class_shaman.png",
  "color" : "#2459ff",
  "tree1" : [ "Elemental", "http://www.axiomfiles.com/Files/278466/icon_shaman_elemental.png" ],
  "tree2" : [ "Enhancement", "http://www.axiomfiles.com/Files/278466/icon_shaman_enhancement.png" ],
  "tree3" : [ "Restoration", "http://www.axiomfiles.com/Files/278466/icon_shaman_restoration.png" ]
 },{
  "name"  : "Warlock",
  "objnm" : "warlock",
  "icon"  : "http://www.axiomfiles.com/Files/278466/icon_class_warlock.png",
  "color" : "#9482c9",
  "tree1" : [ "Affliction", "http://www.axiomfiles.com/Files/278466/icon_warlock_affliction.png" ],
  "tree2" : [ "Demonology", "http://www.axiomfiles.com/Files/278466/icon_warlock_demonology.png" ],
  "tree3" : [ "Destruction", "http://www.axiomfiles.com/Files/278466/icon_warlock_destruction.png" ]
 },{
  "name"  : "Warrior",
  "objnm" : "warrior",
  "icon"  : "http://www.axiomfiles.com/Files/278466/icon_class_warrior.png",
  "color" : "#c79c6e",
  "tree1" : [ "Arms", "http://www.axiomfiles.com/Files/278466/icon_warrior_arms.png" ],
  "tree2" : [ "Fury", "http://www.axiomfiles.com/Files/278466/icon_warrior_fury.png" ],
  "tree3" : [ "Protection", "http://www.axiomfiles.com/Files/278466/icon_warrior_protection.png" ]
 }
]};

function recruitByTalent(b){function f(e){if(e.match("l|low|L|Low"))return"Low";if(e.match("m|med|medium|M|Med|Medium"))return"Medium";if(e.match("h|high|H|High"))return"High";return c.defaultNeed}function i(e){if(e.match("l|low|L|Low"))return k;if(e.match("m|med|medium|M|Med|Medium"))return l;if(e.match("h|high|H|High"))return m;return cd}function g(e){function j(h){return isNaN(h)?"00":hexDigits[(h-h%16)/16]+hexDigits[h%16]}e=e.replace(/[rgb\)\(]/g,"").split(",");hexDigits=["0","1","2","3","4",
"5","6","7","8","9","a","b","c","d","e","f"];return"#"+j(e[0])+j(e[1])+j(e[2])}var a,d,k,l,m;b=$.extend({},{defaultNeed:"Low",colorBackground:true,useClassColors:true,tooltipWidth:150,deathknight:"-,-,-",druid:"-,-,-",hunter:"-,-,-",mage:"-,-,-",paladin:"-,-,-",priest:"-,-,-",rogue:"-,-,-",shaman:"-,-,-",warlock:"-,-,-",warrior:"-,-,-"},b);var c=$.meta?$.extend({},b,this.data()):b;switch(c.defaultNeed.toLowerCase()){case "l":case "low":c.defaultNeed="Low";break;case "m":case "med":case "medium":c.defaultNeed=
"Medium";break;case "h":case "high":c.defaultNeed="High";break;default:c.defaultNeed="None";break}a='<div id="testsetcolors" style="display:none;"><p class="none"/><p class="low"/><p class="medium"/><p class="high"/></div>';$("body").append(a);a=$("#testsetcolors");k=g(a.find(".low").css("color"));l=g(a.find(".medium").css("color"));m=g(a.find(".high").css("color"));cd=g(a.find("."+c.defaultNeed.toLowerCase()).css("color"));a.remove();a='<table width="100%"><tbody>';for(b=0;b<talents.root.length;b++){d=
c[talents.root[b].objnm].split(",");a+='<tr><td class="classIcon"><img src="'+talents.root[b].icon+'" alt="" /><span';a+=c.useClassColors?' style="color:'+talents.root[b].color+'">':">";a+=talents.root[b].name+'</span></td><td class="talentIcons">';a+='<img class="tooltip '+f(d[0]).toLowerCase()+'" src="'+talents.root[b].tree1[1]+'" title="<center><span class=';a+=c.colorBackground?"usebg>"+talents.root[b].tree1[0]+": "+f(d[0])+'</span></center>" rel="'+c.tooltipWidth+","+i(d[0])+'" /> ':f(d[0]).toLowerCase()+
">"+talents.root[b].tree1[0]+": "+f(d[0])+'</span></center>" rel="'+c.tooltipWidth+'" /> ';a+='<img class="tooltip '+f(d[1]).toLowerCase()+'" src="'+talents.root[b].tree2[1]+'" title="<center><span class=';a+=c.colorBackground?"usebg>"+talents.root[b].tree2[0]+": "+f(d[1])+'</span></center>" rel="'+c.tooltipWidth+","+i(d[1])+'" /> ':f(d[1]).toLowerCase()+">"+talents.root[b].tree2[0]+": "+f(d[1])+'</span></center>" rel="'+c.tooltipWidth+'" /> ';a+='<img class="tooltip '+f(d[2]).toLowerCase()+'" src="'+
talents.root[b].tree3[1]+'" title="<center><span class=';a+=c.colorBackground?"usebg>"+talents.root[b].tree3[0]+": "+f(d[2])+'</span></center>" rel="'+c.tooltipWidth+","+i(d[2])+'" />':f(d[2]).toLowerCase()+">"+talents.root[b].tree3[0]+": "+f(d[2])+'</span></center>" rel="'+c.tooltipWidth+'" />';a+="</td></tr>"}a+="</tbody></table>";$("#recruitTalent").html(a)};
