<script language="javascript">
		$(document).ready(function() {
			$("#gallery_output img").not(":first").hide();
			$("#gallery a").click(function() {
				if ( $("#" + this.rel).is(":hidden") ) {
					$("#gallery_output img").slideUp();
					$("#" + this.rel).slideDown();
				}
			});
		});
</script>
<style>
#gallery img {
	border: none;
}
#gallery_nav {
	float: left;
	width: 150px;
	text-align: center;
}
#gallery_output {
	float: left;
	width: 500px;
	height: 350px;
	overflow: hidden;
}
#gallery_output img {
	display: block;
	margin: 20px auto 0 auto;
}
</style>
<div id="sub_menu"> 
		<a href="<?php echo Yii::app()->createUrl('site/index'); ?>">Home </a> 
        <?php
		$usergroup	=	UserGroup::model()->findByPK($model->user_group_id)->group_name;
		$product_group	=	ProductGroup::model()->findByPK($model->product_group_id)->product_group_name;
		if($usergroup!=null)
		echo '&nbsp;&nbsp; <img width="9" height="10" src="'.Yii::app()->baseUrl.'/images/front/1/submenu_13.jpg">&nbsp;&nbsp;&nbsp <a href="#">'.$usergroup.'</a>';
		if($product_group!=null)
		echo ' &nbsp;&nbsp; <img width="9" height="10" src="'.Yii::app()->baseUrl.'/images/front/1/submenu_13.jpg">&nbsp;&nbsp;&nbsp  <a href="'.Yii::app()->createUrl('site/productgroup',array('user_group_id'=>$model->user_group_id,'id'=>$model->product_group_id)).'">'.$product_group.'</a>';
		echo ' &nbsp;&nbsp; <img width="9" height="10" src="'.Yii::app()->baseUrl.'/images/front/1/submenu_13.jpg">&nbsp;&nbsp;&nbsp  '.$model->product_name; 
		?>
        </a> 

</div>
<div id="content">
  <div id="business_solution_leftcontent">
    <?php $this->renderPartial('productgroup_left_menu');  ?>
    <?php $this->renderPartial('pages/leftcontent'); ?>
  </div>
  <div id="overview_rightcontent">
    <div id="business_solution_subheadding"> <h3><?php echo $model->product_generic_name; ?> </h3><h2> <?php echo $model->product_name; ?></h2> </div>
    <div id="product_promotion_box">
      <div id="promotion_product_details"> <br />
        <div id="product_box2">
          <div id="gallery" style="border:1px #ccc solid;border-radius:10px;">
            <div id="gallery_nav"> <a rel="img99" href="javascript:;">
             <?php
				if (!file_exists('media/product_images/thumbs/110_90'.$model->product_image)) 
				{
					$thumb=Yii::app()->phpThumb->create('media/product_images/'.$model->product_image);
					$thumb->resize(180,170);
					$thumb->save('media/product_images/thumbs/110_90'.$model->product_image);
				}
			?>
            <img src="<?php echo Yii::app()->baseUrl; ?>/media/product_images/thumbs/110_90<?php echo $model->product_image; ?>" /></a>
              <?php foreach ($modelProductImages as $i=>$eachImage): ?>
              <?php
				if (!file_exists('media/product_images/thumbs/110_90'.$eachImage->product_image)) 
				{
					$thumb=Yii::app()->phpThumb->create('media/product_images/'.$eachImage->product_image);
					$thumb->resize(180,170);
					$thumb->save('media/product_images/thumbs/110_90'.$eachImage->product_image);
				}
			  ?>
              <a rel="img<?php echo $i; ?>" href="javascript:;"><img src="<?php echo Yii::app()->baseUrl; ?>/media/product_images/thumbs/110_90<?php echo $eachImage->product_image; ?>" /></a>
              <?php endforeach; ?>
            </div>
            <div id="gallery_output"> <img id="img99" src="<?php echo Yii::app()->baseUrl; ?>/media/product_images/image_resized/<?php echo $model->product_image; ?>" />
              <?php foreach ($modelProductImages as $i=>$eachImage): ?>
              <img id="img<?php echo $i; ?>" src="<?php echo Yii::app()->baseUrl; ?>/media/product_images/image_resized/<?php echo $eachImage->product_image; ?>" />
              <?php endforeach; ?>
            </div>
            <div class="clear"></div>
          </div>
        </div>
        <div id="product_specification">
          <div id="tab_wrap"> 
          <a href="javascript:navigate_tabs('a','first-tab');" class="buttons" id="first-tab"  <?php if($model->overview=='') echo 'style="display:none !important;"'; ?>>Overview</a> 
          <a href="javascript:navigate_tabs('b','second-tab');" class="buttons" id="second-tab"  <?php if(count($modelProductFeatureRelation)==0) echo 'style="display:none !important;"'; ?>>Features</a> 
          <a href="javascript:navigate_tabs('c','third-tab');" class="buttons" id="third-tab"  <?php if($model->specifications=='') echo 'style="display:none !important;"'; ?>>Specifications</a>
            <a href="javascript:navigate_tabs('d','fourth-tab');" class="buttons" id="fourth-tab"  <?php if(count($downloadbles)==0) echo 'style="display:none !important;"'; ?>>Downloads</a> <br clear="all" />
            <div id="tab_body" align="center">
              <div class="a"> <?php echo $model->overview; ?> </div>
              <div class="b">
                <?php foreach($modelProductFeatureRelation as $eachFeature): if($eachFeature->feature_value!=''): ?>
                <strong><?php echo @$eachFeature->feature->feature_name; ?></strong><br />
                <br />
                &nbsp;&nbsp;&nbsp; <?php echo $eachFeature->feature_value; ?> <br />
                <br />
                <?php endif; endforeach; ?>
              </div>
              <div class="c"> <?php echo $model->specifications; ?> </div>
              <div class="d" style="display:none;">
              
              <?php foreach($downloadbles as $eachDownloadable): ?>
                <table width="650" cellspacing="2" cellpadding="5" border="0">
                  <tbody>
                    <tr>
                      <td><h1 style="color: #666666;"><?php echo $eachDownloadable['downloadbal_title']; ?></h1></td>
                    </tr>
                    <tr>
                      <td><table width="100%" cellspacing="1" cellpadding="5" bordercolor="#999999" border="0" style="line-height:20px; padding:5px">
                          <tbody>
                            <tr>
                              <td width="10%" bgcolor="#999999">&nbsp;</td>
                              <td width="30%" bgcolor="#999999" align="center"><strong>Description</strong></td>
                              <td width="15%" bgcolor="#999999" align="center"><strong>Type</strong></td>
                              <td width="10%" bgcolor="#999999" align="center"><strong>File Size</strong></td>
                              <td width="35%" bgcolor="#999999">&nbsp;</td>
                            </tr>
                            <?php foreach($eachDownloadable['item_value'] as $i=>$eachValue): ?>
                            <tr>
                              <td valign="middle" bgcolor="#CCCCCC" align="center"><?php echo $i+1; ?><br>
                                <br></td>
                              <td bgcolor="#CCCCCC" align="center"><?php echo $eachValue; ?></td>
                              <td bgcolor="#CCCCCC" align="center"><?php
							 echo  strtoupper(pathinfo(Yii::app()->basePath."/../media/product_item_downloadables/".$eachDownloadable['files_available'][$i], PATHINFO_EXTENSION));
							    ?></td>
                              <td bgcolor="#CCCCCC" align="center"><?php echo round(@filesize(Yii::app()->basePath."/../media/product_item_downloadables/".$eachDownloadable['files_available'][$i])/1000000,2);?>mb</td>
                              <td valign="middle" bgcolor="#CCCCCC" align="center"><a target="_blank" href="<?php echo Yii::app()->request->getBaseUrl(true).'/media/product_item_downloadables/'.$eachDownloadable['files_available'][$i]; ?>"><img width="30" height="30" src="<?php echo Yii::app()->baseUrl; ?>/images/front/1/Download-icon.png"></a></td>
                            </tr>
                            <?php endforeach; ?>
                          </tbody>
                        </table></td>
                    </tr>
                  </tbody>
                </table>
              <?php endforeach; ?>
                
                
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
