
;(function($){
	$.fn.init_shift_promo = function(options) {
		options = $.extend({
				animation_speed : 1000,
				hide_animation : { width : 0, opacity : 0.5 },
				show_animation : { width : 208, opacity : 1 }
			},options);
		return $(this).each(function(i){
			$(this).css(i == 0 ? options.show_animation : options.hide_animation )
			.find('img').css(i == 0 ? options.show_animation : options.hide_animation )
		})
	}
	$.fn.shift_promo = function(options){
		var _current = $(this).eq(0);
		var _next    = $(this).eq(1);
		
		options = $.extend({
			animation_speed : 222,
			hide_animation : { width : 0, opacity : 0.5 },
			show_animation : { width : 208, opacity : 1 }
		},options);
		
		_current.animate(options.hide_animation, options.animation_speed, function(){
			_current.appendTo(_current.parent());
		}).find('img').animate(options.hide_animation, options.animation_speed);
		_next.animate(options.show_animation,options.animation_speed).find('img').animate(options.show_animation, options.animation_speed);
		return $(this);
	}
})(jQuery)

function shift_promo() {
	jQuery('.left_promo_tile .inner_wrapper a, .right_promo_tile .inner_wrapper a').shift_promo();
}

jQuery(document).ready(function(){
	var animation_timer;
	var _promos = $('.left_promo_tile .inner_wrapper a, .right_promo_tile .inner_wrapper a');
	if (_promos.length < 2) return false;
	_promos.init_shift_promo();
	animation_timer = setInterval(shift_promo,5000);
	$('.left_promo_tile, .right_promo_tile').bind('mouseover',function(){
		clearInterval(animation_timer);
	}).bind('mouseleave',function(){
		animation_timer = setInterval(shift_promo,5000);
	});
})

