try {
	document.execCommand("BackgroundImageCache", false, true);
}
catch (e) {
}

function addfavorite(sTitle, sURL) {
	try {
		window.external.addFavorite(sURL, sTitle);
	}
	catch (e) {
		try {
			window.sidebar.addPanel(sTitle, sURL, "");
		}
		catch (e) {
			alert("加入收藏失败，请使用Ctrl+D进行添加。");
		}
	}
}

function sethome(sTitle, sURL) {
	try {
		sTitle.style.behavior='url(#default#homepage)'; sTitle.setHomePage(sURL);
	}
	catch(e) {
		if(window.netscape) {
			try {
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
			}  
			catch (e) { 
				alert("此项操作被浏览器拒绝！\n\n1.请在浏览器地址栏中输入about:config并按回车键。\n2.在进入高级设置之前可能会出现一个安全警告提示，点击“我保证会小心”。\n3.将signed.applets.codebase_principal_support设置为true。\n4.重新进行“设为首页”操作。");  
			}
			var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
			prefs.setCharPref('browser.startup.homepage', sURL);
		}
	}
}

function $$(o) {
	return document.getElementById(o);
}

window.onload = function() {
	for(var i=0; i<document.links.length; i++)
	document.links[i].onfocus = function() {this.blur()}
}

function ikeyword(obj, type) {
	var init = "请输入搜索关键字";
	switch(type) {
		case 1:
			if(obj.value == init) {
				obj.value = "";
			}
			obj.style.cssText = "color: #000000;";
			break;
		case 2:
			if(obj.value == "") {
				obj.value = init;
				obj.style.cssText = "";
			}
			else {
				obj.style.cssText = "color: #000000;";
			}
			break;
	}
}

function checkkeyword(f) {
	var k = f.elements["keyword"];
	if (k.value == "请输入搜索关键字" || k.value == "") {
		alert("请输入搜索关键字！");
		k.focus();
		return false;
	}
	return true;
}

function checode() {
	if ((event.keyCode < 48 && event.keyCode != 13) || event.keyCode > 57) {
		event.returnValue = false;
	}
}
function refcode() {
	$$("imgcode").src = "/getcode.asp?s=" + Math.random();
	$$("code").value = "";
}
function crecode(sURL) {
	if (sURL.indexOf("getcode.asp") == -1) {
		$$("imgcode").src = "/getcode.asp?s=" + Math.random();
	}
}

function webload() {
	var web_left = $$("web_left").scrollHeight;
	var web_right = $$("web_right").scrollHeight;
	var web_newheight = Math.max(web_left, web_right);
	$$("web_left").style.height = web_newheight-80 + "px";
	$$("web_right").style.height = web_newheight-80 + "px";
}

function select_active(o) {
	$$(o).style.display="block";
}
function select_mouseover() {
	try {
		window.clearTimeout(timer);
	}
	catch(e) {
	}
}
function select_mouseout(o) {
	var possel = $$(o).style.display;
	if(possel == "block") {
		timer = setTimeout("select_hide('" + o + "')", 100);
	}
}
function select_hide(o) {
	$$(o).style.display = "none";
}
function select_show(o, i, name, v, s) {
	$$(o).innerHTML = name;
	$$(i).value = v;
	select_hide(s);
}

function all_click() {
	var chk = document.getElementsByName("chk");
	for(var i=0; i<chk.length; i++) {
		chk(i).checked=true;
	}
}
function not_click() {
	var chk = document.getElementsByName("chk");
	for(var i=0; i<chk.length; i++) {
		if(chk(i).checked)
			chk(i).checked = false;
		else
			chk(i).checked = true;
	}
}

function copyToClipboard(txt) {    
     if(window.clipboardData) {    
              window.clipboardData.clearData();    
              window.clipboardData.setData("Text", txt);    
      } else if(navigator.userAgent.indexOf("Opera") != -1) {    
           window.location = txt;    
      } else if (window.netscape) {    
          try {    
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");    
           } catch (e) {    
                alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");    
           }    
           var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);    
          if (!clip)    
               return;    
           var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);    
          if (!trans)    
               return;    
           trans.addDataFlavor('text/unicode');    
           var str = new Object();    
           var len = new Object();    
           var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);    
           var copytext = txt;    
           str.data = copytext;    
           trans.setTransferData("text/unicode",str,copytext.length*2);    
           var clipid = Components.interfaces.nsIClipboard;    
          if (!clip)    
               return false;    
           clip.setData(trans,null,clipid.kGlobalClipboard);    
      }
      alert("复制：\n" + txt);
}    



		function it_announcement() {
	var ann = new Object();
	ann.anndelay = 3000;ann.annst = 0;ann.annstop = 0;ann.annrowcount = 0;ann.anncount = 0;ann.annlis = $$('it_anc').getElementsByTagName('li');ann.annrows = new Array();
	ann.announcementScroll = function () {
		if(this.annstop) {this.annst = setTimeout(function () {ann.announcementScroll();}, this.anndelay);return;}
		if(!this.annst) {
			var lasttop = -1;
			for(i = 0;i < this.annlis.length;i++) {
				if(lasttop != this.annlis[i].offsetTop) {
					if(lasttop == -1) lasttop = 0;
					this.annrows[this.annrowcount] = this.annlis[i].offsetTop - lasttop;this.annrowcount++;
				}
				lasttop = this.annlis[i].offsetTop;
			}
			if(this.annrows.length == 1) {
				$$('it_an').onmouseover = $$('it_an').onmouseout = null;
			} else {
				this.annrows[this.annrowcount] = this.annrows[1];
				$$('it_ancl').innerHTML += $$('it_ancl').innerHTML;
				this.annst = setTimeout(function () {ann.announcementScroll();}, this.anndelay);
				$$('it_an').onmouseover = function () {ann.annstop = 1;};
				$$('it_an').onmouseout = function () {ann.annstop = 0;};
			}
			this.annrowcount = 1;
			return;
		}
		if(this.annrowcount >= this.annrows.length) {
			$$('it_anc').scrollTop = 0;
			this.annrowcount = 1;
			this.annst = setTimeout(function () {ann.announcementScroll();}, this.anndelay);
		} else {
			this.anncount = 0;
			this.announcementScrollnext(this.annrows[this.annrowcount]);
		}
	};
	ann.announcementScrollnext = function (time) {
		$$('it_anc').scrollTop++;
		this.anncount++;
		if(this.anncount != time) {
			this.annst = setTimeout(function () {ann.announcementScrollnext(time);}, 10);
		} else {
			this.annrowcount++;
			this.annst = setTimeout(function () {ann.announcementScroll();}, this.anndelay);
		}
	};
	ann.announcementScroll();
}