﻿/**
* SWFAddress 2.0: Deep linking for Flash and Ajax - http://www.asual.com/swfaddress/
*
* SWFAddress is (c) 2006-2007 Rostislav Hristov and is released under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
*/
if (typeof com == "undefined") { var com = {}; } if (typeof com.asual == "undefined") { com.asual = {}; } if (typeof com.asual.util == "undefined") { com.asual.util = {}; } com.asual.util.Browser = new function() { var _1 = false; var _2 = -1; var _3 = navigator.userAgent; var _4 = false; var _5 = false; var _6 = false; var _7 = false; var _8 = false; if (/MSIE/.test(_3)) { _4 = true; _2 = parseFloat(_3.substring(_3.indexOf("MSIE") + 4)); _1 = _2 >= 6; } else { if (/AppleWebKit/.test(_3)) { _6 = true; _2 = parseFloat(_3.substring(_3.indexOf("Safari") + 7)); _1 = _2 >= 312; } else { if (/Opera/.test(_3)) { _7 = true; _2 = parseFloat(navigator.appVersion); _1 = _2 >= 9.02; } else { if (/Camino/.test(_3)) { _5 = true; _2 = parseFloat(_3.substring(_3.indexOf("Camino") + 7)); _1 = _2 >= 1; } else { if (/Firefox/.test(_3)) { _8 = true; _2 = parseFloat(_3.substring(_3.indexOf("Firefox") + 8)); _1 = _2 >= 1; } else { if (/Netscape/.test(_3)) { _8 = true; _2 = parseFloat(_3.substring(_3.indexOf("Netscape") + 9)); _1 = _2 >= 8; } else { if (/Mozilla/.test(_3) && /rv:/.test(_3)) { _8 = true; _2 = parseFloat(_3.substring(_3.indexOf("rv:") + 3)); _1 = _2 >= 1.8; } } } } } } } this.isSupported = function() { return _1; }; this.getVersion = function() { return _2; }; this.isIE = function() { return _4; }; this.isSafari = function() { return _6; }; this.isOpera = function() { return _7; }; this.isCamino = function() { return _5; }; this.isMozilla = function() { return _8; }; }; com.asual.util.Events = new function() { var _9 = []; var _a = com.asual.util.Browser; var _b = "DOMContentLoaded"; if (_a.isIE() || _a.isSafari()) { (function() { try { if (_a.isIE() || !/loaded|complete/.test(document.readyState)) { document.documentElement.doScroll("left"); } } catch (e) { return setTimeout(arguments.callee, 0); } for (var i = 0, e; e = _9[i]; i++) { if (e.t == _b) { e.l.call(null); } } })(); } this.addListener = function(_e, _f, _10) { _9.push({ o: _e, t: _f, l: _10 }); if (_f == _b && (_a.isIE() || _a.isSafari())) { return; } if (_e.addEventListener) { _e.addEventListener(_f, _10, false); } else { if (_e.attachEvent) { _e.attachEvent("on" + _f, _10); } } }; this.removeListener = function(obj, _12, _13) { for (var i = 0, e; e = _9[i]; i++) { if (e.o == obj && e.t == _12 && e.l == _13) { _9.splice(i, 1); break; } } if (_12 == _b && (_a.isIE() || _a.isSafari())) { return; } if (obj.removeEventListener) { obj.removeEventListener(_12, _13, false); } else { if (obj.detachEvent) { obj.detachEvent("on" + _12, _13); } } }; var _16 = function() { for (var i = 0, evt; evt = _9[i]; i++) { if (evt.t != _b) { com.asual.util.Events.removeListener(evt.o, evt.t, evt.l); } } }; this.addListener(window, "unload", _16); }; SWFAddressEvent = function(_19) { this.toString = function() { return "[object SWFAddressEvent]"; }; this.type = _19; this.target = [SWFAddress][0]; this.value = SWFAddress.getValue(); this.path = SWFAddress.getPath(); this.parameters = {}; var _1a = SWFAddress.getParameterNames(); for (var i = 0, n; n = _1a[i]; i++) { this.parameters[n] = SWFAddress.getParameter(n); } }; SWFAddressEvent.INIT = "init"; SWFAddressEvent.CHANGE = "change"; SWFAddress = new function() { var _1d = com.asual.util.Browser; var _1e = _1d.isSupported(); var _d = top.document; var _h = top.history; var _l = top.location; var _22, _23, _24, _js = "swfaddress.js"; var _26 = _d.title; var _27 = _h.length; var _28 = false; var _29 = {}; var _2a = []; var _2b = []; var _2c = []; _2c["history"] = true; _2c["html"] = false; _2c["strict"] = true; _2c["tracker"] = "urchinTracker"; if ((!_1e && _l.href.indexOf("#") != -1) || (_1d.isSafari() && _1d.getVersion() < 412 && _l.href.indexOf("#") != -1 && _l.search != "")) { _d.open(); _d.write("<html><head><meta http-equiv=\"refresh\" content=\"0;url=" + _l.href.substr(0, _l.href.indexOf("#")) + "\" /></head></html>"); _d.close(); } var _2d = function() { var _2e = _l.href.indexOf("#"); if (_2e != -1) { return _l.href.substring(_2e).replace(/^#/g, ""); } return ""; }; var _2f = _2d(); var _30 = function(_31, _32) { if (_2c["strict"]) { if (_32) { if (_31.substr(0, 1) != "/") { _31 = "/" + _31; } _31 = _31.replace(/^([^\?.]*[^\/])(\?|$)/, "$1/$2").replace(/\/\//, "/"); } else { if (_31 == "") { _31 = "/"; } } } return _31; }; var _33 = function() { if (_1d.isIE() && _d.title != _26) { SWFAddress.setTitle(_26); } }; var _34 = function() { if (!_28) { if (_1d.isIE()) { if (_2f != _2d()) { if (_1d.getVersion() < 7) { _l.reload(); } else { SWFAddress.setValue(_2d()); } } } else { if (_1d.isSafari()) { if (_27 != _h.length) { _27 = _h.length; if (typeof _2a[_27 - 1] != "undefined") { _2f = _2a[_27 - 1]; } _35(); } } else { if (_2f != _2d()) { _2f = _2d(); _35(); } } } _33(); } }; var _36 = function(_37) { if (SWFAddress.hasEventListener(_37)) { SWFAddress.dispatchEvent(new SWFAddressEvent(_37)); } _37 = _37.substr(0, 1).toUpperCase() + _37.substring(1); if (typeof SWFAddress["on" + _37] == "function") { SWFAddress["on" + _37](); } }; var _38 = function() { _36("init"); }; var _39 = function() { _36("change"); }; var _3a = function() { for (var i = 0, id; id = _2b[i]; i++) { var obj = document.getElementById(id); if (obj) { if (obj.parentNode && typeof obj.parentNode.so != "undefined") { obj.parentNode.so.call("setSWFAddressValue", SWFAddress.getValue()); } else { obj = (obj && typeof obj.setSWFAddressValue != "undefined") ? obj : ((obj.getElementsByTagName("object")[0] && typeof obj.getElementsByTagName("object")[0].setSWFAddressValue != "undefined") ? obj.getElementsByTagName("object")[0] : ((obj.getElementsByTagName("embed")[0] && typeof obj.getElementsByTagName("embed")[0].setSWFAddressValue != "undefined") ? obj.getElementsByTagName("embed")[0] : null)); if (obj) { obj.setSWFAddressValue(SWFAddress.getValue()); } } } } }; var _35 = function() { _3a(); _39(); }; var _3e = function() { if (typeof _2c["tracker"] != "undefined" && eval("typeof " + _2c["tracker"] + " != \"undefined\"")) { var fn = eval(_2c["tracker"]); if (typeof fn == "function") { fn((_l.pathname + SWFAddress.getValue()).replace(/\/\//, "/").replace(/^\/$/, "")); } } }; var _40 = function() { var doc = _22.contentWindow.document; doc.open(); doc.write("<script>var swfaddress = \"" + _2d() + "\";</script>"); doc.close(); }; var _42 = function() { if (_2c["html"]) { var src = _22.contentWindow.location.href; _2f = (src.indexOf("?") > -1) ? src.substring(src.indexOf("?") + 1) : ""; } else { _2f = (typeof _22.contentWindow.swfaddress != "undefined") ? _22.contentWindow.swfaddress : ""; } if (_2f != _2d()) { _35(); _l.hash = _2f; } }; var _44 = function() { var _45 = "id=\"swfaddress\" style=\"position:absolute;top:-9999px;\""; if (_1d.isIE()) { document.body.appendChild(document.createElement("div")).innerHTML = "<iframe " + _45 + " src=\"" + (_2c["html"] ? _24.replace(/\.js(\?.*)?$/, ".html") + "?" + _2d() : "javascript:false;") + "\"></iframe>"; _22 = document.getElementById("swfaddress"); setTimeout(function() { if (!_2c["html"] && typeof _22.contentWindow.swfaddress == "undefined") { _40(); } com.asual.util.Events.addListener(_22, "load", _42); }, 10); } else { if (_1d.isSafari()) { if (_1d.getVersion() < 412) { document.body.innerHTML += "<form " + _45 + " method=\"get\"></form>"; _23 = document.getElementById("swfaddress"); } if (typeof _l.swfaddress == "undefined") { _l.swfaddress = {}; } if (typeof _l.swfaddress[_l.pathname] != "undefined") { _2a = _l.swfaddress[_l.pathname].split(","); } } else { if (_1d.isOpera() && _2b.length == 0) { document.body.innerHTML += "<embed " + _45 + " src=\"" + _24.replace(/\.js(\?.*)?$/, ".swf") + "\" type=\"application/x-shockwave-flash\" />"; } } } setTimeout(_38, 1); setTimeout(_39, 2); setTimeout(_3e, 10); setInterval(_34, 50); }; this.onInit = null; this.onChange = null; this.toString = function() { return "[class SWFAddress]"; }; this.back = function() { _h.back(); }; this.forward = function() { _h.forward(); }; this.go = function(_46) { _h.go(_46); }; this.href = function(url, _48) { _48 = typeof _48 != "undefined" ? _48 : "_self"; switch (_48) { case "_self": self.location.href = url; break; case "_top": _l.href = url; break; case "_blank": window.open(url); break; default: top.frames[_48].location.href = url; break; } }; this.popup = function(url, _4a, _4b, _4c) { var _4d = window.open(url, _4a, eval(_4b)); eval(_4c); }; this.addEventListener = function(_4e, _4f) { if (typeof _29[_4e] == "undefined") { _29[_4e] = []; } _29[_4e].push(_4f); }; this.removeEventListener = function(_50, _51) { if (typeof _29[_50] != "undefined") { for (var i = 0, l; l = _29[_50][i]; i++) { if (l == _51) { break; } } _29[_50].splice(i, 1); } }; this.dispatchEvent = function(_54) { if (typeof _29[_54.type] != "undefined" && _29[_54.type].length) { _54.target = this; for (var i = 0, l; l = _29[_54.type][i]; i++) { l(_54); } return true; } return false; }; this.hasEventListener = function(_57) { return (typeof _29[_57] != "undefined" && _29[_57].length > 0); }; this.getStrict = function() { return _2c["strict"]; }; this.setStrict = function(_58) { _2c["strict"] = enabled; }; this.getHistory = function() { return _2c["history"]; }; this.setHistory = function(_59) { _2c["history"] = _59; }; this.getTracker = function() { return _2c["tracker"]; }; this.setTracker = function(_5a) { _2c["tracker"] = _5a; }; this.getIds = function() { return _2b; }; this.getId = function(_5b) { return _2b[0]; }; this.setId = function(id) { _2b[0] = id; }; this.addId = function(id) { this.removeId(id); _2b.push(id); }; this.removeId = function(id) { for (var i = 0, _60; _60 = _2b[i]; i++) { if (id == _60) { _2b.splice(i, 1); break; } } }; this.getTitle = function() { return _d.title; }; this.setTitle = function(_61) { if (!_1e) { return null; } if (typeof _61 == "undefined") { return; } if (_61 == "null") { _61 = ""; } _26 = _d.title = _61; if (_22 && _22.contentWindow) { _22.contentWindow.document.title = _61; } }; this.getStatus = function() { return top.status; }; this.setStatus = function(_62) { if (!_1e) { return null; } if (typeof _62 == "undefined") { return; } if (!_1d.isSafari()) { if (_62 == "null") { _62 = ""; } _62 = _30(_62, true); if (_62 == "/") { _62 = ""; } if (!(/http(s)?:\/\//.test(_62))) { var _63 = _l.href.indexOf("#"); _62 = (_63 == -1 ? _l.href : _l.href.substr(0, _63)) + "#" + _62; } top.status = _62; } }; this.resetStatus = function() { top.status = ""; }; this.getValue = function() { if (!_1e) { return null; } return _30(_2f, false); }; this.setValue = function(_64) { if (!_1e) { return null; } if (typeof _64 == "undefined") { return; } if (_64 == "null") { _64 = ""; } _64 = _30(_64, true); if (_64 == "/") { _64 = ""; } if (_2f == _64) { return; } _2f = _64; _28 = true; _35(); _2a[_h.length] = _2f; if (_1d.isSafari()) { if (_2c["history"]) { _l.swfaddress[_l.pathname] = _2a.toString(); _27 = _h.length + 1; if (_1d.getVersion() < 412) { if (_l.search == "") { _23.action = "#" + _2f; _23.submit(); } } else { var evt = document.createEvent("MouseEvents"); evt.initEvent("click", true, true); var _66 = document.createElement("a"); _66.href = "#" + _2f; _66.dispatchEvent(evt); } } else { _l.replace("#" + _2f); } } else { if (_2f != _2d()) { if (_2c["history"]) { _l.hash = "#" + _2f; } else { _l.replace("#" + _2f); } } } if (_1d.isIE() && _2c["history"]) { if (_2c["html"]) { _22.contentWindow.location.assign(_22.contentWindow.location.pathname + "?" + _2d()); } else { _40(); } } setTimeout(_3e, 10); _28 = false; }; this.getPath = function() { var _67 = this.getValue(); if (_67.indexOf("?") != -1) { return _67.split("?")[0]; } else { return _67; } }; this.getQueryString = function() { var _68 = this.getValue(); var _69 = _68.indexOf("?"); if (_69 != -1 && _69 < _68.length) { return _68.substr(_69 + 1); } return ""; }; this.getParameter = function(_6a) { var _6b = this.getValue(); var _6c = _6b.indexOf("?"); if (_6c != -1) { _6b = _6b.substr(_6c + 1); var _6d = _6b.split("&"); var p, i = _6d.length; while (i--) { p = _6d[i].split("="); if (p[0] == _6a) { return p[1]; } } } return ""; }; this.getParameterNames = function() { var _70 = this.getValue(); var _71 = _70.indexOf("?"); var _72 = []; if (_71 != -1) { _70 = _70.substr(_71 + 1); if (_70 != "" && _70.indexOf("=") != -1) { var _73 = _70.split("&"); var i = 0; while (i < _73.length) { _72.push(_73[i].split("=")[0]); i++; } } } return _72; }; if (!_1e) { return; } for (var i = 1; i < _27; i++) { _2a.push(""); } _2a.push(_l.hash.replace(/^#/g, "")); if (_1d.isIE() && _l.hash != _2d()) { _l.hash = "#" + _2d(); } var _76 = document.getElementsByTagName("script"); for (var i = 0, s; s = _76[i]; i++) { if (s.src.indexOf(_js) > -1) { _24 = String(s.src); break; } } if ((qi = _24.indexOf("?")) > -1) { var _78, _79 = _24.substr(qi + 1).split("&"); for (var j = 0, p; p = _79[j]; j++) { _78 = p.split("="); if (/^(history|html|strict)$/.test(_78[0])) { _2c[_78[0]] = (isNaN(_78[1]) ? eval(_78[1]) : (parseFloat(_78[1]) > 0)); } if (/^tracker$/.test(_78[0])) { _2c[_78[0]] = _78[1]; } } } if (/file:\/\//.test(_l.href)) { _2c["html"] = false; } _33(); com.asual.util.Events.addListener(document, "DOMContentLoaded", _44); }; if (typeof swfobject != "undefined") { SWFObject = swfobject; } if (typeof FlashObject != "undefined") { SWFObject = FlashObject; } if (typeof SWFObject != "undefined") { if (SWFObject.prototype && SWFObject.prototype.write) { com.asual.SWFObjectWrite = SWFObject.prototype.write; SWFObject.prototype.write = function() { if (this.getAttribute("version").major < 8) { this.addVariable("$swfaddress", SWFAddress.getValue()); ((typeof arguments[0] == "string") ? document.getElementById(arguments[0]) : arguments[0]).so = this; } if (success = com.asual.SWFObjectWrite.apply(this, arguments)) { SWFAddress.addId(this.getAttribute("id")); } return success; }; } else { com.asual.SWFObjectRegisterObject = SWFObject.registerObject; SWFObject.registerObject = function() { com.asual.SWFObjectRegisterObject.apply(this, arguments); SWFAddress.addId(arguments[0]); }; com.asual.SWFObjectCreateSWF = SWFObject.createSWF; SWFObject.createSWF = function() { com.asual.SWFObjectCreateSWF.apply(this, arguments); SWFAddress.addId(arguments[0].id); }; com.asual.SWFObjectEmbedSWF = SWFObject.embedSWF; SWFObject.embedSWF = function() { com.asual.SWFObjectEmbedSWF.apply(this, arguments); SWFAddress.addId(arguments[8].id); }; } } if (typeof UFO != "undefined") { com.asual.UFOCreate = UFO.create; UFO.create = function() { com.asual.UFOCreate.apply(this, arguments); SWFAddress.addId(arguments[0].id); }; } if (typeof AC_FL_RunContent != "undefined") { com.asual.AC_FL_RunContent = AC_FL_RunContent; AC_FL_RunContent = function() { com.asual.AC_FL_RunContent.apply(this, arguments); for (var i = 0, a; a = arguments[i]; i++) { if (a == "id") { SWFAddress.addId(arguments[i + 1]); break; } } }; }