<?php  
  header("Content-type:text/html;charset=utf-8");
  include("/template/top.php");?>
<?php  
  $id = intval($_GET['id']);
  if(!$id){
    echo "<script>top.location.href='/mobile/login.php';</script>";exit();
  }  
  $sqlsc = "select * from  {$db_prefix}project where id = '".$id."'";
  $rssc = $db->get_one($sqlsc);  
  $Tzmoney = $rssc['qtje'];
  if(empty($Tzmoney)){
    echo "<script>javascript:alert('抱歉，你输入的数据有误');top.location.href='/mobile/projectlist.php?type=rt';</script>";exit();
  }
  //判断是否会员
  if($rssc['classid'] == 4 && $userConfig['level'] == 1 ){
      echo "<script>javascript:alert('您不是vip，不能访问vip专区');top.location.href='/mobile/projectlist.php?type=rt';</script>";exit();
  }
?> 
<script type="text/javascript" src="/mobile/public/Front/js/json-eps.js"></script> 
<script type="text/javascript" charset="utf-8" src="/mobile/public/Front/user/user.js"></script>
<script type="text/javascript" src="/mobile/public/Front/js/jquery-1.7.2.min.js"></script>
</head>
<body>
<?php  include("/template/menu.php");?>
<div class="tzlc">
  <!-- 未登录 -->
  <div class="tzlc-info clearfix">
    <div class="left">
      <h3><?php echo $rssc['title']; ?></h3>
      <p class="tzbz">由 <?php echo $rssc['bljg']; ?> 提供100%本金收益保障</p>
      <table border="0" cellspacing="0" cellpadding="0">
        <tr>
          <th>交易日化收益</th>
          <th>项目期限</th>
          <th>起投金额</th>
          <th>进度</th>
        </tr>
        <tr>
          <td class="td1"><?php echo $rssc['jyrsy'].'%'; ?><em>%</em></td>
          <td class="td2"><?php echo $rssc['shijian']; ?><em>天</em></td>
          <td class="td3"><?php echo $rssc['qtje']; ?><em>元</em></td>
          <td class="td4"><div id="tzjd"></div></td>
        </tr>
      </table>
      <div class="tzlc-note">
        <p>项目总金额：<span class="jine"><?php echo $rssc['xmgm'].'万元'; ?></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;最高金额：<span class="jine"><?php if($rssc['zgje'] == 0) echo '无限制'; else  echo $rssc['zgje'].'万元'; ?></span></p>
        <p><span class="tag">100%本金+分红</span></p>
      </div>
    </div>
    <?php if(!$_SESSION["glo_username"]){ ?>
    <div class="right">
      <h2 class="line1">可买金额</h2>
      <h2 class="line2"><?php echo $rssc['ktje']; ?><em>（元）</em></h2>
      <p class="loginline">
        <a href="/mobile/login.php" class="loginbtn">登录</a>
        <span>登录后可查看余额！</span>
      </p>
    </div>
    <?php }else{ ?>
    <div class="right">
      <h2 class="line1">账户余额</h2>
      <h2 class="line2"><?php echo $userConfig["amount"];?><em>（元）</em><a  target="_blank" href="/mobile/user/recharge.php">充值</a></h2>
      
      <?php
        if($rssc['tzzt'] == 1 ){
          //已售罄
          echo '<div class="trip">此项目已售罄!</div>';
        }else if($userConfig["amount"] < $rssc['qtje'] ){
          echo '<div class="trip">'."账户余额低于起投".$rssc['qtje']."金额，请先充值!".'</div>';
        }else{
      ?>
      <div class="wytz">
        <input type="hidden"value="<?php echo $id;?>" name="idPay" id="idPay" style="border:#9f9f9f solid 1px; width:128px; height:28px; line-height:28px;">
        <span><em>请填写投资金额</em><input name="amountPay" id="amountPay" type="text" /></span>
        <span><em>请填写交易密码</em><input type="password" name="passwordPay" id="passwordPay" /></span> 
        <p id="terr" style="color:red;"></p>
        <a onclick="javascript:nowToMoney();">立即投资</a>
      </div> <?php } ?>
    </div>
    <?php } ?>
  </div>
  <div class="tzlc-main">
    <div class="box">
      <h2>• 项目介绍</h2>
     <!--  <p>担保机构：<?php echo $rssc['bljg']; ?><br/>项目规模：<?php echo $rssc['xmgm'].'万元'; ?><br/>最低投资：<?php echo $rssc['qtje']; ?>元 （注：此项目限投壹次如有会员充值再投此项目系统将锁定您此项目的投资功能）</p> -->
      <p><?php echo $rssc['content']; ?></p>
    </div>
  </div>
</div>
<?php  include("/template/foot.php");?>
<script type="text/javascript">
window.onload = function(){
  var object = document.getElementById('tzjd')
    function loadImg (data){
      var i = 0;
      setInterval(function(){
        i++
        if(i>data){
          i=data
        }
        var imgLeft = -(i*44+(i*10))+'px'
        object.style.backgroundPosition = imgLeft+'\t'+'0px'
        object.innerHTML = i+'%';
      },50)
    }
  loadImg(<?php echo intval($rssc['xmjd']); ?>)
}
</script>
<script>
$("#amountPay").blur(function(){
  var amountPayc = $("#amountPay").val();
  var touzMc     = $("#qtje").val();
   if(amountPayc == '' && amountPayc == 0 ){
       $("#terr").html("请输入投资金额");
      return false;
   }
 
   if(amountPayc < <?php echo $Tzmoney; ?>){
      $("#terr").html("你输入的小于起投金额");
       return false;
  }
  $("#terr").html("");
});
</script>
  <script src="/mobile/public/Front/js/index.js"></script>
</body>
</html>
