if (typeof $RulingRing == "undefined") {
	var $RulingRing = new function() {
		function s(AS, AR) {
			var AQ = document.createElement(AS);
			if (AR) {
				AK(AQ, AR)
			}
			return AQ
		}
		function N(AQ, AR) {
			return AQ.appendChild(AR)
		}
		function r(AR, AS, AQ) {
			if (window.attachEvent) {
				AR.attachEvent("on" + AS, AQ)
			} else {
				AR.addEventListener(AS, AQ, false)
			}
		}
		function AK(AS, AQ) {
			for ( var AR in AQ) {
				if (typeof AQ[AR] == "object") {
					if (!AS[AR]) {
						AS[AR] = {}
					}
					AK(AS[AR], AQ[AR])
				} else {
					AS[AR] = AQ[AR]
				}
			}
		}
		function l(AQ) {
			if (!AQ) {
				AQ = event
			}
			if (!AQ._button) {
				AQ._button = AQ.which ? AQ.which : AQ.button;
				AQ._target = AQ.target ? AQ.target : AQ.srcElement
			}
			return AQ
		}
		function AA() {
			var AR = 0, AQ = 0;
			if (typeof window.innerWidth == "number") {
				AR = window.innerWidth;
				AQ = window.innerHeight
			} else {
				if (document.documentElement
						&& (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
					AR = document.documentElement.clientWidth;
					AQ = document.documentElement.clientHeight
				} else {
					if (document.body
							&& (document.body.clientWidth || document.body.clientHeight)) {
						AR = document.body.clientWidth;
						AQ = document.body.clientHeight
					}
				}
			}
			return {
				w :AR,
				h :AQ
			}
		}
		function Z() {
			var AQ = 0, AR = 0;
			if (typeof (window.pageYOffset) == "number") {
				AQ = window.pageXOffset;
				AR = window.pageYOffset
			} else {
				if (document.body
						&& (document.body.scrollLeft || document.body.scrollTop)) {
					AQ = document.body.scrollLeft;
					AR = document.body.scrollTop
				} else {
					if (document.documentElement
							&& (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
						AQ = document.documentElement.scrollLeft;
						AR = document.documentElement.scrollTop
					}
				}
			}
			return {
				x :AQ,
				y :AR
			}
		}
		function AG(AS) {
			var AR, AT;
			if (window.innerHeight) {
				AR = AS.pageX;
				AT = AS.pageY
			} else {
				var AQ = Z();
				AR = AS.clientX + AQ.x;
				AT = AS.clientY + AQ.y
			}
			return {
				x :AR,
				y :AT
			}
		}
		function a(AR) {
			var AQ = a.L;
			return (AQ[AR] ? AQ[AR] : 0)
		}
		a.L = {
			fr :2,
			de :3,
			es :6,
			ru :7,
			wotlk :0
		};
		function AE(AQ) {
			var AR = AE.L;
			return (AR[AQ] ? AR[AQ] : -1)
		}
		AE.L = {
			npc :1,
			object :2,
			item :3,
			itemset :4,
			quest :5,
			spell :6,
			zone :7,
			faction :8,
			pet :9,
			achievement :10
		};
		function n(AV, AR, AU) {
			var AT = {
				12 :1.5,
				13 :12,
				14 :15,
				15 :5,
				16 :10,
				17 :10,
				18 :8,
				19 :14,
				20 :14,
				21 :14,
				22 :10,
				23 :10,
				24 :0,
				25 :0,
				26 :0,
				27 :0,
				28 :10,
				29 :10,
				30 :10,
				31 :10,
				32 :14,
				33 :0,
				34 :0,
				35 :25,
				36 :10,
				37 :2.5,
				44 :4.69512176513672
			};
			if (AV < 0) {
				AV = 1
			} else {
				if (AV > 80) {
					AV = 80
				}
			}
			if ((AR == 14 || AR == 12 || AR == 15) && AV < 34) {
				AV = 34
			}
			if (AU < 0) {
				AU = 0
			}
			var AS;
			if (AT[AR] == null) {
				AS = 0
			} else {
				var AQ;
				if (AV > 70) {
					AQ = (82 / 52) * Math.pow((131 / 63), ((AV - 70) / 10))
				} else {
					if (AV > 60) {
						AQ = (82 / (262 - 3 * AV))
					} else {
						if (AV > 10) {
							AQ = ((AV - 8) / 52)
						} else {
							AQ = 2 / 52
						}
					}
				}
				AS = AU / AT[AR] / AQ
			}
			return AS
		}
		var Y = {
			applyto :3
		}, I, x, AF, q, h, AH, i, v, t, Q = document
				.getElementsByTagName("head")[0], c = {}, X = {}, J = {}, AO = {}, w, W, C, d, AI, F = 1, m = 0, y = !!(window.attachEvent && !window.opera), S = navigator.userAgent
				.indexOf("MSIE 7.0") != -1, U = navigator.userAgent
				.indexOf("MSIE 6.0") != -1
				&& !S, g = {
			loading :"<img src=\"http://content.level3.turbine.com/sites/common/images/cluetip_wait.gif\" />",
			noresponse :"No response from server; please try again later"
		}, AC = 0, M = 1, K = 2, p = 3, AB = 4, f = 3, o = 5, V = 6, z = 10, P = 15, k = 15,
		R = {
			3 : [ c, "item", "Item" ],
			5 : [ X, "quest", "Quest" ],
			6 : [ J, "spell", "Spell" ],
			10 : [ AO, "achievement", "Achievement" ]
		},
		H = {
			0 :"enus",
			2 :"frfr",
			3 :"dede",
			6 :"eses",
			7 :"ruru"
		};
		function AM() {
			N(Q, s("link", {
				type :"text/css",
				href :"http://content.level3.turbine.com/sites/lorebook.lotro.com/css/RulingRing.css?3",
				rel :"stylesheet"
			}));
			if (y) {
				N(
						Q,
						s(
								"link",
								{
									type :"text/css",
									href :"http://content.level3.turbine.com/sites/lorebook.lotro.com/css/RulingRingIE.css?3",
									rel :"stylesheet"
								}));
				if (U) {
					N(
							Q,
							s(
									"link",
									{
										type :"text/css",
										href :"http://content.level3.turbine.com/sites/lorebook.lotro.com/css/RulingRingIE6.css?3",
										rel :"stylesheet"
									}))
				}
			}
			r(document, "mouseover", e)
		}
		function O(AQ) {
			var AR = AG(AQ);
			v = AR.x;
			t = AR.y
		}
		function AN(AZ, AX) {
			if (AZ.nodeName != "A" && AZ.nodeName != "AREA") {
				return -2323
			}
			if (!AZ.href.length) {
				return
			}
			var AW, AU, AS, AR, AT = {};
			if (Y.applyto & 1) {
				AR = AZ.href
						.match(/^http:\/\/(lorebook)?\.?lotro\.com\/(wiki|index\.php)\/((Item|Weapon|Armour|Deed|Perk|Quest|Skill|Trait|Special:LotroResource).+)/);
				m = 0
			}
			if (AR) {
				q = 'lorebook';
				if (!AZ.onmousemove) {
					AZ.onmousemove = B;
					AZ.onmouseout = D
				}
				O(AX);
				j(AE('item'), decodeURI(AR[3]).replace(/\'/g, "%27").replace(/ /g, "_"), 'lorebook', AT)
			}
		}
		function e(AS) {
			AS = l(AS);
			var AR = AS._target;
			var AQ = 0;
			while (AR != null && AQ < 3 && AN(AR, AS) == -2323) {
				AR = AR.parentNode;
				++AQ
			}
		}
		function B(AQ) {
			AQ = l(AQ);
			O(AQ);
			b()
		}
		function D() {
			I = null;
			h = [];
			AH = null;
			i = null;
			T()
		}
		function G() {
			if (!w) {
				var AV = s("div"), AZ = s("table"), AS = s("tbody"), AU = s("tr"), AR = s("tr"), AQ = s("td"), AY = s("th"), AX = s("th"), AW = s("th");
				AV.className = "rulingring-tooltip";
				AY.style.backgroundPosition = "top right";
				AX.style.backgroundPosition = "bottom left";
				AW.style.backgroundPosition = "bottom right";
				N(AU, AQ);
				N(AU, AY);
				N(AS, AU);
				N(AR, AX);
				N(AR, AW);
				N(AS, AR);
				N(AZ, AS);
				d = s("p");
				d.style.display = "none";
				N(d, s("div"));
				N(AV, d);
				N(AV, AZ);
				N(document.body, AV);
				w = AV;
				W = AZ;
				C = AQ;
				var AT = s("div");
				AT.className = "rulingring-tooltip-powered";
				N(AV, AT);
				AI = AT;
				T()
			}
		}
		function AP(AT, AU, AV, AR) {
			if (!w) {
				G()
			}
			if (!AT) {
				AT = R[I][2] + " not found :(";
				AU = "Temp"
			} else {
				if (AV && AV.length) {
					var AW = 0;
					for ( var AS = 0, AQ = AV.length; AS < AQ; ++AS) {
						if (AT.indexOf("<span><!--si" + AV[AS] + "-->") != -1) {
							AT = AT.replace("<span><!--si" + AV[AS] + "-->",
									'<span class="q8">');
							++AW
						}
					}
					if (AW > 0) {
						AT = AT.replace("(0/", "(" + AW + "/");
						AT = AT.replace(new RegExp("<span>\\(([0-" + AW
								+ "])\\) Set:", "g"),
								'<span class="q2">($1) Set:')
					}
				}
				if (AR) {
					AT = AT
							.replace(
									/\(<!--r([0-9]+):([0-9]+):([0-9]+)-->([0-9.%]+)(.+?)([0-9]+)\)/g,
									function(AY, AY, AZ, AX, AY, Ab, AY) {
										var Aa = n(AR, AZ, AX);
										Aa = (Math.round(Aa * 100) / 100);
										if (AZ != 12 && AZ != 37) {
											Aa += "%"
										}
										return "(<!--r" + AR + ":" + AZ + ":"
												+ AX + "-->" + Aa + Ab + AR
												+ ")"
									})
				}
			}
			if (AI) {
				AI.style.display = (m ? "" : "none")
			}
			if (F && AU) {
				d.style.display = ""
			} else {
				d.style.backgroundImage = "none";
				d.style.display = "none"
			}
			w.style.display = "";
			w.style.width = "320px";
			C.innerHTML = AT;
			AL();
			b();
			w.style.visibility = "visible"
		}
		function T() {
			if (!w) {
				return
			}
			w.style.display = "none";
			w.style.visibility = "hidden"
		}
		function AL() {
			var AR = C.childNodes;
			if (AR.length >= 2 && AR[0].nodeName == "TABLE"
					&& AR[1].nodeName == "TABLE") {
				AR[0].style.whiteSpace = "nowrap";
				var AQ;
				if (AR[1].offsetWidth > 300) {
					AQ = Math.max(300, AR[0].offsetWidth) + 20
				} else {
					AQ = Math.max(AR[0].offsetWidth, AR[1].offsetWidth) + 20
				}
				if (AQ > 20) {
					w.style.width = AQ + "px";
					AR[0].style.width = AR[1].style.width = "100%"
				}
			} else {
				w.style.width = W.offsetWidth + "px"
			}
		}
		function b() {
			if (!w) {
				return
			}
			if (v == null) {
				return
			}
			var AZ = AA(), Aa = Z(), AW = AZ.w, AT = AZ.h, AV = Aa.x, AS = Aa.y, AU = W.offsetWidth, AQ = W.offsetHeight, AR = v
					+ P, AY = t - AQ - k;
			if (AR + P + AU + 4 >= AV + AW) {
				var AX = v - AU - P;
				if (AX >= 0) {
					AR = AX
				} else {
					AR = AV + AW - AU - P - 4
				}
			}
			if (AY < AS) {
				AY = t + k;
				if (AY + AQ > AS + AT) {
					AY = AS + AT - AQ;
					if (F) {
						if (v >= AR - 48 && v <= AR && t >= AY - 4
								&& t <= AY + 48) {
							AY -= 48 - (t - AY)
						}
					}
				}
			}
			w.style.left = AR + "px";
			w.style.top = AY + "px"
		}
		function AJ(AQ) {
			return (i ? "buff_" : "tooltip_") + H[AQ]
		}
		function AD(AS, AT, AR) {
			var AQ = R[AS][0];
			if (AQ[AT] == null) {
				AQ[AT] = {}
			}
			if (AQ[AT].status == null) {
				AQ[AT].status = {}
			}
			if (AQ[AT].status[AR] == null) {
				AQ[AT].status[AR] = AC
			}
		}
		function j(AT, AV, AR, AU) {
			if (!AU) {
				AU = {}
			}
			// Build together item ID and stuff pulled from rel attr of link
			var AS = AV + (AU.rand ? "r" + AU.rand : "")
					+ (AU.ench ? "e" + AU.ench : "")
					+ (AU.gems ? "g" + AU.gems.join(",") : "");
			I = AT;
			x = AS;
			AF = AR;
			h = AU.pcs;
			AH = AU.lvl;
			i = AU.buff;
			AD(AT, AS, AR);
			var AQ = R[AT][0];
			if (AQ[AS].status[AR] == AB || AQ[AS].status[AR] == p) {
				AP(AQ[AS]['tooltip_enus'], AQ[AS].icon, h, AH)
			} else {
				if (AQ[AS].status[AR] == M) {
					AP(g.tooltip_loading)
				} else {
					E(AT, AV, AR, null, AU)
				}
			}
		}
		function E(AW, AQ, AY, AV, AS) {
			var AX = AQ + (AS.rand ? "r" + AS.rand : "")
					+ (AS.ench ? "e" + AS.ench : "")
					+ (AS.gems ? "g" + AS.gems.join(",") : "");
			var AU = R[AW][0];
			if (AU[AX].status[AY] != AC && AU[AX].status[AY] != K) {
				return
			}
			AU[AX].status[AY] = M;
			if (!AV) {
				AU[AX].timer = setTimeout( function() {
					L.apply(this, [ AW, AX, AY ])
				}, 333)
			}
			var AR = "";
			for ( var AT in AS) {
				if (AT != "rand" && AT != "ench" && AT != "gems") {
					continue
				}
				if (typeof AS[AT] == "object") {
					AR += "&" + AT + "=" + AS[AT].join(":")
				} else {
					AR += "&" + AT + "=" + AS[AT]
				}
			}
			A("http://loreimages.level3.lotro.com/index.php?action=ajax&rs=efLotroResourceAjaxWrapper&rsargs[]=rulingring&rsargs[]=" + AX.replace(/ /g, "_"))
		}
		function A(AQ) {
			N(Q, s("script", {
				type :"text/javascript",
				src :AQ
			}))
		}
		function L(AS, AT, AR) {
			if (I == AS && x == AT && AF == AR) {
				AP(g.loading);
				var AQ = R[AS][0];
				AQ[AT].timer = setTimeout( function() {
					u.apply(this, [ AS, AT, AR ])
				}, 3850)
			}
		}
		function u(AS, AT, AR) {
			var AQ = R[AS][0];
			AQ[AT].status[AR] = K;
			if (I == AS && x == AT && AF == AR) {
				AP(g.tooltip_noresponse)
			}
		}
		this.register = function(AT, AU, AR, AS) {
			var AQ = R[AT][0];
			clearTimeout(AQ[AU].timer);
			AK(AQ[AU], AS);
			if (AQ[AU][AJ(AR)]) {
				AQ[AU].status[AR] = AB
			} else {
				AQ[AU].status[AR] = p
			}
			if (I == AT && AU == x && AF == AR) {
				AP(AQ[AU]['tooltip_enus'], AQ[AU].icon, h, AH)
			}
		};
		this.registerItem = function(AS, AQ, AR) {
			this.register(f, AS, AQ, AR)
		};
		this.registerQuest = function(AS, AQ, AR) {
			this.register(o, AS, AQ, AR)
		};
		this.registerSpell = function(AS, AQ, AR) {
			this.register(V, AS, AQ, AR)
		};
		this.registerAchievement = function(AS, AQ, AR) {
			this.register(z, AS, AQ, AR)
		};
		this.set = function(AQ) {
			AK(Y, AQ)
		};
		this.showTooltip = function(AS, AR, AQ) {
			O(AS);
			AP(AR, AQ)
		};
		this.hideTooltip = function() {
			T()
		};
		this.moveTooltip = function(AQ) {
			B(AQ)
		};
		AM()
	}
};