<?php

require_once 'includes/Mcrypt3Des.php';
$shareicon = ''; // 分享图片
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$weixin=strpos($user_agent, 'MicroMessenger');
$h5_page=$_G['ppp']-1;
$postarr = array();
foreach($postlist as $key => $post) {
    if($post['first']) {
		$shareicon = getshareicon($post['message']);
        $post['message'] = odz_format_message($post['message']);
        $message = str_replace('size=', '', $post['message']);
        // $post['message'] =preg_replace("/<(\/?br.*?)>/si","",$message); //过滤br标签
        $post['message'] =preg_replace('/(<\/?br.*?>\s\D)+/i', '<br>', $message); //过滤br标签
        $postarr = $post;
        unset($postlist[$key]);
        break;
    }
}

$maingroup = $_G['group'];
if(array_key_exists('videolist', $postarr) && $postarr['videolist']) {
    foreach($postarr['videolist'] as $videourl) {

        if(preg_match('/http:\/\/v\.youku\.com\/v_show\/id_(\S+)\.html/i', $videourl, $match)) {
            $postarr['message'] .= '<div class="videoCon"><iframe src="http://player.youku.com/embed/'.$match[1].'" width="240" height="136" frameborder="0"></iframe></div>';
            continue;
        }
        if(preg_match('/static\.video\.qq\.com\/TPout\.swf\?vid=(\S+)\&auto=0/', $videourl, $match2)) {
            $postarr['message'].='<div class="videoCon"><iframe src="http://static.video.qq.com/TPout.swf?vid='.$match2[1].'&auto=0" width="240" height="136" frameborder="0"></iframe></div>';
            continue;
        }
        if(preg_match('/player\.ku6.com\/refer\/(([a-z]|[A-Z]|[0-9])+)\.\.\/v\.swf/', $videourl, $match)) {
            $postarr['message'].= '<video style="display:block;margin: 0px auto; padding: 0px; background-color: black; width: 240px; height: 136px; z-index: 1;" preload="meta" src="http://v.ku6.com/fetchwebm/'.$match[1].'...m3u8" controls="" poster="">';
            continue;
        }
    }
}
  
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET ?>">
       <meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
        <title><?php echo $_G['forum_thread']['subject']; ?></title>
        <link rel="stylesheet" type="text/css" href="assets/css/mods.css?hash=201504021811445">
        <script type="text/javascript" src="assets/js/jquery-1.8.3.min.js"></script>
        <script type="text/javascript" src="assets/js/commondz.js"></script>
        <script type="text/javascript" src="assets/js/artDialog.js"></script>
        <script type="text/javascript" src="assets/js/iframeTools.source.js"></script>
        <script type="text/javascript" src="../data/cache/common_smilies_var.js"></script>
        <link rel="stylesheet" type="text/css" href="assets/css/aero.css">
        <link rel="stylesheet" type="text/css" href="assets/css/activity.css?ver=4454">
        <style type="text/css">
        .downapp {position: fixed;/*left:50%;margin-left: -320px;*/bottom:0px;}
        .downapp span {width: 50px;height: 50px;display: block;position: absolute;right:0px;top:0px;}
        .dh-option-table{table-layout: auto;width: 100%;border-collapse:collapse;margin:10px 2px;}
        .dh-option-table thead{background-color: #F0F0F0;font-weight: bold;line-height: 28px;font-size: 14px}
        .dh-option-table td{border:1px solid #eee;border-collapse:collapse;table-layout:fixed;padding: 5px}
        .dh-option-table .option-label{width: 80px}
        .bbs-feed-list .desc{ font-size: 16px; line-height: 1.6; padding-left: 20px;}
        /*#report-btn{display: inline-block;background-color: #FF9900 ;padding: 1px;color: #fff;margin-right:2px;}*/
        #report-btn{display: inline-block; ;padding: 1px; margin-right:-7px; color: #ff0000;font-size: 16px;}
        .html-data img { height: auto; }
        .bbs-feed-count a.replypost { color: #ff6600; }
        .videoCon { width: 240px; height: 136px; margin: 10px auto; }
        .quote { background-color: #f7f7f7; padding: 5px;font-size: 12px; margin-bottom: 5px; color: #666666; }
        .quote blockquote { margin: 5px 15px; }
        .itm_height{width: 100%;height:230px;}
        .report{
        z-index:1000;
        position:fixed;
        bottom:0px;
        left:0px;
        }
        .hd-s img {max-width:100%;height:auto;}
        /*表格信息*/
        .html-data table{width: 100%;font-size: 14px;}
        .html-data table tr td{padding: 6px 5px 6px 5px !important;}
        .html-data table caption{background: #FAFAFA;padding: 6px 5px 6px 5px !important;font-weight: bold;text-align: left;border:1px solid #EEEEEE;}
        .html-data table tr td{border-bottom:1px solid #C2D5E3;padding: 6px 5px 6px 5px !important;}
        .html-data table tr td.textname{border-bottom:1px solid #EEEEEE;border-left:1px solid #EEEEEE;border-right:1px solid #EEEEEE;color:#B0B0B0;width: 26%}
        .html-data table tr td.textvalue{border-bottom:1px solid #EEEEEE;border-right:1px solid #EEEEEE;color:#6F6F6F;}
        .join_show{width: 90%;margin: 0px auto;position: absolute;background-color: #fff;border-radius: 5px;z-index: 2000;left: 0px;top: 0px;display: none;}
        .join_show h4{padding: 8px 0px 8px 15px;}
        .join_pop{ border-top: solid 1px #E4E4E4;}
        .join_pop .ipt{background-color: #fff; margin-bottom: 15px;}
        .join_pop .ipt > div{margin-left: 10px; border-bottom: solid 1px #EEEEEE;padding: 15px 0px 15px 5px;}
        .join_pop .ipt p{margin-left: 10px; border-bottom: solid 1px #EEEEEE;padding: 15px 0px 15px 5px;}
        .join_pop .ipt .sn{color: #959595; width: 63px;display: block;float: left;}
        /*输入框*/
        .join_pop .ipt input{ margin-left: 10px;font-size: 14px; width:60%;border:1px solid #979797;}
        /*提交*/
        .join_pop  .sub{width: 30%;border-radius: 5px;background-color: #42A8EC; color: #fff;font-size: 20px;text-align: center;padding: 10px 0px 10px 0px;display: block;-webkit-appearance: none; float: left;}
        .jremarks{border: 1px solid #979797;}
        .jabolish{background-color: #42A8EC;color: #fff;font-size: 15px;text-align: center;padding: 5px 17px 5px 17px;border-radius: 5px;display: block;float: left;margin-right: 15px;}
        .jit{margin-left: 10px;}
        .join_b{overflow: hidden;float: right;margin-bottom: 15px;}
        .disabled{background: #B9B4B4;border-color:#908E8E;color: #7E7E7E}
        </style>
		<script type="text/javascript">
            var smiley_search = <?php echo make_smilie_json();?>;
        </script>
</head>
<body>
    <div class="shade"></div>
    <div class="subshade"></div>
    <div class="mobile-wrap" id="mobile-wrap">
        <div class="bbs-cv-hd">
            <h1><?php echo $_G['forum_thread']['subject']; ?></h1>
            <div class="btm">
                <span class="btm-type"><?php echo $_G['forum']['name']?></span>
                <span class="btm-ico btm-ico-reads"><?php echo $_G['forum_thread']['views']; ?></span>
            </div>               
        </div>
        <div class="bbs-cv-main">
            <div class="bbs-cv-info">
                <a href="javascript:void(0);"   onclick="lbsPerson(<?php echo $_G['forum_thread']['authorid']; ?>)"    class="user-hd">
                    <?php echo $postarr['avatar']; ?>
                </a>
                <div class="user-txt">
                    <a href="javascript:void(0);"  onclick="lbsPerson(<?php echo $_G['forum_thread']['authorid']; ?>)"   class="user-txt-name"><?php echo $_G['forum_thread']['author']; ?></a>
                    <p><?php echo $postarr['authortitle']; ?></p>
                </div>
                <div class="user-type">
                    <p><?php echo h5_showstars($_G['cache']['usergroups'][$postarr['groupid']]['stars']);?></p>
                    <span><?php echo $postarr['dateline']; ?></span>
                </div>
            </div>
            <!-- xj_event插件活动表格STSRT -->
            <?php if(in_array('xj_event', $_G['setting']['plugins']['available'])) { ?>
                <?php if($items['postclass'] == 1) {?>
                <div class="html-data hd-s">
                    <?php if($imgurl) {?>
                        <div><img src="<?php echo $_G['baseurl'].$imgurl;?>"></div><br>
                    <?php } ?>
                    <table cellspacing="0" style="margin-bottom: 15px;">
                        <tbody>
                            <tr>
                                <td class="textname" style="border-top:1px solid #EEEEEE;">活动方式</td>
                                <td class="textvalue" style="border-top:1px solid #EEEEEE;"><?php echo $postclass; ?></td>
                            </tr>
                            <tr>
                                <td class="textname">活动类型</td>
                                <td class="textvalue"><?php echo $eventclass[1]; ?></td>
                            </tr>
                            <tr>
                                <td class="textname">活动地区</td>
                                <td class="textvalue"><?php echo $citys; ?></td>
                            </tr>
                            <tr>
                                <td class="textname">开始时间</td>
                                <td class="textvalue"><?php echo $starttime; ?></td>
                            </tr>
                            <tr>
                                <td class="textname">结束时间</td>
                                <td class="textvalue"><?php echo $endtime; ?></td>
                            </tr>
                            <tr>
                                <td class="textname">活动地点</td>
                                <td class="textvalue"><?php echo $items['event_address']; ?></td>
                            </tr>
                            <tr>
                                <td class="textname">活动管理</td>
                                <td class="textvalue"><?php echo $event_adminlist; ?></td>
                            </tr>
                            <?php if($items['use_extcredits_num']>0) {?>
                            <tr>
                                <td class="textname">活动方式</td>
                                <td class="textvalue"><?php echo $postclass; ?></td>
                            </tr>
                            <?php } ?>
                            <tr>
                                <td class="textname">参加名额</td>
                                <td class="textvalue"><?php if($items['event_number']==0) {echo $postclass;} else {echo $items['event_number'].'人';} ?></td>
                            </tr>
                            <tr>
                                <td class="textname">报名人数</td>
                                <td class="textvalue"><?php echo $applycountnumber.'人 待审核'.' '.$applycountnumberd.'人'; ?></td>
                            </tr>
                            <tr>
                                <td class="textname">参加费用</td>
                                <td class="textvalue">
                                    <?php 
                                        if($setting['eventaa']) {
                                            echo 'AA ';
                                            if($items['use_cost']>0) {
                                                echo $items['use_cost'].'元左右';
                                            }
                                        } else {
                                            echo $items['use_cost'].'元';
                                        }
                                     ?>
                                </td>
                            </tr>
                            <tr>
                                <td class="textname">报名截止</td>
                                <td class="textvalue"><?php echo $activityexpiration; ?></td>
                            </tr>

                        </tbody>
                    </table>
                </div>
                <?php } elseif ($items['postclass'] == 2) {?>
                <div class="html-data hd-s">
                    <?php if($imgurl) {?>
                        <div><img src="<?php echo $_G['baseurl'].$imgurl;?>"></div><br>
                    <?php } ?>
                    <table cellspacing="0" style="margin-bottom: 15px;">
                        <tbody>
                            <tr>
                                <td class="textname" style="border-top:1px solid #EEEEEE;">活动方式</td>
                                <td class="textvalue" style="border-top:1px solid #EEEEEE;"><?php echo $postclass; ?></td>
                            </tr>
                            <tr>
                                <td class="textname">活动类型</td>
                                <td class="textvalue"><?php echo $eventclass[1]; ?></td>
                            </tr>
                            <tr>
                                <td class="textname">开始时间</td>
                                <td class="textvalue"><?php echo $starttime; ?></td>
                            </tr>
                            <tr>
                                <td class="textname">结束时间</td>
                                <td class="textvalue"><?php echo $endtime; ?></td>
                            </tr>
                            <tr>
                                <td class="textname">活动地区</td>
                                <td class="textvalue"><?php echo $citys; ?></td>
                            </tr>
                            <tr>
                                <td class="textname">参与积分</td>
                                <td class="textvalue"><?php echo $items['use_extcredits_num'].' '.$extcredit_title; ?></td>
                            </tr>
                            <tr>
                                <td class="textname">参加人数</td>
                                <td class="textvalue">
                                    <?php  
                                        if($items['event_number']==0) {
                                            echo '不限';
                                        } else {
                                            echo $items['event_number'].' 人';
                                        }
                                    ?>
                                </td>
                            </tr>
                            <tr>
                                <td class="textname">报名人数</td>
                                <td class="textvalue"><?php echo $applycountnumber.' 人 待审核 '.$applycountnumberd.' 人'; ?></td>
                            </tr>
                            <tr>
                                <td class="textname">参加费用</td>
                                <td class="textvalue"><?php echo $items['use_cost'].'元';?></td>
                            </tr>
                            <tr>
                                <td class="textname">报名截止</td>
                                <td class="textvalue"><?php echo $activityexpiration;?></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <?php } ?>
                <?php  
                    if($timestamp<($items['endtime']+2592000)) {
                        if($items['activityexpiration']<=$timestamp and $verify==null) {
                            echo '<a href="javascript:void(0);" class="sign-up disabled">报名截止</a>';
                        } else {
                            if(!$_G['uid']){
                                echo '<a href="javascript:void(0);" class="sign-up disabled">我要参加(请登录)</a>';
                            } else {
                                if($items['activitybegin']<$timestamp and $items['activityexpiration']>$timestamp and $verify==null) {
                                    if(!$setting['invitation']['open'] || ($setting['invitation']['open'] && $setting['invitation']['code'] == $_GET['icode'])) {
                                        echo '<a href="javascript:void(0);" class="sign-up event-go">我要参加</a>';
                                    }
                                } elseif($items['activitybegin']>$timestamp and $verify==null) {
                                    echo '<p>报名还未开始</p>';
                                } else {
                                    if($setting['noverify']==0 && $items['activityexpiration']>$timestamp) {
                                        echo '<a href="javascript:void(0);" class="sign-up quxiao">取消报名</a>';
                                    }
                                }
                            }

                        }
                    } 
                ?>
            <?php } ?>
            <!-- xj_event插件活动表格END -->
            <!-- 表格信息START -->
            <?php if ($threadsort && $threadsortshow && $threadsortshow['optionlist'] && $threadsortshow['optionlist'] != 'expire') {?>
            <div class="html-data hd-s">
                <table cellspacing="0">
                    <caption><?php echo  $_G['forum']['threadsorts']['types'][$_G['forum_thread']['sortid']]?></caption>
                        <tbody>
                            <?php foreach($threadsortshow['optionlist'] as $option) { ?>
                                <?php if ($option['type'] != 'info') { ?>
                                    <tr>
                                        <td class="textname"><?php echo $option['title'];?></td>
                                        <td class="textvalue">
                                            <?php echo $option['value'] !== '' ? $option['value'].' '.$option['unit'] : '-'; ?>
                                        </td>
                                    </tr>
                                <?php } ?>
                            <?php } ?>
                        </tbody>
                </table>
            </div>
            <?php } ?>
            <!-- 表格信息END -->
            <div class="html-data hd-s ">
                <?php echo $postarr['message'];?>
                <!-- 活动 START -->
                <?php if($_G['forum_thread']['special'] == 4) { ?>
                    <?php if($activity['thumb']) {?>
                    <div><img src="<?php echo $_G['baseurl'].$activity['thumb'];?>"></div>
                    <?php } ?>
                    <div class="regmain">
                        <!-- <p class="take-number" style="display:none;">已有37人参与。<a href="javascript:void(0);">查看报名名单</a></p> -->
                        <ul class="activity-list">
                            <li>
                                <span class="ac-adress"><?php echo lang('forum/template', 'activity_space'); ?></span>
                                <span class="content"><?php echo $activity['place']; ?></span>
                            </li>
                            <li>
                                <span class="ac-adress"><?php echo lang('forum/template', 'activity_starttime'); ?></span>
                                <span class="content">     
                                    <?php if($activity['starttimeto']) {
                                        echo odz_lang('activity_start_between', array('starttimefrom'=>$activity['starttimefrom'], 'starttimeto'=>$activity['starttimeto']));
                                    } else {
                                        echo $activity[starttimefrom];
                                    } ?>
                                </span>
                            </li>
                            <li>
                                <span class="ac-adress"><?php echo lang('forum/template', 'activity_type'); ?> </span>
                                <span class="content"><?php echo $activity['class']; ?></span>
                            </li>
                            <?php  if(!$_G['forum_thread']['is_archived']) {?>
                            <li>
                                <span class="ac-adress"><?php echo lang('forum/template', 'activity_already'); ?></span>
                                <span class="content"><?php echo $allapplynum.lang('forum/template', 'activity_member_unit');?></span>
                            </li>
                            <?php } ?>
                            <li>
                                <span class="ac-adress"><?php echo lang('forum/template', 'gender');?></span>
                                <span class="content">
                                    <?php if($activity['gender'] == 1) {
                                        echo lang('forum/template', 'male');
                                    } elseif ($activity['gender'] == 2) {
                                        echo lang('forum/template', 'female');
                                    } else{
                                        echo lang('forum/template', 'unlimited');
                                    }?>
                                </span>
                            </li>
                            <?php if($activity['cost']) { ?>
                                <li>
                                    <span class="ac-adress"><?php echo lang('forum/template', 'activity_payment'); ?></span>
                                    <span class="content"><?php echo $activity[cost].lang('forum/template', 'payment_unit');?></span>
                                </li>
                            <?php } ?>  
                            <?php if($activity['number']) { ?>
                                <li>
                                    <span class="ac-adress"><?php echo lang('forum/template', 'activity_about_member'); ?></span>
                                    <span class="content"><?php echo $aboutmembers.lang('forum/template', 'activity_member_unit');?></span>
                                </li>
                            <?php } ?>
                            <?php if($activity['expiration']) { ?>
                                <li>
                                    <span class="ac-adress"><?php echo lang('forum/template', 'post_closing'); ?></span>
                                    <span class="content"><?php echo $activity[expiration];?></span>
                                </li>
                            <?php } ?>
                        </ul>
                        <?php if($_G['uid'] && !$activityclose && (!$applied || $isverified == 2)) {?>
                            <a href="javascript:void(0);" class="sign-up baoming">我要报名</a>
                        <?php } elseif($_G['uid'] && !$activityclose && $applied) {?>
                            <a href="javascript:void(0);" class="sign-up baoming">取消报名</a>
                        <?php } ?>
                    </div>
                <?php } ?>
                <!-- 活动 END -->
                <!-- 投票 START -->
                <?php if ($_G['forum_thread']['special'] == 1) { ?>
                    <p class="take-number">
                        <?php 
                            if($multiple) {
                                echo lang('forum/template', 'poll_multiple').lang('forum/template', 'thread_poll');
                                if($maxchoices) {
                                    echo "（ ".odz_lang('poll_more_than', array('maxchoices'=>$maxchoices))."）";
                                }
                            } else {
                                echo lang('forum/template', 'poll_single').lang('forum/template', 'thread_poll');
                            }
                            if($visiblepoll && $_G['group']['allowvote']) {
                                echo ' , '.lang('forum/template', 'poll_after_result');
                            }
                            echo ' , '.odz_lang('poll_voterscount', array('voterscount'=>'<span class="allVote">'.$voterscount.'</span>'));
                            if(!$visiblepoll && ($overt || $_G['adminid'] == 1 || $thread['authorid'] == $_G['uid']) && $post['invisible'] == 0) {
                                echo '<a href="javascript:viod(0)" id="showpoll">'.lang('forum/template', 'poll_view_voters').'</a>';
                            }
                        ?>
                    </p>
                    <?php if($_G['forum_thread']['remaintime']) { ?>
                        <p>
                            <?php
                                echo lang('forum/template', 'poll_count_down');
                                if($_G['forum_thread']['remaintime'][0]) {
                                    echo $_G['forum_thread']['remaintime'][0].lang('forum/template', 'days');
                                }
                                if($_G['forum_thread']['remaintime'][1]) {
                                    echo $_G['forum_thread']['remaintime'][1].lang('forum/template', 'poll_hour');
                                }
                                echo $_G['forum_thread']['remaintime'][2].lang('forum/template', 'poll_minute');
                            ?>
                        </p>
                    <?php } elseif ($expiration && $expirations < TIMESTAMP) { ?>
                        <p><?php echo lang('forum/template', 'poll_end'); ?></p>
                    <?php }?> 
                    <?php if($isimagepoll) { //图片投票?> 
                    <div class="regmain">
                        <ul class="poll-list">
                            <?php foreach ($polloptions as $key => $row) { ?>
                                <li>
                                    <img src="<?php echo $_G['siteurl'].'../'.$row['imginfo']['big'] ?>" alt="" class="textimg">
                                    <span class="poll-bot">
                                      <span class="progress">
                                          <span class="v-sp1"><?php echo $row['votes']; ?></span>
                                          <span class="v-sp2">(<?php echo $row[
                                          'percent']; ?>%)</span>
                                          <div class="bc" style="width:<?php echo $row['width']; ?>"></div>
                                      </span>
                                    </span>
                                    <p data="<?php echo $row['polloptionid']; ?>">
                                        <?php if($_G['group']['allowvote']) { ?>
                                            <?php if($maxchoices) {?>
                                                <input type="checkbox" value="<?php echo $row['polloptionid'];?>" class="vote-check" >
                                            <?php } else {?>
                                                <a href="javascript:void(0);" class="v-hide"><img src="<?php echo $_G['siteurl'] ?>assets/images/noselect.png" alt=""></a>
                                            <?php } ?>
                                        <?php } ?>
                                        <?php echo $row['polloption']; ?>
                                    </p>
                                </li>
                            <?php } ?>
                        </ul>
                        <?php if($_G['group']['allowvote'] && !$_G['forum_thread']['is_archived']) { ?>
                            <a href="javascript:void(0);" class="sign-up v-hide signimg">投票</a>
                        <?php } ?>
                    </div>
                    <?php } else { // 文字投票?>
                    <div class="vPage">
                        <ul class="v-list">
                            <?php foreach ($polloptions as $key => $row) { ?>
                                <li>
                                    <?php if($_G['group']['allowvote']) { ?>
                                        <?php if(!$maxchoices) { ?>
                                            <a href="javascript:void(0)" class="them toupiao v-hide" data="<?php echo $row['polloptionid']; ?>"><img src="<?php echo $_G['siteurl'] ?>assets/images/noselect.png" alt="" ></a>
                                        <?php } else { ?>
                                            <input type="checkbox" value="<?php echo $row['polloptionid']; ?>" class="vote-check vote-margin" >
                                        <?php } ?>
                                    <?php } ?>
                                    <div class="v-list-left">
                                        <span class="v-list-left-title"><?php echo $row['polloption'] ?></span>
                                        <div class="bc" style="width:<?php echo $row['width']; ?>"></div>
                                        <div class="v-sp">
                                        <span class="poll"><?php echo $row['votes']; ?></span>
                                        (<?php echo $row['percent']; ?>%)
                                        </div>
                                    </div>
                                </li>
                            <?php } ?>
                        </ul>
                        <?php if($_G['group']['allowvote'] && !$_G['forum_thread']['is_archived']) { ?>
                            <a href="javascript:void(0)" class="sign-up v-hide signtext" >投票</a>
                        <?php } ?>
                    </div>
                    <?php } ?>
                    <?php
                     if($_G['group']['allowvote'] && !$_G['forum_thread']['is_archived']) { ?>
                        <?php if($overt) { echo lang('forum/template', 'poll_msg_overt');}?>
                    <?php } elseif(!$allwvoteusergroup) {
                        echo lang('forum/template', 'poll_msg_allwvoteusergroup');
                    } elseif(!$allowvotepolled) {
                        echo lang('forum/template', 'poll_msg_allowvotepolled');
                    } elseif(!$allowvotethread) {
                        echo lang('forum/template', 'poll_msg_allowvotethread');
                    }
                    ?>
                <?php } ?>
                <!-- 投票 END -->
                <?php 
                    $operation_edit = ($_G['forum']['ismoderator'] && $_G['group']['alloweditpost'] && (!in_array($post['adminid'], array(1, 2, 3)) || $_G['adminid'] <= $post['adminid'])) || ($_G['forum']['alloweditpost'] && $_G['uid'] && ($post['authorid'] == $_G['uid'] && $_G['forum_thread']['closed'] == 0) && !(!$alloweditpost_status && $edittimelimit && TIMESTAMP - $post['dbdateline'] > $edittimelimit)) ? true : false;
                    $operation_other = $modmenu['thread'] && $_G['forum']['ismoderator'] ? true : false;
                    if($operation_edit || $operation_other){
                ?>
                <ul class="operation">
                    <?php if ($operation_edit) {?>
                    <li><a href="javascript:editpost(<?php echo $postarr[pid]; ?>);"><img src="assets/images/edit.png" alt=""><p>编辑</p></a></li>
                    <?php } ?>
                    <?php if($operation_other) { ?>
                        <?php if($_G['group']['allowdelpost']) { ?>
                        <li><a href="javascript:deletepost('topic', <?php echo $postarr[pid]; ?>);" class="del_op"><img src="assets/images/delete.png" alt=""><p>删除</p></a></li>
                        <?php } ?>
                        <?php if($_G['group']['allowmovethread'] && !$_G['forum_thread']['is_archived'] && $_G['forum']['status'] != 3) { ?>
                        <li><a href="javascript:void(0);" class="move_op"><img src="assets/images/move.png" alt=""><p>移动</p></a></li>
                        <?php } ?>
                        <?php if($_G['group']['allowdigestthread'] && !$_G['forum_thread']['is_archived']) { ?>
                        <!-- <li><a href="javascript:void(0);" class="essence"><img src="assets/images/move.png" alt="">精华</a></li> -->
                        <li><a href="javascript:void(0);" class="essence"><img src="assets/images/essence.png" alt=""><p>精华</p></a></li>
                        <?php } ?>
                        <?php if($_G['group']['allowstickthread'] && ($_G['forum_thread']['displayorder'] <= 3 || $_G['adminid'] == 1) && !$_G['forum_thread']['is_archived']) { ?>
                        <!-- <li><a href="javascript:void(0);" class="puttop"><img src="assets/images/move.png" alt="">置顶</a></li> -->
                        <li><a href="javascript:void(0);" class="puttop"><img src="assets/images/top.png" alt=""><p>置顶</p></a></li>
                        <?php } ?>
                    <?php } ?>
                </ul>
                <?php } ?>
                <!-- 置顶精华 -->
                <?php if($modmenu['thread'] && $_G['forum']['ismoderator']) {
                    // to do 指定精华
                }?>
                <?php if($postarr['attachment']>0){  ?>
                    <?php foreach($postarr['annexlist']['thumb'] as $val){  ?>
                        <img src="<?php echo $val?>" alt="">
                    <?php }?>
                <?php }?>
                <?php if($postarr['annexlist']['sound']){ ?>
                    <audio src="<?php echo  $postarr['annexlist']['sound'];?>" preload="auto" />
                <?php }?>
            </div> 
        <div class="backtop">
            <img src="assets/images/backtop.png" alt="返回顶部" />
        </div>
        <div class="frame-box">
            <form>
                <h3>选择了一篇帖子</h3>
                <div class="frame-main">
                    <div><span class="seltext">目标板块</span>
                    <span class="selbg">
                    <span class="selhid">
                    <select name="moveto" class="test" onchange="getthreadtypes(this.value);">
                        <?php echo $forumselect; ?>
                    </select>
                    </span>
                    </span>
                </div>
                </div>
                <div class="frame-main frame-main1">
                    <div><span class="seltext">目标分类</span>
                    <span class="selbg">
                    <span class="selhid">
                    <div id="threadtypeid">
                        <select name="threadtypeid" class="test"></select>
                    </div>
                    </span>
                    </span>
                </div>
                </div>
                <div class="select-them">
                    <div class="them1"><a href="javascript:;" class="them"><img src="assets/images/select.png" alt="" data="true">移动主题</a></div>
                    <div class="them2"><a href="javascript:;" class="them"><img src="assets/images/nselect.png" alt="" data="false">保留转向</a></div>
                </div>
                <div class="commd">
                    <a href="javascript:;" class="them1 clance">取消</a>
                    <a href="javascript:;" class="them2 confirm">确定</a>
                </div>
            </form>
        </div>
    </div>
    <!-- 报名活动框 START-->
    <div class="eroll-show">
    <?php if($_G['uid'] && !$activityclose && (!$applied || $isverified == 2)) { ?>
        <p class="careful">
            <?php if($_G['setting']['activitycredit'] && $activity['credit'] && !$applied) { 
                echo lang('forum/template', 'activity_need_credit').$activity[credit].$_G['setting']['extcredits'][$_G['setting']['activitycredit']][title];  
            }?>
        </p>
        <?php if($activity['cost']) { //支付方式?>
            <div class="paybg">
                <p class="method"><?php echo lang('forum/template', 'activity_paytype'); ?></p>
                <p class="payable"><a href="javascript:void(0);" ><img src="<?php echo $_G['siteurl'] ?>assets/images/select.png" alt="" ><?php echo lang('forum/template', 'activity_pay_myself'); ?></a></p>
                <p class="payable"><a href="javascript:void(0);" ><img src="<?php echo $_G['siteurl'] ?>assets/images/noselect.png" class="payImg" alt="" ><?php echo lang('forum/template', 'activity_would_payment'); ?>
                <span><input type="text" class="pay must"><?php echo lang('forum/template', 'payment_unit'); ?></span></a></p>
            </div>
        <?php } ?>

        <form id="myactive">
        <?php if(!empty($activity['ufield']['userfield'])) {?>
            <div class="eMassage"><div class="ipt">
            <?php if($settings[$fieldid][available]) { ?>
                <?php foreach ($activity['ufield']['userfield'] as $fieldid) {?>
                    <?php if(!$settings[$fieldid][title]) {continue;} ?>
                        <p><span class="sn"><strong style="color:red;">*</strong><?php echo $settings[$fieldid][title] ?></span>
                            <?php if($settings[$fieldid][formtype] == 'select' && $settings[$fieldid][choices] || $fieldid == 'gender') { 
                                $choices = explode("\n", $settings[$fieldid][choices]);
                                if ($fieldid == 'gender') {
                                    $choices = array('保密', '男', '女');
                                }
                            ?>
                            <select name="<?php echo $fieldid; ?>" class="it must">
                                <?php foreach($choices as $row) { ?>
                                    <option value="<?php echo $row ?>"><?php echo $row; ?></option>
                                <?php } ?>
                            </select>
                            <?php }elseif($settings[$fieldid][formtype] =='textarea'){ ?>
                                <textarea name="<?php echo $fieldid; ?>" class="it must"></textarea>
                            <?php } else { ?>
                                <input type="text" name="<?php echo $fieldid; ?>" placeholder="请输入<?php echo $settings[$fieldid][title];?>" autocomplete="on" class="it must">
                            <?php } ?>
                        </p>
                <?php } ?>
            <?php } ?>
            </div></div>
        <?php } ?>
        </form>
        <div class="eMassage">
            <div class="ipt">
            <p ><span class="sn"><?php echo lang('forum/template', 'leaveword'); ?></span><textarea name="" id="" cols="30" rows="3" autocomplete="on" class="it remarks"><?php echo $applyinfo[message]; ?></textarea></p>
            </div>
            <div class="opera">
                <input type="submit" value="提交" class="sub" data='go'>
                <a href="javascript:void(0);">取消</a>
            </div>
        </div>
    <?php } elseif($_G['uid'] && !$activityclose && $applied) {?>
        <div class="eMassage">
            <div class="ipt">
            <p ><span class="sn"><?php echo lang('forum/template', 'leaveword'); ?></span><textarea name="" id="" cols="30" rows="3" autocomplete="on" class="it remarks"><?php echo $applyinfo[message]; ?></textarea></p>
            </div>
            <div class="opera">
                <input type="submit" value="提交" class="sub" data='back'>
                <a href="javascript:void(0);">取消</a>
            </div>
        </div>
    <?php } ?>
    </div>
    <!-- 报名活动 END -->

    <div class="vdialog">
        <p class="dTop"><span></span></p>
        <a href="javascript:v_dBottom();"><p class="dBottom">好</p></a>
    </div>  
    
    <div class="subdialog">
        <p class="subdTop"><span></span></p>
        <a href="javascript:sub_dBottom();"><p class="subBottom">好</p></a>
    </div> 
	<script type="text/javascript" src='assets/js/jquery.lazyload.min.js?_=201509291647dd33'></script>
	<script type="text/javascript">
		$(function() {
			$(".img_detail").lazyload();
		});
	</script>
    <!-- 插件活动报名 -->
    <div class="join_show">
        <h4>我要参加</h4>
        <div class="join_pop">
            <div class="ipt">
                <?php if (!empty($selectuserfield)): ?>
                    <?php foreach ($selectuserfield as $key => $fieldid): ?>
                        <?php if ($settings[$fieldid][available]): ?>
                            <div>
                                <span class="sn"><?php echo $settings[$fieldid][title]; ?></span>
                                <?php if ($settings[$fieldid][formtype] != 'file'){?>
                                    <?php echo $htmls[$fieldid]; ?>
                                <?php } ?>
                            </div>                      
                        <?php endif ?>            
                    <?php endforeach ?>
                <?php endif ?>
                <p><span class="sn">报名人数</span>
                    <select name="applynumber" id="applynumber" class="jit">
                        <?php foreach ($applynumber as $value): ?>
                            <option value="<?php echo $value; ?>"><?php echo $value; ?>人</option>    
                        <?php endforeach ?>
                    </select>
                </p>
                <?php if (in_array('bmmessage',$userfield)): ?>
                    <p><span class="sn">留言</span>
                        <textarea name="message" id="message" cols="30" rows="3" autocomplete="on" class="it jremarks"></textarea>
                    </p> 
                <?php endif ?>
            </div>
            <div class="join_b">
                <a href="javascript:void(0)" class="jabolish jconfirm">提交</a>
                <a href="javascript:void(0)" class="jabolish jclance">取消</a>
            </div>
        </div>
    </div>
    <!-- 精华 -->
    <div class="essence-box">
        <form>
            <h3>选择了一篇帖子</h3>
            <div class="frame-main">
                <div><span class="seltext eseltext">精华</span>
                    <span class="selbg">
                        <span class="selhid">
                            <select name="digestlevel" id="digestlevel" class="eselect">
                                <option value="0"><?php echo lang('forum/template', 'admin_digest_remove') ?></option>
                                    <option value="1"><?php echo lang('forum/template', 'thread_digest'); ?> 1</option>
                                    <?php if($_G['group']['allowdigestthread'] >= 2) { ?>
                                        <option value="2"><?php echo lang('forum/template', 'thread_digest'); ?> 2</option>
                                        <?php if($_G['group']['allowdigestthread'] == 3) { ?>
                                            <option value="3"><?php echo lang('forum/template', 'thread_digest'); ?> 3</option>
                                        <?php } ?>
                                    <?php } ?>
                            </select>
                        </span>
                    </span>
                </div>
            </div>
            <div class="commd">
                <a href="javascript:;" class="them1 eclance">取消</a>
                <a href="javascript:;" class="them2 econfirm">确定</a>
            </div>
        </form>
    </div>
    <!-- 置顶 -->
    <div class="puttop-box">
        <form>
            <h3>选择了一篇帖子</h3>
            <div class="frame-main">
                <div><span class="seltext eseltext">置顶</span>
                    <span class="selbg">
                        <span class="selhid">
                            <select name="sticklevel" id="sticklevel" class="eselect">
                            <?php if($_G['forum']['status'] != 3) { ?>
                                <option value="0"><?php echo lang('forum/template', 'none'); ?></option>
                                <option value="1"><?php echo $_G['setting']['threadsticky'][2]; ?></option>
                                <?php if($_G['group']['allowstickthread'] >= 2) { ?>
                                    <option value="2"><?php echo $_G['setting']['threadsticky'][1]; ?></option>
                                    <?php if($_G['group']['allowstickthread'] == 3) { ?>
                                        <option value="3"><?php echo $_G['setting']['threadsticky'][0]; ?></option>
                                    <?php } ?>
                               <?php } ?>
                            <?php } else {?>
                                <option value="0"><?php echo lang('forum/template', 'no'); ?>&nbsp;</option>
                                <option value="1"><?php echo lang('forum/template', 'yes'); ?>&nbsp;</option>
                            <?php } ?>
                            </select>
                        </span>
                    </span>
                </div>
            </div>
            <div class="commd">
                <a href="javascript:;" class="them1 tclance">取消</a>
                <a href="javascript:;" class="them2 tconfirm">确定</a>
            </div>
        </form>
    </div>
    <!-- 分享显示下载按钮 -->
    <?php if($weixin) { ?>
        <div class="downapp">
            <a href="<?php echo $_G['baseurl']; ?>mocuzapp.php"><img src="assets/images/downapp.png?_=12414" alt="" class="downappimg"><span></span></a>
        </div>
    <?php } ?>

<script type="text/javascript" src="assets/js/detail.js"></script>
<script type="text/javascript" src='assets/js/big.image.js?_=<?php echo date('YmdHis'); ?>'></script>
<?php if(in_array('xj_event', $_G['setting']['plugins']['available']) && ($items['postclass'] == 1 || $items['postclass'] == 2)) { ?>
    <script type="text/javascript">
        /*插件活动报名*/
        function joinin_show(){
             window.ontouchmove=function(e){
                e.preventDefault && e.preventDefault();
                e.returnValue=false;
                e.stopPropagation && e.stopPropagation();
                return false;
            }        
            $('.shade').show();
            $('.join_show').show();
            var div=$('.join_show');
            $('.join_show').css('left',parseInt(($(window).width()-div.width())/2));
            $('.join_show').css('top',parseInt(($(window).height()-div.height())/2+$(document).scrollTop()));
        }
        $('.event-go').click(function(){
            joinin_show();
        })
        // 取消
        $('.jclance').click(function(event) {
            $('.join_show').hide();
            $('.shade').hide();
            window.ontouchmove=function(e){
                e.preventDefault && e.preventDefault();
                e.returnValue=true;
                e.stopPropagation && e.stopPropagation();
                return true;
            }
        });

        $('.jconfirm').click(function(event) {
            window.ontouchmove=function(e){
                e.preventDefault && e.preventDefault();
                e.returnValue=true;
                e.stopPropagation && e.stopPropagation();
                return true;
            }
            var auth = '<?php echo $_GET['auth']; ?>';
            var realname = $('#realname').val() || '';
            var telephone = $('#telephone').val() || '';
            var mobile = $('#mobile').val() || '';
            var idcardtype = $('#idcardtype').val() || '';
            var idcard = $('#idcard').val() || '';
            var applynumber = $('#applynumber').val() || '';
            var message = $('#message').val() || '';
            var qq = $('#qq').val() || '';
            auth = encodeURIComponent(auth);
            href = location.href+'&auth='+auth;
            <?php 
                $arr = array('auth'=>$_GET['auth'], 'tid'=>$_G['tid']);
                $params = json_encode($arr);
                $e = new Mcrypt3Des();
                $params = $e->encrypt($params);
            ?>
            params = '<?php echo $params; ?>';
            $.ajax({
                 type: "POST",
                 url: "<?php echo $_G['siteurl'] ?>index.php?mod=xj_event&realname="+realname+"&telephone="+telephone+"&mobile="+mobile+"&qq="+qq+"&idcardtype="+idcardtype+"&idcard="+idcard+"&ishtml=1&applynumber="+applynumber+"&message="+message,
                 data: params,
                 dataType: "html",
                 success: function(data){
                            // $('.eroll-show').hide();
                            $('.join_show').hide();
                            $('.shade').hide();
                            v_dialog(data);
                        }
             });
        });
        $('.quxiao').click(function(){
            if(confirm("是否取消报名？")) {
                var auth = '<?php echo $_GET['auth']; ?>';
                auth = encodeURIComponent(auth);
                href = location.href+'&auth='+auth;
                <?php 
                    $arr = array('auth'=>$_GET['auth'], 'tid'=>$_G['tid']);
                    $params = json_encode($arr);
                    $e = new Mcrypt3Des();
                    $params = $e->encrypt($params);
                ?>
                params = '<?php echo $params; ?>';
                $.ajax({
                     type: "POST",
                     url: "<?php echo $_G['siteurl'] ?>index.php?mod=xj_event&action=cannel&ishtml=1",
                     data: params,
                     dataType: "html",
                     success: function(data){
                                v_dialog(data);
                            }
                 });
            }
        })
    </script>
<?php } ?>
<script type="text/javascript">
    /*精华*/
    function essence_show(){
        window.ontouchmove=function(e){
            e.preventDefault && e.preventDefault();
            e.returnValue=false;
            e.stopPropagation && e.stopPropagation();
            return false;
        }        
        $('.shade').show();
        $('.essence-box').show();
        var div=$('.essence-box');
        $('.essence-box').css('left',parseInt(($(window).width()-div.width())/2));
        $('.essence-box').css('top',parseInt(($(window).height()-div.height())/2+$(document).scrollTop()));
    }
    $('.essence').click(function(){
        essence_show();
    });
   
    // 取消
    $('.eclance').click(function(event) {
        $('.essence-box').hide();
        $('.shade').hide();
         window.ontouchmove=function(e){
            e.preventDefault && e.preventDefault();
            e.returnValue=true;
            e.stopPropagation && e.stopPropagation();
            return true;
        }
    });
    //确定
    $('.econfirm').click(function(event) {
        window.ontouchmove=function(e){
            e.preventDefault && e.preventDefault();
            e.returnValue=true;
            e.stopPropagation && e.stopPropagation();
            return true;
        }
        auth = encodeURIComponent('<?php echo $_GET['auth']; ?>');
        href = location.href+'&auth='+auth;
        var digestlevel = $('#digestlevel').val();
        <?php 
            $arr = array('auth'=>$_GET['auth'], 'fid'=>$_G['fid'], 'moderate'=>array($_G['tid']), 'operations'=>array('digest'));
            $params = json_encode($arr);
            $e = new Mcrypt3Des();
            $params = $e->encrypt($params);
        ?>
        params = '<?php echo $params; ?>';
        $.ajax({
             type: "POST",
             url: "<?php echo $_G['siteurl'] ?>index.php?mod=topicadmin&ishtml=1&action=moderate&digestlevel="+digestlevel,
             data: params,
             dataType: "html",
             success: function(data){
                        $('.essence-box').hide();
                        v_dialog(data);
                    }
        });
    });
    /*置顶*/
    function puttop_show(){
        window.ontouchmove=function(e){
            e.preventDefault && e.preventDefault();
            e.returnValue=false;
            e.stopPropagation && e.stopPropagation();
            return false;
        }        
        $('.shade').show();
        $('.puttop-box').show();
        var div=$('.puttop-box');
        $('.puttop-box').css('left',parseInt(($(window).width()-div.width())/2));
        $('.puttop-box').css('top',parseInt(($(window).height()-div.height())/2+$(document).scrollTop()));
    }

    $('.puttop').click(function(){
        puttop_show();
    });

    // 取消
    $('.tclance').click(function(event) {
        $('.puttop-box').hide();
        $('.shade').hide();
         window.ontouchmove=function(e){
            e.preventDefault && e.preventDefault();
            e.returnValue=true;
            e.stopPropagation && e.stopPropagation();
            return true;
        }
    });

    //确定
    $('.tconfirm').click(function(event) {
        window.ontouchmove=function(e){
            e.preventDefault && e.preventDefault();
            e.returnValue=true;
            e.stopPropagation && e.stopPropagation();
            return true;
        }
        auth = encodeURIComponent('<?php echo $_GET['auth']; ?>');
        href = location.href+'&auth='+auth;
        var sticklevel = $('#sticklevel').val();
        <?php 
            $arr = array('auth'=>$_GET['auth'], 'fid'=>$_G['fid'], 'moderate'=>array($_G['tid']), 'operations'=>array('stick'));
            $params = json_encode($arr);
            $e = new Mcrypt3Des();
            $params = $e->encrypt($params);
        ?>
        params = '<?php echo $params; ?>';
        $.ajax({
             type: "POST",
             url: "<?php echo $_G['siteurl'] ?>index.php?mod=topicadmin&ishtml=1&action=moderate&sticklevel="+sticklevel,
             data: params,
             dataType: "html",
             success: function(data){
                        $('.puttop-box').hide();
                        v_dialog(data);
                    }
        });
    });

    function setdownappsize(){
        if (window.innerWidth)
            winWidth = window.innerWidth;
        else if ((document.body) && (document.body.clientWidth))
            winWidth = document.body.clientWidth;
        $('.downappimg').css('width',winWidth);
    }
    setdownappsize();
    /*checkbox投票*/
    var checknum = '<?php echo $maxchoices;?>'; // 最多可选几项
    checknum = parseInt(checknum);
    function votecheck(){
        var str = '';
        if($(".vote-check:checked").length <= checknum){
            // var chkVal = [];
            $(".vote-check:checked").each(function(){
                // chkVal.push($(this).val());
                str += "&pollanswers[]="+$(this).val();
            });
        }

        return str;
    }
    /*checkbox选中未选中*/
    $('.vote-check').click(function(event) {
         if($(".vote-check:checked").length ==checknum){  
             $('.vote-check').not("input:checked").each(function(){
                $(this).attr('disabled',true);
            });
         }else{
            $('.vote-check').attr('disabled',false);
         }
    });
    // 跳转到投票列表
    $('#showpoll').click(function(){
        var auth = '<?php echo $_GET['auth']; ?>';
        auth = encodeURIComponent(auth);
        var url = '<?php echo $_G['siteurl'].'index.php?mod=forum_misc&action=viewvote&tid='.$_G['tid'] ?>';
        url = url+'&auth='+auth;
        if (MocuzMobile.Android()) {
            window.commonjs.tonextpage(url); //安卓刷新
            return;
        }
        location.href = url;
    })
    // 活动报名框
    function erollshow(){
        $('.shade').show();
        $('.eroll-show').show();
        var div=$('.eroll-show');
        $('.eroll-show').css('left',parseInt(($(window).width()-div.width())/2));
        $('.eroll-show').css('top',parseInt((($(window).height()-div.height())/2+$(document).scrollTop())));
    }
    // 点击报名
    $('.baoming').click(function() {
        erollshow();
    })
    //提交活动报名之后弹出层
    function subshow(html){
        window.ontouchmove=function(e){
            e.preventDefault && e.preventDefault();
            e.returnValue=false;
            e.stopPropagation && e.stopPropagation();
            return false;
        }  
        $('.subshade').show();
        $('.subdialog').show();
        $('.subdTop').text(html);
        var div=$('.subdialog');
        $('.subdialog').css('left',parseInt(($(window).width()-div.width())/2));
        $('.subdialog').css('top',parseInt((document.body.clientHeight-div.height())/2+$(document).scrollTop()));
    }

    //提交活动报名之后弹出层 关闭
    function sub_dBottom(){   
        window.ontouchmove=function(e){
            e.preventDefault && e.preventDefault();
            e.returnValue=true;
            e.stopPropagation && e.stopPropagation();
            return true;
        }
        $('.subdialog').hide();
        $('.subshade').hide();
        
    }

    var href;
    // 提交活动报名信息
    $('.sub').click(function() {
        var auth = '<?php echo $_GET['auth']; ?>';
        var action = 'activityapplies';
        var fid = <?php echo $_G['fid']; ?>;
        var tid = <?php echo $_G['tid'] ?>;
        var pid = <?php echo $postarr['pid']; ?>;
        var message = $('.remarks').val() || '';
        var payvalue = "";
        var payment = 0;
        var activitysubmit = 1;
        auth = encodeURIComponent(auth);
        href = location.href+'&auth='+auth;
        var action, activitysubmit = 0, activitycancel = 0;
        var errmsg = '提交成功';
        if($('.payImg').attr('alt')=='1'){
            payment = 1
            payvalue = $('.pay').val();
        }
        action = 'activityapplies';
        if($(this).attr('data') == 'go') {  
            activitysubmit = 1;
        } else if($(this).attr('data') == 'back') {
            activitycancel = 1;
        }
        var oparams = $('#myactive').serialize();  
        if (oparams) {
            var d = oparams.split('&');
            for (var i = d.length - 1; i >= 0; i--) {
                var dd = d[i].split('=');
                if(!trim(dd[1])) {
                    alert('带 "*" 号为必填项，请填写完整');
                    return;
                }
            }
        }

        <?php 
            $arr = array('auth'=>$_GET['auth'], 'fid'=>$_G['fid'], 'tid'=>$_G['tid'], 'pid'=>$postarr['pid']);
            $params = json_encode($arr);
            $e = new Mcrypt3Des();
            $params = $e->encrypt($params);
        ?>
        params = '<?php echo $params; ?>';
        $.ajax({
             type: "POST",
             url: "<?php echo $_G['siteurl'] ?>index.php?mod=forum_misc&payment="+payment+"&message="+message+"&payvalue="+payvalue+"&ishtml=1&action="+action+"&activitysubmit="+activitysubmit+"&activitycancel="+activitycancel+'&'+decodeURI(oparams),
             data: params,
             dataType: "html",
             success: function(data){
                        $('.eroll-show').hide();
                        v_dialog(data);
                    }
         });
    })
    function trim(str){ 
        return str.replace(/(^\++)|(\++$)|(^\s+)|(\s+$)/g,"");
    }
    // 投票提交
    function votepoll(pollid) {
        var pollid = parseInt(pollid);
        var auth = '<?php echo $_GET['auth']; ?>';
        var str = votecheck();
        if(!checknum) {
            str += '&pollanswers[]='+pollid;
        }
        auth = encodeURIComponent(auth);
        href = location.href+'&auth='+auth;
        <?php
            $arr = array('auth'=>$_GET['auth'], 'fid'=>$_G['fid'], 'tid'=>$_G['tid'], 'action'=>'votepoll');
            $params = json_encode($arr);
            $e = new Mcrypt3Des();
            $params = $e->encrypt($params);
        ?>
        var params = '<?php echo $params; ?>';
        $.ajax({
             type: "POST",
             url: "<?php echo $_G['siteurl'] ?>index.php?mod=forum_misc&ishtml=1"+str,
             data: params,
             dataType: "html",
             success: function(data){
                        v_dialog(data);
                    }
         });
    }
    // 投票成功后调用
    //显示弹窗
    function v_dialog(html){
        window.ontouchmove=function(e){
            e.preventDefault && e.preventDefault();
            e.returnValue=false;
            e.stopPropagation && e.stopPropagation();
            return false;
        }  
        $('.shade').show();
        $('.vdialog').show();
        $('.dTop').text(html);
        var div=$('.vdialog');
        $('.vdialog').css('left',parseInt(($(window).width()-div.width())/2));
        $('.vdialog').css('top',parseInt(($(window).height()-div.height())/2+$(document).scrollTop()));
    }
    //关闭弹窗
    function v_dBottom(){   
        window.ontouchmove=function(e){
            e.preventDefault && e.preventDefault();
            e.returnValue=true;
            e.stopPropagation && e.stopPropagation();
            return true;
        }
        $('.vdialog').hide();
        $('.shade').hide();
        if (MocuzMobile.Android()) {
            window.commonjs.tonextpage(href); //安卓刷新
            return;
        }
        location.href = href;
    }
    //取消
    $('.opera a').click(function(event) {
        $('.shade').hide();
        $('.eroll-show').hide();
         window.ontouchmove=function(e){
            e.preventDefault && e.preventDefault();
            e.returnValue=true;
            e.stopPropagation && e.stopPropagation();
            return true;
        }
    });
    //操作居中
    function op_center(){
        var liindex=$('.operation li').length;
        /*var lihidden=$(".operation li:hidden").length;*/
        var licount=liindex
        var op_w=$('.operation').width();
        $('.operation li').width(op_w/licount-1);
        
    }
    op_center();
        
    //弹出框
    $('.move_op').click(function(event) {
        window.ontouchmove=function(e){
            e.preventDefault && e.preventDefault();
            e.returnValue=false;
            e.stopPropagation && e.stopPropagation();
            return false;
        }        
        $('.frame-box').show();
        $('.shade').show();
        var div=$('.frame-box');
        $('.frame-box').css('left',parseInt(($(window).width()-div.width())/2));
        $('.frame-box').css('top',parseInt(($(window).height()-div.height())/2+$(document).scrollTop()));
        
    });

    //切换选择
    $('.them').click(function(event) {
        $('.them').find('img').attr('data',"false");
        $('.them').find('img').attr('src','<?php echo $_G['siteurl'] ?>assets/images/nselect.png');
        $(this).find('img').attr('data',"true");
        if($(this).find('img').attr('data',"true")){
            $(this).find('img').attr('src','<?php echo $_G['siteurl'] ?>assets/images/select.png');
        }
    });
    
    //下拉
    $('.frame-main select:first').change(function(event) {
        var options=$(".test option:selected");
        if(options.text()!='默认板块'){
            $('.select-them').show();
            $('.frame-main select').css('color','#454545');
        }else{
            $('.select-them').hide();
        } 
    });
    $('.clance').click(function(event) {
        $('.frame-box').hide();
        $('.shade').hide();
        window.ontouchmove=function(e){
            e.preventDefault && e.preventDefault();
            e.returnValue=true;
            e.stopPropagation && e.stopPropagation();
            return true;
        }
    });

    //确定
    $('.confirm').click(function(event) {
         window.ontouchmove=function(e){
            e.preventDefault && e.preventDefault();
            e.returnValue=true;
            e.stopPropagation && e.stopPropagation();
            return true;
        }
        var auth = "<?php echo $_GET['auth']; ?>";
        var action = 'moderate';
        var fid = <?php echo $_G['fid']; ?>;
        var moveto = $('select[name=moveto]').val();
        var threadtypeid = $('select[name=threadtypeid]').val();
        var moderate = <?php echo $_G['tid']; ?>;
        var operations = 'move';
        var type = $('.them1 img').attr('data') ? 'normal' : 'redirect';

        // 调用客户端移动帖子方法
        if (MocuzMobile.Android()) {
            window.myjs.executeMove(""+fid, ""+moderate, ""+moveto, ""+threadtypeid, ""+type);
            return;
        }
        if (MocuzMobile.iOS()) {
            var cmd = "executeMove";
            window.location.href="objc://"+cmd+":/"+action+"/"+fid+"/"+moderate+"/"+operations+"/"+moveto+"/"+threadtypeid+"/"+type;
        }
    });

    // 编辑帖子
    function editpost(pid) {
        var auth = "<?php echo $_GET['auth']; ?>",
            fid = <?php echo $_G['fid']; ?>,
            tid = <?php echo $_G['tid']; ?>,
            pid = pid;
            // alert($('.item-view').length);
        // 调用客户端编辑帖子方法
        if (MocuzMobile.Android()) {
            window.myjs.executeEdit(""+fid, ""+tid, ""+pid);
            return;
        }
        if (MocuzMobile.iOS()) {
            var cmd = "executeEdit";
            window.location.href="objc://"+cmd+":/"+fid+"/"+tid+"/"+pid;
        }
    }
    // 帖子删除  post删除帖子  topic 删除主题
    function deletepost(type, pid) {
        if(confirm("确认要删除吗？")) {
            if (type == 'post') {
                data = {auth:'<?php echo $_GET['auth']; ?>', action:'delpost', fid:<?php echo $_G['fid']; ?>, tid:<?php echo $_G['tid']; ?>, topiclist:pid};
                // alert(data.tid);
                //调用客户端删除帖子方法
                if (MocuzMobile.Android()) {
                    window.myjs.executeDelete(""+data.action, ""+data.fid, ""+data.tid, ""+data.topiclist);//android
                    return;
                }
                if (MocuzMobile.iOS()) {
                    var cmd = "executeDelete";
                    window.location.href="objc://"+cmd+":/"+data.action+"/"+data.fid+"/"+data.tid+"/"+data.topiclist;
                }
            } else if (type == 'topic') {
                data = {auth:'', action:'moderate', fid:<?php echo $_G['fid']; ?>, moderate:<?php echo $_G['tid']; ?>, operations:'delete'};
                // 调用客户端删除主题方法
                if (MocuzMobile.Android()) {
                    window.myjs.executeDelete(""+data.action, ""+data.fid, ""+data.moderate, ""+data.operations);//android
                    return;
                }
                if (MocuzMobile.iOS()) {
                    var cmd = "executeDelete";
                    window.location.href="objc://"+cmd+":/"+data.action+"/"+data.fid+"/"+data.moderate+"/"+data.operations;
                }
            } else {
                return;
            }
        }
    }
    
    // 帖子删除成功调用方法
    function afterdel(pid) {
        var item = document.getElementsByClassName('item-view');
        for(var i=0; i<item.length; i++) {
            tagid = item[i].getAttribute('pid');
            if (tagid == pid) {
                item[i].style.display = 'none';;
            }
        }
    }
    // 获取板块类型
    function getthreadtypes(fid) {
        if (!fid) {
            return;
        }
        $.ajax({
            type: "GET",
            url: "<?php echo $_G['baseurl'].$_G['mocuz_config']['mocuz_type']; ?>/index.php?mod=forum_ajax&action=getthreadtypes&fid="+fid,
            dataType: "html",
            success: function(data){
                $('#threadtypeid').html('');
                $('#threadtypeid').append(data);
                return;
            }
        });
    }
    // 投票 
   //li居中
    function op_center1(){
        var op_w=$('.poll-list').width();
        $('.poll-list li').width(op_w/2-6);
    }
    op_center1();
    // 投票
    var param=0;                      //判断是否选择了一项   
    $('.toupiao').click(function() {
            $(this).children().attr('src','<?php echo $_G['siteurl']; ?>assets/images/select.png');
            //记录已选择
            param=$(this).attr('data');
            obj=$(this);
            if ($(this).children().attr('src','<?php echo $_G['siteurl']; ?>assets/images/select.png')) {
                $('.toupiao').not(this).children().attr('src','<?php echo $_G['siteurl']; ?>assets/images/noselect.png')
            };               
    });
    /*
        改变投票结果
    */
    $('.signtext').click(function(){
        votepoll(param);
    })
    // 投票后
    function hideVote(){
        $('.v-hide').css('visibility','hidden');
    }
    //活动报名切换选择
    $('.payable').click(function(event) {
        $('.payable').find('img').attr('alt',"0");
        $('.payable').find('img').attr('data',"false");
        $('.payable').find('img').attr('src','<?php echo $_G['siteurl'] ?>assets/images/noselect.png');
        $(this).find('img').attr('data',"true");
        if($(this).find('img').attr('data',"true")){
            $(this).find('img').attr('alt',"1");
            $(this).find('img').attr('src','<?php echo $_G['siteurl'] ?>assets/images/select.png');
        }
    });

    //切换选择
    $('.poll-list p').click(function(event) {
        $('.poll-list p').find('img').attr('data',"false");
        $('.poll-list p').find('img').attr('src','<?php echo $_G['siteurl'] ?>assets/images/noselect.png');
        $(this).find('img').attr('data',"true");
        //记录已选择
        s_param=$(this).attr('data');
        //获取勾选的对象上上级(那个li)
        s_obj=$(this).prev().parent();
        if($(this).find('img').attr('data',"true")){
            $(this).find('img').attr('src','<?php echo $_G['siteurl'] ?>assets/images/select.png');
        }        
    });
    /*
        改变投票结果
    */
    $('.signimg').click(function(){
        votepoll(s_param);
    })
    var tagindex = 1;
    var MocuzMobile = {
        Android: function() {
            return /Android/i.test(navigator.userAgent);
        },
        BlackBerry: function() {
            return /BlackBerry/i.test(navigator.userAgent);
        },
        iOS: function() {
            return /iPhone|iPad|iPod/i.test(navigator.userAgent);
        },
        Windows: function() {
            return /IEMobile/i.test(navigator.userAgent);
        },
        any: function() {
            return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Windows());
        }
    };
    $(function() {
        //分享出去页面打开点击回复按钮进去下载引导页
        var wei_href="<?php echo $_G['baseurl']; ?>app.html#mp.weixin.qq.com"
        $('.report-advert').attr('href',wei_href); 
        /*获取页面中img*/
        var  contentid = '<?php echo $_G['tid']?>';
        var data = {
            'tid'        : '<?php echo $_G['tid']?>'
        };
        // DetailHandler.sendDataToClientIOS(data, "getBbsContentInfo");
        // if (window.androidclient && window.androidclient.onClientInit) {
        //     window.androidclient.onClientInit(DetailHandler.json2str(data));
        // }
        var contentid = "<?php echo $_G['tid']?>";
        var auth = "<?php echo $_GET['auth']?>";
        var totalpage = "<?php echo $totalpage?>";
        //加载获取更多内容  
        var tabContainter = $("div.bbs-feed-list");
        var loadinInter   = tabContainter .find('div.loading-con');
        var containter    = tabContainter .find("div.itm");
        var currentP = 1 ,currentLoaded = false ,currentLoading = false ;
        var refresh = function(){
            currentLoading =  true;
            $.ajax({
                url:"<?php echo $_G['baseurl'].$_G['mocuz_config']['mocuz_type']; ?>/index.php?mod=viewthread",
                type:'GET',
                data:{tid:contentid,item_view:1,page:currentP,auth:auth},
                dataType: "html",success:function(html) {
                    var viewLen = $(html).find('li.item-view') .length;
                   if(viewLen < "<?php echo $h5_page ?>"){
            currentLoaded = true;
                        loadinInter .hide();
                    }else currentP ++;
                    if(viewLen>0&&currentP-1<=totalpage){ 
                        $(".parameter").remove();
                        containter .append($(html))
            $('.ul-reply li:last-child a').css('border-right','0px');
                    }else {
                        loadinInter .hide();
                        currentLoaded = true;
                    }
                    img_bind();
                    currentLoading = false;
                    //评论列表回复的回复
                    tabContainter.find(".reply-box-btn").on("click",function(event){
                        var authorid = $(this).attr("authorid");
                        var data = {
//                            'username' : $(this).attr("username"),
                            'tid': $(this).attr("commentid")
                        }; 
                        // DetailHandler.sendDataToClientIOS(data, "commentReplyKey");
                        // if( window.androidclient){
                        //     window.androidclient.onReplyBtnClick(DetailHandler.json2str(data));
                        // }
                    });
                }
            }) 
        }
        //滚动触发加载
        var scrollTrriget = function(){
            if(currentLoaded || currentLoading) return;
            var bodyTop = document.documentElement.scrollTop ;//document.body.scrollTop;
            if(!bodyTop) bodyTop = document.body.scrollTop;
            //滚动到底部时出发函数
            //滚动的当前位置+窗口的高度 >= 整个body的高度
            var oBody = $('body')[0];
            if(bodyTop+oBody.clientHeight >= $(document.body).height()&&!currentLoaded){
        if(currentLoaded==false ){
            refresh();
        }
            };
        }
        window.onload=refresh();
        $(window).bind('scroll',function(event){scrollTrriget()});
        var AdapterObj = {
            scrollEvent: scrollTrriget
        };
        window.AdapterObj = AdapterObj;
        //==============================
     })
        /**
       * 夜间模式切换
       * @param isNight 是否启用夜间模式
       */
       function switchNightMode(isNight) {
           var colorVal = '';
           if (isNight == 1) {
               $('.bbs-cv-hd .btm').css('border-bottom','1px solid #454545');
               $('.bbs-feed-list li').css('border-top','1px solid #454545');
               $('.quote').css('background-color','#A5A7AA');
               colorVal = '#2C2D32';
           } else {
               colorVal = '';
           }
           document.body.style.backgroundColor = colorVal;
       }
    
        //论坛举报客户端加载
       function report(){
           var pid="<?php echo $postarr['pid']?>";  
           var fid="<?php echo $_G['fid']?>";  
           if(MocuzMobile.Android()) {
               window.myjs.report(fid,pid);//android
               return;
           }
           if(MocuzMobile.iOS()) {
               window.location.href="objc://report:/"+fid+"/"+pid;
               return;
           }
       }
        //论坛h5客户端加载
        function testClick(cmd, pid, author){
            var tid = '<?php echo $_G['tid']?>';
            var author = author || "<?php echo $_G['forum_thread']['author']; ?>";
            if(MocuzMobile.Android()) {
                window.myjs.runJs(""+tid, ""+pid);//android
                return;
            }
            if(MocuzMobile.iOS()) {
                window.location.href="objc://"+cmd+":/"+tid+"/"+author+"/"+pid;
            }
        }
    
         function scrollParameter(){
             $(window).bind('scroll', AdapterObj.scrollEvent);
         };
        //回复跳转
        tagindex = 1;
        function  postParameter(uid,username,message) {
            var divFeedList = $("div.bbs-feed-list");
            var divFeedItem = divFeedList.find("div.itm");
            var author="<?php echo $_G['mocuz_config']['userimage_url'];?>";
            var html ='';
            html+="<ul class='parameter'>";
            html+= "<li class='item-view'>";
            html+=  "<div class='hd'>";
            html+=  "<a href='javascript:void(0);' class='user-hd'><img src="+author+"></a>";
            html+=  "<div class='hd-name'>";
            html+=   "<a href='javascript:void(0);' class='user-txt-name'>"+username+"</a>";
            html+=  "<div class='hd-time hd-s'>"+odz_smiley_parse(message)+"</div>";
            html+=  " </div>";
            html+=  "</div>";
            html+=  " </li>";
            html+="</ul>";
            $(window).unbind('scroll');
            if (tagindex == 1) {
                divFeedItem.append(html);
                tagindex = 1;
            }
            var oBody = $('body')[0];
            var scrollTop = oBody.scrollHeight - $(window).height();
            scrollTop = scrollTop - 45;
            $('body').animate({scrollTop:scrollTop}, 300, '', function() {
                $(window).bind('scroll', AdapterObj.scrollEvent);
            });
        }; 
        //返回顶部
        $('.backtop').click(function(event) {
            $('.backtop img').attr('src','assets/images/backtop2.png');
            $("html,body").animate({scrollTop:"0px"},300,function(){
                $('.backtop img').attr('src','assets/images/backtop.png');
            });
        });
    // 快捷回复委托方法
    function odz_quick_reply() {
        var pid = '<?php echo $postarr['pid']; ?>';
        var tid = '<?php echo $_G['tid']; ?>';
        var author = "<?php echo $_G['forum_thread']['author']; ?>";
        if (MocuzMobile.Android()) {
            window.myjs.runJs(""+tid, ""+pid);//android
            return;
        }
        if (MocuzMobile.iOS()) {
            var cmd = "changePage";
            window.location.href="objc://"+cmd+":/"+tid+"/"+author+"/"+pid;
        }
    }

    
    // 数据交互
    function jiaohu(cmd,str) {

        var sharelink="<?php echo urlencode($sharelink); ?>";  
        var share_text="<?php echo odz_format_sharetext($sharetext)?odz_format_sharetext($sharetext):odz_lang('biu_sharetext'); ?>";
        //var subject="<?php echo $_G['forum_thread']['subject']; ?>";
		var shareIcon="<?php echo $shareicon; ?>";
        var eventlink = "<?php echo $link?>";
		var subject   = "<?php echo $name?>";
		
        var cmd ='jiaohu';
        var str = '{"eventlink":"'+eventlink+'", "shareSNS":{"sharelink":"'+sharelink+'","shareIcon":"'+shareIcon+'", "sharetext":"'+share_text+'", "sharesubject":"'+subject+'"}}';
		//alert(str);
		//console.log(str);
        if(MocuzMobile.Android()) {
            window.shareInfo.jiaohu(str);//android
            return;
        }
        if (MocuzMobile.iOS()) {
            window.location.href="objc://"+cmd+":/"+str;
        }
    }
    window.onload = jiaohu();

</script>

</body>
</html>