<!--<?php
require_once(uTemplate::printEot('header'));
require_once(uTemplate::printEot('user_appleft'));
InitGP('s');
print <<<EOT
-->
<div class="contUser">
<table width="100%"><tr><td valign="top" height="500">
	<div class="p15">
		<h4 class="site"><img src="u/images/module/diary.png" align="absmiddle" class="mr10" /><span>日志</span></h4>
		<div class="navC">
			<ul>
<!--
EOT;
$b = $a;
($a == 'friendslists' ||  $a == 'friendlist' || $a == 'frienddetail') && $b = 'friend';
print <<<EOT
-->
				<li id="a_friend"><a href="{$basename}a=friendslists">好友日志</a></li>
				<li id="a_my"><a href="{$basename}">我的日志</a></li>
<script type="text/javascript">
setCurrent('a_$b','a_my','current');
</script>
			</ul>
			<span class="btn_add fl"><span><button onclick="window.location.href='{$basename}a=write';">写新日志</button></span></span>
		</div>
<!--
EOT;
if ($a == "list") {print <<<EOT
-->
		<div class="sidebar fr">
<!--
EOT;
require_once PrintEot('m_diary_type');
print <<<EOT
-->        
		</div>
	<div class="contentB">
	<div class="p10 cc">
<!--
EOT;
$privacy = array('全站可见','仅好友可见','仅自己可见');
if ($diaryDb) {print <<<EOT
-->
		<div class="dlB">
<!--
EOT;
foreach($diaryDb as $value){
$typename = !$value[dtid] ?  '默认分类' : $diaryType[$value[dtid]][name];
!$value[dtid] && $value[dtid] = '-1';
$title = '所属:'.$value[username].'&nbsp;'.$value[title];
$descrip = $value[subject];
print <<<EOT
-->
		<dl class="dl">
			<dt class="dt mb10">
			<p class="mb5"><a href="{$basename}a=detail&did=$value[did]" class="b f14">{$value[subject]}</a></p><span class="gray mr5">{$value[postdate]}</span><a class="mr5 s7" href="{$basename}a=edit&did=$value[did]">编辑</a><a href="javascript:;" class="s7" onclick="pwConfirm('是否确认删除？',this,function(){delDiary('$value[did]','$value[uid]')})">删除</a></dt>
			<dd class="dd">
				<p class="mb10">{$value[content]}</p>
				<cite class="gray">
				<a href="{$basename}a=detail&did=$value[did]" class="fr s7">阅读全文&raquo;</a>
				分类：<a class="s7" href="{$basename}dtid=$value[dtid]">{$typename}</a><span class="p_lr_10">|</span>回复：{$value[c_num]}<span class="p_lr_10">|</span>浏览：{$value[r_num]}<span class="p_lr_10">|</span>
{$privacy[$value[privacy]]}
				</cite>
			</dd>
		</dl>
<!--
EOT;
}print <<<EOT
-->
		</div>
		<div class="mb10 cc">$pages</div>
<!--
EOT;
} else {print <<<EOT
-->
<!--
EOT;
		if (!$dtid) {print <<<EOT
-->
			<div class="p10 f14 tac">暂无日志</div>
<!--
EOT;
		} else {print <<<EOT
-->
			<div class="p10 f14 tac">此分类下暂无日志</div>
<!--
EOT;
		}print <<<EOT
-->
<!--
EOT;
}print <<<EOT
-->
	</div>
	</div>
<!--
EOT;
} elseif ($a == "detail") {
$copy = $diary[copyurl] ? '转载于' : '发表于';

print <<<EOT
-->
	<div class="cc contentB">
	<div id="diary_$did"></div>
	<div class="p10 bdB">
		<div class="fr">
		<a href="apps.php?q=collection&a=favor&type=diary&ajax=1&id={$diary['did']}" onclick="return ajaxurl(this)" class="mr20 allCollect">收藏</a>
<!--
EOT;
if ($weiboPriv) {print <<<EOT
-->
<a href="javascript:;" onclick="sendmsg('operate.php?action=toweibo&ajax=1&type=diary&id=$did','',this.id);" class="allForward">新鲜事</a>
<!--
EOT;
}print <<<EOT
-->
		</div>
		<a href="apps.php?q=diary" class="lh_18">返回列表</a>
	</div>
	<div class="p10">
					<h1 class="mb10">{$diary[subject]}</h1>
					<p class="gray mb5"><span class="mr5">{$diary[postdate]}</span>
<!--
EOT;
if ($winduid) {print <<<EOT
-->
						<a class="mr5 s7" href="{$basename}a=edit&did=$diary[did]">编辑</a> 
<!--
EOT;
}if($winduid || $SYSTEM['deldiary']){print <<<EOT
-->                         
						<a href="javascript:;" class="s7" onclick="pwConfirm('是否确认删除？',this,function(){delDiary('$diary[did]','$winduid','read')})">删除</a>
<!--
EOT;
}print <<<EOT
-->
					</p>
<!--
EOT;
if($diary[copyurl]){print <<<EOT
-->
					<div class="mb20 s5">转载自：<a href="{$db_userurl}$diary[copyuid]" target="_blank" class="s2 mr5">$diary[copyer]</a><a href="$diary[url]" target="_blank">$diary[url]</a></div>
<!--
EOT;
}print <<<EOT
-->
					<div class="contentText s5 f14 mb20">
					<table style="table-layout: fixed;" class="vt"><tr><td height="200">
						{$diary[content]}
<!--
EOT;
if($diary['pic']){
foreach($diary['pic'] as $pic){
if($pic){print <<<EOT
-->
						<div class="f12" id="att_$pic[aid]" style="width:450px;overflow:hidden;margin:5px 0px 5px 0;">
<!--
EOT;
if($pic['desc']){print <<<EOT
-->
							描述:$pic[desc]<br />
<!--
EOT;
}print <<<EOT
-->
<!--
EOT;
if ($pic[img]) {print <<<EOT
-->
							图片:$pic[img]
<!--
EOT;
if($pic['dfadmin']){print <<<EOT
-->
							[<a style="cursor:pointer" onclick="deldiaryatt('$diary[did]','$pic[aid]');">删除</a>]
<!--
EOT;
}}print <<<EOT
-->
						</div>
<!--
EOT;
}}}print <<<EOT
-->
					</td></tr></table>
					</div>
					<div class="mb10">
<!--
EOT;
$typename = !$diary[dtid] ?  '默认分类' : $diaryType[$diary[dtid]][name];
!$diary[dtid] && $diary[dtid] = '-1';
$privacy = array('全站可见','仅好友可见','仅自己可见');
print <<<EOT
--->
						分类：<a href="{$basename}dtid=$diary[dtid]" class="s7">{$typename}</a><span class="p_lr_10">|</span>回复：{$diary[c_num]}<span class="p_lr_10">|</span>浏览：{$diary[r_num]}<span class="p_lr_10">|</span>{$privacy[$diary[privacy]]}<!--
EOT;
if ($_G['allowreport']) {print <<<EOT
--><span class="p_lr_10">|</span><a class="mr10 s7" href="javascript:;" onclick="sendmsg('pw_ajax.php?action=report&type=diary&tid=$did&pid=$winduid','',this.id);" id="report_diary">举报</a> 
<!--
EOT;
}print <<<EOT
-->				

                    </div>
					<div class="mb10">
						<p class="mb5">下一篇：
						<!-- 
EOT;
if(empty($diaryNextName)){print <<<EOT
-->
<span>无</span>
<!--
EOT;
}else{print <<<EOT
-->
						<a href="{$basename}a=next&did=$diary[did]" onclick="return ajaxpage(this.href,'next','$winduid','$space');">{$diaryNextName}</a>
<!--
EOT;
}print <<<EOT
-->
</p>
<p>上一篇：
<!-- 
EOT;
if(empty($diaryPreName)){print <<<EOT
-->
<span>无</span>
<!--
EOT;
}else{print <<<EOT
-->
<a href="{$basename}a=pre&did=$diary[did]" onclick="return ajaxpage(this.href,'pre','$winduid','$space');">{$diaryPreName}</a>
<!--
EOT;
}print <<<EOT
-->
</p>				
					</div>
<!--
EOT;
require_once PrintEot('m_comment');print <<<EOT
-->
<script type="text/javascript" src="js/pw_lwd.js"></script>
					

				</div>
	</div>
<!--
EOT;
} elseif ($a == 'friendslists') {print <<<EOT
-->
	<div class="contentB">
	<!--div class="tips">共 <em>{$count}</em> 篇日志</div-->
	<div class="p10 cc">
<!--
EOT;
$privacy = array('全站可见','仅好友可见','仅自己可见');
if($count){print <<<EOT
-->
		<div class="dlB">
<!--
EOT;
foreach($diaryDb as $value){
$typename = !$value[dtid] ?  '默认分类' : $value[typename];
$title = '所属:'.$value[username].'&nbsp;'.$value[title];
$descrip = $value[subject];
$author = "<a href=\"{$db_userurl}$value[uid]\" class=\"b s5 _cardshow\" target=\"_blank\" data-card-url=\"pw_ajax.php?action=smallcard&type=showcard&uid={$value[uid]}\" data-card-key=\"{$value[username]}\">$value[username]:</a> ";

print <<<EOT
-->
						<dl class="dl">
							<dt class="dt mb10">
								<p class="mb5 f14">{$author}<a href="{$basename}a=frienddetail&fuid={$value[uid]}&did=$value[did]" class="b">{$value[subject]}</a></p><span class="gray mr5">{$value[postdate]}</span>
<!--
EOT;
if ($SYSTEM['deldiary']) {print <<<EOT
-->
								<a href="javascript:;" onclick="pwConfirm('是否确认删除？',this,function(){delDiary('$value[did]','$value[uid]')})" class="s7">删除</a>
<!--
EOT;
}print <<<EOT
-->
							</dt>
							<dd class="dd">
								<p class="mb20">{$value[content]}</p>
								<cite class="gray">
									<a href="{$basename}a=frienddetail&fuid=$value[uid]&did=$value[did]" class="fr s7">阅读全文&raquo;</a>
<!--
EOT;
!$value[dtid] && $value[dtid] = '-1';
print <<<EOT
-->
									分类：<a class="s7" href="{$basename}a=friendlist&fuid=$value[uid]&dtid=$value[dtid]">{$typename}</a><span class="p_lr_10">|</span>回复：{$value[c_num]}<span class="p_lr_10">|</span>浏览：{$value[r_num]}<span class="p_lr_10">|</span>

									{$privacy[$value[privacy]]}
								</cite>
							</dd>
						</dl>
<!--
EOT;
}print <<<EOT
-->	
					</div>
				<div class="p10 cc">$pages</div>
<!--
EOT;
}else{print <<<EOT
-->

<!--
EOT;
		if (!$dtid) {print <<<EOT
-->
			<div class="p10 f14 tac">好友暂无日志</div>
<!--
EOT;
		} else {print <<<EOT
-->
			<div class="p10 f14 tac">此分类下暂无日志</div>
<!--
EOT;
		}print <<<EOT
-->
<!--
EOT;
}print <<<EOT
-->
	</div>
	</div>
<!--
EOT;
} elseif ($a == 'friendlist') {print <<<EOT
-->
<div class="sidebar fr">
	<div class="c mb10">&nbsp;</div>
<!--
EOT;
require_once PrintEot('m_diary_type');
print <<<EOT
-->        
</div>
	<!--div class="tips">共 <em>{$count}</em> 篇日志</div-->
	<div class="contentB">
	<div class="p10 cc">
<!--
EOT;
$privacy = array('全站可见','仅好友可见','仅自己可见');
if($count){print <<<EOT
-->
			<div class="dlB">
<!--
EOT;
foreach($diaryDb as $value){
$typename = !$value[dtid] ?  '默认分类' : $diaryType[$value[dtid]][name];
$title = '所属:'.$value[username].'&nbsp;'.$value[title];
$descrip = $value[subject];
$author = "<a href=\"{$db_userurl}$value[uid]\" class=\"b s5\">$value[username]:</a> ";

print <<<EOT
-->
				<dl class="dl">
					<dt class="dt mb10">
						<p class="mb5 f14">{$author}<a href="{$basename}a=frienddetail&fuid={$value[uid]}&did=$value[did]" class="b">{$value[subject]}</a></p>
						<span class="gray mr5">{$value[postdate]}</span>
<!--
EOT;
if ($SYSTEM['deldiary']) {print <<<EOT
-->
						<a class="s7" href="javascript:;" onclick="pwConfirm('是否确认删除？',this,function(){delDiary('$value[did]','$value[uid]')})">删除</a>
<!--
EOT;
}print <<<EOT
-->
					</dt>
					<dd class="dd">
						<p class="mb20">{$value[content]}</p>
<!--
EOT;
!$value[dtid] && $value[dtid] = '-1';
print <<<EOT
-->
						<cite class="gray"><a href="{$basename}a=frienddetail&fuid={$value[uid]}&did=$value[did]" class="fr s7">阅读全文&raquo;</a>分类：<a class="s7" href="{$basename}a=friendlist&fuid=$value[uid]&dtid=$value[dtid]">{$typename}</a><span class="p_lr_10">|</span>回复：{$value[c_num]}<span class="p_lr_10">|</span>浏览：{$value[r_num]}<span class="p_lr_10">|</span>

						{$privacy[$value[privacy]]}
						</cite>
					</dd>
				</dl>
<!--
EOT;
}print <<<EOT
-->	
					</div>
				<div class="p10 cc">$pages</div>
<!--
EOT;
}else{print <<<EOT
-->			

<!--
EOT;
		if (!$dtid) {print <<<EOT
-->
			<div class="p10 f14 tac">好友暂无日志</div>
<!--
EOT;
		} else {print <<<EOT
-->
			<div class="p10 f14 tac">此分类下暂无日志</div>
<!--
EOT;
		}print <<<EOT
-->

<!--
EOT;
}print <<<EOT
-->
	</div>
	</div>
<!--
EOT;
} elseif ($a == 'frienddetail') {print <<<EOT
-->
	<div class="sidebar fr">
<!--
EOT;
require_once PrintEot('m_diary_type');
print <<<EOT
-->        
	</div>
	<div class="contentB">
		<div class="p10 cc">
			<div class="fr">
<a href="apps.php?q=collection&a=favor&type=diary&ajax=1&id={$diary['did']}" onclick="return ajaxurl(this)" class="mr20 allCollect">收藏</a>
<!--
EOT;
if ($weiboPriv) {print <<<EOT
-->
<a href="javascript:;" onclick="sendmsg('operate.php?action=toweibo&ajax=1&type=diary&id=$did','',this.id);" class="allForward">新鲜事</a>
<!--
EOT;
}print <<<EOT
-->
		</div>
		<h1 class="mb5"><a href="{$db_userurl}$diary[uid]" class="b s5 _cardshow" target="_blank" data-card-url="pw_ajax.php?action=smallcard&type=showcard&uid={$diary['uid']}" data-card-key="{$diary['username']}">$diary[username]</a>: <span class="s4">{$diary[subject]}</span></h1>
					<p class="mb10 gray"><span class="mr5">{$diary[postdate]}</span>
<!--
EOT;
if($SYSTEM['deldiary']){print <<<EOT
-->
							<a class="s7" href="javascript:;" onclick="pwConfirm('是否确认删除？',this,function(){delDiary('$diary[did]','$winduid','read')})">删除</a>
<!--
EOT;
}print <<<EOT
-->
					</p>
					<div class="contentText s5 f14 mb20" id="img-width">
					<table style="table-layout: fixed;"><tr class="vt"><td height="200">
					<div class="mb10">{$diary[content]}</div>
<!--
EOT;
if($diary['pic']){
foreach($diary['pic'] as $pic){
if($pic){print <<<EOT
-->
						<div class="f12 mb10" id="att_$pic[aid]" style="width:450px;overflow:hidden;">
<!--
EOT;
if($pic['desc']){print <<<EOT
-->
							描述:$pic[desc]<br />
<!--
EOT;
}print <<<EOT
-->
							图片:$pic[img]
<!--
EOT;
if($pic['dfadmin']){print <<<EOT
-->
							[<a style="cursor:pointer" onclick="deldiaryatt('$diary[did]','$pic[aid]');">删除</a>]
<!--
EOT;
}print <<<EOT
-->
						</div>
<!--
EOT;
}}}print <<<EOT
-->


					</td></tr></table>
					</div>    
					<div class="mb10">
							<span class="gray">
<!--
EOT;
$typename = !$diary[dtid] ?  '默认分类' : $diaryType[$diary[dtid]][name];
!$diary[dtid] && $diary[dtid] = '-1';
$privacy = array('全站可见','仅好友可见','仅自己可见');
print <<<EOT
--->
							分类：<a href="{$basename}a=friendlist&fuid=$diary[uid]&dtid=$diary[dtid]" class="s7">{$typename}</a><span class="p_lr_10">|</span>回复：{$diary[c_num]}<span class="p_lr_10">|</span>浏览：{$diary[r_num]}<span class="p_lr_10">|</span>{$privacy[$diary[privacy]]}<!--
EOT;
if ($_G['allowreport']) {print <<<EOT
--><span class="p_lr_10">|</span><a class="s7" href="javascript:;" onclick="sendmsg('pw_ajax.php?action=report&type=diary&tid=$did&pid=$fuid','',this.id);" id="report_diary">举报</a><!--
EOT;
}if($diary[ifcopy]){print <<<EOT
--><span class="p_lr_10">|</span><a href="{$basename}a=copydiary&did=$diary[did]" onclick="return ajaxurl(this);" class="s7">转载</a>
<script type="text/javascript">
function ajaxurl(o) {
	read.obj = o;
	ajax.send(o.href,'',ajax.get);
	return false;
}
</script>
<!--
EOT;
}print <<<EOT
-->
							</span>
					</div>
					<div class="mb10 cc">
<!-- 
EOT;
$rateSets = unserialize($db_ratepower);
if($rateSets[2] && isset($db_hackdb['rate'])){
print <<<EOT
-->	 
						<link rel="stylesheet" type="text/css" href="hack/rate/images/rate.css" />
						<script type="text/javascript" src="js/rate_ajax.js"></script>
						<script type="text/javascript">
						window.onload = function() {
							rate.getVote("vote_box","{$db_bbsurl}/hack.php?H_name=rate&action=ajax","elementid=vote_box&typeid=2&objectid={$did}&authorid={$uid}");
						};
						</script>						
						<div id="vote_box"></div>
<!-- 
EOT;
}
print <<<EOT
-->
					</div>
					<div class="c">&nbsp;</div>
					<div class="mb10">
						<p class="mb5">下一篇：
<!-- 
EOT;
if(empty($friendDiaryNextName)){print <<<EOT
-->
<span>无</span>
<!--
EOT;
}else{print <<<EOT
-->
						<a href="{$basename}a=next&fuid={$fuid}&did=$diary[did]" onclick="return ajaxpage(this.href,'next','$fuid','$space');">{$friendDiaryNextName}</a>
	<!--
EOT;
}print <<<EOT
-->
</p>
<p>上一篇：
<!-- 
EOT;
if(empty($friendDiaryPreName)){print <<<EOT
-->
<span>无</span>
<!--
EOT;
}else{print <<<EOT
-->					
						<a href="{$basename}a=pre&fuid={$fuid}&did=$diary[did]" onclick="return ajaxpage(this.href,'pre','$fuid','$space');">{$friendDiaryPreName}</a>
					<!--
EOT;
}print <<<EOT
-->
</p>
					</div>
<!--
EOT;
require_once PrintEot('m_comment');print <<<EOT
-->
<script type="text/javascript" src="js/pw_lwd.js"></script>
		</div>
	</div>
<!--
EOT;
} elseif ($a == 'write' || $a == 'edit') {
print <<<EOT
-->
	<div class="p10 bdB cc">
<!--
EOT;
if ($a == 'write') {
$weibocheck = 'checked=checked';
$weibodisplay = '';
print <<<EOT
-->
            写新日志
<!--
EOT;
} else {
print <<<EOT
-->
            编辑日志
<!--
EOT;
}
$shortcut=$_GET['s']?'target=formTarget':'';
$formiframe=$shortcut?"<iframe width=0 height=0 name=formTarget src='javascript:;' onload=\"this.contentWindow.document.body.innerHTML.indexOf('操作完成')==-1?'':showDialog('success','日志发表成功！')&setEditorContent()&(read.menu.style.top='400px')&getObj('FORM').reset()\"></iframe>":"";
print <<<EOT
-->
            | <a href="{$basename}">返回我的日志</a>
	</div>
	<div class="p15">
			<form action="{$basename}a=$a" method="post" enctype="multipart/form-data" onsubmit="return checkpost(document.FORM);" name="FORM" id="FORM" $shortcut />
			<input type="hidden" name="did" value="$did" />
			<input type="hidden" name="dtided" value="$diary[dtid]" />
			<input type="hidden" name="privacyed" value="$diary[privacy]" />
			<input type="hidden" name="atc_autourl" value="1" />
			<input type="hidden" name="step" value="2" />
			<input type="hidden" name="verify" value="$verifyhash" />
			<input type="hidden" name="diraryAjax" value="1" />
			<div>
			<div class="mb10">
			<input type="text" class="input input_wb mr10" name="atc_title" id="atc_title" tabindex="1" value="$diary[subject]"/><span id="atc_title_warn" class="gray">限 $db_titlemax 字节</span>
			<div id="menu_face" class="menu" style="display:none;"></div>
			</div>
			<div class="cc">
<!--
EOT;
require_once PrintEot('wysiwyg_editor_diary');
print <<<EOT
-->
			</div>
            <table cellpadding="0" cellspacing="0" width="100%" style=" table-layout:fixed;">
                <tr class="tr3">
                    <td width="62">日志分类</td>
                    <td><span class="dropdown mr10">
                        <select name="dtid" id="dtid_add"><option value="0" $dtid_0>默认分类</option>$dtsel</select></span><span class="btn_add"><span><button onclick="javascript:add_dtid('$uid','dtid_add');" type="button">添加分类</button></span></span>
                    </td>
                </tr>
                <tr class="tr3">
                    <td>隐私设置</td>
                    <td>
										<span class="dropdown mr10">
                        <select name="privacy" id="dtid_pvc" onchange="optionsel(this.value,'{$sendWeiboPrivacy}')">
                            <option value="0" $privacy_0>全站可见</option>
                            <option value="1" $privacy_1>仅好友可见</option>
                            <option value="2" $privacy_2>仅自己可见</option>
                        </select>
										</span>
						<label for="if_copy" class="mr10">
							<input id="if_copy" type="checkbox" name="ifcopy" value="1" $checked $disabled>&nbsp;允许转载
						</label>
<!--
EOT;
if ($myAppsData['diary_isfeed']) {print <<<EOT
-->
						<label for="if_sendweibo" class="mr10" $weibodisplay id="lab_weibo">
							<input id="if_sendweibo" type="checkbox" name="ifsendweibo" value="1" $weibocheck >&nbsp;同时发送到新鲜事
						</label>
<!--
EOT;
}print <<<EOT
-->
						<!-- 将$convertChecked 替换成 checked="checked" -->
						<label for="atc_convert" style="display: none">
                       		 <input type="checkbox" name="atc_convert" id="atc_convert" value="1" checked="checked"/>&nbsp;Wind Code自动转换
                        </label>
                       
                    </td>
                </tr>
<!--
EOT;
if ($o_diary_gdcheck) {
$checkCode = L::loadClass('checkcode', 'site');
$checkCodeString = $checkCode->getCheckCodeTemplate();
print <<<EOT
-->
                <tr class="tr3 vt">
                    <td>验证码:</td>
                    <td>
                        <input class="input" onfocus="showgd();" type="text" name="gdcode" id="gdcode" size="5" tabindex="3"  />
                        <span id="ckcode" style="display:none;"></span>
$checkCodeString
                    </td>
                </tr>
<!--
EOT;
}if($db_question && $o_diary_qcheck){
if($db_imagequestion){
	$question = '<img id="ckquestion" src="ckquestion.php?q='.$qkey.'&t='.$timestamp.'" align="top">';
}else{
	$question = $qkey<0 ? getMachineQuestion_1() :  $db_question[$qkey];
}
$q_a = $question.($showq && $qkey>0?" （答案：".$db_answer[$qkey] . '）' : '');
print <<<EOT
-->
                <tr class="tr3">
                    <td>验证问题:</td>
                    <td style="line-height:30px">
                    {$q_a} 
                    <input class="input" name="qanswer" id="qanswer" size="25" tabindex="7" />
                    <input type="hidden" name="qkey" id="qkey" value="$qkey" />
                    </td>
                </tr>
<!--
EOT;
}print <<<EOT
-->
                <tr>
                    <td>&nbsp;</td>
                    <td>
                    <div class="p10">
                    	<span class="btn">
                    		<span><button name="Submit" type="submit">提 交</button></span>
                    	</span>
                    	<span class="bt">
                    		<span><button type="button" class="w_bt" onclick="savedraft();return false;">存为草稿</button></span>
                    	</span>
                    	</div>
                    </td>
                </tr>
            </table>
			</div><div id="divload"></div>
			</form>
    </div>
<!--
EOT;
if($a == 'edit'){print <<<EOT
-->

<!--
EOT;
}else{print <<<EOT
-->
<script type="text/javascript">setTimeout("document.FORM.atc_title.focus()",50);</script>
<!--
EOT;
}print <<<EOT
-->
<script type="text/javascript">var stylepath = 'wind';</script>
<script type="text/javascript">
var charset = '$db_charset';
var titlemax = '$db_titlemax';
var postmax = '$db_postmax';
initCheckTextNum('atc_title','atc_title_warn',titlemax);
initCheckTextNum('textarea','textarea_warn',postmax);
var cnt  = 0;
document.FORM.Submit.disabled = false;
function checkpost(obj) {
	if (strlen(obj.atc_title.value) > $db_titlemax) {
		showDialog("error","日志<span class='s1'>标题</span>不能大于 <span class='s1'>$db_titlemax</span> 个字节",2);
		obj.atc_title.focus();
		return false;
	}
	if (strlen(obj.atc_content.value) < $db_postmin) {
		obj.atc_content.setAttribute("hasError", 1);
		showDialog({
			type: "error",
			message: "日志<span class='s1'>内容</span>不能少于 <span class='s1'>$db_postmin</span> 个字节",
			autoHide:2
		});
		return false;
	} else if (strlen(obj.atc_content.value) > $db_postmax) {
		obj.atc_content.setAttribute("hasError", 1);
		showDialog({
			type: "error",
			message: "日志<span class='s1'>内容</span>不能大于 <span class='s1'>$db_postmax</span> 个字节",
			autoHide:2
		});
		return false;
	}
	var pattern = /\[url=(\d+)\]/gmi;
	var str = obj.atc_content.value;
	var res;
	while( (res = pattern.exec(str))!=null )
	{
		if(getObj('attachment_'+a[1]).value==''){
			str=str.replace(new RegExp('\\\\[url='+a[i]+'\]','gm'),'');
		}
	}
	obj.atc_content.value = str;	
	SubmitAjax(obj);
	return false;
}
//ajax提交数据 
function SubmitAjax(obj) {
	document.FORM.Submit.disabled = true;
	getObj('divload').innerHTML = showLoading();
	cnt++;
	ajax.send("apps.php?q=diary&a=$a", obj, function(){
		if(undefined == ajax.request.responseText){
			showDialog({
				type: 'error',
				message: '请求超时!'
			});
			getObj('divload').innerHTML = "";
			document.FORM.Submit.disabled = false;
			return false;
		}
		var rText = ajax.request.responseText.split('\t');
		if (rText[0] == 'success') {
			window.onbeforeunload = function(){};
			window.location =  rText[1];
		} else {
			showDialog('error', rText[0]);
		}
		cnt = 0;
		document.FORM.Submit.disabled = false;
		getObj('divload').innerHTML = "";
		return false;
	});
}
function showLoading(){
	return "<div id=\"loading\" style=\"padding:20px;width:80%;text-align:center\"><img src=\""+imgpath+"/loading.gif\" align=\"absbottom\" alt=\"loading\" /> 正在加载数据...</div>";
}
</script>
<script type="text/javascript" src="js/post.js"></script>
<!--
EOT;
}print <<<EOT
-->
<script type="text/javascript" src="apps/diary/js/diarytype.js"></script>
<script type="text/javascript" src="js/app_type.js"></script>
<script type="text/javascript" src="js/app_comment.js"></script>
<script type="text/javascript" src="js/select.js"></script>
<script type="text/javascript">
var ifcheck = true;
function CheckAll(form,match) 
{
	for (var j = 0; j < form.length; j++) {
		for (var i = 0; i < form[j].elements.length; i++) {
			var e = form[j].elements[i];
			if (e.type == 'checkbox' && (typeof match == 'undefined' || e.name.match(match))) {
				e.checked = ifcheck;
			}
		}
	}
	ifcheck = ifcheck == true ? false : true;
}
</script>
<div class="c">&nbsp;</div>
</div>
</td></tr></table>
<script type="text/javascript">
var ld=window.onload;
window.onReady(function(){
	new sSelect(getObj('dtid_add'));
	new sSelect(getObj('dtid_pvc'));
	//控制多媒体播放
	var videos=getElementsByClassName("video");
	for(var i=0,len=videos.length;i<len;i++){
(function(elem){
toggleVideo(elem);
})(videos[i])
	}
});
</script>
</div>
<!--
EOT;
require_once(uTemplate::printEot('footer'));
?>-->