
//主页面函数
var napp=0;
<!-- Begin
if ((navigator.appName.indexOf('Microsoft')+1)) {
	document.write('<style type="text/css"> .opacity {filter:alpha(opacity=100)}</style>'); 
	napp=1;
}
if ((navigator.appName.indexOf('Netscape')+1)) {
	document.write('<style type="text/css"> .opacity {-moz-opacity:1} </style>'); 
	napp=2;
}
//  End -->

function search(){
	if(checkspace(document.mainsearch.SEARCHVAL.value)) {
		document.mainsearch.SEARCHVAL.focus();
		alert("请输入要搜索的值！");
		return false;
	}
	window.open("../pub/search.jsp?Findex=1&SType=1&SValue="+document.mainsearch.SEARCHVAL.value,'','');

}
function logincheck() {			
	if(checkspace(document.mainlogin.USERNAME.value)) {
		document.mainlogin.USERNAME.focus();
		alert("请填写用户名！");
		return false;
	}
	if(checkspace(document.mainlogin.UPWD.value)) {
		document.mainlogin.UPWD.focus();
		alert("请填写密码！");
		return false;
	}
	if (Preview){
		alert("用户登录演示......");
		return false;
	}
}

function makevisible_a(objid,nums,curinx,bordercol,pagelabcolor,pagebgimg){

	for (var i=0;i<nums;i++){
		eval("MI"+objid+i).style.display="none";
		var obj=eval("MP"+objid+i);
		obj.style.borderBottom="1px solid "+bordercol;	
		obj.style.backgroundColor=pagelabcolor;	
		obj.style.backgroundImage="url("+pagebgimg+")";
		obj.style.fontWeight="";		
	}
	eval("MI"+objid+curinx).style.display="";
	var c=eval("MP"+objid+curinx);
	c.style.borderBottom="0px";	
	c.style.backgroundColor="";	
	c.style.backgroundImage="";
	c.style.fontWeight="bold";	
	//c.filter.progid.DXImageTransform.Microsoft.Gradient(gradienttype=0,   startcolorstr=#ffffff,   endcolorstr=#dddddd);

}
function makevisible_b(objid,nums,curinx,bordercol,chgbg){

	for (var i=0;i<nums;i++){
		eval("I"+objid+i).style.display="none";
		eval("P"+objid+i).style.borderTop="1px solid "+bordercol;	
		eval("P"+objid+i).style.fontWeight="";			 
	}
	eval("I"+objid+curinx).style.display="";
	eval("P"+objid+curinx).style.borderTop="0px";	
	eval("P"+objid+curinx).style.fontWeight="bold";	
	//if (chgbg==1)	Setcontentsflash(objid,curinx);

}

////function Setcontentsflash(objid,curinx){
////	var randLength = 1;
////	var randStr = "0123456789";
////	var randNum = makeRandChar (randStr,randLength );
////	var objdivid="I"+objid+"SFLASH_"+randNum;
////	var objimgid="I"+objid+"SFIMG_"+randNum;
////	var objdiv=eval(objdivid);
////
////	for (var i=0;i<10;i++)
////	    eval("I"+objid+"SFLASH_"+i).style.display="none";
////	if (napp==1 || napp==2) {
////		if (objdiv.style.display=="none")	objdiv.style.display="";
////		objdiv.style.top=getSFLSHHeight(objid);
////		var objimg=eval(objimgid);
////		contentsflash(objid,objdivid,objimgid,50);	
////	}
////}
////function contentsflash(objid,objdivid,objimgid,inx){
////	var objdiv=eval(objdivid);
////	var objimg=eval(objimgid);
////	var objdiv=eval(objdivid);
////	var timer;
////	objdiv.style.top=getSFLSHHeight(objid);
////	if (inx>1 && objdiv.style.display==""){		
////		if (napp==1) objimg.filters.alpha.opacity=inx;
////		if (napp==2) objimg.style.MozOpacity=(inx/100);
////		timer=setTimeout("contentsflash('"+objid+"','"+objdivid+"','"+objimgid+"',"+(inx-2)+")",1);
////		return;
////	}else{
////		objdiv.style.display="none";
////		clearTimeout(timer);
////	}
////}
////
////function getSFLSHHeight(objid){
////	var objPT=eval("I"+objid+"PT");
////	var pt = objPT.offsetTop+2;
////	vParent = objPT.offsetParent;
////	while (vParent.tagName.toUpperCase() != "BODY")
////	{
////		pt += vParent.offsetTop;
////		vParent = vParent.offsetParent;
////	}
////	return pt;
////}
////function makeRandChar(chars,marklen){//创建随机数
////	var tmpstr = '';
////	var chrlen = chars.length;
////	var iRandom ;
////	do{
////		iRandom = Math.round(Math.random() * chrlen);
////		tmpstr += chars.charAt(iRandom);
////		if( tmpstr.length == marklen ) break;
////	}while (tmpstr.length < marklen)
////	return tmpstr;
////}
//主页面函数OVER


//区域滚动 BEGIN
var speed=30;	

//区域滚动 END

function myreload(){
	window.location.reload(); 
}



//--以下图片自适应大小
function img_auto_size(oldimg,maxW,maxH){
	var newimg = new Image();
	newimg.src = oldimg.src;
	if (newimg.width > 0 && newimg.height > 0) {
		if (newimg.width <= maxW && newimg.height <= maxH){
			oldimg.width = newimg.width; 
			oldimg.height = newimg.height;	
		}else{
			if (newimg.width/maxW>=newimg.height/maxH){
				//适应宽度
				if (newimg.width >= maxW){
					oldimg.width = maxW;
					oldimg.height = (newimg.height*maxW)/newimg.width;
				}
			}else{
				//适应高度
				if (newimg.height >= maxH){
					oldimg.height = maxH;
					oldimg.width = (newimg.width * maxH) / newimg.height;
				}			
			}
		}	
	}
} 
function img_auto_size_x(oldimg,maxW,maxH,ATTIMGwhIDname){	
	var newimg = new Image();
	newimg.src = oldimg.src;
	if (newimg.width > 0 && newimg.height > 0) {
		if (newimg.width <= maxW && newimg.height <= maxH){
			oldimg.width = newimg.width; 
			oldimg.height = newimg.height;	
		}else{
			if (newimg.width/maxW>=newimg.height/maxH){
				//适应宽度
				if (newimg.width >= maxW){
					oldimg.width = maxW;
					oldimg.height = (newimg.height*maxW)/newimg.width;
				}
			}else{
				//适应高度
				if (newimg.height >= maxH){
					oldimg.height = maxH;
					oldimg.width = (newimg.width * maxH) / newimg.height;
				}			
			}
		}
		var ShowWHinnerHTML = eval(ATTIMGwhIDname);
		ShowWHinnerHTML.innerHTML="原始大小 " + newimg.width + " x " + newimg.height + " 像素";		
	}
} 
//--以下图片自适应宽度
function img_auto_size_w(oldimg,maxW){
	var newimg = new Image();
	newimg.src = oldimg.src;
	if (newimg.width > 0 && newimg.height > 0) {
		if (newimg.width > maxW){
			oldimg.width = maxW;
			oldimg.height = (newimg.height*maxW)/newimg.width;
		}	
	}
} 
//--以下图片自适应宽度
function img_auto_size_w_x(oldimg,maxW){
	var newimg = new Image();
	newimg.src = oldimg.src;	
	if (newimg.width > 0 && newimg.height > 0) {
		if (newimg.width > maxW){
			oldimg.width = maxW;
			oldimg.height = (newimg.height*maxW)/newimg.width;
		}	
	}
} 
//--以下图片自适应GAO度
function img_auto_size_h(oldimg,maxH){
	var newimg = new Image();
	newimg.src = oldimg.src;
	
	if (newimg.width > 0 && newimg.height > 0) {
		if (newimg.height > maxH){
			oldimg.height = maxH;
			oldimg.width = (newimg.width * maxH) / newimg.height;
		}
	}
} 

//--以下图片透明
function makevisible(cur,opacity){
	cur.filters.alpha.opacity=opacity;
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
	str = str + ' ';
  }
  return (str == checkstr);
}


// 判断输入的日期的格式 
function ChkDateTime(formname,ObgTextName)   
{   
	var str=document.forms[formname].elements[ObgTextName].value;
	var r = str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);    
	if(r==null){
		alert('请输入日期型值！')		
		document.forms[formname].elements[ObgTextName].value=getCurDate();
		document.forms[formname].elements[ObgTextName].focus();			
		return false;	
	}
	var d= new Date(r[1], r[3]-1,r[4]);     
	var x=(d.getFullYear()==r[1] && (d.getMonth()+1)==r[3] && d.getDate()==r[4]);  
	if(!x) {
		alert('请输入日期型值！')		
		document.forms[formname].elements[ObgTextName].focus();
		document.forms[formname].elements[ObgTextName].value=getCurDate();
		return false;
	}
	return true;
}   
function getCurDate(){
	var riqi = new Date;
	var year = riqi.getFullYear();    // 获取年
	var month = riqi.getMonth() + 1;    // 获取月
	var date = riqi.getDate();    // 获取日 
	return GetDateFormat(year+"-"+month+"-"+date);	
}
function GetDateFormat(xxx){
	//输入:2007-3-1 
	//返回:2007-03-01
	var R=xxx;	
	var temStr = R.split("-");
	temStr[0]=(temStr[0].length==2)?"20"+temStr[0]:temStr[0];
	temStr[1]=(temStr[1].length==1)?"0"+temStr[1]:temStr[1];
	temStr[2]=(temStr[2].length==1)?"0"+temStr[2]:temStr[2];
	R=temStr[0]+"-"+temStr[1]+"-"+temStr[2];
	return R;
}
function GetDateFormatX(xxx){
	//输入:2007-3-1 
	//返回:2007-03-01
	var R=xxx;	
	var temStr = R.split("-");
	temStr[0]=(temStr[0].length==2)?"20"+temStr[0]:temStr[0];
	temStr[1]=(temStr[1].length==1)?"0"+temStr[1]:temStr[1];
	temStr[2]=(temStr[2].length==1)?"0"+temStr[2]:temStr[2];
	R=temStr[0]+temStr[1]+temStr[2];
	return R;
}
//以下首页显示单个新闻
function SetWinHeight(obj)
{
	var win=obj;
	if (document.getElementById)
	{
		if (win && !window.opera)
		{
			if (win.contentDocument && win.contentDocument.body.offsetHeight) 
				win.height = win.contentDocument.body.offsetHeight; 
			else if(win.Document && win.Document.body.scrollHeight){
				if (win.Document.body.innerHTML!="")
					win.height = win.Document.body.scrollHeight;
				else
					win.height = 0;
			}
		}
	}

}
function ShowPagePart(selfname,objname,nums,inx,classnamepart,top){
	var class1=classnamepart+"1";
	var class2=classnamepart+"2";
	for (var i=1;i<=nums;i++){
		eval(objname+i+".style.display=\"none\";");
		eval(selfname+i+".className=\""+class2+"\";");					
	}					
	eval(objname+inx+".style.display=\"\";");
	eval(selfname+inx+".className=\""+class1+"\";");	
	if (top==1){
		window.scrollTo(0,document.body.scrollHeight);   
  		window.scrollTo(0,0);
	}
}


//投票
function VOT_chksubmit()
{
	var votnums=0;	
	for (var i=0;i<document.vottopic.VOT.length;i++)
		if (document.vottopic.VOT[i].checked)
			votnums++;		
	if(votnums==0)
	{
		alert('请选择投票项!');
		return false;
	}
	document.vottopic.VOTUP.disabled=true;
	document.vottopic.VOTREF.disabled=true;
	document.vottopic.submit();
	//alert('您选择了当前投票，请稍侯......');
}
function VOTboxChk()
{
	var obj=document.vottopic.VOT;
	var str="";
	var val="";
	for (var i=0;i<obj.length;i++){
		if (obj[i].checked){
			val=val+obj[i].value+",";
		}			
	}	
	document.vottopic.VOTVALS.value=val;
}
//投票OVER
