/**
 * $id global.js
 */

	//显示隐藏层
	function tag_dis(id,no,n){
		if(!id||no>=n){return false;};
		for(var a=0;a<n;a++){
			document.getElementById(id+'_tag_'+a).className = 'out';
			document.getElementById(id+'_dis_'+a).style.display = 'none';
		}
		document.getElementById(id+'_tag_'+no).className = 'over';
		document.getElementById(id+'_dis_'+no).style.display = 'block';
	};

	//友情链接跳转
	function link_select(id){
		var url = document.getElementById(id).value;
		if(''!=url){
			window.open(url);
		}
	}

	//一级自动合并树型菜单
	function auto_init(id,no,n){
		if(document.getElementById(id+'_'+no).style.display == 'none'){ //如果此层是隐藏的 显示此层
			for(a=0;a<n;a++){
				document.getElementById(id+'_'+a).style.display = 'none';
			}
			document.getElementById(id+'_'+no).style.display = 'block';
		}else{
			document.getElementById(id+'_'+no).style.display = 'none'; //如果此层是显示的 隐藏此层
		}
	}

	//改变字体大小
	function font_size(id,size){
		document.getElementById(id).style.fontSize = size+'px';
	}


	/* 其它函数 */

	//复制URL地址
	function setCopy(_sTxt){
		if(navigator.userAgent.toLowerCase().indexOf('ie') > -1) {
			clipboardData.setData('Text',_sTxt);
			alert ("网址“"+_sTxt+"”\n已经复制到您的剪贴板中\n您可以使用Ctrl+V快捷键粘贴到需要的地方");
		} else {
			prompt("请复制网站地址:",_sTxt); 
		}
	}

	//加入收藏
	function addBookmark(site, url){
		if(navigator.userAgent.toLowerCase().indexOf('ie') > -1) {
			window.external.addFavorite(url,site)
		} else if (navigator.userAgent.toLowerCase().indexOf('opera') > -1) {
			alert ("请使用Ctrl+T将本页加入收藏夹");
		} else {
			alert ("请使用Ctrl+D将本页加入收藏夹");
		}
	}

	//加入收藏 调用<a href="javascript:bookmark()">收藏本站</a>
	function bookmark(){
		var title=document.title
		var url=document.location.href
		if (window.sidebar) window.sidebar.addPanel(title, url,"");
		else if( window.opera && window.print ){
		var mbm = document.createElement('a');
		mbm.setAttribute('rel','sidebar');
		mbm.setAttribute('href',url);
		mbm.setAttribute('title',title);
		mbm.click();}
		else if( document.all ) window.external.AddFavorite( url, title);
	}

	//<a onClick="this.style.behavior='url(#default#homepage)';this.setHomePage(document.location.href)">设为首页</a>

	/**
	 * 全选
	 */
	function checkall(form, prefix, checkall) {
		var checkall = checkall ? checkall : 'chkall';
		for(var i = 0; i < form.elements.length; i++) {
			var e = form.elements[i];
			if(e.name != checkall && (!prefix || (prefix && e.name.match(prefix)))) {
				e.checked = form.elements[checkall].checked;
			}
		}
	}

	//弹出窗口
	function OpenWindow(url, winName, width, height) {
		xposition=0; yposition=0;
		if ((parseInt(navigator.appVersion) >= 4 )) {
			xposition = (screen.width - width) / 2;
			yposition = (screen.height - height) / 2;
		}
		theproperty= "width=" + width + ","
		+ "height=" + height + ","
		+ "location=0,"
		+ "menubar=0,"
		+ "resizable=1,"
		+ "scrollbars=1,"
		+ "status=0,"
		+ "titlebar=0,"
		+ "toolbar=0,"
		+ "hotkeys=0,"
		+ "screenx=" + xposition + "," //仅适用于Netscape
		+ "screeny=" + yposition + "," //仅适用于Netscape
		+ "left=" + xposition + "," //IE
		+ "top=" + yposition; //IE 
		window.open(url, winName, theproperty);
	}

function writeDateInfo()
{
        var day="";
        var month="";
        var ampm="";
        var ampmhour="";
        var myweekday="";
        var year="";
        mydate=new Date();
        myweekday=mydate.getDay();
        mymonth=mydate.getMonth()+1;
        myday= mydate.getDate();
        myyear= mydate.getYear();
        year=(myyear > 200) ? myyear : 1900 + myyear;
        if(myweekday == 0)
        weekday=" 星期日";
        else if(myweekday == 1)
        weekday=" 星期一";
        else if(myweekday == 2)
        weekday=" 星期二";
        else if(myweekday == 3)
        weekday=" 星期三";
        else if(myweekday == 4)
        weekday=" 星期四";
        else if(myweekday == 5)
        weekday=" 星期五";
        else if(myweekday == 6)
        weekday=" 星期六";
        document.write(year+"年"+mymonth+"月"+myday+"日"+weekday);
}
