function $(Id_){return document.getElementById(Id_);}
function Tag(Name_){return document.getElementsByTagName(Name_);}
function dw(Str_){return document.write(Str_);}
function LoadHTML(obj,HTML){if($(obj)){$(obj).innerHTML=HTML;}}
function formatStr(str){str=str.replace(/\r\n/ig,"");return str;}//过滤回车
function Trim(str){return str.replace(/(^\s*)|(\s*$)/g, "");} //过滤字符串空格
function LTrim (str){return str.replace(/(^\s*)/g, "");} //过滤字符串左边的空格
function RTrim (str){return str.replace(/(\s*$)/g, "");} //过滤字符串右边的空格
function iTrim (str,T){return str.replace(T, "");} //自定义过滤
function getescape(a){if(escape)return escape(a)};//编码 GBK
function getencode(a){if(encodeURIComponent)return encodeURIComponent(a);};//编码 uf8
var url_href = location.href;if (url_href==""){url_href="http://www.kkkcha.com/";}
var title = document.title;if (title==""){title="快查网,快快查 --- kkkCha.Com";}
var Is = new Object();
    Is.IE = window.ActiveXObject?true:false;
//var tta=title.indexOf(",");
var ttt=title;//title.substring(0,tta);
var tt=encodeURIComponent(ttt);
var tta=encodeURIComponent(title);
var tb=escape(ttt);
var ttb=escape(title);
var uu=encodeURIComponent(document.location.href);

function getreplace(str){return str.replace(/\+/g,"＋").replace(/\"/g,"&quot;").replace(/\;/g,"&#59;").replace(/\'/g,"&#39;").replace(/\[/g,"&#91;").replace(/\]/g,"&#93;");} 

// IE== 让IE6支持li:hover
function gethoverStyle(obj,tgs,cssTextover,cssTextout){
    var hovers = $(obj).getElementsByTagName(tgs);
		for (var i=0; i<hovers.length; i++) {
			hovers[i].onmouseover=function(){this.style.cssText=cssTextover;}
			hovers[i].onmouseout=function(){this.style.cssText=cssTextout;}
		}
}

// 加入本地收藏夹
function getaddf(){
	if (document.all){
			window.external.addFavorite(url_href,document.title);
		}
		 else if (window.sidebar){
			window.sidebar.addPanel(document.title, url_href, "");
	}
}
// 打开网络收藏
function wopen(url,name){window.open(url,name,'toolbar=0,location=0,directories==0,status=0,menubar=0,scrollbars=1,status=no,resizable=yes');}
function getloadFavorites(){
		// 收藏到=====>>>>>>>---
		$("Favoritesto").onclick=function(){
					var f_list = "<li><a href='javascript:getaddf();'>本地收藏夹</a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://shuqian.qq.com/post?from=3&title='+tt+'&uri='+uu+'&jumpback=2&noui=1','QQ');\">QQ收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://cang.baidu.com/do/add?it='+tt+'&iu='+uu+'&dc='+tta+'&fr=ien#nw=1','baidu');\">baidu收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://koudai.360.cn/reg_create.html?title='+tb+'&url='+uu,'360');\">360.cn收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://vivi.sina.com.cn/collect/icollect.php?pid=xuxule.net&title='+tb+'&url='+uu+'&desc='+ttb,'vivi');\">ViVi收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://www.365key.com/storeit.aspx?t='+tb+'&u='+uu+'&c='+ttb,'365Key');\">365Key收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://hot.yesky.com/dp.aspx?t='+tb+'&u='+uu+'&c='+ttb+'&st=2','yesky');\">yesky收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://www.wozhai.com/wozhai/Cento.asp#t='+tb+'&u='+uu+'&c='+ttb,'wozhai');\">wozhai收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://my.poco.cn/fav/storeIt.php?t='+tb+'&u='+uu+'&c='+ttb,'POCO');\">POCO收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://bookmark.hexun.com/post.aspx?title='+tb+'&url='+uu+'&excerpt='+ttb,'HexunBookmark');\">hexun收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://www5.bolaa.com/CommendBlog/SmallCommend.aspx?title='+tb+'&link='+uu+'&synopsis='+ttb,'bolaa');\">'bolaa收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://myweb.cn.yahoo.com/popadd.html?url='+uu+'&amp;title='+tt,'yahoo');\">yahoo收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://www.shouker.com/mc/col/post3.aspx?surl='+uu+'&title='+tt+'&desc='+tta,'shouker');\">shouker收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://www.digbuzz.com/submit.php?url='+uu,'digbuzz');\">Digbuzz收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://fanfou.com/sharer?u='+uu+'&t='+tt+'&d='+tta+'&s=bm','fanfou');\">fanfou收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://www.google.com/bookmarks/mark?op=add&bkmk='+uu+'&title='+tt,'google');\">google收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://www.1zhai.com/icollect.asp#t='+tb+'&u='+uu+'&c='+ttb,'zhai');\">1zhai收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://www.favorites.com.cn/post/default.aspx?description='+tb+'&urll='+uu+'&notes='+ttb,'favo');\">favorites收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://www.diglog.com/submit.aspx?title='+tb+'&url='+uu+'&description='+ttb,'diglog');\">diglog收藏<\/a>";
						f_list = f_list+"<br /><a target=_self href=\"javascript:void(0);\" onclick=\"wopen('http://www.waakee.com/submit.php?url='+uu,'waakee');\">waakee收藏<\/a></li>";
					$("f_to_list").style.visibility = "visible";
					LoadHTML("f_to_list_v",f_list);
		}

		// 任意点击产生动作
		window.document.onmouseup=function(){$("f_to_list").style.visibility = "hidden";}

		// 设置主页
		$("Setmyhome").onclick=function(){
		    if (document.all)
		    	{
				    $("Setmyhome").style.behavior = "url(#default#homepage)";
				    $("Setmyhome").setHomePage(url_href);
		    	}
		    	else if (window.sidebar)
		    	{
					if(window.netscape)
						{
						try {
							    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
							} 
							catch (e) 
							{ 
								alert("您的浏览器不能设置为主页！请把本站添加入书签!"); 
								window.sidebar.addPanel(document.title, url_href, "");
							}
						}
						var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
						prefs.setCharPref('browser.startup.homepage',url_href);
			}
			return false;
		}
}

// 加载javascript
function getJsurl(url,jsid)
{   var Ran = Math.round(Math.random()*1000)
    var Now = new Date();
	var Num = Now.getSeconds();
	var JsId = "Id_"+jsid+"_"+Num+"_"+ Ran;
	var oHead = document.getElementsByTagName("head").item(0); 
	var oScript = document.createElement("script"); 
	var oldJs = document.getElementById(JsId)
    if (!oldJs)
	{ 
        oScript.language = "javascript"; 
        oScript.type = "text/javascript"; 
        oScript.id = JsId; 
        oScript.defer = true;
        oScript.charset = "gb2312";
        oScript.src = url;
        void(oHead.appendChild(oScript)); 
	}
}
// 加载javascript
function getJsfalse(url,jsid)
{   var Ran = Math.round(Math.random()*1000)
    var Now = new Date();
	var Num = Now.getSeconds();
	var JsId = "Id_"+jsid+"_"+Num+"_"+ Ran;
	var oHead = document.getElementsByTagName("head").item(0); 
	var oScript = document.createElement("script"); 
	var oldJs = document.getElementById(JsId)
    if (!oldJs)
	{ 
        oScript.language = "javascript"; 
        oScript.type = "text/javascript"; 
        oScript.id = JsId; 
        oScript.defer = false;
        oScript.charset = "gb2312";
        oScript.src = url;
        void(oHead.appendChild(oScript)); 
	}
}
