// 荣誉向上滚动脚本
function startmarquee(lh,speed,delay)
{
	var p=false;
	var t;
	var o=document.getElementById("wishmarqueebox");
	o.innerHTML+=o.innerHTML;
	o.style.marginTop=0;
	o.onmouseover=function(){p=true;}
	o.onmouseout=function(){p=false;}
	function start()
	{
		t=setInterval(scrolling,speed);
		if(!p) o.style.marginTop=parseInt(o.style.marginTop)-1+"px";
	}
	function scrolling()
	{
		if(parseInt(o.style.marginTop)%lh!=0)
		{
			o.style.marginTop=parseInt(o.style.marginTop)-1+"px";
			if(Math.abs(parseInt(o.style.marginTop))>=o.scrollHeight/2)
				o.style.marginTop=0;
		}
		else
		{
			clearInterval(t);
			setTimeout(start,delay);
		}
	}
	setTimeout(start,delay);
}

function startmarquee1(lh,speed,delay)
{
	var p=false;
	var t;
	var o=document.getElementById("wenming");
	o.innerHTML+=o.innerHTML;
	o.style.marginTop=0;
	o.onmouseover=function(){p=true;}
	o.onmouseout=function(){p=false;}
	function start()
	{
		t=setInterval(scrolling,speed);
		if(!p) o.style.marginTop=parseInt(o.style.marginTop)-1+"px";
	}
	function scrolling()
	{
		if(parseInt(o.style.marginTop)%lh!=0)
		{
			o.style.marginTop=parseInt(o.style.marginTop)-1+"px";
			if(Math.abs(parseInt(o.style.marginTop))>=o.scrollHeight/2)
				o.style.marginTop=0;
		}
		else
		{
			clearInterval(t);
			setTimeout(start,delay);
		}
	}
	setTimeout(start,delay);
}

// 天气向左滚动
function weatherscroll()
{
	/*
	var speed=40
	demo2.innerHTML=demo1.innerHTML
	function Marquee(){
	if(demo2.offsetWidth-demo.scrollLeft<=0)
	demo.scrollLeft-=demo1.offsetWidth
	else{
	demo.scrollLeft++
	}
	}
	var MyMar=setInterval(Marquee,speed)
	demo.onmouseover=function() {clearInterval(MyMar)}
	demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
	*/
}

function yearscroll()
{
	var speed=40
	demoj2.innerHTML=demoj1.innerHTML
	function Marquee(){
	if(demoj2.offsetWidth-demoj.scrollLeft<=0)
	demoj.scrollLeft-=demoj1.offsetWidth
	else{
	demoj.scrollLeft++
	}
	}
	var MyMar=setInterval(Marquee,speed)
	demoj.onmouseover=function() {clearInterval(MyMar)}
	demoj.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
}

// 滚动脚本
var rollspeed=60;
var myInter;
function MarqueeV(){
	if(oRollV2.offsetTop-oRollV.scrollTop<=0)
	{
		oRollV.scrollTop-=oRollV1.offsetHeight;
	}
	else
	{
		oRollV.scrollTop++;
	}
}
function StartRollV() {
	if (typeof(oRollV) == "undefined") {
		return;
	}
	if (parseInt(oRollV.style.height)>=oRollV2.offsetTop) {
		oRollV.style.height = oRollV2.offsetTop;
		return;
	}
	oRollV2.innerHTML=oRollV1.innerHTML;
	myInter=setInterval(MarqueeV,rollspeed);
	oRollV.onmouseover=function() {clearInterval(myInter)};
	oRollV.onmouseout=function() {myInter=setInterval(MarqueeV,rollspeed)};
}

function MarqueeH(){
	if(oRollH2.offsetLeft-oRollH.scrollLeft<=0) {
		oRollH.scrollLeft-=oRollH1.offsetWidth;
	}else{
		oRollH.scrollLeft++;
	}
}
function StartRollH() {
	if (typeof(oRollH) == "undefined") {
		return;
	}
	if (parseInt(oRollH.style.width)>=oRollH2.offsetLeft) {
		oRollH.style.width = oRollH2.offsetLeft;
		return;
	}
	oRollH2.innerHTML=oRollH1.innerHTML;
	myInter=setInterval(MarqueeH,rollspeed);
	oRollH.onmouseover=function() {clearInterval(myInter)};
	oRollH.onmouseout=function() {myInter=setInterval(MarqueeH,rollspeed)};
}


// 查看调查--------------------------
function ViewPoll(id) {
	window.open("pollView.aspx?act=result&id="+id, "DvnPoll","width=500,height=400,left=0,top=0,scrollbars=1,status=1,resizable=1");
}
// 今日更新图标
//<img src="/images/istoday.gif" border="0"><font color="red" style="font-size:12px;FONT-FAMILY:宋体;">[新]</font>
function isToday(stime)
{
	var m=stime.match(new RegExp(/\d+/g));
	if (m==null)
		return;
	var aa = m.toString().split(',');
	if (aa.length>=3)
	{
		var daysIsNew = 2;//为new的天数
		var today = new Date();
		var dt1 = new Date(parseInt(aa[0],10),parseInt(aa[1],10),parseInt(aa[2],10));
		var dt2 = new Date(parseInt(today.getYear()),parseInt(today.getMonth())+1,parseInt(today.getDate()));
		if ( DateDiff1("d",dt1,dt2)<=daysIsNew )
		{
			document.write('<img src="/common/images/istoday.gif" border="0">');
		}
/*		if ( (parseInt(today.getYear())==parseInt(aa[0]))&&
			( (parseInt(today.getMonth())+1) == parseInt(aa[1]) ) &&
			(parseInt(today.getDate())==parseInt(aa[2])) )
			document.write('<img src="/images/istoday.gif" border="0">');
*/
	}
}

function DateAdd(strInterval, count, dtDate)
{
	var dtTmp = new Date(dtDate);
	if (isNaN(dtTmp)) dtTmp = new Date();
	switch (strInterval)
	{
		case "s":return new Date(Date.parse(dtTmp) + (1000 * count));
		case "n":return new Date(Date.parse(dtTmp) + (60000 * count));
		case "h":return new Date(Date.parse(dtTmp) + (3600000 * count));
		case "d":return new Date(Date.parse(dtTmp) + (86400000 * count));
		case "w":return new Date(Date.parse(dtTmp) + ((86400000 * 7) * count));
		case "m":return new Date(dtTmp.getFullYear(), (dtTmp.getMonth()) + count, dtTmp.getDate(), dtTmp.getHours(), dtTmp.getMinutes(), dtTmp.getSeconds());
		case "y":return new Date((dtTmp.getFullYear() + count), dtTmp.getMonth(), dtTmp.getDate(), dtTmp.getHours(), dtTmp.getMinutes(), dtTmp.getSeconds());
	}
}
// DateDiff("m","2002/12/1 00:00:00","2004/12/1 00:00:00")
function DateDiff(strInterval, dtStart, dtEnd)
{
	var dtStart = new Date(dtStart);
	if (isNaN(dtStart)) dtStart = new Date();
	var dtEnd = new Date(dtEnd);
	if (isNaN(dtEnd)) dtEnd = new Date();
	switch (strInterval)
	{
		case "s":return parseInt((dtEnd - dtStart) / 1000,10);
		case "n":return parseInt((dtEnd - dtStart) / 60000,10);
		case "h":return parseInt((dtEnd - dtStart) / 3600000,10);
		case "d":return parseInt((dtEnd - dtStart) / 86400000,10);
		case "w":return parseInt((dtEnd - dtStart) / (86400000 * 7),10);
		case "m":return (dtEnd.getMonth()+1)+((dtEnd.getFullYear()-dtStart.getFullYear())*12) - (dtStart.getMonth()+1);
		case "y":return dtEnd.getFullYear() - dtStart.getFullYear();
	}
}
function DateDiff1(strInterval, dtStart, dtEnd)
{
	switch (strInterval)
	{
		case "s":return parseInt((dtEnd - dtStart) / 1000,10);
		case "n":return parseInt((dtEnd - dtStart) / 60000,10);
		case "h":return parseInt((dtEnd - dtStart) / 3600000,10);
		case "d":return parseInt((dtEnd - dtStart) / 86400000,10);
		case "w":return parseInt((dtEnd - dtStart) / (86400000 * 7),10);
		case "m":return (dtEnd.getMonth()+1)+((dtEnd.getFullYear()-dtStart.getFullYear())*12) - (dtStart.getMonth()+1);
		case "y":return dtEnd.getFullYear() - dtStart.getFullYear();
	}
}
function searchsubmit()
{
	if (document.getElementById("site").value==1)
	{
		document.getElementById("frmsearch").action='/info/search';
	}
	else
	{
		document.getElementById("frmsearch").action='/search';
	}
	return true;
}
function _istoday(stime,days)
{
	var m=stime.match(new RegExp(/\d+/g));
	if (m==null)
		return false;
	var aa = m.toString().split(',');
	if (aa.length>=3)
	{
		var daysIsNew = days;//为new的天数
		var today = new Date();
		var dt1 = new Date(parseInt(aa[0],10),parseInt(aa[1],10),parseInt(aa[2],10));
		var dt2 = new Date(parseInt(today.getYear()),parseInt(today.getMonth())+1,parseInt(today.getDate()));
		if ( DateDiff1("d",dt1,dt2)<=daysIsNew )
		{
			return true;
		}
	}
	return false;
}
function li_settoday()
{
	var lis=document.getElementsByTagName("li");
	for (var i=0; i<lis.length;i++ )
	{
		var li=lis[i];
		var li_d=li.getAttribute("d");
		if (li_d!=null)
		{
			if (_istoday(li_d,1))
				li.style.background="url(/images/red_dot.gif) no-repeat 2px 8px;";
//			else
//				li.style.background="url(/images/dot.gif) no-repeat 2px 8px;";
		}
	}
//	$("li[d]").each(
//			function(index)
//			{
//				var dd=$(this).attr("d");
//				if (_istoday(dd)) $(this).css("background","url(/images/red_dot.gif) no-repeat 2px 8px;");
//			}
//		);
}
function news_settoday(ul_id,days)
{
	var ul=document.getElementById(ul_id);
	if(ul==null)return;
	var lis=ul.getElementsByTagName("li");
	for (var i=0; i<lis.length;i++ )
	{
		var li=lis[i];
		var li_d=li.getAttribute("d");
		if (li_d!=null)
		{
			if (_istoday(li_d,days))
				li.style.background="url(/images/red_dot.gif) no-repeat 2px 0px;";
//			else
//				li.style.background="url(/images/dot.gif) no-repeat 2px 8px;";
		}
	}
}

function showtime()
{
//	if(!document.layers&&!document.all)
//	{
//		alert('a');
//		return;
//	}
	var Digital=new Date();
	var hours=Digital.getHours();
	var minutes=Digital.getMinutes();
	var seconds=Digital.getSeconds();
	var dn="上午";
	if(hours>12)
	{
		dn="下午";
	//	hours=hours-12;
	}
	if(hours==0)
		hours=12;
	if(minutes<=9)
		minutes="0"+minutes;
	if(seconds<=9)
		seconds="0"+seconds;
	//change  font  size  here  to  your  desire
	myclock=""+hours+":"+minutes+":"+seconds+"";
	if(document.layers)
	{
		document.layers.liveclock.document.write(myclock);
		document.layers.liveclock.document.close();
	}
	else
	{
		var liveclock = document.getElementById("liveclock");
		if (liveclock)
			liveclock.innerHTML=myclock;
	}
	setTimeout("showtime()",1000);
}

var datetimeValue = "";
var D=new Date(); 
var yy=D.getYear(); 
var mm=D.getMonth()+1; 
var dd=D.getDate(); 
var ww=D.getDay(); 
if (ww==0) ww="&nbsp;<font class=weekday>星期天</font>&nbsp;"; 
if (ww==1) ww="&nbsp;星期一&nbsp;"; 
if (ww==2) ww="&nbsp;星期二&nbsp;"; 
if (ww==3) ww="&nbsp;星期三&nbsp;"; 
if (ww==4) ww="&nbsp;星期四&nbsp;"; 
if (ww==5) ww="&nbsp;星期五&nbsp;"; 
if (ww==6) ww="&nbsp;<font class=weekday>星期六</font>&nbsp;"; 
ww=ww;
datetimeValue=yy.toString() + "-";
datetimeValue+=((mm < 10) ? "0":"") + mm.toString() + "-";
datetimeValue+=((dd < 10) ? "0":"") + dd.toString() + "";
datetimeValue+=ww;
//datetimeValue+="<font color=#1f376d>"+bsYear2+"</font>";
//datetimeValue+=ww;
//bsYear="农历"+Yn[iyear]; 
//if (ss>=Ys[7]||ss<Ys[0]) bsYear=Yn[7]; 

function CAL(){ 
	document.write(""+datetimeValue);
	var lunar = new Lunar(new Date());
	lunar.convert();
	document.write("");
	document.write(lunar.getMonth());
	document.write(lunar.getDay());
	document.write(""); 
	document.write(""); 
} 

function getUrlParams()
{
	return location.search.substring(1);
}

function getJobs()
{
	$.ajax({
		url:"/_aspx/jobs_get.aspx",
		cache:true,
		success:function(data){
			$("#jobs").html(data);
		}
	});
}


function clear_passwd(){
	usernameshow.value = "";
	pwshow.value = "";
	//return;
}

function server_choice(){
	if ( isIE() ) {
		//IE浏览器
		d_domain = mailshow.d_domain;
		usernameshow = mailshow.usernameshow;
		pwshow = mailshow.pwshow;

		if (usernameshow.value == "") {
			alert("用户名不可为空");
			usernameshow.focus();
			return false ;
		}
		if (pwshow.value == "") {
			alert("密码不可为空");
			pwshow.focus();
			return false ;
		}

		if (d_domain.value == "dehua"){
			dehua_hidden.saveUser.value = false;
			dehua_hidden.username.value = usernameshow.value;
			dehua_hidden.SecEx.value = true;
			dehua_hidden.pwhidden.value = encode(pwshow.value, parseInt(dehua_hidden.picnum.value));
			dehua_hidden.submit();
			setTimeout(clear_passwd(), 500);
			return false;

		}
		if (d_domain.value == "dhca"){
			dhcahidden.user.value = usernameshow.value;
			dhcahidden.pass.value = pwshow.value;
			dhcahidden.submit();
			setTimeout(clear_passwd(), 500);
			return false;
			
		}
		if (d_domain.value == "edudh"){
			edudhhidden.User.value = edudhhidden.value;
			edudhhidden.Pass.value = edudhhidden.value;
			edudhhidden.submit();
			setTimeout(clear_passwd(), 500);
			return false;

		}
		if (d_domain.value == "dehua_gov_cn"){
			dehua_gov_cn.f_user.value = usernameshow.value;
			dehua_gov_cn.f_pass.value = pwshow.value;
			dehua_gov_cn.f_domain.value = "dehua.gov.cn";
			dehua_gov_cn.submit();
			setTimeout(clear_passwd(), 500);
			return false;
		}
		if (d_domain.value == "dhxzfw_gov_cn"){
			dehua_gov_cn.f_user.value = usernameshow.value;
			dehua_gov_cn.f_pass.value = pwshow.value;
			dehua_gov_cn.f_domain.value = "dhxzfw.gov.cn";
			dehua_gov_cn.submit();
			setTimeout(clear_passwd(), 500);
			return false;
		}
		//other mails
			otherhidden.u.value = usernameshow.value;
			otherhidden.p.value = pwshow.value;
			otherhidden.domain.value = d_domain.value;
			otherhidden.submit();
			setTimeout(clear_passwd(), 500);
			return false;
		//end of other mails


	}
	else {
		//其它浏览器,FIREFOX TESTED
		d_domain = document.getElementById("d_domain");
		usernameshow = document.getElementById("usernameshow");
		pwshow = document.getElementById("pwshow");

		if (usernameshow.value == "") {
			alert("用户名不可为空");
			usernameshow.focus();
			return false ;
		}
		if (pwshow.value == "") {
			alert("密码不可为空");
			pwshow.focus();
			return false ;
		}

		if (d_domain.value == "dehua"){
			username = document.getElementById("username");
			pwhidden = document.getElementById("pwhidden");
			saveUser = document.getElementById("saveUser");
			SecEx    = document.getElementById("SecEx");
			picnum   = document.getElementById("picnum");
			dehua_hidden   = document.getElementById("dehua_hidden");

			username.value = usernameshow.value;
			pwhidden.value = encode(pwshow.value, parseInt(picnum.value));
			saveUser.value = false;
			SecEx.value    = true;
			dehua_hidden.submit();
			setTimeout('clear_passwd()', 500);
			return false;

		}
		if (d_domain.value == "dhca"){
			user = document.getElementById("user");
			pass = document.getElementById("pass");
			dhcahidden = document.getElementById("dhcahidden");
			user.value = usernameshow.value;
			pass.value = pwshow.value;
			dhcahidden.submit();
			setTimeout(clear_passwd(), 500);
			return false;

		}
		if (d_domain.value == "edudh"){
			User = document.getElementById("User");
			Pass = document.getElementById("Pass");
			edudhhidden = document.getElementById("edudhhidden");
			User.value = usernameshow.value;
			Pass.value = pwshow.value;
			edudhhidden.submit();
			setTimeout(clear_passwd(), 500);
			return false;
		}

		//other mails
			u = document.getElementById("u");
			p = document.getElementById("p");
			domain = document.getElementById("domain");
			otherhidden = document.getElementById("otherhidden");
			u.value = usernameshow.value;
			p.value = pwshow.value;
			domain.value = d_domain.value;
			otherhidden.submit();
			setTimeout(clear_passwd(), 500);
			return false;
		//end of other mails


	}
	return false;
}
function isIE(){
	return (navigator.userAgent.indexOf("MSIE")>=1||navigator.userAgent.indexOf("Opera")>=1);
}
function encode(datastr, bassnum) {
	var tempstr;
	var tchar;
	var newdata = "";

	for (var i = 0; i < datastr.length; i++)
	{
		tchar = 65535 + bassnum - datastr.charCodeAt(i);
		tchar = tchar.toString();

		while(tchar.length < 5)
		{
			tchar = "0" + tchar;
		}

		newdata = newdata + tchar;
	}

	return newdata;
}
