<!--<?php
print <<<EOT
-->
<div class="g_navB mb10">

<span class="fr">
 <!--
EOT;
$tmp = '';
if ($ifadmin && $job != 'post') {print<<<EOT
-->
<span class="btn_add"><span><button onClick="location.href='apps.php?q=group&a=active&cyid=$cyid&job=post';">發起活動</button></span></span>
<!--
EOT;
$tmp = '&nbsp;|&nbsp; ';
}if ($job == 'post' || $job == 'view') {print<<<EOT
-->
{$tmp}<a href="apps.php?q=group&a=active&cyid=$cyid">返回活動列表</a>
<!--
EOT;
} elseif (in_array($job, array('membermanage', 'actmember', 'edit'))) {print<<<EOT
-->
{$tmp}<a href="apps.php?q=group&a=active&cyid=$cyid&job=view&id=$id">返回活動</a>
<!--
EOT;
}print <<<EOT
-->
</span>
<span class="mr20">
<!--
EOT;
if(in_array($job, array('membermanage', 'actmember'))){print<<<EOT
-->
	共{$active[members]}人參加活動
<!--
EOT;
} else {print<<<EOT
-->
	共{$colony['activitynum']}個活動
<!--
EOT;
}print<<<EOT
-->
</span></div>
<!--
EOT;
if (empty($job)) {print <<<EOT
-->
<div class="g_contentA fl">
	<div class="p10">
    	<table class="vt mb10" width="100%" style="table-layout:fixed;">
<!--
EOT;
if ($activedb) {
$key_lang = array(1=>'出游',2=>'聚餐 ',3=>'舞會',4=>'戶外',5=>'燒烤',6=>'其他');
foreach ($activedb as $key => $value) {print <<<EOT
-->
        	<tr>
            	<td width="145">
                	<a href="{$basename}a=$a&job=view&cyid=$cyid&id=$value[id]"><img src="$value[poster_img]" class="img" width="120" height="160" /></a>
                </td>
                <td>
                	<div style="min-height:170px;_height:170px;">
                	<p class="mb10 f14 b">
<!--
EOT;
if ($timestamp > $value['endtime']) {print <<<EOT
-->
					<span class="bt fr" style="cursor:text;"><span><button type="button" style="cursor:text;" disabled>活動已結束</button></span></span>
<!--
EOT;
} elseif ($timestamp > $value['deadline'] && $timestamp > $value['begintime']) {print <<<EOT
-->
					<span class="bt fr" style="cursor:text;"><span><button type="button" style="cursor:text;" disabled>活動進行中</button></span></span>
<!--
EOT;
} elseif ($timestamp > $value['deadline']) {print <<<EOT
-->
					<span class="bt fr" style="cursor:text;"><span><button type="button" style="cursor:text;" disabled>報名已截止</button></span></span>
<!--
EOT;
} elseif ($value['limitnum'] && $value['members'] >= $value['limitnum']) {print <<<EOT
-->
					<span class="bt fr" style="cursor:text;"><span><button type="button" style="cursor:text;" disabled>人員已滿</button></span></span>
<!--
EOT;
} else {print <<<EOT
-->
					<span class="btn fr"><span><button type="button" id="active_join_$value[id]" onclick="sendmsg('{$basename}a=$a&job=join&cyid=$cyid&id=$value[id]','',this.id)">我要報名</button></span></span>
<!--
EOT;
}print <<<EOT
-->

<!--
EOT;
if ($value['type']) {print <<<EOT
-->
										<span class="s2 mr5">[{$key_lang[$value['type']]}]</span>
<!--
EOT;
}print <<<EOT
-->
                    <a href="{$basename}a=$a&job=view&cyid=$cyid&id=$value[id]">$value[title]</a></p>
                    <p class="mb10"><span class="s6">簡介︰</span>$value[introduction]</p>
                    <p class="mb10"><span class="s6">時間︰</span>$value[begintime_s]&nbsp;至&nbsp;$value[endtime_s]</p>
                    <p class="mb10"><span class="s6">地點︰</span>$value[address]</p>
                    <p class="mb10"><span class="mr10"><strong class="act_num">$value[members]</strong>人參加</span><a href="{$basename}a=$a&job=view&cyid=$cyid&id=$value[id]">查看詳情</a></p>
                    </div>
                    <div class="hrA">&nbsp;</div>
                </td>
            </tr>
<!--
EOT;
}} else {print <<<EOT
-->
			<tr><td class="p10"><div class="f14 tac">
<!--
EOT;
if($ifadmin && $colony['activitynum'] == 0){print <<<EOT
-->
			暫無活動，我來第一個<a href="apps.php?q=group&a=active&cyid=$cyid&job=post" class="line s2">發起活動</a>吧！
<!--
EOT;
}elseif($colony['activitynum'] == 0){print <<<EOT
-->
			暫無活動
<!--
EOT;
}print <<<EOT
-->
			</div></td></tr>
<!--
EOT;
}print <<<EOT
-->
        </table>
        <div class="p10">$pages</div>
        </div>
    </div>
	<div class="g_sidebarA fr">
<!--
EOT;
if ($newactivedb) {print <<<EOT
-->
		<div class="g_tA mb10">
			<h2 class="g_hB">社區最新活動</h2>
            <div class="p10">
                <div class="dlD">
<!--
EOT;
foreach ($newactivedb as $key => $value) {
$value['begintime'] = get_date($value['begintime'], 'n月j日');
$value['endtime'] = get_date($value['endtime'], 'n月j日');
print <<<EOT
-->
                    <dl class="dl mb10">
                        <dt class="dt f14"><h3><a href="{$basename}a=active&cyid=$value[cid]&job=view&id=$value[id]">$value[title]</a></h3></dt>
<!--
EOT;
if ($value['address']) {print <<<EOT
-->
						<dd class="dd2">$value[address]</dd>
<!--
EOT;
}print <<<EOT
-->
                        <dd class="dd">{$value['begintime']} - {$value['endtime']}</dd>
                        <dd class="dd2 s2"><span class="mr20">{$value[members]}人參加</span>熱度︰$value[hits]</dd>
                    </dl>
<!--
EOT;
}print <<<EOT
-->
                </div>
            </div>
		</div>
<!--
EOT;
}if ($hotactivedb) {print <<<EOT
-->
		<div class="g_tA mb10">
			<h2 class="g_hB">社區熱門活動</h2>
            <div class="p10">
                <div class="dlD">
<!--
EOT;
foreach ($hotactivedb as $key => $value) {
$value['begintime'] = get_date($value['begintime'], 'n月j日');
$value['endtime'] = get_date($value['endtime'], 'n月j日');
print <<<EOT
-->
					<dl class="dl mb10">
						<dt class="dt f14"><h3><a href="{$basename}a=active&cyid=$value[cid]&job=view&id=$value[id]">$value[title]</a></h3></dt>
<!--
EOT;
if ($value['address']) {print <<<EOT
-->
						<dd class="dd2">$value[address]</dd>
<!--
EOT;
}print <<<EOT
-->
                        <dd class="dd">{$value['begintime']} - {$value['endtime']}</dd>
                        <dd class="dd2 s2"><span class="mr20">{$value[members]}人參加</span>熱度︰$value[hits]</dd>
					</dl>
<!--
EOT;
}print <<<EOT
-->
				</div>
            </div>
		</div>
<!--
EOT;
}print <<<EOT
-->
	</div>
<!--
EOT;
} elseif ($job == 'view') {
$key_lang = array(1=>'出游',2=>'聚餐 ',3=>'舞會',4=>'戶外',5=>'燒烤',6=>'其他');
print <<<EOT
-->
<script>
var db_urlcheck = "$db_urlcheck";
var db_bbsurl = '$db_bbsurl';
</script>
	<div class="fl g_contentA">
    	<div class="g_tA">
		<div class="p10" style="min-height:950px;_height:950px;">
        	<table width="100%" class="mb10" style="table-layout:fixed;">
            	<tr class="vt">
                	<td width="195"><img src="$active[poster_img]" width="180" height="240" /></td>
                    <td>
                    <h1 class="mb10">
<!--
EOT;
if ($active['type']) {print <<<EOT
-->
							<a href="{$basename}a=$a&cyid=$cyid&type=$active[type]" class="s2">[{$key_lang[$active['type']]}]</a>
<!--
EOT;
}print <<<EOT
-->
						$active[title]</h1>
                        <p class="g_hF cc">
													<span class="fr">
													<a href="apps.php?q=collection&a=favor&type=groupactive&ajax=1&id={$active[id]}" onclick="return ajaxurl(this)" class="mr10 allCollect">收藏</a>
<!--
EOT;
print <<<EOT
-->
													<a href="javascript:;" onclick="sendmsg('operate.php?action=toweibo&ajax=1&type=groupactive&id=$active[id]','',this.id);" class="allForward mr20">新鮮事</a></span>
                        	<strong>發起人︰</strong><a href="{$db_userurl}$active[uid]" target="_blank" class="img_25 mr10"><i><img src="$active[icon]" align="absmiddle" /></i></a><a href="{$db_userurl}$active[uid]" target="_blank">$active[username]</a>
                        </p>
                        <p class="g_hF cc"><strong>活動時間︰</strong>$active[begintime_s] 至 $active[endtime_s]</p>
                        <p class="g_hF cc"><strong>報名截止︰</strong>$active[deadline_s]</p>
                        <p class="g_hF cc"><strong>地點︰</strong>$active[address]</p>
                        <p class="g_hF cc"><strong>費用估計︰</strong>
<!--
EOT;
if ($active['price'] == '0.00') {print <<<EOT
-->
									免費
<!--
EOT;
} else {print <<<EOT
-->
									{$active['price']}
<!--
EOT;
}print <<<EOT
-->
                        </p>
                        <p class="g_hF cc">
<!--
EOT;
if ($timestamp > $active['endtime']) {print<<<EOT
-->
						<span class="mr10"><span class="bt2" style="cursor:text;"><span><button type="button" style="cursor:text;" disabled>活動已結束</button></span></span></span>
<!--
EOT;
} elseif ($timestamp > $active['deadline'] && $timestamp > $active['begintime']) {print <<<EOT
-->
						<span class="mr10"><span class="bt2" style="cursor:text;"><span><button type="button" style="cursor:text;" disabled>活動進行中</button></span></span></span>
<!--
EOT;
} elseif ($timestamp > $active['deadline']) {print <<<EOT
-->
						<span class="mr10"><span class="bt2" style="cursor:text;"><span><button type="button" style="cursor:text;" disabled>報名已截止</button></span></span></span>

<!--
EOT;
} elseif ($active['limitnum'] && $active['members'] >= $active['limitnum']) {print <<<EOT
-->
						<span class="mr10"><span class="bt2" style="cursor:text;"><span><button type="button" style="cursor:text;" disabled>人員已滿</button></span></span></span>

<!--
EOT;
} if ($active['objecter'] == 1 && !$colony['ifcyer'] && !$isJoin) {print <<<EOT
-->
						參加活動請先<a href="{$basename}a=join&cyid=$cyid" onclick="return ajaxurl(this)">加入群組</a>

<!--
EOT;
} elseif ($active['deadline'] > $timestamp && !$newActive->isJoin($id, $winduid)) {print <<<EOT
-->
						<span class="mr10"><span class="btn"><span><button type="button" id="active_join" onclick="sendmsg('{$basename}a=active&job=join&cyid=$cyid&id=$id','',this.id)">我要參加</button></span></span></span>
<!--
EOT;
} elseif ($newActive->isJoin($id, $winduid) && $winduid != $active['uid']) {print <<<EOT
-->
						<span class="bt2"><span><button type="button" id="active_quit" onclick="sendmsg('apps.php?q=group&a=$a&job=quit&cyid=$cyid&id=$id', '', this.id);">退出活動</button></span></span>
<!--
EOT;
} if ($winduid == $active['uid'] || $ifadmin) {print <<<EOT
-->
						<span class="bt2"><span><button onClick="location.href='{$basename}a=$a&job=edit&cyid=$cyid&id=$id';">編輯活動</button></span></span>
						<span class="bt2"><span><button id="del_active" onClick="sendmsg('apps.php?q=group&a=active&job=del&cyid=$cyid&id=$id','',this.id)">取消活動</button></span></span>
<!--
EOT;
} if ($active['deadline'] > $timestamp) {print <<<EOT
-->
						<span class="btn4"><span><button onClick="location.href='apps.php?q=group&cyid=$cyid&a=invite&type=groupactive&id=$id';">邀請朋友參加</button></span></span>
<!--
EOT;
} if ($newActive->isJoin($id, $winduid)) {print <<<EOT
-->
						<a href="{$basename}a=active&cyid=$cyid">查看其它活動</a>
<!--
EOT;
}print <<<EOT
-->
                        </p>
                    </td>
                </tr>
            </table>
            <h3 class="g_hA b">
            	活動詳情
            </h3>
<style type="text/css">
.a_content img{max-width:500px;}
</style>
			<div class="p15 mb10 f14 a_content" style="line-height:2;overflow:hidden;">
					$active[content]
<!--
EOT;
if($active['pic']){
	foreach($active['pic'] as $pic){
		if($pic){
print <<<EOT
-->
							<div class="mb10" id="att_$pic[aid]">
<!--
EOT;
			if($pic['descrip']){
print <<<EOT
-->
								描述:$pic[descrip]<br />
<!--
EOT;
			}
print <<<EOT
-->
								圖片: $pic[img]
<!--
EOT;
			if($pic['dfadmin']){
print <<<EOT
-->
								[<a style="cursor:pointer" onclick="delatt('$read[pid]','$pic[aid]','active');">刪除</a>]
<!--
EOT;
			}
print <<<EOT
-->
							</div>
<!--
EOT;
		}
	}
}if($active['downattach']){
	foreach($active['downattach'] as $attach){
		if($attach){
print <<<EOT
-->
							<div class="mb10" id="att_$attach[aid]">
<!--
EOT;
			if($attach['descrip']){
print <<<EOT
-->
								描述:$attach[descrip]<br />
<!--
EOT;
			}
			$att_id = $db_attfg ? "id=\"fg_$attach[aid]\"" : '';
print <<<EOT
-->
								附件: <img src="$imgpath/wind/file/$attach[type].gif" align="absmiddle" />
<!--
EOT;
if($attach['ext'] == 'swf'){print<<<EOT
-->
						<a $att_id style="cursor:pointer" onclick="openatt('$attach[aid]');"> <font color="red">$attach[name]</font></a>
<!--
EOT;
}else{print<<<EOT
-->
						<a $att_id href="job.php?action=download&type=active&aid=$attach[aid]" target="_blank"> <font color="red">$attach[name]</font></a>
<!--
EOT;
}print<<<EOT
-->
								($attach[size] K) 下載次數:$attach[hits]
<!--
EOT;
			if ($attach['needrvrc']) {
				$at_lang = $attach['special'] == 2 ? '售價' : '需要';
				//{$at_lang}:{$attach[needrvrc]}{$attach[cname]}
print <<<EOT
-->
								該附件被加密,需要{$attach[needrvrc]}{$attach[cname]}以上積分才能下載
<!--
EOT;
			}elseif(in_array($attach['ext'],array('mp3','wma','wmv','rm','swf'))){
print <<<EOT
-->
								[<a style="cursor:pointer" onclick="playatt('$attach[aid]');">試播</a>]
<!--
EOT;
			}if($attach['ext'] == 'swf'){print<<<EOT
-->
								[<a href="job.php?action=download&type=active&aid=$attach[aid]" target="_blank">下載</a>]
<!--
EOT;

			}if($attach['dfadmin']){
print <<<EOT
-->
								[<a style="cursor:pointer" onclick="delatt('$read[pid]','$attach[aid]','active');">刪除</a>]
<!--
EOT;
			}
print <<<EOT
-->
							</div>
<!--
EOT;
		}
	}
}print <<<EOT
-->
			</div>
            <h3 class="g_hA">
<!--
EOT;
if ($active['members'] >= 20) {print <<<EOT
-->
				<a href="{$basename}a=$a&job=actmember&cyid=$cyid&id=$id" class="fr">更多>></a>
<!--
EOT;
}print <<<EOT
-->
            	<b class="mr10">已有{$active[members]}人報名</b>
<!--
EOT;
if ($active['members'] > 0 && ($ifadmin || $active['uid'] == $winduid)) {print <<<EOT
-->
				<a href="apps.php?q=group&cyid=$cyid&a=active&job=membermanage&id=$id">管理</a>
<!--
EOT;
}print <<<EOT
-->
            </h3>
			<div class="p10 mb10">
                <ul class="ulB cc">
<!--
EOT;
foreach ($actMembers as $key => $value) {
if ($key > 0 && ($key % 5 == 0)) {print <<<EOT
-->

<!--
EOT;
}
if ($value['anonymous'] == 1 && !$ifadmin && $winduid !=$value['uid']) {print <<<EOT
-->

                    <li><a href="javascript:;" class="i"><img src="images/face/none.gif" class="img_60" /></a><p class="n">匿名</p></li>
<!--
EOT;
} else {print <<<EOT
-->
                    <li><a href="{$db_userurl}$value[uid]" target="_blank" class="i"><img src="$value[icon]" width="44" height="44" /></a><p class="n"><a href="{$db_userurl}$value[uid]" title="$value[username]" target="_blank">$value[username]</a></p></li>
<!--
EOT;
}}print <<<EOT
-->
                </ul>
			</div>
			<script type="text/javascript" src="js/app_comment.js"></script>
			<div>
<!--
EOT;
require_once PrintEot('m_active_comment');print <<<EOT
-->
			</div>
			<div class="c"></div>
		</div>
        </div>
	</div>
	<div class="g_sidebarA fr">
<!--
EOT;
if ($relateactivedb) {print <<<EOT
-->
		<div class="g_tA mb10">
			<h2 class="g_hB">參加這個活動的人也參加了</h2>
            <div class="p10">
                <div class="dlD">
<!--
EOT;
foreach ($relateactivedb as $key => $value) {
$value['begintime'] = get_date($value['begintime'], 'n月j日');
$value['endtime'] = get_date($value['endtime'], 'n月j日');
print <<<EOT
-->
					<dl class="dl mb10">
						<dt class="dt f14"><h3><a href="{$basename}a=active&cyid=$value[cid]&job=view&id=$value[id]">$value[title]</a></h3></dt>
<!--
EOT;
if ($value['address']) {print <<<EOT
-->
						<dd class="dd2">$value[address]</dd>
<!--
EOT;
}print <<<EOT
-->
						<dd class="dd">{$value['begintime']} - {$value['endtime']}</dd>
						<dd class="dd2 s2"><span class="mr20">{$value[members]}人參加</span>熱度︰$value[hits]</dd>
					</dl>
<!--
EOT;
}print <<<EOT
-->
				</div>
            </div>
		</div>
<!--
EOT;
}if ($newactivedb) {print <<<EOT
-->
		<div class="g_tA mb10">
			<h2 class="g_hB">最新活動</h2>
            <div class="p10">
                <div class="dlD">
<!--
EOT;
foreach ($newactivedb as $key => $value) {
$value['begintime'] = get_date($value['begintime'], 'n月j日');
$value['endtime'] = get_date($value['endtime'], 'n月j日');
print <<<EOT
-->
					<dl class="dl mb10">
						<dt class="dt f14"><h3><a href="{$basename}a=active&cyid=$value[cid]&job=view&id=$value[id]">$value[title]</a></h3></dt>
<!--
EOT;
if ($value['address']) {print <<<EOT
-->
						<dd class="dd2">$value[address]</dd>
<!--
EOT;
}print <<<EOT
-->
						<dd class="dd">{$value['begintime']} - {$value['endtime']}</dd>
						<dd class="dd2 s2"><span class="mr20">{$value[members]}人參加</span>熱度︰$value[hits]</dd>
					</dl>
<!--
EOT;
}print <<<EOT
-->
				</div>
            </div>
		</div>
<!--
EOT;
}if ($hotactivedb) {print <<<EOT
-->
		<div class="g_tA mb10">
			<h2 class="g_hB">社區熱門活動</h2>
            <div class="p10">
                <div class="dlD">
<!--
EOT;
foreach ($hotactivedb as $key => $value) {
$value['begintime'] = get_date($value['begintime'], 'n月j日');
$value['endtime'] = get_date($value['endtime'], 'n月j日');
print <<<EOT
-->
					<dl class="dl mb10">
						<dt class="dt f14"><h3><a href="{$basename}a=active&cyid=$value[cid]&job=view&id=$value[id]">$value[title]</a></h3></dt>
<!--
EOT;
if ($value['address']) {print <<<EOT
-->
						<dd class="dd2">$value[address]</dd>
<!--
EOT;
}print <<<EOT
-->
						<dd class="dd">{$value['begintime']} - {$value['endtime']}</dd>
						<dd class="dd2 s2"><span class="mr20">{$value[members]}人參加</span>熱度︰$value[hits]</dd>
					</dl>
<!--
EOT;
}print <<<EOT
-->
				</div>
            </div>
		</div>
<!--
EOT;
}print <<<EOT
-->
	</div>
<!--
EOT;
} elseif ($job == 'actmember') {print <<<EOT
-->
	<div class="g_box">
		<div class="bd">
			<table class="g_tableB" width="100%" cellpadding="0" cellspacing="0">
				<tr class="vt">
<!--
EOT;
foreach ($actMembers as $key => $value) {
if ($key > 0 && ($key % 5 == 0)) {print <<<EOT
-->
				</tr>
				<tr class="vt">
<!--
EOT;
}
if ($value['anonymous'] == 1 && $groupid != 3 && $active['uid'] != $winduid && $value['username'] != $windid) {print <<<EOT
-->

					<td><img src="images/face/none.gif" class="img_60" /><br />匿名</td>
<!--
EOT;
} else {print <<<EOT
-->
					<td><a href="{$db_userurl}$value[uid]"  target="_blank"><img src="$value[icon]" class="img_60" /><br />$value[username]</a></td>
<!--
EOT;
}}print <<<EOT
-->

				</tr>
			</table>
		</div>
	</div>
	<div class="p10">$pages</div>
<!--
EOT;
} elseif ($job == 'membermanage') {print <<<EOT
-->
	<h3>
		<a href="apps.php?q=group&cyid=$cyid&a=active&job=sendmsg&id=$id" class="fr" onclick="return ajaxurl(this)">群發信息</a>
		<a href="apps.php?q=group&cyid=$cyid&a=active&job=exportmember&id=$id" class="fr mr10">導出報名信息</a>
	</h3>
	<div class="g_box">
		<div class="bd">
			<table class="g_tableB" width="100%" cellpadding="0" cellspacing="0">
				<tr class="vt g_bgB">
					<td width="15%">用戶名</td>
					<td width="15%">手機</td>
					<td width="15%">電話</td>
					<td>地址</td>
					<td width="8%">操作</td>
				</tr>
<!--
EOT;
foreach ($actMembers as $key => $value) {print <<<EOT
-->
				<tr class="vt">
					<td>$value[username] ($value[realname])</td>
					<td>$value[phone]</td>
					<td>$value[mobile]</td>
					<td>$value[address]</td>
					<td><a href="apps.php?q=group&cyid=$cyid&a=active&job=delmember&id=$id&uid=$value[uid]" onclick="return ajaxurl(this);">刪除</a></td>
				</tr>
<!--
EOT;
}print <<<EOT
-->
			</table>
		</div>
	</div>
	<div class="p10">$pages</div>
<!--
EOT;
} elseif ($job == 'post' || $job == 'edit') {print <<<EOT
-->
<style type="text/css">
.w_editor_up{background-color:#f8f8f8;padding:5px;}
.w_editor_up td{padding:2px 0 2px 10px;}
.w_editor_up .w_tab_a{padding-left:10px;position:absolute;}
.w_editor_up .w_tab_a li{float:left;margin-right:5px;color:#666;}
.w_editor_up .w_tab_a li a{float:left;display:block;line-height:22px;padding:0 15px;border:1px solid #ddd;color:#666;background-color:#fbf9fa;}
.w_editor_up .w_tab_a li a:hover{background-color:#fff;text-decoration:none;}
.w_editor_up .w_tab_a .none_css a{border:none;background-color:none;line-height:18px;margin-top:2px;}
.w_editor_up .w_tab_a .none_css a:hover{background-color:#f8f8f8;color:#3366cc;}
.w_editor_up .w_tab_a .none_css .wy_tips:hover{color:#666;}
.wy_tips{background:url($imgpath/post/c_editor/w_edit_but.png) right center no-repeat;float:left;}
.wy_tips i{display:none;}
.wy_tips:hover{color:#333;_position:relative;text-decoration:none;}
.wy_tips:hover i{display:block; position:absolute;border:1px solid #f8ad48;background:#fffeed;padding:2px 5px;color:#333;font-style:normal;line-height:130%;word-break:keep-all;word-wrap:no-wrap;}
.w_editor_up .w_tab_a .current a{background:#fff;border-bottom:none;color:#333;padding-bottom:1px;}
.w_editor_up_con{background-color:#ffffff;padding:10px;border-top:1px solid #ddd;}
.bta {
background:none repeat scroll 0 0 #FFFFFF;
border:1px solid #D5E6ED;
color:#333333;
cursor:pointer;
line-height:22px;
width:5px;
margin:0 3px;
padding:0 8px;
white-space:nowrap;
}
</style>
<!--
EOT;
//max attachnum
$uploadedNum = $winddb['uploadtime'] < $tdtime ? 0 : $winddb['uploadnum'];
if ($_G['allownum'] > 0 && $_G['allownum'] - $uploadedNum<$db_attachnum){
	$maxAttachnum = $_G['allownum'] - $uploadedNum;
} else {
	$maxAttachnum = $db_attachnum;
}
if ($isGM || ($db_allowupload && $_G['allowupload'] && (!$_G['allownum'] || $winddb['uploadnum'] < $_G['allownum'])) || $attach) {print <<<EOT
-->
<table cellPadding="0" cellSpacing="0" style="display:none" width="100%">
	<tbody id="att_mode"><tr>
		<td class="review_bg"><input class="input" type="file" name="attachment_" style="width:200px;overflow:hidden;"/></td><td><input class="input" type="text" name="atc_desc" size="25" /></td>
		<td style="display:none;"><select name="att_special" onchange="newAtt.sel(this);" style="width:60px;"><option value="0"></option><option value="1">加密</option><option value="2">出售</option></select></td>
		<td style="display:none;"><select name="att_ctype" style="width:60px;">{$alltype}</select></td>
		<td style="display:none;"><input class="input" type="text" name="atc_needrvrc" value="0" size="1" /></td>
		<td></td></tr>
	</tbody>
</table>
<script type="text/javascript">
var allowmutinum = parseInt('$maxAttachnum');
var allow_ext = '$uploadfiletype';
var allow_size = '$uploadfilesize';
var attachnum = parseInt('$db_attachnum');
</script>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript" src="js/upload.js"></script>
<!--
EOT;
}print <<<EOT
-->
<script type="text/javascript" src="js/post.js"></script>
<script type="text/javascript" src="js/date.js"></script>
	<div style="padding:0 40px;">
		<div class="mt30 f14 b g_hD ">發起活動</div>
		<div class="p10 mt10">
		<form action="{$basename}a=$a&job=$job&cyid=$cyid" method="post" enctype="multipart/form-data" name="FORM" onsubmit="return checkpost(document.FORM);" >
		<input type="hidden" name="step" value="3" />
		<input type="hidden" name="id" value="$id" />
		<input type="hidden" name="owner" value="{$active[uid]}" />
			<table width="100%" border="0" cellspacing="0" cellpadding="0" class="g_table2 vt">
				<tr>
					<td width="120px">活動名稱&nbsp;<span class="s1">*</span></td>
					<td>
						<input type="text" class="input input_wb" name="atc_title" id="atc_title" value="{$active[title]}" />
						<span id="atc_title_warn" class="s6">限 $db_titlemax 字節</span>
					</td>
				</tr>
				<tr>
					<td>活動類型&nbsp;<span class="s1">*</span></td>
					<td>
						<label for="type1" class="mr10"><input type="radio" id="type1" name="type" value="1" $typeCheck_1 />&nbsp;出游</label>
						<label for="type2" class="mr10"><input type="radio" id="type2" name="type" value="2" $typeCheck_2 />&nbsp;聚餐 </label>
						<label for="type3" class="mr10"><input type="radio" id="type3" name="type" value="3" $typeCheck_3 />&nbsp;舞會</label>
						<label for="type4" class="mr10"><input type="radio" id="type4" name="type" value="4" $typeCheck_4 />&nbsp;戶外</label>
						<label for="type5" class="mr10"><input type="radio" id="type5" name="type" value="5" $typeCheck_5 />&nbsp;燒烤</label>
						<label for="type6"><input type="radio" id="type6" name="type" value="6" $typeCheck_6 />&nbsp;其他</label>
					</td>
				</tr>
				<tr>
					<td>活動時間&nbsp;<span class="s1">*</span></td>
					<td>
						<input type="text" class="input input_wa" name="begintime" value="$active[begintime_s]" id="begintime" onClick="ShowCalendar(this.id, 1)" /><span class="p_lr_10">至</span><input type="text" class="input input_wa" name="endtime" value="$active[endtime_s]" id="endtime" onClick="ShowCalendar(this.id, 1)" />
					</td>
				</tr>
				<tr>
					<td>報名截止&nbsp;<span class="s1">*</span></td>
					<td><input type="text" class="input input_wa" name="deadline" value="$active[deadline_s]" id="deadline" onClick="ShowCalendar(this.id, 1)" /></td>
				</tr>
				<tr>
					<td>活動地點</td>
					<td>
						<input type="text" class="input input_wb" name="address" id="address" value="{$active[address]}" size="40" />
						<span id="address_warn" class="s6">限 $db_titlemax 字節</span>
					</td>
				</tr>
				<tr>
					<td>人數上限</td>
					<td><input type="text" class="input input_wa mr10" name="limitnum" value="$active[limitnum]" />(留空即是不限制)</td>
				</tr>
				<tr>
					<td>報名限制</td>
					<td>
						<label for="objecterCheck_0" class="mr20"><input type="radio" id="objecterCheck_0" name="objecter" value="0" $objecterCheck_0 />所有用戶</label>
						<label for="objecterCheck_1"><input type="radio" id="objecterCheck_1" name="objecter" value="1" $objecterCheck_1 />限本群組成員</label>
					</td>
				</tr>
				<tr>
					<td>活動費用</td>
					<td><input type="text" class="input input_wa mr10" name="price" value="$active[price]" />(留空即是免費)</td>
				</tr>
				<tr>
					<td>活動海報</td>
					<td>
						<input type="file" class="input input_wb" name="poster" value="" />
<!--
EOT;
if ($active['poster']) {print <<<EOT
-->
						<img style="height:80px" src="{$active['poster_img']}" />
<!--
EOT;
}print <<<EOT
-->
					</td>
				</tr>
				<tr>
					<td>活動介紹&nbsp;<span class="s1">*</span></td>
					<td>
						<textarea name="introduction" id="introduction" class="textareaA">$active[introduction]</textarea>
						<p id="introduction_warn" class="s6">限制 130 字節</p>
					</td>
				</tr>
				<tr>
					<td>活動詳情&nbsp;<span class="s1">*</span></td>
					<td>
<!--
EOT;
require_once PrintEOT('wysiwyg_editor_active');
print <<<EOT
-->
					</td>
				</tr>
                <tr>
                	<td></td>
                    <td>	<span class="btn"><span><button type="submit" name="Submit" >發 布</button></span></span></td>
                </tr>
			</table>
        </form>
		</div>
	</div>
<script type="text/javascript">
initCheckTextNum('atc_title','atc_title_warn','$db_titlemax');
initCheckTextNum('address','address_warn','$db_titlemax');
initCheckTextNum('introduction','introduction_warn',130);
document.FORM.Submit.disabled = false;
var cnt = 0;
function checkpost(obj) {
	if (obj.atc_title.value == "") {
		showDialog("error","活動名稱不能為空",2,function(){obj.atc_title.focus();});
		return false;
	} else if (obj.type.value == "") {
		obj.atc_title.focus();
		showDialog("error","請選擇活動類型",2);
		return false;
	} else if (obj.limitnum.value && obj.limitnum.value != parseInt(obj.limitnum.value)) {
		obj.limitnum.focus();
		showDialog("error","人數上限類型為數字!",2);
		return false;
	} else if (obj.price.value && obj.price.value != parseFloat(obj.price.value)) {
		obj.price.focus();
		showDialog("error","活動費用類型為數字!",2);
		return false;
	} else if (!obj.begintime.value|| !obj.endtime.value) {
		obj.begintime.focus();
		showDialog("error","請填寫活動開始時間和結束時間!",2);
		return false;
	} else if (compTime(obj.begintime.value,obj.endtime.value) == 1 || compTime(obj.begintime.value,obj.endtime.value) == 0) {
		obj.atc_title.focus();
		showDialog("error","活動開始時間不能大于結束時間!",2);
		return false;
	} else if (obj.deadline.value == "") {
		obj.deadline.focus();
		showDialog("error","請填寫報名截止時間!",2);
		return false;
	} else if (compTime(obj.deadline.value,obj.endtime.value) == 1 || compTime(obj.deadline.value,obj.endtime.value) == 0) {
		obj.deadline.focus();
		showDialog("error","報名截止時間不能大于活動結束時間!",2);
		return false;
	} else if (obj.introduction.value == "") {
		obj.introduction.focus();
		showDialog("error","請填寫活動介紹!",2);
		return false;
	} else if (obj.atc_content.value == "") {
		showDialog("error","活動詳情不為空!",2,function(){
			editor.focus();
		});
		return false;
	}
	document.FORM.Submit.disabled = true;
	cnt++;

	if (cnt != 1) {
		showDialog("warning","Submission Processing. Please Wait");
		return false;
	}
	return true;
}
//時間比較函數
function compTime(beginTime, endTime) {

    var beginTimes = beginTime.split(' ');
    var endTimes = endTime.split(' ');

    var beginTimes_0 = beginTimes[0].split('-');
    var endTimes_0 = endTimes[0].split('-');

    //parse方法要求短日期可以使用“/”或“-”作為分隔符，但是必須用月/日/年的格式來表示
    //使用"/"兼容 IE和Firefox

    beginTime = beginTimes_0[1] + '/' + beginTimes_0[2] + '/' + beginTimes_0[0] + '/ ' + beginTimes[1];
    endTime = endTimes_0[1] + '/' + endTimes_0[2] + '/' + endTimes_0[0] + '/ ' + endTimes[1];

    var parseBeginTime = Date.parse(beginTime);
    var parseEedTime = Date.parse(endTime);
    if (parseBeginTime > parseEedTime) {
        return 1;
    } else if (parseBeginTime < parseEedTime) {
        return -1;
    } else if (parseBeginTime == parseEedTime) {
        return 0;
    } else {
        return 'exception'
    }
}
</script>
	<div id="menu_face" class="menu" style="display:none;"></div>
	<div id="menu_generalface" class="menu" style="display:none;"></div>
<!--
EOT;
}print <<<EOT
-->
<div class="c">&nbsp;</div>
<!--
EOT;
?>