function mainoneKeywords(k, w, t, bg, bd, cid) {
    this.mainone_mainword = k;
    this.mainone_if_width = w;
    this.mainone_color_bg = bg;
    this.mainone_color_bd = bd;
    this.mainone_wordtype = t;
    this.mainone_container = "#" + cid;
    this.writeFrame = function() {

        if (this.mainone_mainword != "" && this.mainone_wordtype == 1)           //URL GET KEYWORD
        {
            this.mainone_mainword = GetQueryString(mainone_mainword);
        }
        else {
            this.mainone_mainword = escape(this.mainone_mainword);
        }
        if (this.mainone_if_width == null) {
            this.mainone_if_width = 760;
        }
        if (this.mainone_if_width <= 650) {
            this.mainone_if_width = 650;
        }
        if (this.mainone_color_bg != '') {
            this.mainone_mainword += '&BGcolor=' + this.mainone_color_bg;
        }
        if (this.mainone_color_bd != '') {
            this.mainone_mainword += '&BDcolor=' + this.mainone_color_bd;
        }
        $(this.mainone_container).html('<ifr' + 'ame id="mainoneiframe"  src="' + URL() + '/keyword.aspx?mainkey=' + this.mainone_mainword + '" width="' + this.mainone_if_width + '" height="120" scrolling="no" frameborder="0"> </ifr' + 'ame>');
        var b2bUnionUrl = "<script src=\"" + URL() + "/B2bUnionEntry.ashx?key=" + this.mainone_mainword + "\"><" + "/script>";
        document.write(b2bUnionUrl);

    }

}



function GetQueryString(name) {
    var mainone_reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var mainone_r = window.location.search.substr(1).match(mainone_reg);
    if (mainone_r != null) {
        if (window.location.href.indexOf("www.china-papernet.com") >= 0) {
            return decodeURIComponent(mainone_r[2]);
        }
        return mainone_r[2];
        //return unescape(mainone_r[2]);
    }
    return "";
}
function MainOne_GetKeyword(key) {
    var mainone_getkeyword = GetQueryString(key);
    if (mainone_getkeyword == "") {
        mainone_getkeyword = document.getElementById(key).value;
        return mainone_getkeyword;
    }
    return "";
}

function URL() {
    var url = "http://acode.b2b.cn/union";
    if (getPageCharset() == "utf-8" || getPageCharset()=="gb18030") {
        url = "http://acode.b2b.cn/union_utf";
    }
    if (getPageCharset() == "gbk") {
        url = "http://acode.b2b.cn/union_gbk";
    }
    return url;
}

function getPageCharset() {

    var charSet = "";
    var oType = getBrowser();
    switch (oType) {
        case "IE":
            charSet = document.charset;
            break;
        case "FIREFOX":
            charSet = document.characterSet;
            break;
        default:
            break;
    }
    return charSet.toLowerCase();
}
function getBrowser() {
    var oType = "";
    if (navigator.userAgent.indexOf("MSIE") != -1) {
        oType = "IE";
    } else if (navigator.userAgent.indexOf("Firefox") != -1) {
        oType = "FIREFOX";
    }
    return oType;
}

//ÅÐ¶ÏÊÇ·ñº¬ÓÐÖÐÎÄ
function isChinese(temp) {
    var re = /[^\u4e00-\u9fa5]/;
    if (temp != "") {
        for (j = 0; j < temp.length; j++) {
            if (!re.test(temp.charAt(j)))
            { return true; }
        }
    }
    return false;
}
