$(function(){
	$('#serviceGuarantee > ol').css('position', 'absolute');
	$('#serviceGuarantee > ol > li').each(function(){
		$(this).attr('number', $(this).index()+1);
	});
	
	$('#serviceGuarantee > ol > li[number=1], #serviceGuarantee > ol > li[number=2], #serviceGuarantee > ol > li[number=3], #serviceGuarantee > ol > li[number=4], #serviceGuarantee > ol > li[number=5], #serviceGuarantee > ol > li[number=6]').addClass('active');
});
$(window).load(function(){
	var serviceGuaranteeHeight = 0;
	$('#serviceGuarantee > ol > li.active').each(function(){
		serviceGuaranteeHeight = serviceGuaranteeHeight + parseInt($(this).outerHeight(true));
	});
	$('#serviceGuarantee').stop(true, true).animate({
			'height': serviceGuaranteeHeight
		}, 1000);
	
	setInterval("slideList()", 5000);
});
function slideList()
{
	var serviceGuaranteeHeight = 0;
	if($('#serviceGuarantee > ol > li.active:last').attr('number')==$('#serviceGuarantee > ol > li:last').attr('number'))
	{
		serviceGuaranteeHeight = serviceGuaranteeHeight + $('#serviceGuarantee > ol > li[number=1]').outerHeight(true);
		serviceGuaranteeHeight = serviceGuaranteeHeight + $('#serviceGuarantee > ol > li[number=2]').outerHeight(true);
		serviceGuaranteeHeight = serviceGuaranteeHeight + $('#serviceGuarantee > ol > li[number=3]').outerHeight(true);
		serviceGuaranteeHeight = serviceGuaranteeHeight + $('#serviceGuarantee > ol > li[number=4]').outerHeight(true);
		serviceGuaranteeHeight = serviceGuaranteeHeight + $('#serviceGuarantee > ol > li[number=5]').outerHeight(true);
		serviceGuaranteeHeight = serviceGuaranteeHeight + $('#serviceGuarantee > ol > li[number=6]').outerHeight(true);
		$('#serviceGuarantee').stop(true, true).animate({
			'height': serviceGuaranteeHeight
		}, 1000);
		$('#serviceGuarantee > ol').stop(true, true).animate({
			top: 0
		}, 1000);
		$('#serviceGuarantee > ol > li.active').each(function(){
			$(this).removeClass('active');
		});
		$('#serviceGuarantee > ol > li[number=1], #serviceGuarantee > ol > li[number=2], #serviceGuarantee > ol > li[number=3], #serviceGuarantee > ol > li[number=4], #serviceGuarantee > ol > li[number=5], #serviceGuarantee > ol > li[number=6]').addClass('active');
	}
	else
	{
		$('#serviceGuarantee > ol > li.active').each(function(){
			serviceGuaranteeHeight = serviceGuaranteeHeight + parseInt($('#serviceGuarantee > ol > li[number=' + (parseInt($(this).attr('number'))+1) + ']').outerHeight(true));
		});
		$('#serviceGuarantee > ol').stop(true, true).animate({
			top: (parseInt($('#serviceGuarantee > ol').css('top').replace('px', '')))+(-1*($('#serviceGuarantee > ol > li.active:first').outerHeight(true)))
		}, 500);
		$('#serviceGuarantee > ol > li.active:first').removeClass('active');
		$('#serviceGuarantee > ol > li[number=' + (parseInt($('#serviceGuarantee > ol > li.active:last').attr('number'))+1) + ']').addClass('active');
		$('#serviceGuarantee').stop(true, true).animate({
			'height': serviceGuaranteeHeight
		}, 500);
	}
}
