{?set $jieqi_pagetitle = "新建草稿-{$jieqi_sitename}"?}
{?set $jieqi_contenttitle = "新建草稿"?}
<script type="text/javascript">
var customprice = '{?$customprice?}';
function frmnewdraft_validate(){
  if(document.frmnewdraft.chaptername.value == ""){
    alert("请输入章节标题");
    document.frmnewdraft.chaptername.focus();
    return false;
  }
}
//统计输入字数
function show_inputwords(txt){
	txt = $_(txt);
	var words = (arguments.length > 1) ? $_(arguments[1]) : $_(txt.id + '_words');
	words.innerHTML = txt.value.replace(/[\x00-\x08\x0e-\x1f\x21-\xff]+/gi, 'w').replace(/\s/g, '').length;
}
//显示默认字数
addEvent(window, 'load', function(){show_inputwords('chaptercontent');});
</script>
<script type="text/javascript" src="{?$jieqi_url?}/scripts/attaches.js"></script>
<form class="form" name="frmnewdraft" id="frmnewdraft" action="{?$jieqi_modules['article']['url']?}/newdraft.php?do=submit" method="post" onsubmit="return frmnewdraft_validate();" enctype="multipart/form-data">
<fieldset>
	<div class="frow">
		<label class="col4 flabel">草稿类型：</label>
		<div class="col8 last">
			<label class="radio"><input type="radio" name='isvip' value='0' checked="checked" onclick="document.getElementById('selarticle').style.display='block';document.getElementById('selobook').style.display='none';if(customprice == '1') document.getElementById('sprice').style.display='none';" />免费章节</label> &nbsp; 
			<label class="radio"><input type="radio" name='isvip' value='1' onclick="document.getElementById('selarticle').style.display='none';document.getElementById('selobook').style.display='block';if(customprice == '1') document.getElementById('sprice').style.display='';" />VIP章节</label> &nbsp; 
		</div>
	</div>
	<div class="frow">
		<label class="col4 flabel">小说名称：</label>
		<div class="col8 last">
        <div id="selarticle" style="display:block;">
		<select class='select'  size='1' name='articleid' id='articleid'>
		<option value='0'>--请选择--</option>
		{?section name=i loop=$articlerows?}
		<option value='{?$articlerows[i].articleid?}'>{?$articlerows[i].articlename?}</option>
		{?/section?}
		</select>
		</div>
		<div id="selobook" style="display:none;">
		<select class='select'  size='1' name='obookid' id='obookid'>
		<option value='0'>--请选择--</option>
		{?section name=i loop=$obookrows?}
		<option value='{?$obookrows[i].obookid?}'>{?$obookrows[i].obookname?}</option>
		{?/section?}
		</select>
		</div>
		</div>
	</div>
	<div class="frow">
		<label class="col4 flabel">章节标题：</label>
		<div class="col8 last">
			<input type="text" class="text" name="chaptername" id="chaptername" maxlength="50" value="" />
		</div>
	</div>
	{?if $customprice > 0?}
	<div class="frow">
		<label class="col4 flabel">本章定价：</label>
		<div class="col8 last">
			<input type="text" class="text" name="saleprice" id="saleprice" maxlength="10" value="" /><br /><span class="hot">{?$egoldname?}(留空则自动按字数计价)</span>
		</div>
	</div>
	{?/if?}
	{?if $authtypeset > 0?}
	<div class="frow">
		<label class="col4 flabel">小说排版：</label>
		<div class="col8 last">
			<label class="radio"><input type="radio" name="typeset" value="1" checked="checked" />自动排版</label>
			<label class="radio"><input type="radio" name="typeset" value="0" />无需排版</label>
		</div>
	</div>
	{?/if?}
	{?if $uptiming > 0?}
	<div class="frow">
		<label class="col4 flabel">定时发表：</label>
		<div class="col8 last">
			<label class="radio"><input type="radio" name="uptiming" value="0" checked="checked" onclick="document.getElementById('pubtime').style.display='none';" />否</label> &nbsp; 
			<label class="radio"><input type="radio" name="uptiming" value="1" onclick="document.getElementById('pubtime').style.display='';" />是</label> &nbsp; 
		</div>
	</div>
	<div class="frow">
		<label class="col4 flabel">发表时间：</label>
		<div class="col8 last">
			<p><input type="text" class="text" style="width:4em;" name="pubyear" id="pubyear" maxlength="4" value="{?$jieqi_time|date:'Y'?}" />年<input type="text" class="text" style="width:2.4em;" name="pubmonth" id="pubmonth" maxlength="2" value="{?$jieqi_time|date:'m'?}" />月<input type="text" class="text" style="width:2.4em;" name="pubday" id="pubday" maxlength="2" value="{?$jieqi_time|date:'d'?}" />日</p>
			<p><input type="text" class="text" style="width:2.4em;" name="pubhour" id="pubhour" maxlength="2" value="" />时<input type="text" class="text" style="width:2.4em;" name="pubminute" id="pubminute" maxlength="2" value="" />分</p>
		</div>
	</div>
	{?/if?}
	<div class="frow">
		<div class="row">
		<label class="col4 flabel">章节内容：</label>
		<div class="col8 last">
			已输入 <span class="hot" id="chaptercontent_words">0</span> 字
		</div>
		</div>
		<div class="row">
		<textarea class="textarea" name="chaptercontent" id="chaptercontent" rows="15" onkeyup="show_inputwords(this);" oninput="show_inputwords(this);" onpropertychange="show_inputwords(this);"></textarea>
		</div>
	</div>
	{?if $canupload == true && $maxattachnum > 0?}
	<div class="frow">
		<label class="col4 flabel">附件限制：</label>
		<div class="col8 last">
			<span class="hot">文件类型：{?$attachtype?}, 图片最大：{?$maximagesize?}K, 文件最大：{?$maxfilesize?}K</span>
		</div>
	</div>
	<div class="frow">
		<label class="col4 flabel">附件上传：</label>
		<div class="col8 last">
			<input type="file" class="file" name="attachfile[]" id="attachfile" onchange="Attaches.addFile('attachfile', 'attachdiv', true);" /><button type="button" class="filebutton" onclick="if(document.all){document.getElementById('attachfile').outerHTML += '';}else{document.getElementById('attachfile').value = '';}">清空</button>
  			<div id="attachdiv"></div>
		</div>
	</div>
	{?/if?}
	
	<div class="frow">
		<label class="col4 flabel">&nbsp;</label>
		<div class="col8 last">
			<button type="submit" class="button" name="submit">提 交</button>
			<input type="hidden" name="act" value="newdraft" />{?$jieqi_token_input?}
		</div>
	</div>
</fieldset>
</form>