﻿// JavaScript Document
function AlertButton(){window.alert("对不起，请您登陆后再执行此操作！");window.open('userlogin.asp','');}
function AlertButton2(){window.alert("对不起，请您登陆后再执行此操作！");window.location='userlogin.asp';}
function AlertGao(){alert("对不起，请您登陆后再执行此操作！");}

//容错函数屏蔽网页脚本错误
function SlyarErrors(){return true;} 
window.onerror = SlyarErrors;

//站内搜索表单验证
function SearchForm_Check(){
 if (document.SearchForm.SearchName.value=="请输入关键字"){
  alert("请输入您要搜索的内容！");
  document.SearchForm.SearchName.focus();
  return false;
 } 
}
//end//

//展开或合并产品类别类别
function showsubmenu(sid){
	whichEl = eval("submenu" + sid);
	//imgmenu = eval("menuTitle" + sid);
	//classUrl= eval("bigclassurl" + sid);
	if (whichEl.style.display == "none"){
		eval("submenu" + sid + ".style.display=\"\";");
		//imgmenu.background="Images/leftBigClassBg1.gif";
		//classUrl.className="ClassList";
	}
	else{
		eval("submenu" + sid + ".style.display=\"none\";");
		//imgmenu.background="Images/leftBigClassBg2.gif";
		//classUrl.className="ClassList2";
	}
}
//end

function ShowWeek() {   //显示中文星期
	now = new Date() //定义新对象，new具有Date的性质 
	if (now.getDay() == 0) return ("星期日") 
	if (now.getDay() == 1) return ("星期一") 
	if (now.getDay() == 2) return ("星期二") 
	if (now.getDay() == 3) return ("星期三") 
	if (now.getDay() == 4) return ("星期四") 
	if (now.getDay() == 5) return ("星期五") 
	if (now.getDay() == 6) return ("星期六") 
} 
function ShowDate(){    //显示系统日期 
	var now = new Date() 
	var year = now.getYear() 
	var month = now.getMonth()+1 
	var day = now.getDate() 
	return year+"年"+month+"月"+day+"日" 
} 
//end//

//首页公司简介、新闻动态选项卡函数
function SelectTab(tt,kp,mlink){
	document.getElementById("k1").className='indexNewsMenu2'
	document.getElementById("k2").className='indexNewsMenu2'
	tt.className='indexNewsMenu1'
	if (kp=="c1"){
		document.getElementById("c1").style.display="block"
		document.getElementById("c2").style.display="none"
		document.getElementById("cm1").style.display="block"
		document.getElementById("cm2").style.display="none"
	}
	else{
		document.getElementById("c1").style.display="none"
		document.getElementById("c2").style.display="block"
		document.getElementById("cm1").style.display="none"
		document.getElementById("cm2").style.display="block"
	}
}
//end//


//Banner开始--主函数//
var s=function(){
var interv=2000; //切换间隔时间
var interv2=10; //切换速速
var opac1=0; //文字背景的透明度
var source="fade_focus" //焦点轮换图片容器的id名称
//获取对象
function getTag(tag,obj){
	if(obj==null){
		return document.getElementsByTagName(tag)
		}
		else{return obj.getElementsByTagName(tag)}
	}
function getid(id){
	return document.getElementById(id)};
var opac=0,j=0,t=63,num,scton=0,timer,timer2,timer3;
var id=getid(source);id.removeChild(getTag("div",id)[0]);
var li=getTag("li",id);
var div=document.createElement("div");
var title=document.createElement("div");
var span=document.createElement("span");
var button=document.createElement("div");button.className="button";
for(var i=0;i<li.length;i++){
	var a=document.createElement("a");a.innerHTML=i+1;a.onclick=function(){clearTimeout(timer);clearTimeout(timer2);clearTimeout(timer3);j=parseInt(this.innerHTML)-1;scton=0;t=63;opac=0;fadeon();};a.className="b1";a.onmouseover=function(){this.className="b2"};a.onmouseout=function(){this.className="b1";sc(j)};button.appendChild(a);}
//控制图层透明度
function alpha(obj,n){
	if(document.all){
		obj.style.filter="alpha(opacity="+n+")";
		}
	else{obj.style.opacity=(n/100);}
	}
//控制焦点按钮
function sc(n){
	for(var i=0;i<li.length;i++){
		button.childNodes[i].className="b1"
		};
		button.childNodes[n].className="b2";
		}
title.className="num_list";
title.appendChild(span);
alpha(title,opac1);
id.className="d1";
div.className="d2";
id.appendChild(div);
id.appendChild(title);
id.appendChild(button);
//渐显
var fadeon=function(){opac+=5;div.innerHTML=li[j].innerHTML;span.innerHTML=getTag("img",li[j])[0].alt;alpha(div,opac);if(scton==0){sc(j);num=-2;scrolltxt();scton=1};if(opac<100){timer=setTimeout(fadeon,interv2)}else{timer2=setTimeout(fadeout,interv);};}
//渐隐
var fadeout=function(){opac-=5;div.innerHTML=li[j].innerHTML;alpha(div,opac);if(scton==0){num=2;scrolltxt();scton=1};if(opac>0){timer=setTimeout(fadeout,interv2)}else{if(j<li.length-1){j++}else{j=0};fadeon()};}
//滚动文字
var scrolltxt=function(){t+=num;span.style.marginTop=t+"px";if(num<0&&t>3){timer3=setTimeout(scrolltxt,interv2)}else if(num>0&&t<62){timer3=setTimeout(scrolltxt,interv2)}else{scton=0}};
fadeon();
}
//初始化
window.onload=s;
//Banner结束//


//鼠标超链接特效
var rate=20;
var obj;
var act=0;
var elmH=0;
var elmS=128;
var elmV=255;
var clrOrg;
var TimerID;
if(navigator.appName.indexOf("Microsoft",0)!=-1&&parseInt(navigator.appVersion)>=4){Browser = true;}
else{Browser=false;}
if(Browser){document.onmouseover=doRainbowAnchor;document.onmouseout=stopRainbowAnchor;}
function doRainbow(){
	if(Browser&&act!=1){
		act=1;
		obj=event.srcElement;
		clrOrg=obj.style.color;
		TimerID=setInterval("ChangeColor()",100);
	}
}
function stopRainbow(){
	if(Browser&&act!=0){
		obj.style.color=clrOrg;
		clearInterval(TimerID);
		act=0;
	}
}
function doRainbowAnchor(){
	if(Browser&&act!=1){
		obj=event.srcElement;
		while(obj.tagName!='A'&&obj.tagName!='BODY'){
		obj=obj.parentElement;
		if(obj.tagName=='A'||obj.tagName=='BODY')break;
	}
	if(obj.tagName=='A'&&obj.href!=''){
		act = 1;
		clrOrg=obj.style.color;
		TimerID=setInterval("ChangeColor()",100);
		}
	}
}
function stopRainbowAnchor(){
	if (Browser&&act!=0){
		if(obj.tagName=='A'){
			obj.style.color=clrOrg;
			clearInterval(TimerID);
			act=0;
		}
	}
}
function ChangeColor(){
	obj.style.color=makeColor();
}
function makeColor(){
	if(elmS==0){
		elmR=elmV;
		elmG=elmV; 
		elmB=elmV;
	}
	else{
		t1=elmV;
		t2=(255-elmS)*elmV/255;
		t3=elmH%60;
		t3=(t1-t2)*t3/60;
		if(elmH<60){
		elmR=t1;
		elmB=t2;
		elmG=t2+ t3;
	}
	else if(elmH<120){
		elmG=t1;
		elmB=t2;
		elmR=t1-t3;
	}
	else if (elmH<180){
		elmG=t1;
		elmR=t2;
		elmB=t2+t3;
		}
	else if(elmH<240){
		elmB=t1;
		elmR=t2;
		elmG=t1-t3;
		}
	else if(elmH<300){
		elmB=t1;
		elmG=t2;
		elmR=t2+t3;
		}
	else if(elmH<360){
		elmR=t1;
		elmG=t2;
		elmB=t1-t3;
		}
	else{
		elmR=0;
		elmG=0;
		elmB=0;
		}
	}
	elmR=Math.floor(elmR);
	elmG=Math.floor(elmG);
	elmB=Math.floor(elmB);
	clrRGB='#'+elmR.toString(16)+elmG.toString(16)+elmB.toString(16);
	elmH=elmH+rate;
	if(elmH >=360)elmH=0;
	return clrRGB;
}
//鼠标超链接特效End
