//run fun
$(document).ready(function() {
	if ($.browser.msie) {
		if (parseInt($.browser.version) < 7) {
			try {
				document.execCommand('BackgroundImageCache', false, true);
			} catch(e){}
			$('a.pngfix').hover(function() {$(this).addClass('hover');}, function() {$(this).removeClass('hover');});
		}
	}

	home_slider();
});

function home_slider() {
	var slider = $('.slider');
	if (slider.length != 1) return false;
	var len = $('.control li', slider).length;
	var index = 0,
		step = 940,
		speed = 5500,
		pause = false;
	var autoplay = function() {
		if (pause) return false;
		index++;
		if (index >= len) index = 0;
		if (index < 0) index = len - 1;
		$('.control li', slider).eq(index).click();
	};
	$('.control li', slider).click(function() {
		index = $(this).index();
		$(this).addClass('active').siblings().removeClass('active');
		$('.list').animate({left:-1*step*index});
	});
	slider.hover(function() {
		pause = true;
	}, function() {
		pause = false;
	});
	$('.control li').eq(0).click();
	var timer = setInterval(autoplay, speed);
}
