﻿//网站公告
document.write('<script type="text/javascript" src="/JavaScript/L4cd.Ajax.js"></script>')
var showAnnID;
var showAnnObj;
var showAnnContObj;
var showAnnOverflow;
var showAnnFilterObj
var showAnnContent1 = '';
var showAnnContent2 = '';
showAnnContent1 += '<div id="showAnn" style="display:none;z-index:1000;margin:0px;height:0px;overflow:hidden;text-align:center;position:absolute;width:0px;background:#000;opacity: 0.5;filter:alpha(opacity=50);};"></div>'
showAnnContent1 += '<div id="showAnnContent" style="display:none;z-index:1001;position:absolute;border:1px #333 solid;margin:0px;width:600px;height:400px;background-color:white;float:none;">'
showAnnContent1 += '	<div style="color:#000;border:1px #fff solid;border-bottom:2px #999 solid;height:25px;width:598px;background-color:#E0E0DE;line-height:25px;text-align:left;"><div style="float:left">　<b>网站公告</b>　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　<a style="cursor:pointer;" onclick="closeTip();">关闭</a></div><div><a style="cursor:pointer;" onclick="closeTip();"><img style="margin:2px;" src="/images/noteClose.jpg" /></a></div></div>'
showAnnContent1 += '	<div id="showAnnTitle" style="color:#333;height:25px;width:598px;line-height:25px;text-align:center;font-size:14px;font-weight:bold;">标题标题</div>'
showAnnContent1 += '	<div id="showAnnContent2" style="color:#666;overflow:hidden;overflow-y:auto;width:570px;height:290px;text-align:left;padding:15px;"></div>'
showAnnContent1 += '	<div style="border-top:1px #ccc solid;height:25px;width:598px;line-height:25px;text-align:center;"><a style="cursor:pointer;" onclick="closeTip()">关闭</a></div>'
showAnnContent1 += '</div>';
showAnnContent2 += '<div id="regShowAnn" style="display:none;z-index:1000;margin:0px;height:0px;overflow:hidden;text-align:center;position:absolute;width:0px;"></div>'
showAnnContent2 += '<div id="regShowAnnContent" style="display:none;z-index:1001;position:absolute;margin:0px;width:300px;height:240px;background-color:#ccc;">'
showAnnContent2 += '	<div style="position:relative;top:-5px;left:-5px;margin:0px;width:300px;height:240px;border:1px #333 solid;">'
showAnnContent2 += '		<div style="color:#000;border:1px #fff solid;border-bottom:1px #666 solid;height:25px;width:298px;background-color:#E0E0DE;line-height:25px;text-align:left;"><div style="float:left;font-size:12px;">&nbsp;<b>系统提示信息</b></div><div style="float:right;"><a style="cursor:pointer;" onclick="closeTip();"><img style="margin:2px;margin-right:5px;" src="/images/noteClose.jpg" /></a></div></div>'
showAnnContent2 += '		<div id="regMsgboxbg" style="background-image:url(/images/msgbox01.jpg);background-repeat:no-repeat;border:1px #666 solid;background-color:#fff;color:#000;overflow:hidden;overflow-y:auto;width:268px;height:181px;text-align:left;padding:15px;">';
showAnnContent2 += '			<div id="regShowAnnContent2" style="margin-left:100px;margin-top:40px!important;margin-top:55px;"></div>'
showAnnContent2 += '			<input type="button" onclick="closeTip()" style="border:0px;margin-left:100px!important;margin-left:108px;margin-top:55px;" value="&nbsp;确&nbsp;定&nbsp;"/>'
showAnnContent2 += '		</div>';
showAnnContent2 += '	</div>';
showAnnContent2 += '</div>';
document.write(showAnnContent1)
document.write(showAnnContent2)
function showTip(id,type,msg){
	if(!id)return;
	if(type == 'reg'){
		showAnnObj = document.getElementById("regShowAnn");
		showAnnContObj = document.getElementById("regShowAnnContent");
		if(!showAnnObj || !showAnnContObj){
			alert('未初始化,请刷新当前页面.')
			return;
		}
		if(id==1){
			document.getElementById("regShowAnnContent2").innerHTML = '该登录名可以使用：）';
		}else{
			if(msg)
				document.getElementById("regShowAnnContent2").innerHTML = msg;
			else
				document.getElementById("regShowAnnContent2").innerHTML = '很抱歉，该登录名已被占用：）';
			
		}
		document.getElementById("regMsgboxbg").style.backgroundImage='url(/images/msgbox0'+id+'.jpg)'
	}else{
		showAnnObj = document.getElementById("showAnn");
		showAnnContObj = document.getElementById("showAnnContent");
		if(!showAnnObj || !showAnnContObj){
			alert('未初始化,请刷新当前页面.')
			return;
		}
		document.getElementById("showAnnTitle").innerHTML = '正在加载公告信息...';
		document.getElementById("showAnnContent2").innerHTML = '';
		getAnn(id)
	}
	showAnnOverflow = document.documentElement.style.overflow
	document.documentElement.style.overflow='hidden'
	showAnnID = setInterval('moveTip()',50);
}
function closeTip(){
	clearInterval(showAnnID)
	document.documentElement.style.overflow=showAnnOverflow
	showAnnObj.style.display='none'
	showAnnContObj.style.display='none'
}
function moveTip(){
	showAnnObj.style.top = document.documentElement.scrollTop+'px'
	showAnnObj.style.left = 0
	showAnnObj.style.width = document.documentElement.clientWidth+'px'
	showAnnObj.style.height = document.documentElement.clientHeight+'px'
	var temp = 	(showAnnObj.style.height.replace('px','') - showAnnContObj.style.height.replace('px',''))/2	
	if(temp<0)temp=0
	showAnnContObj.style.top = (document.documentElement.scrollTop+temp)+'px'
	var temp = 	(showAnnObj.style.width.replace('px','') - showAnnContObj.style.width.replace('px',''))/2	
	if(temp<0)temp=0
	showAnnContObj.style.left = temp+'px'
	showAnnObj.style.display=''
	showAnnContObj.style.display=''
}
function getAnn(theId){
	if(!theId)return;
	var L4cd = new Ajax1()
	L4cd.onReady = function(s){
		switch (s){
			case 0://未初始化
				document.getElementById("showAnnTitle").innerHTML = '加载公告出错,请刷新当前页面.';
				break;
			case 1://正在装载
				document.getElementById("showAnnTitle").innerHTML = '正在加载公告信息...';
				break;
			//case 2://装载完毕
			//case 3://交互中
			case 4://完成
                document.getElementById("showAnnTitle").innerHTML = L4cd.xml().getElementsByTagName('title')[0].childNodes[0].nodeValue;
				document.getElementById("showAnnContent2").innerHTML = L4cd.xml().getElementsByTagName('content')[0].childNodes[0].nodeValue;
				break;
			case -1://页面出错
				document.getElementById("showAnnTitle").innerHTML = '加载公告出错,请刷新当前页面.';
				break;
		}
	}
	L4cd.get('/Inc/Ann.aspx?show=1&id='+theId)
}
function getAnnTitle(){
    document.write('<div id="showAnnTitleDiv"></div>')
	var L4cd = new Ajax1()
	L4cd.onReady = function(s){
		switch (s){
			case 4://完成
			    var myXml=L4cd.xml();
			    document.getElementById('showAnnTitleDiv').innerHTML="<ul class='list'>";
                for(var i=0;i<myXml.getElementsByTagName('item').length;i++){
                    document.getElementById('showAnnTitleDiv').innerHTML+='<li><span style="cursor:pointer" onclick="showTip('+myXml.getElementsByTagName('item')[i].getElementsByTagName('id')[0].childNodes[0].nodeValue+')">'+myXml.getElementsByTagName('item')[i].getElementsByTagName('title')[0].childNodes[0].nodeValue+'</span></li>';
                }
			    document.getElementById('showAnnTitleDiv').innerHTML+="</ul>";
				break;
			case -1://页面出错
				document.getElementById("showAnnTitle").innerHTML = '加载公告出错,请刷新当前页面.';
				break;
		}
	}
	L4cd.get('/Inc/Ann.aspx?show=2')
}