﻿function getFirstDomain() { var b = location.hostname; var a = b.indexOf("."); if (a >= 0) { b = b.substring(a + 1, b.length) } return b } var ABMapMover = { obj: "", startX: 0, startY: 0, endX: 0, endY: 0, curX: 0, curY: 0, moveDirectionX: false, moveDirectionY: false, perPixel: 3, perTimer: 1, isPlayEnable: false, timerHandle: 0, riser: 0, __initial: function(d, h, a, f, g, b, c, e) { this.obj = document.getElementById(d); this.curX = this.startX = h; this.curY = this.startY = a; this.endX = 0; this.endY = 0; this.moveDirectionX = b; this.moveDirectionY = c; this.isPlayEnable = Cookie.read("play"); this.start() }, start: function() { var a = this; if (a.timerHandle == 0) { a.timerHandle = setInterval(function() { a.mover() }, a.perTimer) } }, mover: function() { var b = $("text_sider").clientHeight; var a = $("map_scroll").clientHeight; if (!Cookie.read("play") || b < a) { this.stop(); return } this.getAdditionPosition(); this.riser += 1; this.obj.style.top = this.curY + "px"; this.obj.style.left = this.curX + "px"; if (!this.curX && this.curY) { this.obj.style.position = "absolute" } if (this.curX == this.endX && this.curY == this.endY) { this.stop(); return } }, getAdditionPosition: function() { this.moveTo(); if (this.moveDirectionY) { this.curY += this.perPixel; if (this.curY >= this.endY) { this.curY = this.endY } } else { if (!this.moveDirectionY) { this.curY -= this.perPixel; if (this.curY <= this.endY) { this.curY = this.endY; this.moveDirectionY = true } } } }, moveTo: function() { var b = this.getContainerTop(this.obj.parentNode); var a = ABBrowser.getAvailableHeight(); if (b < 0 && a > 776) { b = 0 - b } else { b = 0 } this.endX = this.startX + ABBrowser.getScrollLeft(); this.endY = this.startY + b }, stop: function() { try { clearTimeout(this.timerHandle); this.timerHandle = 0 } catch (a) { } }, getContainerTop: function(b) { var a = 0; var c = b; do { a += c.offsetTop || 0; if (c.offsetParent == document.body) { if (c.style.position == "absolute") { break } } } while (c = c.offsetParent); c = b; do { if (!window.opera || c.tagName == "BODY") { a -= c.scrollTop || 0 } } while (c = c.parentNode); return a } }; var MapTag = false; function mapTrigger(e, d) { if (MapTag) { ABMapMover.start(); return } var h = 0; var a = 0; var f = h + ABBrowser.getScrollLeft(); var g = a + ABBrowser.getScrollTop(); var b = false; var c = true; ABMapMover.__initial(e, h, a, f, g, b, c, d); MapTag = true } function setMapPlay(a) { if (a.checked) { Cookie.write("play", 1, { duration: 30, domain: getFirstDomain(), path: "/" }) } else { Cookie.dispose("play", { domain: getFirstDomain(), path: "/" }); MapTag = false; resetMover() } } function resetMover() { var a = $("map_scroll"); a.style.position = "relative"; a.style.left = 0; a.style.top = 0 } function setMover() { var a = $("map_outer"); var b = (parseInt(ABBrowser.getViewWidth()) - 950) / 2 + 658; var c = ABBrowser.getBody().offsetTop; c += parseInt($("text_sider").offsetTop); a.style.top = c + "px"; if (b <= 658) { b = 658 } a.style.left = b + "px"; a.style.position = "fixed"; a.style.zIndex = 10000 } function scrollByWheel(a) { var c = Cookie.read("play"); if (!c) { return } var b = true; if (a.wheelDelta) { if (a.wheelDelta == 120) { b = false } else { if (a.wheelDelta == -120) { b = true } } ABMapMover.moveDirectionY = b; mapTrigger("map_scroll", c) } else { if (a.detail != 1) { if (a.detail == -3) { b = false } else { if (a.detail == 3) { b = true } } ABMapMover.moveDirectionY = b; mapTrigger("map_scroll", c) } } } function scrollByKeyDown(a) { var c = Cookie.read("play"); if (!c) { return } var b = true; if (a.keyCode == 38 || a.keyCode == 33) { b = false } else { if (a.keyCode == 40 || a.keyCode == 34) { b = true } } ABMapMover.moveDirectionY = b; mapTrigger("map_scroll", c) } function scrollByMouseDown(d) { var c = Cookie.read("play"); if (!c) { return } var b = true; var a = ABBrowser.getScrollTop(); if (a > ABMapMover.endY) { b = true } else { b = false } ABMapMover.moveDirectionY = b; mapTrigger("map_scroll", c) } function addMapListener() { if (document.attachEvent) { document.attachEvent("onmousewheel", scrollByWheel); document.attachEvent("onkeydown", scrollByKeyDown); window.attachEvent("onscroll", scrollByMouseDown) } else { document.addEventListener("DOMMouseScroll", scrollByWheel, false); document.addEventListener("keydown", scrollByKeyDown, false); window.addEventListener("scroll", scrollByMouseDown, false) } } function onMappletInited() { if (Cookie.read("play")) { $("dqc_map").checked = true } else { if ($("dqc_map").checked) { Cookie.write("play", 1, { duration: 30, domain: getFirstDomain(), path: "/" }) } } } var ABBrowser = { navi: navigator.userAgent.toLowerCase(), isIE: function() { var a = this; return (a.navi.indexOf("msie") != -1) && (a.navi.indexOf("opera") == -1) && (a.navi.indexOf("omniweb") == -1) }, getBody: function() { return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body }, getScrollTop: function() { return this.isIE() ? this.getBody().scrollTop : window.pageYOffset }, getScrollLeft: function() { return this.isIE() ? this.getBody().scrollLeft : window.pageXOffset }, getAvailableHeight: function() { return this.getBody().offsetHeight > this.getBody().scrollHeight ? this.getBody().offsetHeight : this.getBody().scrollHeight }, getAvailableWidth: function() { return this.getBody().offsetWidth > this.getBody().scrollWidth ? this.getBody().offsetWidth : this.getBody().scrollWidth }, getViewWidth: function() { return self.innerWidth || (document.documentElement.clientWidth || document.body.clientWidth) }, getViewHeight: function() { return self.innerHeight || (document.documentElement.clientHeight || document.body.clientHeight) }, getPointerPositionInDocument: function(c) { var d = c; var a = d.pageX || (d.clientX + ABBrowser.getBody().scrollLeft); var b = d.pageY || (d.clientY + ABBrowser.getBody().scrollTop); return { x: a, y: b} }, getElementPosition: function(b) { if (typeof b.offsetParent != "undefined") { for (var c = 0, a = 0; b; b = b.offsetParent) { c += b.offsetLeft; a += b.offsetTop } return { x: c, y: a} } else { return { x: c, y: a} } } };