function InsBannRotator (width_bann,div_anext,div_aprev,curr,timeout){
				$(div_anext).click(function() {
					InsBannRNext(width_bann,curr);
					$('.to_right_active, .to_left_active').show();
					 return false;
				})
				.mousedown(function(){
					return false;
				});
				$(div_aprev).click(function() {
					InsBannRPrev(width_bann,curr);
					$('.to_right_active, .to_left_active').show();
					 return false;
				})
				.mousedown(function(){
					return false;
				});
				function auto_rotate(timeout){
					interval = setInterval(function() {
						$(div_anext).click();
					}, timeout);
				}
				if (timeout > 0){
					auto_rotate(timeout);
				}
			}
			var anima = false;
			
			function InsBannRNext (width_bann,curr){
				if(anima)return false;
				anima = true;
				var li_first = curr+' li:first';
				var li_last = curr+' li:last';
					$(li_first).clone().insertAfter(li_last).find('.show_popup').each(function(){
						make_popup(this);
					});
					$(curr).stop(false,true).animate({
						marginLeft: -width_bann + "px"
					}, 'normal', function() {
							$(curr).css({marginLeft: 0 + "px"});
							$(li_first).remove();
							anima = false;
						if(!left_active)
						{
							$('.to_left_active').hide();
						}
						if(!right_active)
						{
							$('.to_right_active').hide();
						}
					  });
	$('.brands-carousel ul li').hover(function()
	{
		$(this).addClass('hover');
	}, function()
	{
		$(this).removeClass('hover');
	});
			}			
			function InsBannRPrev (width_bann,curr){
				if(anima)return false;
				anima = true;
				var li_first = curr+' li:first';
				var li_last = curr+' li:last';
				$(li_last).clone().insertBefore(li_first).find('.show_popup').each(function(){
					make_popup(this);
				});;
				$(curr).css({marginLeft: -width_bann + "px"});
				
				$(curr).stop(false,true).animate({
						marginLeft: 0 + "px"
					}, 'normal', function(){
						$(li_last).remove();
						anima = false;
						if(!left_active)
						{
							$('.to_left_active').hide();
						}
						if(!right_active)
						{
							$('.to_right_active').hide();
						}
					});
	$('.brands-carousel ul li').hover(function()
	{
		$(this).addClass('hover');
	}, function()
	{
		$(this).removeClass('hover');
	});
			}
var left_active = false,right_active = false;
$(function(){
	dom_ready = true;
	// Banners
	InsBannRotator(290,'.brands-carousel .to_left','.brands-carousel .to_right','.brands-carousel ul',0);
});
