<?php if ($display_type == 0) { ?>
<div class="reveal-modal xlarge" id="sd_reveal_<?php echo $module; ?>">
<?php } ?>
	<div class="box-special-deal <?php echo $content_right_class; ?>">
	
		<div id="special_deal_<?php echo $module; ?>" class="deals-slider">
			<?php foreach($products as $product) { ?>
			<div class="box-special-deal-content">
				<div class="special-deal-content-left">
					<div class="sd-discount-details">
						<div class="sd-discount-box">
							<div class="sd-discount-text"><?php echo $text_old_price; ?></div>
							<div class="sd-discount-number old-price"><?php echo $product['price']; ?></div>
						</div>
						<div class="sd-discount-box">
							<div class="sd-discount-text"><?php echo $text_discount; ?></div>
							<div class="sd-discount-number"><?php echo $product['discount']; ?>%</div>
						</div>
						<div class="sd-discount-box">
							<div class="sd-discount-text"><?php echo $text_save; ?></div>
							<div class="sd-discount-number"><?php echo $product['save']; ?></div>
						</div>
					</div>
					<div class="sd-time-left">
						<div class="time-left-text"><?php echo $text_time_left_purchase; ?></div>
						<div class="time-left-counter" id="time_left_counter_<?php echo $module; ?>_<?php echo $product['product_id']; ?>"></div>
					</div>
					<div class="sd-time-text">
						<div class="sd-time-mu-det">
							<div class="sd-mu"><?php echo $text_day; ?></div>
							<div class="sd-mu"><?php echo $text_hour; ?></div>
							<div class="sd-mu"><?php echo $text_minute; ?></div>
							<div class="sd-mu"><?php echo $text_second; ?></div>
						</div>	
					</div>
					<div class="sd-price"><?php echo $product['special']; ?></div>
					<div class="sd-buy-now">
						<?php if ($buy_now_behaviour) { ?>
						<a class="buy-now-button" href="<?php echo $product['href']; ?>"><span><?php echo $text_buy_now; ?></span></a>
						<?php } else { ?>
						<a class="buy-now-button" onclick="addToCart(<?php echo $product['product_id']; ?>);"><span><?php echo $text_buy_now; ?></span></a>
						<?php } ?>
					</div>
					<div class="sd-recommend">
						<div class="recommend-text"><?php echo $text_recommend_friends; ?></div>
						<div class="recommend-buttons">
							<!-- AddThis Button BEGIN -->
							<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
							<a class="addthis_button_facebook" addthis:url="<?php echo $product['href']; ?>"></a>
							<a class="addthis_button_twitter" addthis:url="<?php echo $product['href']; ?>"></a>
							<a class="addthis_button_pinterest_share" addthis:url="<?php echo $product['href']; ?>"></a>
							<a class="addthis_button_google_plusone_share" addthis:url="<?php echo $product['href']; ?>"></a>
							<a class="addthis_button_email" addthis:url="<?php echo $product['href']; ?>"></a>
							</div>
							<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=undefined"></script>
							<!-- AddThis Button END -->
						</div>
					</div>
				</div>
				<div class="special-deal-content-right <?php echo $content_right_class; ?>">
					<div class="sd-name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
					<div class="sd-image">
						<div class="slider">
							<?php if ($product['thumb']) { ?>
							<div class="slide"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb'];?>" /></a></div>
							<?php } ?>
							<?php foreach ($product['additional_images'] as $additional_image) { ?>
							<div class="slide"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $additional_image['thumb']; ?>" /></a></div>
							<?php } ?>
						</div>
					</div>
					<div class="sd-social"><div class="fb-like" data-href="<?php echo $product['href']; ?>" data-send="false" data-layout="button_count" data-width="200" data-show-faces="false"></div></div>
					<div class="sd-description"><?php echo $product['description']; ?></div>
				</div>
			</div>
			<?php } ?>
		</div>
	</div>	
<?php if ($display_type == 0) { ?>		
	<a class="close-reveal-modal">&#215;</a>
</div>
<?php } ?>
<div id="fb-root"></div>

<script type="text/javascript">
$(document).ready(function(){

	<?php foreach($products as $product) { ?>
	<?php if ($product['show_countdown']) { ?>
	$('#time_left_counter_<?php echo $module; ?>_<?php echo $product['product_id']; ?>').sdcountdown({
		timestamp	: new Date(<?php echo $product['countdown_from'][0]; ?>, <?php echo $product['countdown_from'][1] - 1; ?>, <?php echo $product['countdown_from'][2]; ?> ),
		now         : new Date(<?php echo date('Y,m-1,d,H,i,s'); ?>)
	});	
	<?php } ?>
	<?php } ?>
 
	$('.slider').bxSlider4({
		minSlides: 1,
		maxSlides: 3,
		slideMargin: 10,
		//controls: false,
		pager: false
	});
	
	<?php if ($display_type == 0 && $remaining_popup_show) { ?>  
	$('#sd_reveal_<?php echo $module; ?>').reveal($(this).data());
	<?php } ?>
});

$('#special_deal_<?php echo $module; ?>').rhinoslider({
	controlsMousewheel: false,
	controlsKeyboard: false,
	controlsPlayPause: false,
	<?php if ($slide_type) { ?>
	autoPlay: true,
	<?php } else { ?>
	autoPlay: false,
	<?php } ?>
	showTime: <?php echo $slide_time; ?>,
	<?php if (count($products) < 2) {?>
	showControls: 'never',
	<?php } else { ?>
	showControls: 'always',
	<?php } ?>
	<?php if (count($products) < 2) {?>
	showBullets: 'never'
	<?php } else { ?>
	showBullets: 'always'
	<?php } ?>
});
</script>

<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

