/*----------搜索框提示----------*/
//获得焦点
	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 getTips() {
		var current_category_ele = document.getElementById('current_category');
		if (!current_category_ele || !current_category_ele.value) {
			return '';
		}
		var title = current_category_ele.value;
		if (!title) {
			alert('无法识别当前分类。');
			return '';
		}
		if (title == '首页' || title == '全部分类') {
			return '全部分类：网站名称、网址、标签等';
		} else if (title == '新闻资讯') {
			return '新闻资讯：商铺名等';
		} else if (title == '会员卡') {
			return '会员卡：商铺名等';
		} else if (title == '优惠券') {
			return '优惠券：商铺名等';
		} else if (title == '兑奖中心') {
			// 不必提示
			return '';
		} else if (title == 'MODOER') {
			// 不必提示
			return '';
		} else {
			// 一级分类：美食餐馆、休闲娱乐等
			return title + '：网站名称、网址、标签等';
		}
	}
	$(document).ready(function() {
		var inputKey = document.getElementById('inputKey');
		if (!inputKey.value) {
			$('#inputKey').attr('class', 'searchTip').val(getTips());
		}

	});

/*----------设为首页加入收藏----------*/
function addCookie(){//加入收藏 
if(document.all){
       window.external.addFavorite('http://www.dianzhantai.com', '点站台--点评网站的平台');
}
else if(window.sidebar){
      window.sidebar.addPanel('点站台--点评网站的平台','http://www.dianzhantai.com',"");
}
}

function setHomepage(){//设为首页 
   if(document.all){
      document.body.style.behavior='url(#default#homepage)';
      document.body.setHomePage('http://www.dianzhantai.com');
   }
   else if(window.sidebar){
        if(window.netscape){
             try{
                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
             }
             catch(e){
                 alert("您的浏览器未启用[设为首页]功能，您可以手动设置，方法如下：点击“工具”-“选项”，弹出对话框后，选择“启动Firefox时”显示我的主页，并在“主页”一栏输入 www.dianzhantai.com ，点击“确定”即可。");
             }
        }
        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;