// JavaScript Document
var HomepageFavorite = {

    //设为首页

    Homepage: function () {

        if (document.all) {

            document.body.style.behavior = 'url(#default#homepage)';

            document.body.setHomePage(window.location.href);

        }

        else if (window.sidebar) {

            if (window.netscape) {

                try {

                    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

                }

                catch (e) {

                    alert("该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");

                    history.go(-1);   //这里我用firefox测试的时候出错，我把它注释掉，改成 return false;

 

                }

            }

            var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);

            prefs.setCharPref('browser.startup.homepage', window.location.href);

        }

    }

    ,

    //加入收获

    Favorite: function Favorite(sURL, sTitle) {

        try {

            window.external.addFavorite(sURL, sTitle);

        }

        catch (e) {

            try {

                window.sidebar.addPanel(sTitle, sURL, "");

            }

            catch (e) {

                alert("加入收藏失败,请手动添加.");

            }

        }

    }

}



/*搜索方法begin*/
function SearchGo() {
    var keyword = document.getElementById("txtSearchKey").value;
    if (keyword == "") {
        alert("请输入关键字");
        return false;
    }
    window.location.href = 'Search.jsp?keyword=' + escape(keyword);
}
/*搜索方法end*/








function login() {
   
    document.getElementById("ctl00_loginname").style.display = "block";
   

}

function loginnone() {

    document.getElementById("ctl00_loginname").style.display = "none";
//    document.getElementById("ctl00_txtLoginName").value = "";
//   document.getElementById("ctl00_pwd").value = "";
    return false;

}

function reg() {
    document.getElementById("ctl00_reg").style.display = "block";


}
function reg1() {
    document.getElementById("ctl00_reg").style.display = "block";
    document.getElementById("ctl00_loginname").style.display = "none";
    return false;

}
function regnone() {
    document.getElementById("ctl00_reg").style.display = "none";
    return false;

}


function check() {

  var name= document.getElementById("ctl00_txtLoginName").value;
  var pwd = document.getElementById("ctl00_pwd").value;

  if (document.getElementById("ctl00_txtLoginName").value.length < 1) {

      alert("请输入用户名！");
    //  document.getElementById("ctl00_txtLoginName").focus();
      return false;
  }

  if (pwd.length < 1) {

      alert("请输入密码！");
      document.getElementById("ctl00_pwd").focus();
      return false;
  }

  return true;

}

//function focus0() {
//    alert();
//    document.getElementById("ctl00_txtLoginName").value = "";
//    return false;
//   // document.getElementById("ctl00_pwd").value = "";

//}