// TAKEN DIRECTLY FROM WOW OFFICIAL ARMORY
// ICON SYSTEM BY BEEPBEEP
var ItemDirectory="https://www.molten-wow.com/resource/tooltip/43x43/";var toolVault=new Array();var X,Y;var Forum=false;var currentURL="";$(document).ready(function(){$("body").append('<div id="globalToolTip"><span id="icon"></span><table id="type"><tbody><tr><td class="tl"><em></em></td><td class="tm"></td><td class="tr"><em></em></td></tr><tr><td class="ml"></td><td class="mm" valign="top"><div id="globalToolTip_text"></div></td><td class="mr"></td></tr><tr><td class="bl"><em></em></td><td class="bm"></td><td class="br"><em></em></td></tr></tbody></table></div>');theGlobalToolTip=$("#globalToolTip");$(".has_Tool").mouseover(function(e){$("head").append('<link rel="stylesheet" type="text/css" href="https://www.molten-wow.com/resource/tooltip/tooltip.css">');Forum=true;if(Forum){$(document).mousemove(function(p){X=p.pageX+5;Y=p.pageY+5;$("#globalToolTip:visible").css("left",X).css("top",Y)})}if($(this).attr("tool_url")){currURL=$(this).attr("tool_url");if(Forum){preURL='https://www.molten-wow.com/?power=true&'}else{preURL=''}currentURL=preURL+currURL;getTipHTML(preURL+currURL,this,e);if($(theGlobalToolTip).css("display")!="block")$(theGlobalToolTip).show()}else if($(this).attr("tt")){setTipText($(this).attr("tt"));setToolTipPosition(this,e);$(theGlobalToolTip).show()}});$(".has_Tool").mouseout(function(){$(theGlobalToolTip).hide();currentURL=null;currURL=null;})});function getTipHTML(ajaxURL,itemWithTip,mouseEvent){if(toolVault[ajaxURL]==null){setTipText("Loading...");setToolTipPosition(itemWithTip,mouseEvent);$.ajax({type:"GET",url:ajaxURL,success:function(msg){if(currentURL==ajaxURL){toolVault[ajaxURL]=msg;setTipText(toolVault[ajaxURL])}},error:function(msg){setTipText("Unknown Error")}})}else{setTipText(toolVault[ajaxURL]);setToolTipPosition(itemWithTip,mouseEvent)}}function setToolTipPosition(tooltipObj,e){if(Forum){$(theGlobalToolTip).css("left",X);$(theGlobalToolTip).css("top",Y);$(theGlobalToolTip).show()}else{var tipPosition=getXYCoords(tooltipObj,e);$(theGlobalToolTip).css("left",tipPosition[0]);$(theGlobalToolTip).css("top",tipPosition[1]);$(theGlobalToolTip).show()}}function getXYCoords(tooltipObj,e){var useMousePosition=false;var xPos=$(tooltipObj).offset().left;var yPos=$(tooltipObj).offset().top;if(((xPos-$(window).scrollLeft())<=0)&&((yPos-$(window).scrollTop())<=0)){useMousePosition=true}var tooltipWidth=-1;var tooltipHeight=-1;var itemWidth=$(tooltipObj).outerWidth();var itemHeight=$(tooltipObj).outerHeight();tooltipWidth=$(theGlobalToolTip).outerWidth();tooltipHeight=$(theGlobalToolTip).outerHeight();if(useMousePosition==true){xPos=e.pageX+7;yPos=e.pageY+15}if((itemWidth+xPos+tooltipWidth+5)>$(window).width()){xPos=xPos-tooltipWidth-5}else{xPos=xPos+itemWidth+5}yPos=yPos-(tooltipHeight/2);if((yPos+tooltipHeight)>$(window).height()+$(window).scrollTop()){yPos=$(window).height()-tooltipHeight+$(window).scrollTop()}if(yPos<$(window).scrollTop()){yPos=$(window).scrollTop()}return[xPos,yPos]}function setTipText(tipStr){var tooltipTxt=$("#globalToolTip_text");var tooltipIcon=$("#icon");var setIcon=$("#type");var Icon=tipStr.between('value="','">');$(tooltipIcon).html("");$(setIcon).removeClass('hasIcon');if(Icon){$(setIcon).addClass('hasIcon');$(tooltipIcon).append("<span class=\"icon\"><table width=\"57\" height=\"59\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td align=\"center\"><div style=\"background:url('"+ItemDirectory+Icon+".png') no-repeat; background-position:10px 8px;\"><img src=\"https://www.molten-wow.com/resource/tooltip/icon.png\" width=\"57\" height=\"59\"></div></td></tr></table></span>")}$(tooltipTxt).html("");$(tooltipTxt).append(tipStr);if(($.browser.msie)&&($.browser.version=="6.0")){if($(tooltipTxt).outerWidth()>300){$(tooltipTxt).css("width","300px")}}else{$(theGlobalToolTip).css("max-width","400px");$(tooltipTxt).css("max-width","400px")}}String.prototype.between=function(prefix,suffix){s=this;var i=s.indexOf(prefix);if(i>=0){s=s.substring(i+prefix.length)}else{return''}if(suffix){i=s.indexOf(suffix);if(i>=0){s=s.substring(0,i)}else{return''}}return s}
