﻿var root = "/web/";
function searchInfo(obj,type,init)
{
    obj = document.getElementById(obj).value;
    if(obj == "" || obj == init)
    {
        alert("请输入搜索关键字！");
        return false;
    }
    var strUrl = root;
    switch (type)
    {
        case "training" : strUrl += "Training.aspx";break;
        default :strUrl += "Lists.aspx";break;
    }
    this.location.href=strUrl + "?cons=" + escape(obj);
}



function  onFocusText(obj,value)
{
    if(obj.value==value)
    {
	    obj.value = "";
	    obj.style.color = "#000000";
    }
}
function  onblurText(obj,value)
{
    if(obj.value=="")
    {
        obj.value = value;
	    obj.style.color = "";
    }
}

function  onFocusPwd(obj,pwdName)
{
    var pwd=document.getElementById(pwdName);
    obj.style.display = "none";
    pwd.style.display = "block";
    pwd.style.color = "#000000";
    pwd.focus();
}
function  onblurPwd(obj,pwdName)
{
    if(obj.value=="")
    {
        var pwd=document.getElementById(pwdName);
        obj.style.display = "none";
        pwd.style.display = "block";
    }
}

var tmExpand = null;//i当前是否存在定时器
var tmExpandName = "";//当前定时器的名称
//显示一个对象
function showObj(objName)
{
    if(tmExpand && objName == tmExpandName)
        window.clearTimeout(tmExpand);
    document.getElementById(objName).style.display = "block";
    tmExpandName = objName;
}
//隐藏一个对象
function hideObj(objName)
{
    tmExpandName = objName;
    tmExpand = window.setTimeout("document.getElementById('"+objName+"').style.display='none'",200)
}


//加入收藏夹
function addFavicon(url,urlTitle)
{

if((url==null||url=="undefined")){
    url="http://www.4006090906.com";
  }
  
  if((urlTitle==null||urlTitle=="undefined")){
    urlTitle="中国家政网";
  }
  
 if (document.all)
    {
       window.external.addFavorite(url,urlTitle);
    }
    else if (window.sidebar)
    {
       window.sidebar.addPanel(urlTitle, url, "");
 }
}

//设为首页
function setHomepage(url)
{
  if((url==null||url=="undefined")){
    url="http://www.4006090906.com";
  }
 if (document.all)
    {
        document.body.style.behavior='url(#default#homepage)';
  document.body.setHomePage(url);
 
    }
    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',url);
 }
}