// JavaScript Document

var $cnexp = new Object();
$cnexp.base = {
	e:function(a,f){
		for(var i=0,j=a.length;i<j;i++){f.call(a[i],i);}
	}
}
$cnexp. slide = function (id,arg){
	var arg = arg||{},
		t = document.getElementById(id),
		a = t.getElementsByTagName("a"),
		lis = [],
		cl = arg.color||'#f30',
		ctm = arg.time*1000||2000,
		w = t.clientWidth,
		h = t.clientHeight,
		b = ['<ul class="num">'],
		index = 0,
		$$ = null,
		$ = null;
		function change(i){
			if(!!$$){clearTimeout($$);}
			index = !isNaN(i)?i:index+1;
			if(index >= a.length){index = 0;}
			$cnexp.base.e(lis,function(k){if(k == index){c(1,this);}else{c(0,this)}});
			var to = - index*h;
			if(a[0].offsetTop == to){
				return;
			}else{
				if(!!$){clearInterval($);}
				$ = setInterval(function(){
					var ot = a[0].offsetTop;
					v = Math[to<ot?'floor':'ceil']((to - ot)*0.2);
					if(ot == to){clearInterval($);$=null;st();}
					ot += v;
					a[0].style.marginTop = ot + "px";
				},30)
			};
		}
		function c(b,o){
			o.style.backgroundColor = !!b?cl:"#fff";
			o.style.color = !!b?"#fff":cl;
		}
		function st(){
			if(!!$$)clearTimeout($$);
			$$ = setTimeout(function(){change()},ctm);
		}
		with(t.style){overflow = 'hidden';position = 'relative';}
		$cnexp.base.e(a,function(n){
			this.style.display = "block";
			with(this.firstChild.style){borderWidth = '0';width = w + 'px';height = h + 'px';}
			b.push('<li class="c1">' + (n+1) + '</li>');	
		});
		b.push('</ul>');
		t.innerHTML += b.join("");
		lis = t.getElementsByTagName("li");
		$cnexp.base.e(lis,function(n){
			if(n == index){c(1,this)}
			this.onmouseover = function(){
				if(n!=index)change(n);
			}
		});
		st();
}


