$(function(){

	numSlides = $('.multiple .image_area .item').length;

if(numSlides>1){

// specials rotation
	slideshowDelay = 7000;
	animating = false;
	current = 0;
	
	$('.items .item:not(.on)').css({left: '0', display: 'none'})
	// create the ctrls
	controlsHtml = '<a class="on"></a>';
	for (i=0; i< numSlides-1; i++) {
		controlsHtml += '<a></a>';
	}

	$('.specials_ctrl').html(controlsHtml)
	ctrls = $('.multiple .specials_ctrl a')
	// rotation on click
	ctrls.click(function(){
		if(!animating) {
			$('.multiple .image_area').stopTime('specRotation');
			ind = current = $('.specials_ctrl a').index($(this));
			rotateSpecials(ind);
			$('.multiple .image_area').everyTime(slideshowDelay, 'specRotation', autoRotateSpecials);
		}
	});
	function autoRotateSpecials(){
		current++;
		current %= numSlides;
		rotateSpecials(current);
	}
	// auto rotation
	$('.multiple .image_area').everyTime(slideshowDelay, 'specRotation', autoRotateSpecials);
	// pause auto rotation while mouse is over the specials
	$('.multiple .image_area .items')
		.mouseenter(function(){ $('.multiple .image_area').stopTime('specRotation'); })
		.mouseleave(function(){ $('.multiple .image_area').everyTime(slideshowDelay, 'specRotation', autoRotateSpecials); })
	// show the one
	function rotateSpecials(ind){
		ctrls.removeClass();
		$('.specials_ctrl a:eq('+ind+')').addClass('on');
		$('.multiple .image_area .on').css({zIndex: '4'});
		animating = true;
		$('.multiple .image_area .item:eq('+ind+')').css({'zIndex':5,'left':0}).fadeIn('2000', function(){
			$('.multiple .image_area .on').removeClass('on').css({display: 'none'});
			$(this).addClass('on');
			animating = false;
		});
	}

} // End if on numSlides

});
