﻿//翻页的跳转
function GoToTheUrl(TheSelect)
{
	window.open(TheSelect.value,"_self");
}
//信息搜索
function SearchBtn()
{
	var SearchTxt=document.getElementById("SearchTxt").value;
	if(SearchTxt=="" || SearchTxt=="请输入您要查找的内容")
	{alert("请输入您要查找的内容");}
	else
	{location.href="News_Search.asp?TheTxt="+SearchTxt}
}
//网页导航
var menu=function(){
	var t=15,z=50,s=6,a;
	function dd(n){this.n=n; this.h=[]; this.c=[]}
	dd.prototype.init=function(p,c){
		a=c; var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0;
		for(i;i<l;i++){
			var h=s[i].parentNode; this.h[i]=h; this.c[i]=s[i];
			h.onmouseover=new Function(this.n+'.st('+i+',true)');
			h.onmouseout=new Function(this.n+'.st('+i+')');
		}
	}
	dd.prototype.st=function(x,f){
		var c=this.c[x], h=this.h[x], p=h.getElementsByTagName('a')[0];
		clearInterval(c.t); c.style.overflow='hidden';
		if(f){
			p.className+=' '+a;
			if(!c.mh){c.style.display='block'; c.style.height=''; c.mh=c.offsetHeight; c.style.height=0}
			if(c.mh==c.offsetHeight){c.style.overflow='visible'}
			else{c.style.zIndex=z; z++; c.t=setInterval(function(){sl(c,1)},t)}
		}else{p.className=p.className.replace(a,''); c.t=setInterval(function(){sl(c,-1)},t)}
	}
	function sl(c,f){
		var h=c.offsetHeight;
		if((h<=0&&f!=1)||(h>=c.mh&&f==1)){
			if(f==1){c.style.filter=''; c.style.opacity=1; c.style.overflow='visible'}
			clearInterval(c.t); return
		}
		var d=(f==1)?Math.ceil((c.mh-h)/s):Math.ceil(h/s), o=h/c.mh;
		c.style.opacity=o; c.style.filter='alpha(opacity='+(o*100)+')';
		c.style.height=h+(d*f)+'px';
	}
	return{dd:dd}
}();

//向左滚动
function ScrollImgLeft()
{
	var speed=20
	var scroll_begin = document.getElementById("scroll_begin");
	var scroll_end = document.getElementById("scroll_end");
	var scroll_div = document.getElementById("scroll_div");
	scroll_end.innerHTML=scroll_begin.innerHTML
	function Marquee(){
	if(scroll_end.offsetWidth-scroll_div.scrollLeft<=0)
	scroll_div.scrollLeft-=scroll_begin.offsetWidth
	else
	scroll_div.scrollLeft++
	}
	var MyMar=setInterval(Marquee,speed)
	scroll_div.onmouseover=function() {clearInterval(MyMar)}
	scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
}

//限制内容图片大小
function resize(o) {
	if (o.width>700) {
	o.style.width='700px';
	o.style.height='auto';
	}
}

//向下滚动
function DownScroll(dome,dome1,dome2)
{
	var speed=30
	var A2=document.getElementById(dome2);
	var A1=document.getElementById(dome1);
	var A=document.getElementById(dome);
	A2.innerHTML=A1.innerHTML
	Marquee2(dome,dome1,dome2);
	//A.scrollTop=A.scrollHeight
	var MyMar2=setInterval(function(){Marquee2(dome,dome1,dome2);},speed)
	A.onmouseover=function() {clearInterval(MyMar2)}
	A.onmouseout=function() {MyMar2=setInterval(function(){Marquee2(dome,dome1,dome2);},speed)}
}

function Marquee2(dome,dome1,dome2)
{
	var B2=document.getElementById(dome2);
	var B1=document.getElementById(dome1);
	var B=document.getElementById(dome);
	var n=get_offset(B2)-get_offset(B1)//求相对上个节点的唯移动(兼容目的)
	//B2.offsetTop 有可能是相对上个节点 有可能是相对BODY
	if(n-B.scrollTop<=0)
		B.scrollTop-=B1.offsetHeight
	else
	{
		B.scrollTop++
	}
}
function get_offset(obj){
    var offsetparent = obj;
	var top=0
    while(offsetparent != null && offsetparent.nodeName != "BODY"){
         //left += offsetparent.offsetLeft;
         top += offsetparent.offsetTop;
         offsetparent=offsetparent.parentNode;
    }
	return top;
}

//无数字切换
function objSP_Article() {this.ImgUrl="";} //this.LinkUrl=""; this.Title="";}
function SlidePic_Article(_id) {this.ID=_id; this.Width=0;this.Height=0; this.TimeOut=5000; this.Effect=23; this.TitleLen=0; this.PicNum=-1; this.Img=null; this.Url=null; this.Title=null; this.AllPic=new Array(); this.Add=SlidePic_Article_Add; this.Show=SlidePic_Article_Show; this.LoopShow=SlidePic_Article_LoopShow;}
function SlidePic_Article_Add(_SP) {this.AllPic[this.AllPic.length] = _SP;}
function SlidePic_Article_Show() {
  if(this.AllPic[0] == null) return false;
  document.write("<div><a id='Url_" + this.ID + "' target='_blank'><img id='Img_" + this.ID + "' style='width:" + this.Width + "px; height:" + this.Height + "px; filter: revealTrans(duration=2,transition=23);' src='javascript:null' border='0'></a>");
  if(this.TitleLen != 0) document.write("<br><span id='Title_" + this.ID + "'></span></div>");
  this.Img = document.getElementById("Img_" + this.ID);
  this.Url = document.getElementById("Url_" + this.ID);
//  this.Title = document.getElementById("Title_" + this.ID);
  this.LoopShow();
}
function SlidePic_Article_LoopShow() {
  if(this.PicNum<this.AllPic.length-1) this.PicNum++ ; 
  else this.PicNum=0; 
  this.Img.filters.revealTrans.Transition=this.Effect; 
  this.Img.filters.revealTrans.apply(); 
  this.Img.src=this.AllPic[this.PicNum].ImgUrl;
  this.Img.filters.revealTrans.play();
  this.Url.href=this.AllPic[this.PicNum].LinkUrl;
  if(this.Title) this.Title.innerHTML="<a href="+this.AllPic[this.PicNum].LinkUrl+" target=_blank>"+this.AllPic[this.PicNum].Title+"</a>";
  this.Img.timer=setTimeout(this.ID+".LoopShow()",this.TimeOut);
}
function CkGuestBookAdd(TheForm)
{
	if(TheForm.subject.value=="")
	{
		alert("主题不能为空");
		TheForm.subject.focus();
		return false;
	}
	if(TheForm.nickname.value=="")
	{
		alert("姓名不能为空");
		TheForm.nickname.focus();
		return false;
	}
	if(TheForm.Content.value=="")
	{
		alert("内容不能为空");
		TheForm.Content.focus();
		return false;
	}
}

//改变字体
function Gbziti(zh,obj)
{
	for(var i=1;i<=3;i++)
	{
		document.getElementById("gbzt_"+i).className="";
	}
	obj.className="onfocus";
	document.getElementById("TheNewsContent").style.fontSize=zh+"px";
}
//改变颜色
function GbYanse(ys,obj)
{
	for(var i=1;i<=5;i++)
	{
		document.getElementById("gbys_"+i).className="";
	}
	obj.className="onfocus";
	document.getElementById("TheBigNewsContent").style.backgroundColor=ys;
}

