var board_url="pb";

function formsend(formid,divid,link) {
	var string = $("#"+formid).serialize();
	$.post(link,string,function(data) {
		$("#"+divid).html(data);});
}


function comment_paging(divid,link,page_get,code_get,didx_get) {
	var link = "/"+board_url+"/view_comment.php";
	$.get(link,{cmt_page:page_get,code:code_get,didx:didx_get}, function(data) {
		$("#"+divid).html(data);});
}


//임시저장글 불러오기
function load_temp_document(tidx) {
	var link = "/"+board_url+"/load_temp.php";
	$.post(link,{temp_idx:tidx},function(data) {
		$("#temp_div").html(data);});
}

function attached_remove(divid,aidx,didx,tidx) {
	var link = "/"+board_url+"/attached_remove.php";
	$.post(link,{attached_idx:aidx,document_idx:didx,temp_idx:tidx}, function(data) {
		$("#"+divid).html(data);});
}

function widget_list_latest(divid,send_lidx,send_page) {
	var link = "/"+board_url+"/widget/list_latest/view.php";
	$.get(link,{lidx:send_lidx,page:send_page,div:divid}, function(data) {
		$("#"+divid).html(data);});
}

//신고하기
function on_report(document_idx) {
	var link = "/"+board_url+"/on_report.php";
	var rreason=$("#report_form > input[name='report_reason']").val();
	$.post(link,{didx:document_idx,reason:rreason}, function(data) {
		alert(data);
	});
}

//추천하기
function on_recommend(board_code,document_idx,recommend_type) {
	var link = "/"+board_url+"/on_recommend.php";
	$.post(link,{code:board_code,didx:document_idx,type:recommend_type}, function(data) {
		alert(data);
	});
}


//연재란 추천하기
function on_recommend_serial(board_code,document_idx,serial_idx,recommend_type) {
	var link = "/"+board_url+"/module/serial/on_recommend.php";
	$.post(link,{code:board_code,didx:document_idx,sidx:serial_idx,type:recommend_type}, function(data) {
		alert(data);
	});
}



//체크포스트 추가
function add_checkpost(board_code,document_idx) {
	var link = "/"+board_url+"/widget/checkpost/add_checkpost.php";
	$.post(link,{code:board_code,didx:document_idx}, function(data) {
		alert(data);
	});
}

//체크포스트 보여주기
function widget_checkpost(divid,send_page) {
	var link = "/"+board_url+"/widget/checkpost/checkpost.php";
	$.ajax({
		url : link,
		type : "GET",
		data : ({div:"divid",page:send_page}),
		success : function(data) {
			$("#"+divid).html(data);
			$("#"+divid).slideToggle(250);
		}
	});
}

//체크포스트 삭제
function widget_checkpost_del(send_page) {
	var link = "/"+board_url+"/widget/checkpost/delete_checkpost.php";
	$.get(link,{checkpost_idx:send_page}, function(data) {
		$("#checkpost").html(data);});
}

function widget_checkpost_arrange(seq,tgt) {
	var link = "/"+board_url+"/widget/checkpost/arrange_checkpost.php";
	$.get(link,{src:seq,target:tgt}, function(data) {
		$("#checkpost").html(data);});
}



function pasteHTMLDemo(img){
	sHTML = "<img src=../../"+img+">";
	oEditors.getById["ir1"].exec("PASTE_HTML", [sHTML]);
}


function pasteImgTag(img,width,height){
	sHTML = "<a href=../../"+img+" target=_blank><img src=../../"+img+" width="+width+" height="+height+" border=0;></a>";
	oEditors.getById["ir1"].exec("PASTE_HTML", [sHTML]);
}



function insert_image(url) {
	//이부분 고쳐야함
	sHTML = "<img src=http://www.seednovel.com"+url+">";
	oEditors.getById["ir1"].exec("PASTE_HTML", [sHTML]);
}


function insert_image(url) {
	//이부분 고쳐야함
	sHTML = "<img src=http://www.seednovel.com"+url+">";
	oEditors.getById["ir1"].exec("PASTE_HTML", [sHTML]);
}

function module_popupdown(popup_idx) {
	var link = "/"+board_url+"/module/popup/popup_down.php";
	$.get(link,{pidx:popup_idx}, function(data) {
		$("#popup_"+popup_idx).hide();})
}
