// JavaScript Document
function chapter(ida,idt,idb,title){
	/*var novelbackground=document.getElementById('novelbackground').value;
	var novelcolor=document.getElementById('novelcolor').value;
	var novelsize=document.getElementById('novelsize').value;*/
	ajaxs('?action=chaptercontent&id='+ida+'&idt='+idt+'&ids='+idb,"tme="+new Date());
	var chaptercontent=window.open('','','toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
	chaptercontent.document.open();
	chaptercontent.document.onselectstart=new Function("return false");
	chaptercontent.document.onselect=new Function("return false");
	chaptercontent.document.oncontextmenu=new Function("return false");
	chaptercontent.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r\n');
	chaptercontent.document.write('<html xmlns="http://www.w3.org/1999/xhtml">\r\n');
	chaptercontent.document.write('<head>\r\n');
	chaptercontent.document.write('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\r\n');
	chaptercontent.document.write('<title></title>\r\n');
	chaptercontent.document.write('</head>\r\n');
	chaptercontent.document.write('<body>\r\n');
	chaptercontent.document.write('<div style="font-size:36px;text-align:center;">'+title+'</div><br />');
	chaptercontent.document.write('<div id="chaptercontent">\r\n');
	chaptercontent.document.write('</div>\r\n');
	chaptercontent.document.write('</body>\r\n');
		chaptercontent.document.write('</html>\r\n');
	onAjax=function(chaptercontents){
		chaptercontent.document.getElementById("chaptercontent").innerHTML=chaptercontents+"\r\n";
		chaptercontent.document.close();
	}
}
function volumeconfirm(mes,url,nourl){
	if(confirm(mes)){
		window.location.href=url;
		return true;
	}else{
		window.location.href=nourl;
		return false;
	}
}
function passchecklevel(idu){
	if(idu.value.length>=12&&!idu.value.match('^[0-9]+$')&&!idu.value.match('^[a-zA-Z]+$')){
		getob(idu.name+'s').innerHTML='密碼強度：高';
	}else if(idu.value.length>=6&&!idu.value.match('^[0-9]+$')){
		getob(idu.name+'s').innerHTML='密碼強度：中';
	}else if(idu.value.length>=1){
		getob(idu.name+'s').innerHTML='密碼強度：低';
	}else{
		getob(idu.name+'s').innerHTML='';
	}
}
function checkecpassand(idu){
	if(idu.value!=getob('passe').value&&idu.value!=''){
		getob(idu.name+'s').innerHTML='確認密碼與登入密碼不相符！';
	}else{
		getob(idu.name+'s').innerHTML='';
	}
}
function emailchecked(idu){
	if(idu.value!=''&&!idu.value.match('^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$')){
		getob(idu.name+'s').innerHTML='信箱格式不正確！';
	}else{
		getob(idu.name+'s').innerHTML='';
	}
}
function telchecked(idu){
	if(idu.value!=''&&!idu.value.match('^[0-9\-\(\)]+$')){
		getob(idu.name+'s').innerHTML='電話內有錯誤字元！';
	}else{
		getob(idu.name+'s').innerHTML='';
	}
}
function novelcheckedthree(idu){
	getob(idu.name+'s').innerHTML='（限定3000字以上，目前已有'+idu.value.length+'字）';
	getob(idu.name+'e').value=idu.value.length;
}
function scriptevent(id,type){
	if(type==0){
		url=window.prompt('請輸入連結位址：','http://');
		if(url==null){return false;}
		urlname=window.prompt('請輸入連結名稱：','');
		if(urlname==null){return false;}
		id.value+="[url="+url+"]"+urlname+"[/url]";
	}else if(type==1){
		src=window.prompt('請輸入圖片位址：','http://');
		if(src==null){return false;}
		imgw=window.prompt('請輸入圖片寬度：\r\n(不設定則留空白)','');
		if(imgw==null){return false;}
		imgh=window.prompt('請輸入圖片高度：\r\n(不設定則留空白)','');
		if(imgh==null){return false;}
		imgw=(!imgw.match("^[0-9]+$")?"":" width="+imgw);
		imgh=(!imgh.match("^[0-9]+$")?"":" height="+imgh);
		id.value+="[img"+imgw+imgh+"]"+src+"[/img]";
	}else if(type==2){
		color=window.prompt('請輸入顏色代號：','');
		if(color==null){return false;}
		colortxt=window.prompt('請輸入欲改變顏色的文字：','');
		if(colortxt==null){return false;}
		id.value+="[color="+color+"]"+colortxt+"[/color]";
	}
	return true;
}