/*----------搜索框提示----------*/
//失去焦点
	function addTip() {
		var inputKey = document.getElementById('inputKey');
		if (inputKey.value != '') {
			// users inputed, do not add tip
		} else {
			$('#inputKey').attr('class', 'searchTip').val(getTips());
		}
	}
	//获得焦点
	function removeTip() {
		$('#inputKey').attr('class', '').val('');
	}
	//提示表单的时候过滤提示语
	function filterCategoryNames() {
		var inputKeyEle = document.getElementById('inputKey');
		var inputKey = inputKeyEle.value;
		if (inputKey == getTips()) {
			inputKeyEle.value = '';
		}
	}
	function searchs()
	{
		filterCategoryNames();
		var inputKey=document.getElementById("inputKey").value;
		if(inputKey=='')return false;
		return true;
		
	}
	// 根据当前的分类生成其对应的提示语
	function getTips() {
		return '网站名称、网址等';
	}
	$(document).ready(function() {
		var inputKey = document.getElementById('inputKey');
		if (!inputKey.value) {
			$('#inputKey').attr('class', 'searchTip').val(getTips());
		}

	});

/*----------设为首页加入收藏----------*/
function addCookie(a){//加入收藏 
if(document.all){
       window.external.addFavorite(a, '评站');
}
else if(window.sidebar){
      window.sidebar.addPanel('评站',a,"");
}
}

function setHomepage(a){//设为首页 
   if(document.all){
      document.body.style.behavior='url(#default#homepage)';
      document.body.setHomePage(a);
   }
   else if(window.sidebar){
        if(window.netscape){
             try{
                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
             }
             catch(e){
                 alert("您的浏览器未启用[设为首页]功能，您可以手动设置，方法如下：点击“工具”-“选项”，弹出对话框后，选择“启动Firefox时”显示我的主页，并在“主页”一栏输入 网址 ，点击“确定”即可。");
             }
        }
        var prefs=Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
        prefs.setCharPref('browser.startup.homepage','http://www.dianzhantai.com');
   }
}

/*----------全部分类弹出关闭----------*/
function openShutManager(oSourceObj,oTargetObj,shutAble,oOpenTip,oShutTip){
var sourceObj = typeof oSourceObj == "string" ? document.getElementById(oSourceObj) : oSourceObj;
var targetObj = typeof oTargetObj == "string" ? document.getElementById(oTargetObj) : oTargetObj;
var openTip = oOpenTip || "";
var shutTip = oShutTip || "";
if(targetObj.style.display!="none"){
   if(shutAble) return;
   targetObj.style.display="none";
   if(openTip  &&  shutTip){
    sourceObj.innerHTML = shutTip; 
   }
} else {
   targetObj.style.display="block";
   if(openTip  &&  shutTip){
    sourceObj.innerHTML = openTip; 
   }
}
}

/*----------网站功能提示----------*/
function cookiesave(n, v, mins, dn, path)
{
    if(n)
    {
		
	    if(!mins) mins = 365 * 24 * 60;
		if(!path) path = "/";
	    var date = new Date();
		
	    date.setTime(date.getTime() + (mins * 60 * 1000));
		
	    var expires = "; expires=" + date.toGMTString();
		
	    if(dn) dn = "domain=" + dn + "; ";
	    document.cookie = n + "=" + v + expires + "; " + dn + "path=" + path;
    }
}
function cookieget(n)
{
    var name = n + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i<ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
	}
	return "";
}
function closeclick(){
	document.getElementById('note').style.display='none';
	cookiesave('closeclick','closeclick','','','');
}
function clickclose(){
	if(cookieget('closeclick')=='closeclick'){
		document.getElementById('note').style.display='none';
	}else{
		document.getElementById('note').style.display='block';
	}
}
window.onload=clickclose;