MugedaHelper = {}; function G(a) { return document.getElementById(a) } function E(a, b, c) { b || (b = "load"); c || (c = window); c.attachEvent ? c.attachEvent("on" + b, a) : c.addEventListener(b, a, false) } function json(a) { try { return eval("(" + a + ")") } catch(b) { return null } } function _7C(a) { if (!a || typeof a == "string") return a; var b = "", c; for (c in a) b += "&" + c + "=" + encodeURIComponent(a[c]); b && (b = b.substr(1)); return b } function ajax(a) { var b = /POST/i.test(a.type); var c = a.data || ""; var e = a.dataType; var f = a.url || location.href; var d = /\?/.test(f) ? "&": "?"; var g = window.XMLHttpRequest ? new XMLHttpRequest: new ActiveXObject("Msxml2.XMLHTTP") || new ActiveXObject("Microsoft.XMLHTTP"); g.onreadystatechange = function(d) { if (g.readyState == 4) { if (g.status == 200) { d = g.responseText; if (e == "json") { d = json(d); } if (b = a.success) { b(d); } } else { if (a.error) { a.error(g.status, g); } } } }; if (typeof c == "object") { var j = []; var i; for (i in c) { j.push(encodeURIComponent(i) + "=" + encodeURIComponent(c[i])); } c = j.join("&") } g.open(b ? "POST" : "GET", f + (b ? "": (c ? d: "") + c + (a.cache ? "": (!c && d == "?" ? "?": "&") + (a.cache_ok ? "": "_=" + (new Date).getTime()))), a.async === false ? false: true); if (b) { g.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); } g.send(c); return g } var ajaxHelper = function(a) { a = a || {}; a.method = a.method || "GET"; a.type = (a.type || "text").toLowerCase(); a.success = a.success || function() {}; a.error = a.error || function() {}; a.cache_ok = a.cache_ok || false; a.url = a.url || (a.error({ status: -5, desc: "Empty url" }), ""); a.mode = a.mode || null; var b = (new Date).getTime() + "" + Math.random(); b = b.replace(".", ""); a.jsonp_callback = a.jsonp_callback || "callback_" + b; window.hashOptions = window.hashOptions || {}; window.hashOptions[b] = a; window.hashOptions[""] = a; if (!a.cache_ok) { a.url += a.url.indexOf("?") > -1 ? "&" : "?"; a.url += "_mats=" + b; a.url += "&callback=" + a.jsonp_callback; } if (a.type == "jsonp") if (a.mode && a.mode == "postMessage") { var c = (location.protocol || "http:") + "//weika.mugeda.com"; if (!window._POSTMESSAGE) window.addEventListener("message", function(a) { if (a.data) { if (a.data.callbackName && window[a.data.callbackName]) window[a.data.callbackName](a.data.res, a.data.mats) } else console.log("postMessage\u8bf7\u6c42\u5931\u8d25") }), window._POSTMESSAGE = true; var e = "postMessage_" + b; window[e] = function(c) { a.success(c); d.removeChild(document.getElementById(b)); delete window[e] }; var f = { url: a.url, form: a.form || {}, mats: b, callbackName: e, dataType: a.postMessageType || "JSONP", isPost: a.isPost || false }, d = document.getElementsByTagName("head")[0], g = document.createElement("iframe"); g.id = b; g.src = "//weika.mugeda.com/server/postMessage.html"; d.appendChild(g); g.onload = function() { g.contentWindow.postMessage(f, c) }; g.onerror = function() { alert("postMessage\u6a21\u5757\u52a0\u8f7d\u5931\u8d25\u3002") } } else if (a.mode && a.mode == "iframe") { d = document.getElementsByTagName("head")[0]; e = a.jsonp_callback + "_" + b; window[e] = function(c) { a.success(c); d.removeChild(document.getElementById(b)); delete window[e] }; g = document.createElement("iframe"); d.appendChild(g); var j = g.contentDocument; g.id = b; j.open(); j.write('