<?php // no direct access
defined('_JEXEC') or die('Restricted access');
$col= 1 ;
$current_manufacturer_id = JRequest::getInt('virtuemart_manufacturer_id',0);
?>
<div class="vmgroup<?php echo $params->get( 'moduleclass_sfx' ) ?>">

<?php if ($headerText) : ?>
	<div class="vmheader"><?php echo $headerText ?></div>
<?php endif;
if ($display_style =="div") { ?>
	<div class="vmmanufacturer<?php echo $params->get('moduleclass_sfx'); ?>">
	<?php foreach ($manufacturers as $manufacturer) {
		$link = JROUTE::_('index.php?option=com_virtuemart&view=manufacturer&virtuemart_manufacturer_id=' . $manufacturer->virtuemart_manufacturer_id);
		if ($manufacturer->virtuemart_manufacturer_id==$current_manufacturer_id) {
			$active_class = ' class="active"';
		} else {
			$active_class = '';
		}
		?>
		<div style="float:left;"<?php echo $active_class; ?>>
			<a href="<?php echo $link; ?>">
		<?php
		if ($manufacturer->images && ($show == 'image' or $show == 'all' )) { ?>
			<?php echo $manufacturer->images[0]->displayMediaThumb('',false);?>
		<?php
		}
		if ($show == 'text' or $show == 'all' ) { ?>
		 <div><?php echo $manufacturer->mf_name; ?></div>
		<?php
		} ?>
			</a>
		</div>
		<?php
		if ($col == $manufacturers_per_row) {
			echo "</div><div style='clear:both;'>";
			$col= 1 ;
		} else {
			$col++;
		}
	} ?>
	</div>
	<br style='clear:both;' />

<?php
} else {
	$last = count($manufacturers)-1;
?>
<div class="list_carousel_brand responsive">
<ul id="brand_slider" class="vmmanufacturer<?php echo $params->get('moduleclass_sfx'); ?>">
<?php
foreach ($manufacturers as $manufacturer) {
	$link = JROUTE::_('index.php?option=com_virtuemart&view=category&virtuemart_manufacturer_id=' . $manufacturer->virtuemart_manufacturer_id);
	if ($manufacturer->virtuemart_manufacturer_id==$current_manufacturer_id) {
		$active_class = ' class="active"';
	} else {
		$active_class = '';
	}
	?>
	<li<?php echo $active_class; ?>><a href="<?php echo $link; ?>">
		<?php
		if ($manufacturer->images && ($show == 'image' or $show == 'all' )) { ?>
			<?php echo $manufacturer->images[0]->displayMediaThumb('',false);?>
		<?php
		}
		if ($show == 'text' or $show == 'all' ) { ?>
		 <div><?php echo $manufacturer->mf_name; ?></div>
		<?php
		}
		?>
		</a>
	</li>
	<?php
	if ($col == $manufacturers_per_row && $manufacturers_per_row && $last) {
		echo '</li>';
		$col= 1 ;
	} else {
		$col++;
	}
	$last--;
} ?>
</ul>
<div class="clearfix"></div>
<a id="prevB" class="list_prev" href="#"><span>&lt;</span></a>
<a id="nextB" class="list_next" href="#"><span>&gt;</span></a>

</div>
<?php }
	if ($footerText) : ?>
	<div class="vmfooter<?php echo $params->get( 'moduleclass_sfx' ) ?>">
		 <?php echo $footerText ?>
	</div>
<?php endif; ?>
</div>
<script type="text/javascript" src="modules/mod_virtuemart_manufacturer/js/jquery.carouFredSel-6.1.0-packed.js"></script>
<script type="text/javascript">
var isIE8 = jQuery.browser.msie && + jQuery.browser.version === 8;
if (isIE8 ) {
	function sliderInit() {							   	
			jQuery('#brand_slider').carouFredSel({
					auto: false,
					circular: false,
                    infinite: false,
					prev: '#prevB',
					next: '#nextB',
					height: 'auto',
					mousewheel: false,
					swipe: {
						onMouse: false,
						onTouch: false
					},				   
					responsive: true,
					width: '100%',
					scroll: 1,
					items: {
						width: 190,
						height: 'auto',	//	optionally resize item-height
						visible: {
							min: 1,
							max: 6
						}
					}
				});
		}
} else {
function sliderInit() {	
if (notAnimate =='1'){
jQuery('#brand_slider li').addClass('display-none');
	jQuery('#brand_slider li').viewportChecker({
		classToAdd: 'display-block animated zoomIn', // Class to add to the elements when they are visible
		offset: 100 // The offset of the elements (let them appear earlier or later)
	});
}
	jQuery('#brand_slider').carouFredSel({
					auto :false , 
					circular: false,
                    infinite: false,
					prev: '#prevB',
					next: '#nextB',
					mousewheel: false,
					swipe: {
						onMouse: true,
						onTouch: true
					},				   
					responsive: true,
					width: '100%',
					height: null,
					scroll: 1,
					items: {
						width: 190,
						height: null,	//	optionally resize item-height
						visible: {
							min: 2,

							max: 6
						}
					}
				});
				
			}
}
jQuery(function(){
	jQuery('.list_carousel_brand').addClass('loader');
	jQuery(window).load(function() {
		jQuery('.list_carousel_brand').removeClass('loader'); // remove the loader when window gets loaded.
		jQuery('#brand_slider').show();
	sliderInit();
	});
});
</script>
