﻿/*是否为IE浏览器*/

var server_host = '/';
var rankhelp_doc = '/help/rankhelp.html';
var isIE = navigator.userAgent.indexOf("compatible") > -1 && navigator.userAgent.indexOf("MSIE") > -1 && (navigator.appName !== "Oprea");
var isIE7 = (isIE && window.XMLHttpRequest) ? true : false;
var isIE6 = (isIE && !window.XMLHttpRequest && window.ActiveXObject) ? true : false;
var isFirefox = navigator.userAgent.indexOf('Firefox') == -1 ? false : true;
var userAgent = navigator.userAgent.toLowerCase();

var is_opera = userAgent.indexOf('opera') != -1 && opera.version();
var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3);
var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);


function loadPng(o) {
    if (isIE6) {
        try {
            var img = o; var imgName = o.src.toUpperCase();
            if (imgName.substring(imgName.length - 3, imgName.length) == "PNG") {
                var imgID = (img.id) ? "id='" + img.id + "' " : "";
                var imgClass = (img.className) ? "class='" + img.className + "' " : "";
                var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
                var imgStyle = "display:inline-block;" + img.style.cssText;
                if (img.align == "left") imgStyle = "float:left;" + imgStyle;
                if (img.align == "right") imgStyle = "float:right;" + imgStyle;
                if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
                var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='image');width:1px;\"></span>"; img.outerHTML = strNewHTML;
            }
        }
        catch (e) { }
    }
}



copy2Clipboard = function (txt) {
    if (window.clipboardData) {
        window.clipboardData.clearData();
        window.clipboardData.setData("Text", txt);
    }
    else if (navigator.userAgent.indexOf("Opera") != -1) {
        window.location = txt;
    }
    else if (window.netscape) {
        try {
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
        }
        catch (e) {
            alert("您的firefox安全限制限制您进行剪贴板操作，请打开’about:config’将signed.applets.codebase_principal_support’设置为true’之后重试，相对路径为firefox根目录/greprefs/all.js");
            return false;
        }
        var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
        if (!clip) return;
        var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
        if (!trans) return;
        trans.addDataFlavor('text/unicode');
        var str = new Object();
        var len = new Object();
        var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
        var copytext = txt; str.data = copytext;
        trans.setTransferData("text/unicode", str, copytext.length * 2);
        var clipid = Components.interfaces.nsIClipboard;
        if (!clip) return false;
        clip.setData(trans, null, clipid.kGlobalClipboard);
    }
}
function getClipboard() {
    if (window.clipboardData) { return (window.clipboardData.getData('text')); } else {
        if (window.netscape) {
            try
{ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var clip = Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard); if (!clip) { return; } var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable); if (!trans) { return; } trans.addDataFlavor("text/unicode"); clip.getData(trans, clip.kGlobalClipboard); var str = new Object(); var len = new Object(); trans.getTransferData("text/unicode", str, len); } catch (e) { alert("您的firefox安全限制限制您进行剪贴板操作，请打开'about:config'将signed.applets.codebase_principal_support'设置为true'之后重试，相对路径为firefox根目录/greprefs/all.js"); return null; } if (str) {
                if (Components.interfaces.nsISupportsWString) { str = str.value.QueryInterface(Components.interfaces.nsISupportsWString); } else {
                    if (Components.interfaces.nsISupportsString) { str = str.value.QueryInterface(Components.interfaces.nsISupportsString); } else
                    { str = null; } 
                } 
            } if (str) { return (str.data.substring(0, len.value / 2)); } 
        } 
    } return null;
}






//ChangeSelect(上一级的值,下一级Select控件的ID值,下一级Select控件要选中的值(即value而非text),数据源数组名,默认显示字符(如:请选择...如果不写的话会用默认值填充))，第一级的上级值为0
function ChangeSelect(ParentValue, NextId, NextSelectedValue, ArrObj, DefaultStr) {
    StrObj = eval(document.getElementById(NextId));
    StrObj.length = 0;
    //判断它是二级数据源，还是三级
    if (ArrObj.length > 0) {
        if (ArrObj[0].length == 2)
        { ArrNum = 0; }
        else
        { ArrNum = 2; }
    }
    //显示所有列表
    for (i = 0; i < ArrObj.length; i++) {
//        if (i == 0) {
//            if (DefaultStr == undefined) DefaultStr = "==请选择==";
//            StrObj.options[StrObj.length] = new Option(DefaultStr, "");
//        }
        if (ArrObj[i][1] == ParentValue) {
            StrObj.options[StrObj.length] = new Option(ArrObj[i][0], ArrObj[i][ArrNum]);
        }
    }
    //选中列表内某一项
    for (i = 0; i < StrObj.length; i++) {
        if (StrObj.options[i].value == NextSelectedValue) {
            StrObj.options[i].selected = true;
        }
    }
    //激发下一级的onchange事件以实现多级级联
    StrObj.onchange();
}


//ChangeSelect(上一级的值,下一级Select控件的ID值,下一级Select控件要选中的值(即value而非text),数据源数组名,默认显示字符(如:请选择...如果不写的话会用默认值填充))，第一级的上级值为0
function ChangeSelectDefault(ParentValue, NextId, NextSelectedValue, ArrObj, DefaultStr) {
    StrObj = eval(document.getElementById(NextId));
    StrObj.length = 0;
    //判断它是二级数据源，还是三级
    if (ArrObj.length > 0) {
        if (ArrObj[0].length == 2)
        { ArrNum = 0; }
        else
        { ArrNum = 2; }
    }
    //显示所有列表
    for (i = 0; i < ArrObj.length; i++) {
        if (i == 0) {
            if (DefaultStr == undefined) DefaultStr = "==请选择==";
            StrObj.options[StrObj.length] = new Option(DefaultStr, "");
        }
        if (ArrObj[i][1] == ParentValue) {
            StrObj.options[StrObj.length] = new Option(ArrObj[i][0], ArrObj[i][ArrNum]);
        }
    }
    //选中列表内某一项
    for (i = 0; i < StrObj.length; i++) {
        if (StrObj.options[i].value == NextSelectedValue) {
            StrObj.options[i].selected = true;
        }
    }
    //激发下一级的onchange事件以实现多级级联
    StrObj.onchange();
}







//radio取值
function GetRadioValue(RadioName) {
    var obj;
    obj = document.getElementsByName(RadioName);
    if (obj != null) {
        var i;
        for (i = 0; i < obj.length; i++) {
            if (obj[i].checked) {
                return obj[i].value;
            }
        }
    }
    return null;
}


//radio自动选中
function s_radio(radio_name, aValue) {    //传入一个对象
    var radio_oj = document.getElementsByName(radio_name);
    for (var i = 0; i < radio_oj.length; i++) //循环
    {
        if (radio_oj[i].value == aValue) //比较值
        {
            radio_oj[i].checked = true; //修改选中状态
            break; //停止循环
        }
    }
}
//input鼠标点击清除，失去焦点还原默认内容的方法
function clearDefaultText(el, message) {
    var obj = el;
    if (typeof (el) == "string")
        obj = document.getElementById(id);
    if (obj.value == message) {
        obj.value = "";
    }
    obj.onblur = function () {
        if (obj.value == "") {
            obj.value = message;
        }
    }
}


//select自动选中
function s_select(obj_name, aValue) {    //传入一个对象
    var radio_oj = document.getElementById(obj_name);
    for (var i = 0; i < radio_oj.length; i++) //循环
    {
        if (radio_oj[i].value == aValue) //比较值
        {
            radio_oj[i].selected = true; //修改选中状态
            break; //停止循环
        }
    }
}

function s_checks(obj_name, aValue) {
    var sd = document.getElementsByName(obj_name);
    var statdata = aValue;
    var arr = statdata.split(",");
    for (var i = 0; i < arr.length; i++) {
        for (var j = 0; j < sd.length; j++) {
            if (arr[i] == sd[j].value) {
                sd[j].checked = true;
            }
        }
    }
}


function s_checks_(obj_name, aValue) {

    if (aValue == "") {
        return;
    }

    var sd = document.getElementsByName(obj_name);
    var statdata = aValue;
    var arr = statdata.split(",");
    for (var i = 0; i < arr.length; i++) {
        for (var j = 0; j < sd.length; j++) {
            if (arr[i] == (sd[j].value).split("-")[0]) {
                sd[j].checked = true;
            }
        }
    }
}

//列表的checkbox全选反选
function check_zf() {
    var chkother = document.getElementsByTagName("input"); //找模版中CheckBox
    for (var i = 0; i < chkother.length; i++) {
        if (chkother[i].type == 'checkbox') {
            if (chkother[i].id.indexOf('chkSelection') > -1) {
                chkother[i].checked = !chkother[i].checked;
            }
        }
    }
}



function copyUrl(str) {
    var clipBoardContent = str;
    window.clipboardData.setData("Text", clipBoardContent);
    alert("复制成功啦!");
} 


////radio自动选中(不用了)
//function changeaaaa(radio_name, aValue) {    //传入一个对象
//    var radio_oj = document.getElementsByName(radio_name);

//    for (var i = 0; i < radio_oj.length; i++) //循环
//    {
//        if (radio_oj[i].value == aValue) //比较值
//        {
//            radio_oj[i].checked = true; //修改选中状态
//            break; //停止循环
//        }
//    }
//}




function popWin(url, win, para) {
    var win = window.open(url, win, para);
    win.focus();
}
function setrefs() {
    window.location.href = window.location.href;
}

function setgo(url) {
    window.location.href = url;
}
function setback() {
   history.back(-1); 
}
function setPLocation(url, setFocus) {
    if (setFocus) {
        window.opener.focus();
    }
    window.opener.location.href = url;
}

function visit(href) {
    var target = "_blank";
    if (navigator.appName.toLowerCase().search("microsoft") != -1) {
        var bodyElem = document.getElementsByTagName("body")[0];
        var elem = document.createElement("a");
        elem.style.display = "none";
        elem.href = href;
        elem.target = target;
        bodyElem.appendChild(elem);
        elem.click();
        bodyElem.removeChild(elem);
    } else {
        if (target == undefined || target == "" || target == "_self") {
            window.location.href = href;
        } else {
            window.open(href);
        }
    }
}
function visitbody(href) {
    var target = "";
    if (navigator.appName.toLowerCase().search("microsoft") != -1) {
        var bodyElem = document.getElementsByTagName("body")[0];
        var elem = document.createElement("a");
        elem.style.display = "none";
        elem.href = href;
        elem.target = target;
        bodyElem.appendChild(elem);
        elem.click();
        bodyElem.removeChild(elem);
    } else {
        if (target == undefined || target == "" || target == "_self") {
            window.location.href = href;
        } else {
            window.open(href);
        }
    }
} 











function imgsize(ImgD, FitWidth, FitHeight) {
    var image = new Image();
    image.src = ImgD.src;
    if (image.width > 0 && image.height > 0) {
        if (image.width / image.height >= FitWidth / FitHeight) {
            if (image.width > FitWidth) {
                ImgD.width = FitWidth;
                ImgD.height = (image.height * FitWidth) / image.width;
            } else {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }
        } else {
            if (image.height > FitHeight) {
                ImgD.height = FitHeight;
                ImgD.width = (image.width * FitHeight) / image.height;
            } else {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }
        }
    }
}

//创建fck('txtArea')
function fck(tname) {
    var oFCKeditor = new FCKeditor(tname); //参数与textarea中name对应。 
    oFCKeditor.BasePath = "/FCKEditor/";
    oFCKeditor.Width = "100%";
    oFCKeditor.Height = "200px";
    oFCKeditor.Value = "wiki";
    oFCKeditor.ToolbarSet = "Basic";
    oFCKeditor.ReplaceTextarea(); //替换textarea标签内容 
} 



//openScript
function openScript(url, width, height) {
    var Win = window.open(url, "openScript", 'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=no');
}


//自适应iframe高度
function SetCwinHeight(objname) {
    var bobo = $E(objname);
    if (document.getElementById) {
        if (bobo && !window.opera) {
            if (bobo.contentDocument && bobo.contentDocument.body.offsetHeight) {
                bobo.height = bobo.contentDocument.body.offsetHeight;
            } else if (bobo.Document && bobo.Document.body.scrollHeight) {
                bobo.height = bobo.Document.body.scrollHeight;
            }
        }
    }
}


//选取所有
function CheckAll(form) {
    for (var i = 0; i < form.elements.length; i++) {
        var e = form.elements[i];
        if (e.name != 'chkall') e.checked = form.chkall.checked;
    }
}




function Nav() {
    if (window.navigator.userAgent.indexOf("MSIE") >= 1) return 'IE';
    else if (window.navigator.userAgent.indexOf("Firefox") >= 1) return 'FF';
    else return "OT";
}
function showhide(objname) {
    var obj = document.getElementById(objname);
    if (obj.style.display != "none")
        obj.style.display = "none";
    else {
        if (Nav() == 'IE') obj.style.display = "block";
        else obj.style.display = "table-row";
    }
}

function xi(o) {

    var a = "#edf3fc";
    var b = "#ffffff";
    var c = "#fcf5dd";
  //  var d = "#daecf1";


    var t = document.getElementById(o).getElementsByTagName("tr");
    for (var i = 0; i < t.length; i++) {
        t[i].style.backgroundColor = (t[i].sectionRowIndex % 2 == 0) ? a : b;
//        t[i].onclick = function() {
//            if (this.x != "1") {
//                this.x = "1"; //本来打算直接用背景色判断，FF获取到的背景是RGB值，不好判断
//                this.style.backgroundColor = d;
//            } else {
//                this.x = "0";
//                this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
//            }
//        }
        t[i].onmouseover = function() {
            if (this.x != "1") this.style.backgroundColor = c;
        }
        t[i].onmouseout = function() {
            if (this.x != "1") this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
        }
    }
}



function ximap(o) {

    var a = "#f5f7fc";
    var b = "#ffffff";
    var c = "#fcf5dd";
    //  var d = "#daecf1";


    var t = document.getElementById(o).getElementsByTagName("tr");
    for (var i = 0; i < t.length; i++) {
        t[i].style.backgroundColor = (t[i].sectionRowIndex % 2 == 0) ? a : b;
        //        t[i].onclick = function() {
        //            if (this.x != "1") {
        //                this.x = "1"; //本来打算直接用背景色判断，FF获取到的背景是RGB值，不好判断
        //                this.style.backgroundColor = d;
        //            } else {
        //                this.x = "0";
        //                this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
        //            }
        //        }
        t[i].onmouseover = function() {
            if (this.x != "1") this.style.backgroundColor = c;
        }
        t[i].onmouseout = function() {
            if (this.x != "1") this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
        }
    }
}








function xib(o) {

    var a = "#f0f0f0";
    var b = "#ffffff";
    var c = "#fff5dc";
    //  var d = "#daecf1";


    var t = document.getElementById(o).getElementsByTagName("tr");
    for (var i = 0; i < t.length; i++) {
        t[i].style.backgroundColor = (t[i].sectionRowIndex % 2 == 0) ? a : b;
        //        t[i].onclick = function() {
        //            if (this.x != "1") {
        //                this.x = "1"; //本来打算直接用背景色判断，FF获取到的背景是RGB值，不好判断
        //                this.style.backgroundColor = d;
        //            } else {
        //                this.x = "0";
        //                this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
        //            }
        //        }
        t[i].onmouseover = function() {
            if (this.x != "1") this.style.backgroundColor = c;
        }
        t[i].onmouseout = function() {
            if (this.x != "1") this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
        }
    }
}

function xiq(o) {

    var a = "#ffffff";
    var b = "#f5f7fc";
    var c = "#ebf1ff";
    var d = "#daecf1";


    var t = document.getElementById(o).getElementsByTagName("tr");
    for (var i = 0; i < t.length; i++) {
        t[i].style.backgroundColor = (t[i].sectionRowIndex % 2 == 0) ? a : b;
//        t[i].onclick = function() {
//            if (this.x != "1") {
//                this.x = "1"; //本来打算直接用背景色判断，FF获取到的背景是RGB值，不好判断
//                this.style.backgroundColor = d;
//            } else {
//                this.x = "0";
//                this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
//            }
//        }
        t[i].onmouseover = function() {
            if (this.x != "1") this.style.backgroundColor = c;
        }
        t[i].onmouseout = function() {
            if (this.x != "1") this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
        }
    }
}



function xiqNull(o) {

    var a = "#ffffff";
    var b = "#ffffff";
    var c = "#ebf1ff";
    var d = "#daecf1";


    var t = document.getElementById(o).getElementsByTagName("tr");
    for (var i = 0; i < t.length; i++) {
        t[i].style.backgroundColor = (t[i].sectionRowIndex % 2 == 0) ? a : b;
        //        t[i].onclick = function() {
        //            if (this.x != "1") {
        //                this.x = "1"; //本来打算直接用背景色判断，FF获取到的背景是RGB值，不好判断
        //                this.style.backgroundColor = d;
        //            } else {
        //                this.x = "0";
        //                this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
        //            }
        //        }
        t[i].onmouseover = function() {
            if (this.x != "1") this.style.backgroundColor = c;
        }
        t[i].onmouseout = function() {
            if (this.x != "1") this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
        }
    }
}


function xiqB2b(o) {

    var a = "#ffffff";
    var b = "#ffffff";
    var c = "#fffae3";
    var d = "#fffae3";


    var t = document.getElementById(o).getElementsByTagName("tr");
    for (var i = 0; i < t.length; i++) {
        t[i].style.backgroundColor = (t[i].sectionRowIndex % 2 == 0) ? a : b;
        
        t[i].onmouseover = function() {
            if (this.x != "1") this.style.backgroundColor = c;
        }
        t[i].onmouseout = function() {
            if (this.x != "1") this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
        }
    }
}





function xifc(o) {

    var a = "#f8faff";
    var b = "#ffffff";
    var c = "#f1f5ff";



    var t = document.getElementById(o).getElementsByTagName("tr");
    for (var i = 0; i < t.length; i++) {
        t[i].style.backgroundColor = (t[i].sectionRowIndex % 2 == 0) ? a : b;

        t[i].onmouseover = function() {
            if (this.x != "1") {
                this.style.backgroundColor = c;
                this.className = "listtrbin";
            }

        }
        t[i].onmouseout = function() {
            if (this.x != "1") {
                this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
                this.className = "listtrb";
            }

        }
    }
}




function xifcmap(o) {

    var a = "#f8faff";
    var b = "#ffffff";
    var c = "#f1f5ff";



    var t = document.getElementById(o).getElementsByTagName("tr");
    for (var i = 0; i < t.length; i++) {
        t[i].style.backgroundColor = (t[i].sectionRowIndex % 2 == 0) ? a : b;

        t[i].onmouseover = function() {
            if (this.x != "1") {
                this.style.backgroundColor = c;
                this.className = "mmlisttrbin";
            }

        }
        t[i].onmouseout = function() {
            if (this.x != "1") {
                this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
                this.className = "mmlisttrb";
            }

        }
    }
}


function xige(o) {
    var trs = document.getElementById(o).getElementsByTagName("tr"); //获取tbid的table中所有tr的信息 
    for (var i = 0; i < trs.length; i++) {
        if (trs[i].className != "sub") {
            if (i % 2 == 0) {
                trs[i].className = "tr1";
            }
            else {
                trs[i].className = "tr2";
            }
        }
    }
} 








//idqz:id前缀,idnow:目前第几个,tabcount:总共有几个,incss选中样式,outcss:离开样式
function showTabs(idqz, idnow, tabcount, incss, outcss) {

    var tabsNumber = tabcount;
    for (i = 0; i < tabsNumber; i++) {
        if (i == idnow) {
            $("#panel-" + idqz + i).show();
            $("#" + idqz + i).removeClass(outcss);
            $("#" + idqz + i).addClass(incss);
        }
        else {
            $("#panel-" + idqz + i).hide();
            $("#" + idqz + i).removeClass(incss);
            $("#" + idqz + i).addClass(outcss);
        }
    }
}

//idqz:id前缀,idnow:目前第几个,incss选中样式,outcss:离开样式:10个
function showTabs2(idqz, idnow, incss, outcss) {

    var tabsNumber = 10;
    for (i = 0; i < tabsNumber; i++) {

        if ($("#" + idqz + i).length > 0) {

            if (i == idnow) {
                $("#panel-" + idqz + i).show();
                $("#" + idqz + i).removeClass(outcss);
                $("#" + idqz + i).addClass(incss);
            }
            else {
                $("#panel-" + idqz + i).hide();
                $("#" + idqz + i).removeClass(incss);
                $("#" + idqz + i).addClass(outcss);
            }
        }
    }
}



///*tab切换*/
//function showtabs(main, obj1_qz) {

//    $(document).ready(function() {
//        if (obj1_qz == "0") {

//            $("#tab0" + main).show();
//            $("#tab1" + main).hide();
//            $("#rtabtitle" + main).removeClass('rtabtitle1');
//            $("#rtabtitle" + main).addClass('rtabtitle0');
//        }
//        else {

//            $("#tab1" + main).show();
//            $("#tab0" + main).hide();
//            $("#rtabtitle" + main).removeClass('rtabtitle0');
//            $("#rtabtitle" + main).addClass('rtabtitle1');
//        }
//    });
//}


//图片预览this,
function onUploadImgChange(sender, width, height, index) {
    //try {
    index = index == undefined ? "" : index;
    if (!sender.value.match(/.jpg|.gif|.png|.bmp/i)) {
        alert('请上传.jpg|.gif|.png|.bmp类型的图片');
        return false;
    }

    var objPreview = $(".previewpic" + index);
    var objPreviewFake = document.getElementById('previewfake' + index);

    if (sender.files && sender.files[0]) {
        objPreview.show();
        objPreview.attr("width", width);
        objPreview.attr("height", height);

        objPreview.attr("src", sender.files[0].getAsDataURL());
    } else if (objPreviewFake.filters) {

        sender.select();
        var imgSrc = document.selection.createRange().text;
        objPreviewFake.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = imgSrc;

        objPreviewFake.style.width = width + 'px';
        objPreviewFake.style.height = height + 'px';
        objPreview.hide();
        sender.blur();
    }
    //} catch (ex) {
    ///    alert("图片加载失败！");
    // }
}    





function ytgs(i) {
    i.className = "ytgs";
}
function ytgs1(i) {
    i.className = "ytgs1";
}


function tbcss(i, cssname) {
    var aa = cssname;
    i.className =aa;
}




function fafasearch(gokeywords) {
   
    var keywords = gokeywords;
   
    var zkeywords = encodeURI(keywords);
    visitbody("/search/search_fafa_go.aspx?keywords=" + zkeywords + "");
}


function setc(value) {
    setCookie('ddcitypinyinClient', value, '1680');
    
}


function setCookie(name, value,timeMin) {
    var Days = 30;
    var exp = new Date();
    //exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
    exp.setTime(exp.getTime() + timeMin  * 60 * 1000);
    document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";path=/;domain=.k518.com";
    //document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString())+";path=/;domain=b.com";

}

//读取cookies 
function getCookie(name) {
    var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");

    if (arr = document.cookie.match(reg))

        return unescape(arr[2]);
    else
        return null;
}

//删除cookies 
function delCookie(name) {
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval = getCookie(name);
    if (cval != null)
        document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
} 
