var BASE = {}; if (document.addEventListener) { BASE.addEventListener = function(c, a, b) { c.addEventListener(a, b, false) }; BASE.removeEventListener = function(c, a, b) { c.removeEventListener(a, b, false) }; BASE.preventDefault = function(a) { a.preventDefault() }; BASE.stopPropagation = function(a) { a.stopPropagation() } } else { BASE.addEventListener = function(b, d, c) { if (!c.$guid) { c.$guid = BASE.addEventListener.guid++ } if (!b.events) { b.events = {} } var a = b.events[d]; if (!a) { a = b.events[d] = {}; c[0] = b["on" + d] } a[c.$guid] = c; b["on" + d] = BASE._handleEvent }; BASE.addEventListener.guid = 1; BASE.removeEventListener = function(a, c, b) { if (a.events && a.events[c]) { delete a.events[c][b.$guid] } }; BASE.preventDefault = function(a) { a.returnValue = false }; BASE.stopPropagation = function(a) { a.cancelBubble = true }; BASE._handleEvent = function(d) { var c = true; d = d || window.event; var a = this.events[d.type]; for (var b in a) { this.$handleEvent = a[b]; if (this.$handleEvent(d) === false) { c = false } } return c } } BASE.start = function(a) { BASE.addEventListener(window, "load", a.init) }; BASE._click_ = function(b, a) { BASE.addEventListener(b, "click", a) }; BASE._submit_ = function(b, a) { BASE.addEventListener(b, "submit", a) }; BASE._prevent_ = function(a) { BASE.preventDefault(a) }; BASE._keyDown_ = function(b, a) { BASE.addEventListener(b, "keydown", a) }; BASE._focus_ = function(b, a) { BASE.addEventListener(b, "focus", a) }; BASE._mouseOver_ = function(b, a) { BASE.addEventListener(b, "mouseover", a) }; BASE._mouseOut_ = function(b, a) { BASE.addEventListener(b, "mouseout", a) }; BASE._blur_ = function(b, a) { BASE.addEventListener(b, "blur", a) }; BASE.get = function(d, f) { f = f || document; var a = d.substr(0, 1), c = d.slice(1); switch (a) { case "#": if (f.querySelctor) { return f.querySelector(d) } else { return f.getElementById(c) } break; case ".": var g = [], b = [], h = new RegExp("(^| )" + c + "( |$)"); if (typeof document.all != "undefined") { if (f.querySelectorAll) { return f.querySelectorAll(d) } else { g = f.all } } else { if (f.querySelectorAll) { return f.querySelectorAll(d) } else { g = f.getElementsByTagName("*") } } for (var e = 0; e < g.length; e++) { if (h.test(g[e].className)) { b[b.length] = g[e] } } return b; break; default: if (f.querySelectorAll) { return f.querySelectorAll(d) } else { return f.getElementsByTagName(d) } } }; BASE.addClass = function(a, b) { if (!BASE.hasClass(a, b)) { if (a.className === "") { a.className = b } else { a.className += " " + b } } }; BASE.hasClass = function(b, c) { var a = new RegExp("(^| )" + c + "( |$)"); if (a.test(b.className)) { return true } return false }; BASE.removeClass = function(b, c) { var a = new RegExp("(^| )" + c + "( |$)"); b.className = b.className.replace(a, "$1"); b.className = b.className.replace(/ $/, "") }; BASE.getComputedStyle = function(b, c) { var a = null; if (typeof b.currentStyle != "undefined") { a = b.currentStyle } else { a = document.defaultView.getComputedStyle(b, null) } return a[c] }; BASE.stringulate = function(a, b) { return "{'" + a + "':'" + b + "'}" }; BASE.stringulateTwo = function(c, d, a, b) { return "{'" + c + "':'" + d + "','" + a + "':'" + b + "'}" }; BASE.modal = function(b, g) { var e = BASE.get("#modal-container"), h = BASE.get("#modal-inner"), c = BASE.get("img", h), d, a, f = {}; if (b === false) { BASE.addClass(c[0], "ninja") } if (g != undefined) { d = document.createElement("span"); a = document.createTextNode(g); d.appendChild(a); h.appendChild(d) } f = BASE.getWindowMeasurements(); e.style.top = ((f.height / 2) + f.yOffset - 90) + "px"; e.style.left = ((f.width / 2) - 150) + "px"; setTimeout(function() { BASE.removeClass(e, "ninja") }, 50) }; BASE.getWindowMeasurements = function() { var a = {}; if (document.addEventListener) { a.height = window.innerHeight; a.width = window.innerWidth; a.yOffset = window.pageYOffset; a.xOffset = window.pageXOffset } else { a.height = document.documentElement.clientHeight || document.body.clientHeight; a.width = document.documentElement.clientWidth || document.body.clientWidth; a.yOffset = document.documentElement.scrollTop || document.body.scrollTop; a.xOffset = document.documentElement.scrollLeft || document.body.scrollLeft } return a }; BASE.requestQueryString = function(h) { var f = window.location.search.substring(1), e = f.split("&"), m = [], l = [], d = new RegExp("(^| )" + h + "( |$)"); for (var c = 0; c < e.length; c++) { var g = e[c].split("%"); e[c] = g[0] } for (var b = 0; b < e.length; b++) { m[b] = e[b].slice(0, e[b].indexOf("=")); l[b] = e[b].slice(e[b].indexOf("=") + 1) } for (var a = 0; a < m.length; a++) { if (d.test(m[a])) { return l[a] } } }; XHR = function(b, a) { var d = this, c = null; this.updating = false; this.abort = function() { if (d.updating) { d.updating = false; d.AJAX.abort(); d.AJAX = null } }; this.update = function(e, f) { if (d.updating) { return false } d.AJAX = null; if (window.XMLHttpRequest) { d.AJAX = new XMLHttpRequest() } else { d.AJAX = new ActiveXObject("Microsoft.XMLHTTP") } if (d.AJAX === null) { return false } else { d.AJAX.onreadystatechange = function() { if (d.AJAX.readyState === 4) { d.updating = false; d.callback(d.AJAX.responseText, d.AJAX.status); d.AJAX = null } }; d.updating = new Date(); if (/post/i.test(f)) { c = b + "?" + d.updating.getTime(); d.AJAX.open("POST", c, true); d.AJAX.setRequestHeader("Content-type", "application/json; charset=utf-8"); d.AJAX.setRequestHeader("Content-Length", e.length); d.AJAX.send(e) } else { c = b + "?" + e + "&timestamp" + (d.updating.getTime()); d.AJAX.open("GET", c, true); d.AJAX.send(null) } return true } }; this.callback = a || function() { } }; var JSON = JSON || {}; (function() { var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta = { "\b": "\\b", "\t": "\\t", "\n": "\\n", "\f": "\\f", "\r": "\\r", '"': '\\"', "\\": "\\\\" }, rep; if (typeof JSON.parse !== "function") { JSON.parse = function(text, reviver) { var j; function walk(holder, key) { var k, v, value = holder[key]; if (value && typeof value === "object") { for (k in value) { if (Object.hasOwnProperty.call(value, k)) { v = walk(value, k); if (v !== undefined) { value[k] = v } else { delete value[k] } } } } return reviver.call(holder, key, value) } cx.lastIndex = 0; if (cx.test(text)) { text = text.replace(cx, function(a) { return "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4) }) } if (/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) { j = eval("(" + text + ")"); return typeof reviver === "function" ? walk({ "": j }, "") : j } throw new SyntaxError("JSON.parse") } } } ());