<div class="content2_outerbox"> 
  <nav>
    <ul id="tabs" style=" list-style:none">
    <?php $section	=	''; $userGroups	=	UserGroup::model()->findAll(array('condition'=>'isActive="Y" AND show_in_partner="Y"')); 
        foreach($userGroups as $eachUserGroup):?>
      <li><a class="current" href="javascript:;"><?php echo $eachUserGroup->group_name; ?></a></li>
      <?php   
          $productGroups	=	ProductGroup::model()->findAll(array('limit'=>4,'condition'=>'user_group_id='.$eachUserGroup->id.' AND isActive="Y" AND show_in_partner="Y"'));
	  $section	.= '<section><div class="product_tabbox"><div class="product_tab_linkbox">'.$eachUserGroup->group_name. '</div>';
          foreach($productGroups as $eachProductGroup):
			if ($eachProductGroup->product_group_icon!='' && file_exists('media/product_group_images/'.$eachProductGroup->product_group_icon) /*&& !file_exists('media/product_group_images/200_1101'.$eachProductGroup->product_group_image)*/) 
			{
				$thumb=Yii::app()->phpThumb->create('media/product_group_images/'.$eachProductGroup->product_group_icon);
				$thumb->resize(200,110);
				$thumb->save('media/product_group_images/200_1101'.$eachProductGroup->product_group_icon);
			}
			$image	=	($eachProductGroup->product_group_icon!='')?'200_1101'.$eachProductGroup->product_group_icon:'noimage_dlink.png';
	 $section	.=	'
        <a href="'.Yii::app()->createUrl('site/productgroup',array('user_group_id'=>$eachProductGroup->user_group_id,'id'=>$eachProductGroup->id)).'">
        <div class="product_tabbox">
          <div class="product_outer">
            <div class="product_imgbox"> <img style="display: block;margin: auto;" src="'.Yii::app()->baseUrl.'/media/product_group_images/'.$image.'"  alt="'.$eachProductGroup->product_group_name.'" /></div>
            <div class="product_namebox">' .$eachProductGroup->product_group_name. '</div>
          </div>
        </div>
        </a>';
	  endforeach;  
	  $section	.= ' </div></section>';
	  endforeach; ?>
    </ul>
    <span id="indicator"></span> </nav>
  <div id="content"><?php echo $section; ?></div>
  <!--product Tab --> 
</div>
<script type="text/javascript">
	
		$(function() {			
			var indicator = $('#indicator'),
					indicatorHalfWidth = indicator.width()/2,
					lis = $('#tabs').children('li');
			$("#tabs").tabs("#content section", {
				effect: 'fade',
				fadeOutSpeed: 0,
				fadeInSpeed: 400,
				onBeforeClick: function(event, index) {
					var li = lis.eq(index),
					    newPos = li.position().left + (li.width()/2) - indicatorHalfWidth;
					indicator.stop(true).animate({ left: newPos }, 600, 'easeInOutExpo');
				}
			});
		});
	</script>