var showImgIng=false;
function showImgFun(hideObj,showObj){
	if(!showImgIng){
		showImgIng=true;
		if(showObj.length){
			hideObj.fadeOut(300,function (){
				showObj.fadeIn(300,function (){
					showImgIng=false;
				})
			})
		}else{
			showImgIng=false;
		}
	}
}
function showImgLeft(id){
	var hideObj=$('#'+id+' li:visible:first');
	var showObj=$('#'+id+' li:visible:last').next();
	showImgFun(hideObj,showObj);
}
function showImgRight(id){
	var hideObj=$('#'+id+' li:visible:last');
	var showObj=$('#'+id+' li:visible:first').prev();
	showImgFun(hideObj,showObj);
}
function imgshow(tab,tabid,defid,typeid){
	if(!defid) defid='';
	if(!typeid) typeid='';
	var url='/imgshow.php?tab='+tab+'&amp;tabid='+tabid+'&amp;id='+defid+'&amp;typeid='+typeid;
	url+='&amp;TB_iframe=true&amp;width=550&amp;height=380';
	tb_show('',url,false);
}
function showtime(obj){
	var fun=function (){
		var nowObj=$(obj).children('*:visible');
		var newObj=nowObj.next();
		if(newObj.length<1){
			newObj=$(obj).children('*:first');
		}
		nowObj.fadeOut(300,function (){
			newObj.fadeIn(300);
		})
	}
	setInterval(fun,5000);
}
function favorite(typeid,dostr,act,ttObj,url,json){
	if($(ttObj).length>0){
		var title='';
		ttObj.find('a[rel!=clear]').each(function (){
			title+=$(this).html()+'; ';
		})
	}else{
		title=ttObj;
	}
	var param={};
	param['typeid']=typeid;
	param['do']=dostr;
	param['act']=act;
	param['title']=title;
	param['url']=url;
	param['param']=json;
	$.post('/command/favorite.code.php',param,function (msg){
		alert(msg);
	});
}
function copyUrl() {
	var clipBoardContent = window.location.href+"\r\n"+document.title;
	copyToClipboard(clipBoardContent);
	alert("复制本站链接成功,您可以直接粘贴给您的朋友!");
}
function AddFavorite() {
	var sURL = window.location.href;
	var sTitle = document.title;
	try{
		window.external.addFavorite(sURL, sTitle);
	}catch(e){
		try{
			window.sidebar.addPanel(sTitle, sURL, "");
		}catch(e){
			alert("加入收藏失败，请使用Ctrl+D进行添加");
		}
	}
}
function SetHome(obj, vrl) {
	try{
		obj.style.behavior = 'url(#default#homepage)';
		obj.setHomePage(vrl);
	}catch(e){
		if(window.netscape){
			try{
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}catch(e){
				alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'");
			}
			var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
			prefs.setCharPref('browser.startup.homepage', vrl);
		}
	}
}

