﻿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+')');
			}
		},
		
		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};
	
}();








//首页图片滚动

//图片滚动列表 5icool.org
var Speed = 5; //速度(毫秒)
var Space = 4; //每次移动(px)
var PageWidth = 678; //翻页宽度 1 是一次 翻动几张
var fill = 0; //整体移位
var MoveLock = false;
var MoveTimeObj;
var Comp = 0;
var AutoPlayObj = null;
GetObj("List2").innerHTML = GetObj("List1").innerHTML;
GetObj('ISL_Cont').scrollLeft = fill;
GetObj("ISL_Cont").onmouseover = function(){clearInterval(AutoPlayObj);}
GetObj("ISL_Cont").onmouseout = function(){AutoPlay();}
AutoPlay();
function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}}
function AutoPlay(){ //自动滚动
 clearInterval(AutoPlayObj);
 AutoPlayObj = setInterval('ISL_GoDown();ISL_StopDown();',0); //间隔时间
}
function ISL_GoUp(){ //上翻开始
 if(MoveLock) return;
 clearInterval(AutoPlayObj);
 MoveLock = true;
 MoveTimeObj = setInterval('ISL_ScrUp();',Speed);
}
function ISL_StopUp(){ //上翻停止
 clearInterval(MoveTimeObj);
 if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0){
  Comp = fill - (GetObj('ISL_Cont').scrollLeft % PageWidth);
  CompScr();
 }else{
  MoveLock = false;
 }
 AutoPlay();
}
function ISL_ScrUp(){ //上翻动作
 if(GetObj('ISL_Cont').scrollLeft <= 0){GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft + GetObj('List1').offsetWidth}
 GetObj('ISL_Cont').scrollLeft -= Space ;
}
function ISL_GoDown(){ //下翻
 clearInterval(MoveTimeObj);
 if(MoveLock) return;
 clearInterval(AutoPlayObj);
 MoveLock = true;
 ISL_ScrDown();
 MoveTimeObj = setInterval('ISL_ScrDown()',Speed);
}
function ISL_StopDown(){ //下翻停止
 clearInterval(MoveTimeObj);
 if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0 ){
  Comp = PageWidth - GetObj('ISL_Cont').scrollLeft % PageWidth + fill;
  CompScr();
 }else{
  MoveLock = false;
 }
 AutoPlay();
}
function ISL_ScrDown(){ //下翻动作
 if(GetObj('ISL_Cont').scrollLeft >= GetObj('List1').scrollWidth){GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft - GetObj('List1').scrollWidth;}
 GetObj('ISL_Cont').scrollLeft += Space ;
}
function CompScr(){
 var num;
 if(Comp == 0){MoveLock = false;return;}
 if(Comp < 0){ //上翻
  if(Comp < -Space){
   Comp += Space;
   num = Space;
  }else{
   num = -Comp;
   Comp = 0;
  }
  GetObj('ISL_Cont').scrollLeft -= num;
  setTimeout('CompScr()',Speed);
 }else{ //下翻
  if(Comp > Space){
   Comp -= Space;
   num = Space;
  }else{
   num = Comp;
   Comp = 0;
  }
  GetObj('ISL_Cont').scrollLeft += num;
  setTimeout('CompScr()',Speed);
 }
}
//--><!]]>





