function ReplaceParameters(location_href, name, strvalue) {
    var url = "";
    if (location_href.indexOf("?") != -1)
        url = "?"+ location_href.split("?")[1];
    var scriptname = location_href.replace(url, "");
    
    var strurl = "";
    var bl = false;    
    var scriptext;
    var currentclassid = 0;  //当前栏目id
    var modulepath = "";
    modulepath = scriptname.substring(0, scriptname.lastIndexOf("/")+1);
    scriptname = scriptname.split("/")[scriptname.split("/").length - 1]
    scriptext = scriptname.split(".")[1];
    scriptname = scriptname.split(".")[0];

    if (scriptname.indexOf("-") != -1) {
        currentclassid = scriptname.replace(scriptname.split("-")[0]+"-","");
        scriptname = scriptname.split("-")[0];
    }
    //scriptname = "index";
    //  alert(scriptname +"."+scriptext+"-" + currentclassid);
    //  return;

    if (url.indexOf("?") != -1) {
        var str = url.substr(1)
        strs = str.split("&");
        for (i = 0; i < strs.length; i++) {
            if (strs[i].split("=")[0] == name) {
                bl = true
            }
        }
        for (i = 0; i < strs.length; i++) {
            if (strs[i].split("=")[0] == name) {
                if (strurl == "")
                    strurl += "?" + name + "=" + strvalue;
                else
                    strurl += "&" + name + "=" + strvalue;
            } else {
                if (strs[i].split("=")[0] != "page") {
                    if (strs[i].split("=")[0]) {
                        if (strurl != "") {
                            strurl += "&" + strs[i].split("=")[0] + "=" + strs[i].split("=")[1];
                        } else {
                            strurl += "?" + strs[i].split("=")[0] + "=" + strs[i].split("=")[1];
                        }
                    }
                }
            }
        }

        if (!bl) {
            if (strurl == "")
                strurl += "?" + name + "=" + strvalue;
            else
                strurl += "&" + name + "=" + strvalue;
        }

    } else {
        strurl += "?" + name + "=" + strvalue;
    }

    var result = "";
    try {
        if (scriptpagename) {
            if (scriptpagename != "")
                scriptname = scriptpagename;
        }
    } catch (e) {
        //self_debug(e.message);
    }
    if (scriptext != undefined)
        scriptext = "." + scriptext
    else
        scriptext = "";
    if (scriptname == "index") {
        result = modulepath + scriptname + "-" + currentclassid + scriptext + strurl;
    } else {
        result = modulepath + scriptname + scriptext + strurl;
    }
    return result;
}

function SetParameters(name, strvalue) {
    var url = window.location.search;
    var strurl = "";
    var bl = false;
    var scriptname = window.location.href.replace(window.location.search, "");
    var scriptext;
    var currentclassid = 0;  //当前栏目id
    scriptname = scriptname.split("/")[scriptname.split("/").length - 1]
    scriptext = scriptname.split(".")[1];
    scriptname = scriptname.split(".")[0];

    if (scriptname.indexOf("-") != -1) {
        currentclassid = scriptname.split("-")[1];
        scriptname = scriptname.split("-")[0];
    }
    if(QueryString("cid")!= ""){
        currentclassid = QueryString("cid");
    }
    
    //scriptname = "index";
    //  alert(scriptname +"."+scriptext+"-" + currentclassid);
    //  return;

    if (url.indexOf("?") != -1) {
        var str = url.substr(1)
        strs = str.split("&");
        for (i = 0; i < strs.length; i++) {
            if (strs[i].split("=")[0] == name) {
                bl = true
            }
        }
        for (i = 0; i < strs.length; i++) {
            if (strs[i].split("=")[0] == name) {
                if (strurl == "")
                    strurl += "?" + name + "=" + strvalue;
                else
                    strurl += "&" + name + "=" + strvalue;
            } else {
                if (strs[i].split("=")[0] != "page") {
                    if (strs[i].split("=")[0]) {
                        if (strurl != "") {
                            strurl += "&" + strs[i].split("=")[0] + "=" + strs[i].split("=")[1];
                        } else {
                            strurl += "?" + strs[i].split("=")[0] + "=" + strs[i].split("=")[1];
                        }
                    }
                }
            }
        }

        if (!bl) {
            if (strurl == "")
                strurl += "?" + name + "=" + strvalue;
            else
                strurl += "&" + name + "=" + strvalue;
        }

    } else {
        strurl += "?" + name + "=" + strvalue;
    }
    try {
        if (scriptpagename) {
            if (scriptpagename != "")
                scriptname = scriptpagename;
        }
    } catch (e) {
        //self_debug(e.message);
    }
    //alert(scriptname);
    if (scriptext != undefined)
        scriptext = "." + scriptext
    else
        scriptext = "";
    if (scriptname == "index"){
        window.location.href = scriptname + "-" + currentclassid + scriptext + strurl;
    } else {
        //alert(scriptname + scriptext + strurl);
        window.location.href = scriptname + scriptext + strurl;
    }
}

function RemoveParameters(name) {
    var url = window.location.search;
    //  alert(url);
    var strurl = "";
    var scriptname = window.location.href.replace(window.location.search, "");

    var scriptext;
    var currentclassid = 0;  //当前栏目id
    scriptname = scriptname.split("/")[scriptname.split("/").length - 1]
    scriptext = scriptname.split(".")[1];
    scriptname = scriptname.split(".")[0];
    if (name == "type" && scriptname.split("-").length == 2) {
        window.location.href = scriptname + ".aspx";
    } else {
        //alert(scriptname);    
        if (scriptname.indexOf("-") != -1) {
            currentclassid = scriptname.split("-")[1];
            scriptname = scriptname.split("-")[0];
        }
        //scriptname = "index";

        if (url.indexOf("?") != -1) {
            var str = url.substr(1)
            strs = str.split("&");
            for (i = 0; i < strs.length; i++) {
                if (name != "cid") {
                    if (strs[i].split("=")[0] != name && strs[i].split("=")[0] != "page") {
                        if (strurl != "")
                            strurl += "&" + strs[i].split("=")[0] + "=" + strs[i].split("=")[1];
                        else
                            strurl += "?" + strs[i].split("=")[0] + "=" + strs[i].split("=")[1];
                    }
                } else {
                    if (strs[i].split("=")[0] == name) {
                        strurl += "?" + name + "=" + strs[i].split("=")[1];
                    }
                }
            }
        }
        try {
            if (scriptpagename) {
                if (scriptpagename != "")
                    scriptname = scriptpagename;
            }
        } catch (e) {
            //self_debug(e.message);
        }
        //window.location.href="index.aspx"+strurl;
        if (scriptext != undefined)
            scriptext = "." + scriptext
        else
            scriptext = "";
        if(currentclassid != "0")
            window.location.href = scriptname + "-" + currentclassid + scriptext + strurl;
        else
            window.location.href = scriptname + scriptext + strurl;
    }
}

function RemovesParameters(location_href, name) {
    var url = "";
    if (location_href.indexOf("?") != -1)
        url = "?" + location_href.split("?")[1];
    var scriptname = location_href.replace(url, "");

    var result = "";
    var strurl = "";
    var scriptext;
    var currentclassid = 0;  //当前栏目id
    scriptname = scriptname.split("/")[scriptname.split("/").length - 1]
    scriptext = scriptname.split(".")[1];
    scriptname = scriptname.split(".")[0];
    if (name == "type" && scriptname.split("-").length == 2) {
        result = scriptname + ".aspx";
    } else {
        //alert(scriptname);    
        if (scriptname.indexOf("-") != -1) {
            currentclassid = scriptname.split("-")[1];
            scriptname = scriptname.split("-")[0];
        }
        scriptname = "index";

        if (url.indexOf("?") != -1) {
            var str = url.substr(1)
            strs = str.split("&");
            for (i = 0; i < strs.length; i++) {
                if (name != "cid") {
                    if (strs[i].split("=")[0] != name && strs[i].split("=")[0] != "page") {
                        if (strurl != "")
                            strurl += "&" + strs[i].split("=")[0] + "=" + strs[i].split("=")[1];
                        else
                            strurl += "?" + strs[i].split("=")[0] + "=" + strs[i].split("=")[1];
                    }
                } else {
                    if (strs[i].split("=")[0] == name) {
                        strurl += "?" + name + "=" + strs[i].split("=")[1];
                    }
                }
            }
        }
        try {
            if (scriptpagename) {
                if (scriptpagename != "")
                    scriptname = scriptpagename;
            }
        } catch (e) {
            //self_debug(e.message);
    }
    if (scriptext != undefined)
        scriptext = "." + scriptext
    else
        scriptext = "";
        if (currentclassid != "0")
            result = scriptname + "-" + currentclassid + scriptext + strurl;
        else
            result = scriptname + scriptext + strurl;
    }

    return result;
}
///移除参数
function PackRemoveParameters(name){
    //得到查询条件
    var url=window.location.search;
    var strurl="";

    //得到去除查询条件的网址
    var scriptname = window.location.href.replace(window.location.search,"");

    var scriptext;
    var currentclassid=0;  //当前栏目id

    //得到当前文件名
    scriptname = scriptname.split("/")[scriptname.split("/").length-1];

    //得到页面后缀
    scriptext = scriptname.split(".")[1];
    scriptname = scriptname.split(".")[0];

    //scriptname = "pack";

    if (scriptext != undefined)
        scriptext = "." + scriptext
    else
        scriptext = "";
    if(name=="type"){
        window.location.href = scriptname +"."+scriptext;
        return;
    }
    
    if(url.indexOf("?")!=-1){
        //去掉问号后的所有参数串
        var str = url.substr(1);

        //将str 用"&"分隔成数组
        strs = str.split("&");
      
        //循环去掉当前的参数
        for(i=0;i<strs.length;i++)
        {
            if (strs[i].split("=")[0] != name && strs[i].split("=")[0] != "page") 
            {
                if (strurl != "")
                    strurl += "&" + strs[i].split("=")[0] + "=" + strs[i].split("=")[1];
                else
                    strurl += "?" + strs[i].split("=")[0] + "=" + strs[i].split("=")[1];
            }
        }
    }
    
    //alert(scriptname +"."+scriptext + strurl);
    //return;

    window.location.href = scriptname +"."+scriptext + strurl;

}

function SetPackParameters(name, strvalue) {
    //当前页搜索参数
    var url = window.location.search;
    var strurl = "";
    var bl = false;
    
    //去除搜索参数后的网址
    var scriptname = window.location.href.replace(window.location.search, "");
    var scriptext;
    var currentclassid = 0;  //当前栏目id
    
    //当前页
    scriptname = scriptname.split("/")[scriptname.split("/").length - 1]
    scriptext = scriptname.split(".")[1];
    
    //设置页面
    scriptname = "pack";
    
    //scriptname = "index";
    //  alert(scriptname +"."+scriptext+"-" + currentclassid);
    //  return;
    
    
    if (url.indexOf("?") != -1) {
        var str = url.substr(1)
        strs = str.split("&");
        for (i = 0; i < strs.length; i++) {
            if (strs[i].split("=")[0] == name) {
                bl = true
            }
        }
        for (i = 0; i < strs.length; i++) {
            if (strs[i].split("=")[0] == name) {
                if (strurl == "")
                    strurl += "?" + name + "=" + strvalue;
                else
                    strurl += "&" + name + "=" + strvalue;
            } else {
                if (strs[i].split("=")[0] != "page") {
                    if (strs[i].split("=")[0]) {
                        if (strurl != "") {
                            strurl += "&" + strs[i].split("=")[0] + "=" + strs[i].split("=")[1];
                        } else {
                            strurl += "?" + strs[i].split("=")[0] + "=" + strs[i].split("=")[1];
                        }
                    }
                }
            }
        }

        if (!bl) {
            if (strurl == "")
                strurl += "?" + name + "=" + strvalue;
            else
                strurl += "&" + name + "=" + strvalue;
        }

    } else {
        strurl += "?" + name + "=" + strvalue;
    }

    //alert(scriptname + scriptext + strurl);
    if (scriptext != undefined)
        scriptext = "." + scriptext
    else
        scriptext = "";
    window.location.href = scriptname + scriptext + strurl;
    
}
