(function() {
    var queryErrorCode=function(url){
        var patt=/(errorcode=.*(?=&)|errorcode=.*$)/g;
        var arr=url.match(patt);
        return arr&&arr[0].split('=')[1];
    };
    var errorcode = queryErrorCode(window.location.href);

    var $ = function(id) {
        return document.getElementById(id)
    };
    var retry = function() {
        paramObj = {cmd:"common.Reload",param:{},seq:""};
        window.external.qplus.apiCall(paramObj);
    };

    var content = $("err_content");
    var btn = $("btn");
    var img = $("err_img");
    var wrap = $("wrap");
    var messageObj = {
        "network": {
            content: "网络不给力，请确保网络连接正常后再重试。<span id='errCode_text' class='errCode_text'></span>",
            btnName: "重&nbsp试",
            clickHandler: retry,
            imgSrc: "images/images_network.gif"
        }

    };
    var show = function(errType, errText) {
        var data = messageObj[errType];
        content.innerHTML = data.content;
        btn.className = "btn";
        btn.innerHTML = data.btnName;
        btn.onclick = data.clickHandler;
        img.src = data.imgSrc;
        var errCodeText = $("errCode_text");

        errCodeText.innerHTML = "(" + errText + ")"

        var feedbackLink = $("feedbackLink");
        if (feedbackLink) {
            feedbackLink.onclick = feedback
        }

        wrap.className = "min_wrap";
        img.className = "min_img";
    
    };
    var codeToType = function(errCode) {
        return "network";
    };
    var errType = codeToType(errorcode);
    show(errType,errorcode)
})();