//章节提交时进行检查
function checkChapterSubmit() {
	var chapterName = $('#chaptername').val();
	if ('' == chapterName) {
		alert('请输入新章节名');
		return false;
	}
	if (chapterName.length > 50) {
		alert('章节名不能超过50个字');
		return false;
	}

	return true;
}

// 过滤章节里的特殊字符
function filterChapter() {
	var bookName = $('#chaptername').val();
	var content = $('#content').val();
	$('#chaptername').val(filterString(bookName));
	$('#content').val(filterString(content));
}

function filterChar() {
	verifyBookInfo();
	var bookName = $('#bookname').val();
	var bookInfo = $('#bookinfo').val();
	$('#bookname').val(filterString(bookName));
	$('#bookinfo').val(filterString(description));
}

function verifyBookInfo() {
	$("#message").html("");
	var bookinfo = $("#bookinfo").val();
	if(bookinfo.length > 400) {
		alert("内容简介长度必须在400字以内！");
		return false;
	}
}

// 小说提交时检查
function checkBookSubmit(isEdit) {
	verifyBookInfo();
	if (false !== isEdit) {
		var bookName = $('#bookname').val();
		if ('' == bookName) {
			alert('请输入小说名');
			return false;
		}
		if (bookName.length > 20) {
			alert('小说名不能超过20个字');
			return false;
		}
	}
	var bookInfo = $('#bookinfo').val();
	
	if ('' == bookInfo) {
		alert('请输入小说简介');
		return false;
	}
	if (bookInfo.length < 50) {
		alert('简介不能少于50个字');
		return false;	
	}
	return true;
}