<?php echo $this->fetch('header.html'); ?>
 <?php echo $this->fetch('product/breadcrumb_list.html'); ?>

<div id="container">
<?php $this->skymvc->loadmodel("category");$this->assign("tag_nav",$_ENV["categoryModel"]->tag_nav(get('catid','i'))); ?>
<?php if ($this->_var['tag_nav']['child']): ?>
<div class="rec_nav box">
 

<h2><a href="/index.php?m=list&a=default&catid=<?php echo $this->_var['tag_nav']['id']; ?>"><?php echo $this->_var['tag_nav']['cname']; ?></a></h2>
<ul class="nav_list">
<?php $_from = $this->_var['tag_nav']['child']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['c']):
?>
<li>
<span><a href="/index.php?m=list&catid=<?php echo $this->_var['c']['id']; ?>" class="red_f"><?php echo $this->_var['c']['cname']; ?></a></span>
<?php if ($this->_var['c']['tags'] || $this->_var['c']['child']): ?>
<p>
<?php if ($this->_var['c']['child']): ?>
<?php $_from = $this->_var['c']['child']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'd');if (count($_from)):
    foreach ($_from AS $this->_var['d']):
?>
<a href="/index.php?m=list&a=default&catid=<?php echo $this->_var['d']['id']; ?>" ><?php echo $this->_var['d']['cname']; ?></a>
<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
<?php endif; ?>

<?php $_from = $this->_var['c']['tags']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'cc');if (count($_from)):
    foreach ($_from AS $this->_var['cc']):
?>
<a href="/index.php?m=list&catid=<?php echo $this->_var['c']['id']; ?>&tagname=<?php echo urlencode($this->_var['cc']); ?>" <?php if ($this->_var['cc'] == $_GET['tagname']): ?> class="active"<?php endif; ?>><?php echo $this->_var['cc']; ?></a> 
<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
</p>
<?php endif; ?>
</li>
<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
</ul>
</div>
<?php endif; ?>

<?php $_from = $this->_var['list']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('k', 'p');if (count($_from)):
    foreach ($_from AS $this->_var['k'] => $this->_var['p']):
?>
<div class="box box99" >
<a href="/index.php?m=show&a=default&id=<?php echo $this->_var['p']['id']; ?>"   target="_blank"><img <?php if ($this->_var['p']['thumbsinfo']): ?>class="lzImg" json='<?php echo $this->_var['p']['thumbsinfo']; ?>'<?php endif; ?> width="220" title="<?php echo $this->_var['p']['title']; ?>" alt="<?php echo $this->_var['p']['title']; ?>"    src="/<?php if ($this->_var['k'] > 12): ?>images/lazy.jpg<?php else: ?><?php echo $this->_var['p']['imgurl']; ?>.small.jpg<?php endif; ?>" data-original="/<?php echo $this->_var['p']['imgurl']; ?>.small.jpg" /></a>
<?php if ($this->_var['p']['start_time'] > time()): ?>
<!--即将开始-->
<div class="will_start ">
    <span  class="price"><?php echo intval($this->_var['p']['lower_price']); ?>金币</span> 
    <span  class="start_time"> <?php echo date("H:m",$this->_var['p']['start_time']); ?>开始</span>
</div>
<?php elseif ($this->_var['p']['end_time'] > time()): ?>
<!--正在进行-->
<div class="going">
    <span  class="price"> <?php echo intval($this->_var['p']['lower_price']); ?>金币</span>
    <a href="/index.php?m=show&a=default&id=<?php echo $this->_var['p']['id']; ?>"  target="_blank"   class="btn btn-danger">去兑换</a>
</div>
<?php else: ?>
<!--已结束-->
<div class="finish">
    <span  class="price"> <?php echo intval($this->_var['p']['lower_price']); ?>金币</span>
   <a href="/index.php?m=show&a=default&id=<?php echo $this->_var['p']['id']; ?>"  target="_blank"   class="btn btn-link">已抢光</a>
</div>

<?php endif; ?>

<?php if (isset ( $_SESSION['ssuser']['userid'] )): ?>
<div class="hd" style="margin-top:10px; margin-bottom:10px; width:100%; ">
<span style="padding-left:10px; float:left;" class="btn-group">
<span class="btn btn-danger loves"  url="/index.php?m=loves&a=product&id=<?php echo $this->_var['p']['id']; ?>" >喜欢</span> <span class="btn"> <?php echo $this->_var['p']['loves']; ?> </span>
</span> 

<span style="padding-right:10px; float:right;" class="btn-group">
<span href="javascript:;" class="btn btn-warning hates"  url="/index.php?m=hates&a=product&id=<?php echo $this->_var['p']['id']; ?>">失望</span> <span class="btn"><?php echo $this->_var['p']['hates']; ?></span>
</span>
</div>
<?php endif; ?>
 
<div class="info"><a   href="/index.php?m=show&a=default&id=<?php echo $this->_var['p']['id']; ?>"  <?php if ($this->_var['p']['goodsid'] && $this->_var['p']['start_time'] < time() && $this->_var['p']['end_time'] > time()): ?>data-itemid="<?php echo $this->_var['p']['goodsid']; ?>"<?php endif; ?>  target="_blank"><?php echo $this->_var['p']['title']; ?></a>  (<?php echo $this->_var['p']['price']; ?>元)</div>
</div>
<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
</div>

<div style="clear:both;"></div>
<div ><?php echo $this->_var['pagelist']; ?></div>

  

<script>

 lzImage("lzImg",220);
  
  $(function(){ 
   //$(".box img").lazyload();
   
    var $container=$("#container");
    $container.imagesLoaded(function(){
      $container.masonry({
        itemSelector: '.box99',
        columnWidth: function( containerWidth ) {
    		return containerWidth / 4;
  		}
      });
    });
	
	$(window).scroll(function(){
		$(".box99").show();
		$container.masonry( 'reload' )
		if($("img[src$='/images/lazy.jpg']").length>0){
			obj=$("img[src$='/images/lazy.jpg']");
			
			len=obj.length;
			
			for(i=0;i<len;i++){
				if(i<12){
					obj.eq(i).attr("src",obj.eq(i).attr("data-original"));
				}
			}
			
			$container.masonry( 'reload' )
		}
		
	}
	)
	
	 
	

});

</script>

<?php echo $this->fetch('footer.html'); ?> 


