//run fun
$(document).ready(function() {
	if ($.browser.msie && parseInt($.browser.version) < 7) {
		$('.shadow-left, .shadow-right').height($('#container').height());
	}
	if ($('.slider').length) {
		slider();
	}
});

function slider() {
	var slider = $('.slider'),
		list   = $('.list > ul', slider),
		len    = $('> li', list).length,
		step   = 948,
		index  = 0,
		speed = 4000,
		timer = null;

	if (len <= 1) return false;
	
	$('.num li', slider).click(function() {
		index = $(this).index();
		play();
	});
	var autoplay = function() {
		index++;
		if (index >= len) index = 0;
		play();
	};
	var play = function() {
		$('.num li', slider).eq(index).addClass('active').siblings().removeClass('active');
		list.stop().animate({left : -index * step}); 
	};
	slider.hover(function() {
		clearInterval(timer);
	}, function() {
		timer = setInterval(autoplay, speed);
	});
	timer = setInterval(autoplay, speed);
}
