<?php 
  $SqlSpecifications = "SELECT * FROM specifications WHERE pid=" . $_REQUEST['id'];

  $SqlImages = "SELECT * FROM productimages WHERE pid=" . $_REQUEST['id'];

  $SqlReviews = "SELECT * FROM reviews WHERE pid=" . $_REQUEST['id'] . " ORDER BY id DESC";

?>
<section id="product">

      <!-- Product Details-->
      <div class="row">
        <div class="span5">

          <ul class="thumbnails mainimage">

          <?php
            foreach ($db->query($SqlImages) as $rowimg) {
          ?>
            <li class="span5">
              <a  rel="position: 'inside' , showTitle: false, adjustX:-4, adjustY:-4" class="thumbnail cloud-zoom" href="images/products/<?php echo $rowimg['pimage']; ?>">
                <img alt="" src="images/products/<?php echo $rowimg['pimage']; ?>">
              </a>
            </li>
            <?php } ?>
       
          </ul>
           
          <ul class="thumbnails mainimage">

          <?php
            foreach ($db->query($SqlImages) as $rowthumb) {
          ?>
           <li class="producthtumb">
              <a href="#"><span><span><img style="width=240px; height=240px;" src="images/products/<?php echo $rowthumb['pimage']; ?>" alt=""></span></span> </a>
            </li>
            <?php } ?>

          </ul>
          
        </div>
        <div class="span7">
          <div class="row">
            <div class="span7">
              <h1 class="productname"><?php echo $rowProduct['ptitle']; ?></h1>
              <div class="productprice">
                <div class="proldprice"><?php echo $rowSettings['csymbol']; ?><?php echo number_format($rowProduct['oldprice'],2); ?></div>
                <div class="prnewprice span2 margin-none"><?php echo $rowSettings['csymbol']; ?><?php echo number_format($rowProduct['nprice'],2); ?></div>
                <div class="pull-right"><span class="label label-success"><?php echo $rowLang['lang50'];?>:</span> <?php echo $rowProduct['availability']; ?> <?php echo $rowLang['lang51'];?></div>
              </div>
              <p></p>
              <div class="productdesc">

                <ul class="nav nav-tabs" id="myTab">
                  <li class="active"><a href="#description"><?php echo $rowLang['lang46'];?></a></li>
                  <li><a href="#specification"><?php echo $rowLang['lang47'];?></a></li>
                  <li><a href="#review"><?php echo $rowLang['lang48'];?></a></li>
                </ul>

                <div class="tab-content">
                  <div class="tab-pane active" id="description">
                    <?php echo $rowProduct['pdescription']; ?>
                  </div>
                  <div class="tab-pane " id="specification">
                    <ul class="productinfo">

                      <?php
                      foreach ($db->query($SqlSpecifications) as $rowSp) {
                      ?>
                      <li>
                        <span class="productinfoleft"><?php echo $rowSp['speci']; ?>:</span> <?php echo $rowSp['pvalue']; ?> </li>
                      <?php } ?>

                    </ul>
                  </div>

                  <div class="tab-pane" id="review">

                    <ul class="reveiw">
                      <?php
                        foreach ($db->query($SqlReviews) as $rowReview) {
                      ?>
                      <li>
                        <h4 class="title"><?php echo $rowReview['rtitle']; ?> <span class="date"><i class="icon-calendar"></i> <?php echo $rowReview['rdate']; ?> </span></h4>
                        <ul class="rate">
                          <li class="<?php echo $rowReview['rrate']>=1 ? "on" : "off"; ?>"></li>
                          <li class="<?php echo $rowReview['rrate']>=2 ? "on" : "off"; ?>"></li>
                          <li class="<?php echo $rowReview['rrate']>=3 ? "on" : "off"; ?>"></li>
                          <li class="<?php echo $rowReview['rrate']>=4 ? "on" : "off"; ?>"></li>
                          <li class="<?php echo $rowReview['rrate']>=5 ? "on" : "off"; ?>"></li>
                        </ul>
                        <span class="reveiwdetails"> <?php echo $rowReview['rdesc']; ?></span>
                      </li>
                      <?php } ?>

                    </ul>

                    <h3><?php echo $rowLang['lang54'];?></h3>
                    <form class="form-vertical" action="functions/addreview.php?pid=<?php echo $rowProduct['id']; ?>" method="POST">
                      <fieldset>
                        <div class="control-group">
                          <label class="control-label"><?php echo $rowLang['lang55'];?></label>
                          <div class="controls">
                            <input name="rtitle" type="text" class="span3">
                          </div>
                        </div>
                        <div class="control-group">
                          <label class="control-label"><?php echo $rowLang['lang56'];?></label>
                          <div class="controls">
                            <select name="rrate">
                              <option value="1">1</option>
                              <option value="2">2</option>
                              <option value="3">3</option>
                              <option value="4">4</option>
                              <option value="5" selected>5</option>
                            </select>
                          </div>
                        </div>
                        <div class="control-group">
                          <label class="control-label"><?php echo $rowLang['lang46'];?></label>
                          <div class="controls">
                            <textarea name="rdesc" rows="3"  class="span3"></textarea>
                          </div>
                        </div>
                      </fieldset>
                      <input type="submit" class="btn btn-success" value="<?php echo $rowLang['lang53'];?>">
                    </form>
                  </div>


                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      
      <!-- Product Description tab & comments-->
      
    </div>
  </section>