﻿function $(e) {
    return document.getElementById(e);
}

//鼠标移动上去离开
function ontablefocus(id, type, count, on, uon) {
    var i = 0
    for (i; i < count; i++) {
        $(type + i).className = uon;
        $(type + "div" + i).style.display = "none";
    }
    $(type + id).className = on;
    $(type + "div" + id).style.display = "block";
}

//商播
function onvoidfocus(id, type, count, on, uon) {
    var i = 0
    for (i; i < count; i++) {
        $(type + i).className = uon;
        $(type + "div" + i).style.display = "none";
        $(type + "adiv" + i).style.display = "none";
    }
    $(type + id).className = on;
    $(type + "div" + id).style.display = "block";
    $(type + "adiv" + id).style.display = "block";
}
/*--------------滚动----------------------------*/


/*--------------END----------------------------*/


function GetKey(val) {
    $("Keyword").value = val;
}

/*        搜索       */
function ShowSearch(val) {
    for (var i = 0; i < 4; i++) {
        $('fors' + i).className = '';
        $('SiteType').value = val;
    }
    $('fors' + val).className = 'sopt';
}

function Search() {
    if ($("Keyword").value.indexOf("　") < 0 && $("Keyword").value.indexOf(" ") < 0 && $("Keyword").value != "") {
        if ($("SiteType").value == "0") {
            window.location.href = "http://sx.stx168.com/search_gs.html?sdtype=0&dropepMode=0&dropepProv=0&dropepBClass=0&txtepName=" + $('Keyword').value;
        }
        if ($("SiteType").value == "1") {
            window.location.href = "http://sx.stx168.com/search_sj.html?sdtype=0&dropepMode=0&dropepProv=0&dropepBClass=0&txtepName=" + $('Keyword').value;
        }
        if ($("SiteType").value == "2") {
            window.location.href = "http://sx.stx168.com/search_sj.html?sdtype=1&dropepMode=0&dropepProv=0&dropepBClass=0&txtepName=" + $('Keyword').value;
        }
        if ($("SiteType").value == "3") {
            window.location.href = "http://sx.stx168.com/search_zx.html?sdtype=0&dropepMode=0&dropepProv=0&dropepBClass=0&txtepName=" + $('Keyword').value;
        }
    }


}


function SetHomePage(obj) {
    if (document.all) {
        obj.style.behavior = 'url(#default#homepage)';
        obj.setHomePage('http://www.stx168.com');
    } else if (window.sidebar) {
        if (window.netscape) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            } catch (e) {
                alert("该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config, 然后将项 signed.applets.codebase_principal_support 值改为true");
            }
        }
        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
        prefs.setCharPref('browser.startup.homepage', 'http://www.stx168.com');
    }
}


/**************************************************************************/
function search4()
{
    var fKey = UrlEncode(form2.key.value);
    //if(form2.abc1.checked) window.open("http://www.gougou.com/search?id=1&search="+fKey,"mspg1");
    if (form2.abc2.checked) window.open("http://www.yahoo.cn/search:" + fKey, "mspg2");
    if (form2.abc4.checked) window.open("http://www.google.cn/search?hl=zh-CN&q=" + fKey, "mspg4");
    if (form2.abc6.checked) window.open("http://www.baidu.com/baidu?tn=stx168&word=" + fKey, "mspg6");
    if (form2.abc7.checked) window.open("http://www.yodao.com/search?q=" + fKey, "mspg7");
    if (form2.abc8.checked) window.open("http://www.soso.com/q?pid=s.idx&w=" + fKey, "mspg8");
    if (form2.abc9.checked) window.open("http://www.sogou.com/web?_asf=www.stx168.com&query=" + fKey, "mspg9");
    if (form2.abc12.checked) window.open("http://www.baidu.com/s?tn=sitestx168&word=" + fKey + "%20site%3Astx168.com", "mspg12");
    return false
}
function Searchx()
{
    $Obj('form2').submit();
}

    function UrlEncode(str){
       var ret="";
       var strSpecial="!\"#$%&'()*+,/:;<=>?[]^`{|}~%";
       for(var i=0;i<str.length;i++){
       var chr = str.charAt(i);
         var c=str2asc(chr);
         if(parseInt("0x"+c) > 0x7f){
           ret+="%"+c.slice(0,2)+"%"+c.slice(-2);
         }else{
           if(chr==" ")
             ret+="+";
           else if(strSpecial.indexOf(chr)!=-1)
             ret+="%"+c.toString(16);
           else
             ret+=chr;
         }
       }
       return ret;
    }
    /********************************************************/



    /****************************login**********************************************/


    function onusername() {
        if ($("stxusername").value == "用户名") {
            $("stxusername").value = "";
        }
    }
    function outusername() {
        if ($("stxusername").value== "") {
            $("stxusername").value = "用户名";
        }
    }

    function onuserpass() {
        if ($("stxuserpass").value == "密码") {

            $("stxuserpass").value = "";
        }
    }
    function outuserpass() {
        if ($("stxuserpass").value == "") {
            $("stxuserpass").value = "密码";
        }

    }

    function onuserpass1() {
        if ($("stxuserpass1").value == "密码") {

            $("stxuserpass1").value = "";
        }
    }
    function outuserpass1() {
        if ($("stxuserpass1").value == "") {
            $("stxuserpass1").value = "密码";
        }

    }
    /*****************************end*********************************************/




