$(document).ready(function () {
	setTimeout(function () {$('div.ms-tab-content.current').fadeIn(500); }, 300);
	$('a.ms-tab-link').click(function (e) {
		e.preventDefault();
		if (!$(this).hasClass('current') && !$('div.ms-tab-content').is(':animated')) {
			var index = $('a.ms-tab-link').index(this);
			$('a.ms-tab-link').removeClass('current'); $(this).addClass('current');
			$('div.ms-tab-content.current').fadeOut(500).removeClass('current');
			$('div.ms-tab-content:eq(' + index + ')').fadeIn(500).addClass('current');
			if (index == 2) {
				samplePreview('start');
			} else {
				samplePreview('stop');
			}
		}
	});
});

var s_I = 1; var s_ID = null;
function samplePreview(option) {
	var option = option || 'start';
	if (option==='start') {
		s_ID = setInterval(function () {
			s_I = s_I==$('img.p-img').length ? 0 : ++s_I;
			$('img.p-img.shown').fadeOut(2500, function () { $(this).removeClass('shown');});
			$('img.p-img:eq(' + s_I + ')').fadeIn(2500).addClass('shown');
		},4000);
	} else {
		if (!FMUtils.isEmpty(s_ID)) {
			clearInterval(s_ID);
		}
		s_I = 0;
	}
}