//打开一个居中窗口的程序
function centerWindow(url,title,w,h){
var left=(screen.width-w)/2;
var top = (screen.height-h)/2;
window.open(url,title,'scrollbars=yes,left='+left+',top='+top+',width='+w+',height='+h);
return false;
}
//根据下拉列表的值，跳转到某个链接
function changeTheUrl(thisSelect){
urlStr =thisSelect.options[thisSelect.selectedIndex].value;
window.focus();
if (urlStr!='')
	{
	window.open(urlStr);
	}
}
//新闻搜索函数
function searchNews(action){
	if(document.forms[0].keyword.value ==""){
			alert("请输入关键字！");
			document.forms[0].keyword.focus();
		}
	else{
	document.forms[0].action=action;
	document.forms[0].submit();
		}

}
//控制搜索关键字回车后执行搜索
function gotoSearch(action){
	var keyCode="";
	keyCode=keyCode+event.keyCode
	if(event.keyCode=="13"){
		if(document.forms[0].keyword.value ==""){
			alert("请输入关键字！");
			return false;
	}
	else{
	document.forms[0].action=action
	document.forms[0].submit();		
		}
	}
}
//产品搜索
function productSearch(bigClassName,action){
	form = document.forms[0];
	if(form.productKey.value==""){
			alert("请输入产品名称!");
			form.productKey.focus();
			return false;
		}
	else{
		for(i=0;i<form.WhichClass.options.length;i++){
				if(form.WhichClass.options[i].value==bigClassName){
						form.WhichClass.options[i].selected=true;
					}
			}
		form.keyword.value = form.productKey.value;
		searchNews(action);
		}
	
	}
//取得当前日期
function getToday(){
	today=new Date();
	function initArray(){
		this.length=initArray.arguments.length;
		for(var i=0;i<this.length;i++)
		this[i+1]=initArray.arguments[i];
	}
	var d=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
	document.write(today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日 ",d[today.getDay()+1] );
}
//设置新闻中的图像大小
	function setImgSize(image){
		var imgWidth=600;
		var oldImgWidth;
		var imgHeigth;
		var oldImgHeight;
		
		for(i=1;i<=image;i++){
			oldImgWidth=eval("document.all.newsImg"+i+".width");
			if(oldImgWidth >600){
				oldImgHeight=eval("document.all.newsImg"+i+".height");
				imgHeigth= oldImgHeight*(imgWidth/oldImgWidth);
				eval("document.all.newsImg"+i+".width="+imgWidth);
				eval("document.all.newsImg"+i+".height="+imgHeigth);
			}
		}
	}
//最大化窗口，IE版本	
	function resizeWin(){
	var winWidth = screen.width;
	var winHeight = screen.availHeight;
	window.moveTo(0,0);	
	window.resizeTo(winWidth,winHeight);
	}
//将页面添加到收藏夹
function Addme(url,title){
window.external.AddFavorite(url,title);
}
//改变Tab页的内容
function changeTab(tabIds,tabId){
	var tabArray = tabIds.split(";");
	var tabPage = document.getElementById(tabId);
	var tabImg = document.getElementById(tabId+'_img')
	if(tabPage.style.display == 'none'){
		tabPage.style.display="block";
		tabImg.src = "images/"+tabId + "_up.jpg"
		}
	for(i=0;i<tabArray.length;i++){
		if (tabArray[i]!=tabId){
			var tabPage = document.getElementById(tabArray[i]);
			var tabImg = document.getElementById(tabArray[i] +"_img")
			tabPage.style.display="none";
			tabImg.src = "images/"+tabArray[i] + "_down.jpg"
			}
		}
	}
//改变菜单背景
	function changeMenuBack(obj,src,target){
		bImg = obj.background;
		obj.background = bImg.replace(src,target);
		oItem = obj.all;
		oLen = oItem.length;
		for(i=0;i<oLen;i++){
			if(oItem(i).tagName=="A"){
				clsName = oItem(i).className;
				oItem(i).className = clsName.replace(src,target);
			}
		}
	}
//改变回车为Tab
	function changeEnterToTab(itemName){
		var keyCode=""
		keyCode=keyCode+event.keyCode
		if(event.keyCode=="13"){
			eval("document.forms[0]." + itemName+".focus()");
		}
		}		
//登陆BBS
function gotoBBS(){
	var keyCode="";
	keyCode=keyCode+event.keyCode
	if(event.keyCode=="13"){
		if(document.forms[0].username.value ==""){
			alert("请输入用户名！");
			document.forms[0].username.focus();
			return false;
	}
	else{
	document.forms[0].action='bbs/login.asp'
	document.forms[0].submit();		
		}
	}
}

function bbs(){
	if (document.forms[0].username.value==""){
			alert("请输入用户名！");
			document.forms[0].username.focus();
			return false;
		}
	else{
	document.forms[0].action='bbs/login.asp'
	document.forms[0].submit();			
		}
	}
	
function preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}	