﻿var _count = $("#slide1 .small li").length;
var _i = 0;
$("#slide1 .big>p").each(function(i){
	if(i==0){
		$(this).fadeIn("slow");
	}
	$(this).attr("id","SIMAGE_"+i);
});
$("#slide1 .small li").each(function(i){
	if(i==0){
		$(this).addClass("current");
	}
	$(this).attr("id","SLI_"+i);
});
function $slide(){
		_i++;
		var id = _i;
		if(id>=_count){ _i=0; id=0; }
			$("#slide1 .big>p").hide();
			$("#SIMAGE_"+id).show();
			$("#slide1 .small li").removeClass("bgnone");
			$("#slide1 .small li").removeClass("current");
			$("#slide1 .small li:last").addClass("bgnone");
			$("#SLI_"+id).prev('li').addClass("bgnone");
			$("#SLI_"+id).addClass("current");
};
var t=setInterval($slide,5000);
$("#slide1 .small li").each(function(i){
		$(this).hover(
			function(){
				try{
					clearInterval(t);
				}catch(e){}
				if(i != _i){
					$("#slide1 .big>p").hide();
					$("#SIMAGE_"+i).show();
					$("#slide1 .small li").removeClass("bgnone");
					$("#slide1 .small li").removeClass("current");
					$("#slide1 .small li:last").addClass("bgnone");
					$(this).prev('li').addClass("bgnone");
					$(this).addClass("current");
				}
				_i = i;
			},function(){
				t=setInterval($slide,5000);
			}
		)
});
