var $178DB = new function(){
	this.regstItem = function(_tip){
		I = _tip.id;
		n = '';
		q = 0;
		i = _tip.icon;
		s = _tip.tip;
		c = false;
		$atlasolinePower.regItem(I, n, q, i, s, c);
	}
	this.regstSpell = function(_tip) {
		I = _tip.id;
		n = '';
		i = _tip.icon;
		t = 0;
		s = _tip.tip;
		c = false;
		$atlasolinePower.regSpell(I, n, i, t, s, c);
	}
	this.regstAchievement = function(_tip) {
		a = _tip.id;
		b = '';
		c = _tip.icon;
		d = _tip.tip;
		cc = false;
		$atlasolinePower.regAchievement(a, b, c, d, cc);
	}
}

if (typeof $atlasolinePower == "undefined") {
	var $atlasolinePower = new function() {
		var aOLa = (navigator.userAgent.indexOf('Safari') != -1), aOLc = (!!(window.attachEvent && !window.opera)), aOLb = (aOLc && parseFloat(navigator.appVersion.split('MSIE')[1]) < 7), aOL_item = new Array(), aOL_spell = new Array(), aOL_achievement = new Array(), aOL_quest = new Array(), aOLl = aOLm = aOLn = aOLp = aOLq = aOLr = aOLs = aOLt = aOLu = aOLv = aOLw = aOlc = aOLD = aOLE = aOLF = aOLG = false, aOLx = (aOLa) ? window.pageYOffset: document.documentElement.scrollTop, aOLy = 394, aOLz = 18, aOLA = '<p class="qUnknown">正在获取数据……</p>', aOLB = '<p class="qUnknown">抱歉，本地数据库内无该项数据。&nbsp;</p>', aOLC = '<p>与服务器连接超时 :(</p>', gaOLH = gaOLI = false;
		aOLevent = 1;
		this.maxwidth = 320;
		this.regItem = function(I, n, q, i, s, c) {
			aOL_item[(c) ? c : I] = {
				name : n,
				quality : q,
				icon : i,
				stat : s
			};
			aOlN('item', I, (c) ? c : I)
		};
		this.regSpell = function(I, n, i, t, s, c) {
			aOL_spell[I] = {
				name : n,
				icon : i,
				stack : t,
				stat : s
			};
			aOlN('spell', I, (c) ? c : I)
		};
		this.regAchievement = function(a, b, c, d, cc) {
			aOL_achievement[(cc) ? cc : a] = {
				name : b,
				icon : c,
				stat : d
			};
			aOlN('achievement', a, (cc) ? cc : a)
		};
		this.regQuest = function(a, b, c) {
			aOL_quest[a] = {
				stat : b
			};
			aOlN('quest', a, (c) ? c : a)
		};/* this.errMsg=function(msg,c){msg='<p class="qUnknown">'+msg+'</p>';aOlN('tip',msg,c);aOLE.innerHTML=msg} */
		this.errMsg = function(a, b, c) {
			if (a == 1) {
				eval('aOL_' + b)[c] = {
					name : false,
					stat : '<p class="qUnknown">数据库内无该项数据</p>'
				};
				aOlN(b, c, c);
				aOLE.innerHTML = '<p class="qUnknown">简体数据库内无该项数据</p>'
			}
		};
		function aOl$(A) {
			if (document.getElementById) {
				$ = function(B) {
					return document.getElementById(B)
				};
				return $(A)
			}
			;
			if (document.all) {
				$ = function(B) {
					return document.all[B]
				};
				return $(A)
			}
		}
		function rdnum() {
			var d = new Date();
			d = d.getTime();
			return d
		}
		this.aOlA = function() {
			if (!aOLD) {
				if (document.body) {
					A = function(a, b) {
						var c = document.createElement(a);
						if (b) {
							c.id = b
						}
						;
						return c
					};
					B = function(a, b) {
						return a.appendChild(b)
					};
					var a = (aOLb) ? 'gif' : 'png', b = A('div', 'atlasoline_i'), c = A(
							'img', 'atlasoline_ii'), d = A('table',
							'atlasoline_iTT'), e = A('tbody'), f = A('tr'), g = A(
							'td', 'atlasoline_iTTc'), h = A('th'), i = A('tr'), j = A('th'), k = A('th');
					c.src = 'http://db.178.com/wow/atlas/image/Icon-Border-Medium.' + a;
					d.cellSpacing = d.cellPadding = d.border = '0';
					h.className = 'rt';
					j.className = 'lb';
					k.className = 'rb';
					B(b, c);
					B(d, e);
					B(e, f);
					B(f, g);
					B(f, h);
					B(e, i);
					B(i, j);
					B(i, k);
					B(document.body, b);
					B(document.body, d);
					aOLD = d, aOLE = g, aOLF = b, aOLG = c;
					g.innerHTML += '<div style="position:absolute;z-index:-1;left:-8px;top:0;width:232px;"><iframe style="width:100%;height:100%;filter:alpha(opacity=0);opacity:0"></iframe></div>';
					if (location.hostname
							.match(/(.)+(178.com|ngacn.cc|atlas-o-line.com)/)) {
						aOLF.style.background = 'none'
					}
				} else {
					aOlA()
				}
			}
		};
		function aOlB(h) {
			var t = document.createElement('link');
			t.type = 'text/css';
			t.rel = 'stylesheet';
			t.href = h;
			document.getElementsByTagName('head')[0].appendChild(t)
		}
		function aOlC() {
			this.load = function(u) {
				var ss = document.getElementsByTagName('script');
				for (i = 0; i < ss.length; i++) {
					if (ss[i].src && ss[i].src.indexOf(u) != -1) {
						this.onsuccess();
						return;
					}
				}
				;
				t = document.createElement('script');
				t.type = 'text/javascript';
				t.charset = 'utf-8';
				t.src = u;
				var head = document.getElementsByTagName('head')[0];
				head.appendChild(t);
				var self = this;
				t.onload = t.onreadystatechange = function() {
					if (this.readyState && this.readyState == 'loading') {
						return;
					}
					self.onsuccess();
				};
				t.onerror = function() {
					head.removeChild(t);
					self.onfailure()
				}
			};
			this.onsuccess = function() {
			};
			this.onfailure = function() {
			}
		}
		function aOlL() {
			if (aOLD.offsetWidth > $atlasolinePower.maxwidth) {
				aOLD.style.width = $atlasolinePower.maxwidth + 'px';
			}
			;
			aOlM()
		}
		function aOlM() {
			if (gaOLH) {
				aOlG(gaOLH)
			} else {
				aOLz = aOLs + 18;
				aOlF()
			}
		}
		function aOlN(t, I, check) {
			if (t + I + check == aOlc) {
				aOlO();
				aOLE.innerHTML = (t == 'tip') ? I
						: eval('aOL_' + t)[check].stat;
				if (gaOLI && t != 'tip') {
					var a = eval('aOL_' + t)[check].icon;
					if (a) {
						aOLF.style.display = 'block';/* aOLG.style.backgroundImage='url(http://db.178.com/wow/atlas/icon/36/'+a.toLowerCase()+'.jpg)' */
						aOLG.style.backgroundImage = 'url(http://db1.178.com/wow/icons/m/' + a
								.toLowerCase() + '.jpg)'
					} else {
						aOLF.style.display = 'none'
					}
				} else {
					aOLF.style.display = 'none'
				}
				aOLr = true;
				aOlL();
				aOLs = (aOLD.offsetHeight < 64) ? 64 : aOLD.offsetHeight;
				aOLz = aOLs + 18;
				aOlL();
				aOlL();
				clearTimeout(aOLu)
			}
		}
		function aOlO() {
			aOLn = document.documentElement.clientHeight;
			aOLp = document.documentElement.clientWidth;
			aOLx = (aOLa) ? window.pageYOffset
					: document.documentElement.scrollTop;
			aOLs = (aOLD.offsetHeight < 44) ? 44 : aOLD.offsetHeight
		}
		this.aOlD = function(t, I, f, i, lang, prop) {
			if (!lang) {
				lang = ''
			}
			if (!prop) {
				prop = false
			}
			lang = (lang == 'cn' || lang == '') ? '' : '-' + lang;
			var llang = (lang == '') ? false : lang.substr(1), check = (prop) ? t
					+ '=' + I + '&' + prop + (llang ? '&lang=' + llang : '')
					: I;
			if (aOLq && aOlc == t + I) {
				return
			}
			this.aOlA();
			this.aOlK();
			aOlc = t + I + check;
			aOlO();
			if (t == 'quest') {
				i = false
			} else if (!i && i !== false) {
				i = true
			}
			;
			gaOLI = i;
			if (f) {
				gaOLH = f
			}
			function B() {
				aOLq = (!f) ? true : false;
				aOlM()
			}
			;
			if (t == 'tip') {
				aOlN(t, I, check);
				aOlL();
				B()
			} else {
				if (typeof eval('aOL_' + t)[check] == 'undefined') {
					aOLt = setTimeout(
							function() {
								var a = new aOlC(), file = prop ? 'http://db.178.com/wow/atlas/tooltip/?' + check + '&rdnum=' + rdnum() : ((t == 'item' || t == 'spell' || t == 'achievement') ? 'http://db1.178.com/wow/' + (llang ? llang : 'cn') + '/a/' + t + '/' + I + '.js' : 'http://db.178.com/wow/atlas/tooltip/' + t + lang + '/' + I + '.js');
								a.onfailure = function() {
									aOLE.innerHTML = aOLB;
									clearTimeout(aOLu)
								};
								a.load(file);
								if (aOLE.innerHTML == 'undefined') {
									aOLE.innerHTML = aOLA
								}
								aOlL();
								B();
							}, 400)
				} else {
					B();
					aOlN(t, I, check)
				}
			}
		};
		this.aOlK = function() {
			clearTimeout(aOLt);
			clearTimeout(aOLu);
			gaOLH = aOLq = aOLr = aOlc = false;
			if (aOLF) {
				aOLF.style.display = 'none'
			}
			if (aOLD) {
				aOLD.style.top = aOLD.style.left = '-1000px';
				aOLD.style.width = 'auto'
			}
			aOLE.innerHTML = aOLA;
			aOLz = 18
		};
		function aOlE(e) {
			if (!e) {
				e = window.event
			}
			;
			aOLl = e.clientX;
			aOLm = e.clientY - 1;
			aOlF()
		}
		function aOlF() {
			if (aOLq) {
				if (aOLz > aOLn - aOLm) {
					aOLF.style.top = aOLD.style.top = aOLn - aOLs + aOLx - 1
							+ 'px';
				} else {
					aOLF.style.top = aOLD.style.top = aOLm + 16 + aOLx + 'px'
				}
				;
				if (aOLy > aOLp - aOLl) {
					aOLD.style.left = aOLl - aOLE.offsetWidth - 16 + 'px';
					aOLF.style.left = aOLl - aOLE.offsetWidth - 60 + 'px'
				} else {
					aOLD.style.left = aOLl + 16 + 'px';
					aOLF.style.left = aOLl + 26 + aOLE.offsetWidth + 'px'
				}
			}
		}
		function aOlG(a) {
			var b = a, c = b.offsetTop - aOLD.offsetHeight, d = b.offsetLeft
					+ b.offsetWidth;
			while (b.offsetParent) {
				b = b.offsetParent;
				c += b.offsetTop;
				d += b.offsetLeft
			}
			if (c < aOLx) {
				if ((c += aOLD.offsetHeight + a.offsetHeight)
						+ aOLD.offsetHeight > aOLn + aOLx) {
					c = aOLn + aOLx - aOLD.offsetHeight
				}
				;
				aOLF.style.top = aOLD.style.top = c + 'px'
			} else {
				aOLF.style.top = aOLD.style.top = c + 'px'
			}
			if (d + 394 > aOLp) {
				aOLD.style.left = d - a.offsetWidth - aOLD.offsetWidth + 'px';
				aOLF.style.left = d - a.offsetWidth - aOLD.offsetWidth - 44
						+ 'px'
			} else {
				aOLD.style.left = d + 'px';
				aOLF.style.left = d + aOLD.offsetWidth + 'px'
			}
		}
		function aOlH(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)
				}
			}
		}
		this.aOlI = function() {
			aOlH(document, 'mousemove', aOlE);
			var A = document.links, i = 0, B;
			while (B = A[i++]) {
				if (!(B.rel && B.rel == 'np')
						&& B.href
								.match(/(wowdb.178.com|db.ngacn.cc|db.178.com\/wow|db.178.com\/twwow)\/(cn|tw)\/(item|quest|spell|achievement)\/([0-9]+)/)) {
					aOlH(B, 'mouseover', aOlJ);
					aOlH(B, 'mouseout', atlasOline_hi)
				}
			}
		};
		function aOlJ(e) {
			var A;
			if (!e) {
				var e = window.event
			}
			;
			if (e.target) {
				A = e.target
			} else if (e.srcElement) {
				A = e.srcElement
			}
			;
			while (A && A.tagName != 'A') {
				A = A.parentNode
			}
			if (A.tagName == 'A') {
				var a = A.href.split('/cn/'), lang = 'cn', b = false, prop = false;
				if (a.length == 1) {
					a = A.href.split('/tw/');
					lang = 'tw'
				}
				a = a[a.length - 1];
				a = a.split('/');
				if (A.rel) {
					if (A.rel.indexOf("nofloat") != -1) {
						b = A
					}
					if (A.rel.indexOf("prop=[") != -1) {
						prop = A.rel.split('prop=[')[1];
						prop = prop.split(']')[0]
					}
				}
				$atlasolinePower.aOlD(a[0], a[1].split('.')[0], b, true, lang,
						prop)
			}
		}
		aOlB('http://db.178.com/wow/atlas/widget/4.css');
		aOlB('http://db.178.com/wow/css/interface.css');
		if (aOLb) {
			aOlB('http://db.178.com/wow/atlas/widget/3_ie6.css')
		}
		;
		aOlH(window, 'load', this.aOlI);
	}
};
function atlasolineRegItem(I, n, q, i, s) {
	$atlasolinePower.regItem(I, n, q, i, s)
}
function atlasolineRegSpell(I, n, i, t, s) {
	$atlasolinePower.regSpell(I, n, i, t, s)
}
function atlasolineRegAchievement(a, b, c, d) {
	$atlasolinePower.regAchievement(a, b, c, d)
}
function atlasolineRegQuest(a, b) {
	$atlasolinePower.regQuest(a, b)
}
function atlasOline_si(I, f, i) {
	$atlasolinePower.aOlD('item', I, f, i);
}
function atlasOline_ss(I, f, i) {
	$atlasolinePower.aOlD('spell', I, f, i);
}
function atlasOline_sa(I, f, i) {
	$atlasolinePower.aOlD('achievement', I, f, i);
}
function atlasOline_sq(I, f, i) {
	$atlasolinePower.aOlD('quest', I, f, i);
}
function atlasOline_tip(t, f) {
	$atlasolinePower.aOlD('tip', t, f, false);
}
function atlasOline_hi() {
	$atlasolinePower.aOlK()
}