function MovePost(menu,bid,idx) {
	gCode = menu;

	Ext.getCmp("category").load({url:"/html/"+menu+".menu.php",nocache:true,scripts:true,callback:function() {
		MenuClick(menu+bid.substr(0,1).toUpperCase()+bid.substr(1));
	}});
	MoveBoard(bid,"list",idx);
}

function MoveBoard(bid,mode,idx) {
	gSubcode = bid;

	AllRemove();

	var temp = Ext.getCmp("content").title.split(" - ");
	var title = temp[0]+" - ";
	switch (bid) {
		case "board" :
			title+= "의견게시판";
		break;

		case "notice" :
			title+= "공지사항";
		break;

		case "freeboard" :
			title = "커뮤니티 - 자유게시판";
		break;

		case "tip" :
			title = "커뮤니티 - 팁&테크게시판";
		break;

		case "qna" :
			title = "커뮤니티 - 묻고답하기";
		break;
	}

	if (mode == "list") {
		Ext.getCmp("content").setTitle(title);
		CreateBoardListPanel(bid,idx);
	} else if (mode == "post") {
		if (idx) Ext.getCmp("content").setTitle(title+" 글 수정하기");
		else Ext.getCmp("content").setTitle(title+" 새 글 작성하기");
		CreateBoardPostPanel(bid,idx);
	}
	Ext.getCmp("content").syncSize().doLayout();
}

function DeleteBoard(type,idx,mno) {
	var action = type == "post" ? "delete_post" : "delete_ment";
	var text = type == "post" ? "글" : "댓글";

	if (gMember != null) {
		Ext.Ajax.request({
			url:"/exec/member.php?action=check",
			success:function(XML) {
				var logged = XML.responseXML.getElementsByTagName("logged")[0].firstChild.nodeValue;
				if (logged == "TRUE") {
					if (XML.responseXML.getElementsByTagName("idx")[0].firstChild.nodeValue == mno || XML.responseXML.getElementsByTagName("is_admin")[0].firstChild.nodeValue == "TRUE") {
						Ext.Msg.show({title:"삭제확인",msg:"해당"+text+"을 정말 삭제하시겠습니까?",buttons:Ext.Msg.OKCANCEL,icon:Ext.MessageBox.QUESTION,fn:function(button) {
							if (button == "ok") {
								Ext.Ajax.request({
									url:"/exec/board.php?action="+action,
									success:function(XML) {
										var is_del = XML.responseXML.getElementsByTagName("isDelete")[0].firstChild.nodeValue;

										if (is_del == "TRUE") {
											Ext.Msg.show({title:"안내",msg:text+"을 성공적으로 삭제하였습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO,fn:function() {
												if (type == "post") {
													MoveBoard(gSubcode,"list");
												} else {
													MoveBoard(gSubcode,"list",Ext.getCmp("BoardListGrid").selModel.getSelections()[0].get("idx")+","+gPage);
												}
											}});
										} else {
											Ext.Msg.show({title:"권한에러",msg:text+"을 삭제하지 못하였습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});
										}
									},
									failure:function() {},
									headers:{},
									params:{idx:idx}
								});
							}
						}});
					} else {
						if (mno == "0") {
							new Ext.Window({
								id:"DeleteWindow",
								title:text+" 삭제하기",
								modal:true,
								width:280,
								height:105,
								modal:true,
								resizable:false,
								items:[
									new Ext.form.FormPanel({
										id:"DeleteForm",
										border:false,
										labelWidth:60,
										style:"padding:5px; background:#FFFFFF;",
										items:[
											new Ext.form.TextField({
												name:"password",
												fieldLabel:"패스워드",
												inputType:"password",
												width:180,
												enableKeyEvents:true,
												listeners:{
													specialkey:{fn:function (form,e) {
														if (e.keyCode == 13) {
															Ext.Ajax.request({
																url:"/exec/board.php?action="+action,
																success:function(XML) {
																	var is_del = XML.responseXML.getElementsByTagName("isDelete")[0].firstChild.nodeValue;

																	if (is_del == "TRUE") {
																		Ext.Msg.show({title:"안내",msg:text+"을 성공적으로 삭제하였습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO,fn:function() {
																			if (type == "post") {
																				Ext.getCmp("DeleteWindow").close();
																				MoveBoard(gSubcode,"list");
																			} else {
																				Ext.getCmp("DeleteWindow").close();
																				MoveBoard(gSubcode,"list",Ext.getCmp("BoardListGrid").selModel.getSelections()[0].get("idx")+","+gPage);
																			}
																		}});
																	} else {
																		Ext.Msg.show({title:"패스워드에러",msg:"패스워드가 일치하지 않습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});
																	}
																},
																failure:function() {},
																headers:{},
																params:{idx:idx,password:Ext.getCmp("DeleteForm").getForm().findField("password").getValue()}
															});
														}
													}}
												}
											})
										]
									})
								],
								buttons:[
									new Ext.Button({
										text:"삭제하기",
										handler:function() {
											Ext.Ajax.request({
												url:"/exec/board.php?action="+action,
												success:function(XML) {
													var is_del = XML.responseXML.getElementsByTagName("isDelete")[0].firstChild.nodeValue;

													if (is_del == "TRUE") {
														Ext.Msg.show({title:"안내",msg:text+"을 성공적으로 삭제하였습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO,fn:function() {
															if (type == "post") {
																Ext.getCmp("DeleteWindow").close();
																MoveBoard(gSubcode,"list");
															} else {
																Ext.getCmp("DeleteWindow").close();
																MoveBoard(gSubcode,"list",Ext.getCmp("BoardListGrid").selModel.getSelections()[0].get("idx")+","+gPage);
															}
														}});
													} else {
														Ext.Msg.show({title:"패스워드에러",msg:"패스워드가 일치하지 않습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});
													}
												},
												failure:function() {},
												headers:{},
												params:{idx:idx,password:Ext.getCmp("DeleteForm").getForm().findField("password").getValue()}
											});
										}
									})
								],
								listeners:{show:{fn:function() {
									Ext.getCmp("DeleteForm").getForm().findField("password").focus(false,500);
								}}}
							}).show();
						} else {
							Ext.Msg.show({title:"권한에러",msg:text+"을 삭제할 수 있는 권한이 없습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});
						}
					}
				} else {
					gMember = null;
					Ext.getCmp("MemberLoginForm").show();

					if (mno == "0") {
						new Ext.Window({
							id:"DeleteWindow",
							title:text+" 삭제하기",
							modal:true,
							width:280,
							height:105,
							modal:true,
							resizable:false,
							items:[
								new Ext.form.FormPanel({
									id:"DeleteForm",
									border:false,
									labelWidth:60,
									style:"padding:5px; background:#FFFFFF;",
									items:[
										new Ext.form.TextField({
											name:"password",
											fieldLabel:"패스워드",
											inputType:"password",
											width:180,
											enableKeyEvents:true,
											listeners:{
												specialkey:{fn:function (form,e) {
													if (e.keyCode == 13) {
														Ext.Ajax.request({
															url:"/exec/board.php?action="+action,
															success:function(XML) {
																var is_del = XML.responseXML.getElementsByTagName("isDelete")[0].firstChild.nodeValue;

																if (is_del == "TRUE") {
																	Ext.Msg.show({title:"안내",msg:text+"을 성공적으로 삭제하였습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO,fn:function() {
																		if (type == "post") {
																			Ext.getCmp("DeleteWindow").close();
																			MoveBoard(gSubcode,"list");
																		} else {
																			Ext.getCmp("DeleteWindow").close();
																			MoveBoard(gSubcode,"list",Ext.getCmp("BoardListGrid").selModel.getSelections()[0].get("idx")+","+gPage);
																		}
																	}});
																} else {
																	Ext.Msg.show({title:"패스워드에러",msg:"패스워드가 일치하지 않습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});
																}
															},
															failure:function() {},
															headers:{},
															params:{idx:idx,password:Ext.getCmp("DeleteForm").getForm().findField("password").getValue()}
														});
													}
												}}
											}
										})
									]
								})
							],
							buttons:[
								new Ext.Button({
									text:"삭제하기",
									handler:function() {
										Ext.Ajax.request({
											url:"/exec/board.php?action="+action,
											success:function(XML) {
												var is_del = XML.responseXML.getElementsByTagName("isDelete")[0].firstChild.nodeValue;

												if (is_del == "TRUE") {
													Ext.Msg.show({title:"안내",msg:text+"을 성공적으로 삭제하였습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO,fn:function() {
														if (type == "post") {
															Ext.getCmp("DeleteWindow").close();
															MoveBoard(gSubcode,"list");
														} else {
															Ext.getCmp("DeleteWindow").close();
															MoveBoard(gSubcode,"list",Ext.getCmp("BoardListGrid").selModel.getSelections()[0].get("idx")+","+gPage);
														}
													}});
												} else {
													Ext.Msg.show({title:"패스워드에러",msg:"패스워드가 일치하지 않습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});
												}
											},
											failure:function() {},
											headers:{},
											params:{idx:idx,password:Ext.getCmp("DeleteForm").getForm().findField("password").getValue()}
										});
									}
								})
							],
							listeners:{show:{fn:function() {
								Ext.getCmp("DeleteForm").getForm().findField("password").focus(false,500);
							}}}
						}).show();
					} else {
						Ext.Msg.show({title:"권한에러",msg:text+"을 삭제할 수 있는 권한이 없습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});
					}
				}
			},
			failure:function() {},
			headers:{},
			params:{logged:gMember}
		});
	} else {
		if (mno == "0") {
			new Ext.Window({
				id:"DeleteWindow",
				title:text+" 삭제하기",
				modal:true,
				width:280,
				height:105,
				modal:true,
				resizable:false,
				items:[
					new Ext.form.FormPanel({
						id:"DeleteForm",
						border:false,
						labelWidth:60,
						style:"padding:5px; background:#FFFFFF;",
						items:[
							new Ext.form.TextField({
								name:"password",
								fieldLabel:"패스워드",
								inputType:"password",
								width:180,
								enableKeyEvents:true,
								listeners:{
									specialkey:{fn:function (form,e) {
										if (e.keyCode == 13) {
											Ext.Ajax.request({
												url:"/exec/board.php?action="+action,
												success:function(XML) {
													var is_del = XML.responseXML.getElementsByTagName("isDelete")[0].firstChild.nodeValue;

													if (is_del == "TRUE") {
														Ext.Msg.show({title:"안내",msg:text+"을 성공적으로 삭제하였습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO,fn:function() {
															if (type == "post") {
																Ext.getCmp("DeleteWindow").close();
																MoveBoard(gSubcode,"list");
															} else {
																Ext.getCmp("DeleteWindow").close();
																MoveBoard(gSubcode,"list",Ext.getCmp("BoardListGrid").selModel.getSelections()[0].get("idx")+","+gPage);
															}
														}});
													} else {
														Ext.Msg.show({title:"패스워드에러",msg:"패스워드가 일치하지 않습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});
													}
												},
												failure:function() {},
												headers:{},
												params:{idx:idx,password:Ext.getCmp("DeleteForm").getForm().findField("password").getValue()}
											});
										}
									}}
								}
							})
						]
					})
				],
				buttons:[
					new Ext.Button({
						text:"삭제하기",
						handler:function() {
							Ext.Ajax.request({
								url:"/exec/board.php?action="+action,
								success:function(XML) {
									var is_del = XML.responseXML.getElementsByTagName("isDelete")[0].firstChild.nodeValue;

									if (is_del == "TRUE") {
										Ext.Msg.show({title:"안내",msg:text+"을 성공적으로 삭제하였습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO,fn:function() {
											if (type == "post") {
												Ext.getCmp("DeleteWindow").close();
												MoveBoard(gSubcode,"list");
											} else {
												Ext.getCmp("DeleteWindow").close();
												MoveBoard(gSubcode,"list",Ext.getCmp("BoardListGrid").selModel.getSelections()[0].get("idx")+","+gPage);
											}
										}});
									} else {
										Ext.Msg.show({title:"패스워드에러",msg:"패스워드가 일치하지 않습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});
									}
								},
								failure:function() {},
								headers:{},
								params:{idx:idx,password:Ext.getCmp("DeleteForm").getForm().findField("password").getValue()}
							});
						}
					})
				],
				listeners:{show:{fn:function() {
					Ext.getCmp("DeleteForm").getForm().findField("password").focus(false,500);
				}}}
			}).show();
		} else {
			Ext.Msg.show({title:"권한에러",msg:text+"을 삭제할 수 있는 권한이 없습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});
		}
	}
}

function CreateBoardListPanel(bid,post) {
	gPage = 0;

	if (post) {
		var temp = post.split(",");
		var idx = temp[0] == "0" ? false : temp[0];
		var page = temp[1];
	} else {
		var idx = false;
		var page = false;
	}

	var isCommentWysiwygRender = false;

	var BoardStore = new Ext.data.Store({
		proxy:new Ext.data.ScriptTagProxy({url:'/exec/board.php?action=list_post'}),
		reader:new Ext.data.JsonReader({
			root:'lists',
			totalProperty:'totalCount',
			fields:["idx","category","title","name","reg_date","hit","ment","homepage","email","mno","nickcon","is_secret","is_notice","is_new","is_file","is_img"]
		}),
		remoteSort:true,
		baseParams:{bid:"",code:"",category:"",keyword:"",name:"",mno:"0"},
		sortInfo:{field:"idx", direction:"DESC"}
	});

	var PostStore = new Ext.data.Store({
		proxy:new Ext.data.ScriptTagProxy({url:'/exec/board.php?action=view_post'}),
		reader:new Ext.data.JsonReader({
			root:'lists',
			totalProperty:'totalCount',
			fields:["idx","category","title","name","date","hit","content","ment","file","is_secret","is_allow","nickcon","mno","photo","level","exp","next","remain"]
		}),
		baseParams:{idx:"",password:""}
	});

	var MentStore = new Ext.data.Store({
		proxy:new Ext.data.ScriptTagProxy({url:'/exec/board.php?action=list_ment'}),
		reader:new Ext.data.JsonReader({
			root:'lists',
			totalProperty:'totalCount',
			fields:["idx","name","content","date","nickcon","mno","photo","level","exp","next","remain"]
		}),
		remoteSort:true,
		baseParams:{idx:""},
		sortInfo:{field:"idx", direction:"ASC"}
	});

	Ext.getCmp("content").add(
		new Ext.Panel({
			id:"BoardListPanel",
			layout:"border",
			style:"padding:5px 0px 5px 5px; background:#DFE8F6;",
			border:false,
			items:[
				new Ext.grid.GridPanel({
					id:"BoardListGrid",
					region:"center",
					layout:"fit",
					border:true,
					title:"목록보기",
					split:true,
					trackMouseOver:true,
					tbar:[
						new Ext.Button({
							text:"글쓰기",
							cls:"x-btn-text-icon details",
							icon:"/images/icon/icon_note_add.png",
							handler:function() {
								MoveBoard(Ext.getCmp("BoardListGrid").getStore().baseParams.bid,"post");
							}
						}),
						{xtype:"tbseparator"},
						new Ext.form.ComboBox({
							id:"BoardListCategory",
							fieldLabel:"카테고리",
							width:100,
							typeAhead:true,
							triggerAction:"all",
							lazyRender:false,
							listClass:"x-combo-list-small",
							store:new Ext.data.SimpleStore({
								fields:["values"],
								data:[]
							}),
							editable:false,
							mode:"local",
							displayField:"values",
							valueField:"values",
							value:"의견",
							listeners:{select:{fn:function(form) {
								BoardStore.baseParams.category = form.getValue();
								BoardStore.load({params:{start:0,limit:50}});
							}}}
						}),
						{xtype:"tbseparator"},
						new Ext.form.TextField({
							id:"BoardListKeyword",
							emptyText:"검색어를 입력하세요.",
							width:150,
							listeners:{
								specialkey:{fn:function (form,e) {
									if (e.keyCode == 13) {
										BoardStore.baseParams.keyword = Ext.getCmp("BoardListKeyword").getValue();
										BoardStore.load();
									}
								}}
							}
						}),
						{xtype:"tbspacer"},
						new Ext.Button({
							text:"검색",
							cls:"x-btn-text-icon details",
							icon:"/images/icon/icon_magnifier.png",
							handler:function() {
								BoardStore.baseParams.keyword = Ext.getCmp("BoardListKeyword").getValue();
								BoardStore.load();
							}
						}),
						new Ext.Button({
							text:"검색취소",
							handler:function() {
								Ext.getCmp("BoardListKeyword").setValue("");
								BoardStore.baseParams.keyword = "";
								BoardStore.baseParams.name = "";
								BoardStore.baseParams.mno = "0";
								BoardStore.load();
							}
						})
					],
					bbar:new Ext.PagingToolbar({
						pageSize:50,
						store:BoardStore,
						displayInfo:true,
						displayMsg:'{0} - {1} of {2}',
						emptyMsg:"데이터가 없습니다.",
						listeners:{change:{fn:function(toolbar,page) {
							gPage = page.activePage-1;
							Ext.getCmp("BoardViewPanel").collapse(false);
						}}}
					}),
					cm:new Ext.grid.ColumnModel([
						new Ext.grid.RowNumberer(),
						{
							id:"title",
							header:"제목",
							dataIndex:"title",
							sortable:true,
							minWidth:200,
							width:400,
							renderer:function(value,p,record) {
								var str = '<span style="color:#EF5600;">['+record.data.category+']</span> ';
								if (record.data.is_secret == "TRUE") str+= '<img src="/images/icon/icon_bullet_key.png" alt="비밀글" style="vertical-align:middle; margin-right:3px;" />';
								str+= value;
								if (record.data.ment > 0) str+= ' <span style="color:#EF5600;">+'+record.data.ment+'</span>';
								if (record.data.is_new == "TRUE") str+= '<img src="/images/icon/icon_bullet_new.png" alt="신규글" style="vertical-align:middle; margin:0px 3px 0px 3px;" />';
								if (record.data.is_img == "TRUE") str+= '<img src="/images/icon/icon_bullet_img.png" alt="이미지" style="vertical-align:middle; margin:0px 3px 0px 3px;" />';
								if (record.data.is_file == "TRUE") str+= '<img src="/images/icon/icon_bullet_disk.png" alt="첨부파일" style="vertical-align:middle; margin:0px 3px 0px 3px;" />';
								return str;
							}
						},{
							header:"작성자",
							dataIndex:"name",
							width:100,
							sortable:true,
							renderer:function(value,p,record) {
								if (record.data.nickcon) return '<img src="'+record.data.nickcon+'" style="vertical-align:middle;" />';
								else if (record.data.mno != '0') return '<b>'+value+'</b>';
								else return value;
							}
						},{
							header:"작성일",
							dataIndex:"reg_date",
							width:80,
							sortable:true
						},{
							header:"조회",
							dataIndex:"hit",
							width:60,
							sortable:true,
							renderer:function(value) {
								return '<div style="text-align:right;font-family:arial;">'+Ext.util.Format.number(value,"0,0")+'</div>';
							}
						}
					]),
					sm:new Ext.grid.RowSelectionModel({
						singleSelect:true,
						listeners:{
							rowselect:function(sm,row,keep,rec) {
								new Ext.Window({
									id:"PostViewLoading",
									title:"글을 로딩중입니다.",
									width:250,
									closable:false,
									modal:true,
									resizable:false,
									items:new Ext.Panel({
										border:false,
										style:"background:#FFFFFF; padding:10px; line-height:150%;",
										html:"데이터를 서버로부터 로딩중입니다.<br />잠시만 기다려주십시오."
									})
								}).show();

								if (Ext.getCmp("BoardListGrid").getStore().getAt(row).get("is_secret") == "TRUE") {
									if (gMember != null) {
										Ext.Ajax.request({
											url:"/exec/member.php?action=check",
											success:function(XML) {
												var logged = XML.responseXML.getElementsByTagName("logged")[0].firstChild.nodeValue;

												if (logged == 'TRUE') {
													var mno = XML.responseXML.getElementsByTagName("idx")[0].firstChild.nodeValue;
													var is_admin = XML.responseXML.getElementsByTagName("is_admin")[0].firstChild.nodeValue;

													if (is_admin == "TRUE" || (Ext.getCmp("BoardListGrid").getStore().getAt(row).get("mno") != "0" && mno == Ext.getCmp("BoardListGrid").getStore().getAt(row).get("mno"))) {
														PostStore.baseParams.idx = Ext.getCmp("BoardListGrid").getStore().getAt(row).get("idx");
														PostStore.load();
													} else if (Ext.getCmp("BoardListGrid").getStore().getAt(row).get("mno") == "0") {
														Ext.getCmp("PostViewLoading").close();
														new Ext.Window({
															id:"SecretViewWindow",
															title:"비밀글보기",
															modal:true,
															width:280,
															height:105,
															modal:true,
															resizable:false,
															items:[
																new Ext.form.FormPanel({
																	id:"SecretViewForm",
																	border:false,
																	labelWidth:60,
																	style:"padding:5px; background:#FFFFFF;",
																	items:[
																		new Ext.form.TextField({
																			name:"password",
																			fieldLabel:"패스워드",
																			inputType:"password",
																			width:180,
																			enableKeyEvents:true,
																			listeners:{
																				specialkey:{fn:function (form,e) {
																					if (e.keyCode == 13) {
																						PostStore.baseParams.idx = Ext.getCmp("BoardListGrid").getStore().getAt(row).get("idx");
																						PostStore.baseParams.password = Ext.getCmp("SecretViewForm").getForm().findField("password").getValue();
																						Ext.getCmp("SecretViewWindow").close();
																						PostStore.load();
																					}
																				}}
																			}
																		})
																	]
																})
															],
															buttons:[
																new Ext.Button({
																	text:"확인",
																	handler:function() {
																		PostStore.baseParams.idx = Ext.getCmp("BoardListGrid").getStore().getAt(row).get("idx");
																		PostStore.baseParams.password = Ext.getCmp("SecretViewForm").getForm().findField("password").getValue();
																		Ext.getCmp("SecretViewWindow").close();
																		PostStore.load();
																	}
																})
															]
														}).show();
													} else {
														Ext.getCmp("PostViewLoading").close();
														Ext.Msg.show({title:"권한에러",msg:"비밀글을 읽을 수 있는 권한이 없습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});
													}
												} else {
													gMember = null;
													Ext.getCmp("MemberLoginForm").show();
													Ext.getCmp("PostViewLoading").close();
													Ext.getCmp("BoardListGrid").selModel.selectRow(row);
												}
											},
											failure:function() {
												Ext.Msg.show({title:"에러",msg:"처리하지 못하였습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});
											},
											headers:{},
											params:{logged:gMember}
										});
									} else {
										if (Ext.getCmp("BoardListGrid").getStore().getAt(row).get("mno") == "0") {
											Ext.getCmp("PostViewLoading").close();
											new Ext.Window({
												id:"SecretViewWindow",
												title:"비밀글보기",
												modal:true,
												width:280,
												height:105,
												modal:true,
												resizable:false,
												items:[
													new Ext.form.FormPanel({
														id:"SecretViewForm",
														border:false,
														labelWidth:60,
														style:"padding:5px; background:#FFFFFF;",
														items:[
															new Ext.form.TextField({
																name:"password",
																fieldLabel:"패스워드",
																inputType:"password",
																width:180,
																enableKeyEvents:true,
																listeners:{
																	specialkey:{fn:function (form,e) {
																		if (e.keyCode == 13) {
																			PostStore.baseParams.idx = Ext.getCmp("BoardListGrid").getStore().getAt(row).get("idx");
																			PostStore.baseParams.password = Ext.getCmp("SecretViewForm").getForm().findField("password").getValue();
																			Ext.getCmp("SecretViewWindow").close();
																			PostStore.load();
																		}
																	}}
																}
															})
														]
													})
												],
												buttons:[
													new Ext.Button({
														text:"확인",
														handler:function() {
															PostStore.baseParams.idx = Ext.getCmp("BoardListGrid").getStore().getAt(row).get("idx");
															PostStore.baseParams.password = Ext.getCmp("SecretViewForm").getForm().findField("password").getValue();
															Ext.getCmp("SecretViewWindow").close();
															PostStore.load();
														}
													})
												],
												listeners:{show:{fn:function() {
													Ext.getCmp("SecretViewForm").getForm().findField("password").focus(false,500);
												}}}
											}).show();
										} else {
											Ext.getCmp("PostViewLoading").close();
											Ext.Msg.show({title:"권한에러",msg:"비밀글을 읽을 수 있는 권한이 없습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});
										}
									}
								} else {
									PostStore.baseParams.idx = Ext.getCmp("BoardListGrid").getStore().getAt(row).get("idx");
									PostStore.load();
								}
							}
						}
					}),
					store:BoardStore,
					autoExpandColumn:"title",
					autoExpandMin:300,
					loadMask:{msg:"데이터를 로딩중입니다."},
					viewConfig:{forceFit:false},
					listeners:{cellcontextmenu:{fn:function(grid,row,col,e) {
						if (col == 2) {
							var data = grid.getStore().getAt(row);

							var menu = new Ext.menu.Menu();
							menu.add({
								text:"이름으로검색",
								icon:(Ext.isIE6 ? "" : "/images/icon/icon_magnifier.png"),
								handler:function(item) {
									BoardStore.baseParams.name = data.get("name");
									BoardStore.baseParams.mno = data.get("mno");
									BoardStore.load({params:{start:0,limit:50}});
								}
							});
							if (data.get("homepage")) {
								menu.add({
									text:"홈페이지",
									icon:(Ext.isIE6 ? "" : "/images/icon/icon_house_link.png"),
									handler:function(item) {
										window.open(data.get("homepage"));
									}
								});
							}
							if (data.get("mno") != "0" && gMember != null) {
								menu.add({
									text:"쪽지보내기",
									icon:(Ext.isIE6 ? "" : "/images/icon/icon_note_edit.png"),
									handler:function(item) {
										MemberSendMessage(data.get("mno"),data.get("name"));
									}
								});
							}
							e.stopEvent();
							menu.showAt(e.getXY());
						}
					}}}
				}),
				new Ext.Panel({
					id:"BoardViewPanel",
					layout:"fit",
					region:"east",
					width:520,
					autoScroll:true,
					border:true,
					collapsible:true,
					split:true,
					collapsed:true,
					title:"글 보기",
					margins:"0 5 0 0",
					tbar:[
						new Ext.Button({
							text:"수정하기",
							cls:"x-btn-text-icon details",
							icon:"/images/icon/icon_note_edit.png",
							handler:function() {
								var mno = Ext.getCmp("BoardListGrid").selModel.getSelections()[0].get("mno");

								if (mno == "0") {
									MoveBoard(Ext.getCmp("BoardListGrid").getStore().baseParams.bid,"post",Ext.getCmp("BoardListGrid").selModel.getSelections()[0].get("idx"));
								} else {
									if (gMember != null) {
										Ext.Ajax.request({
											url:"/exec/member.php?action=check",
											success:function(XML) {
												var logged = XML.responseXML.getElementsByTagName("logged")[0].firstChild.nodeValue;
												if (logged == "TRUE") {
													if (XML.responseXML.getElementsByTagName("idx")[0].firstChild.nodeValue == mno || XML.responseXML.getElementsByTagName("is_admin")[0].firstChild.nodeValue == "TRUE") {
														MoveBoard(Ext.getCmp("BoardListGrid").getStore().baseParams.bid,"post",Ext.getCmp("BoardListGrid").selModel.getSelections()[0].get("idx"));
													} else {
														Ext.Msg.show({title:"권한에러",msg:"글을 수정할 수 있는 권한이 없습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});
													}
												} else {
													gMember = null;
													Ext.getCmp("MemberLoginForm").show();
													Ext.Msg.show({title:"권한에러",msg:"글을 수정할 수 있는 권한이 없습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});
												}
											},
											failure:function() {},
											headers:{},
											params:{logged:gMember}
										});
									} else {
										Ext.Msg.show({title:"권한에러",msg:"글을 수정할 수 있는 권한이 없습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});
									}
								}
							}
						}),
						new Ext.Button({
							text:"삭제하기",
							cls:"x-btn-text-icon details",
							icon:"/images/icon/icon_note_delete.png",
							handler:function() {
								var idx = Ext.getCmp("BoardListGrid").selModel.getSelections()[0].get("idx");
								var mno = Ext.getCmp("BoardListGrid").selModel.getSelections()[0].get("mno");

								DeleteBoard("post",idx,mno);
							}
						})
					],
					items:[
						new Ext.Panel({
							border:false,
							autoWidth:true,
							autoHeight:true,
							html:'<div id="BoardViewPanelTitle"></div><div id="BoardViewPanelContent" class="smartOutput"></div>'
						}),
						new Ext.Panel({
							title:"댓글",
							border:false,
							collapseFirst:false,
							style:"border-top:1px solid #99BBE8;",
							items:[
								new Ext.Panel({
									border:false,
									id:"BoardViewMentPanel",
									html:""
								}),
								new Ext.form.FormPanel({
									collapseFirst:false,
									id:"BoardViewMentForm",
									style:"padding:5px;",
									reader:new Ext.data.XmlReader({
										record:"form",
										success:"@success"
									},["title","file","content"]),
									errorReader:new Ext.form.XmlErrorReader(),
									border:false,
									items:[
										new Ext.form.FieldSet({
											title:"댓글 작성하기",
											autoWidth:true,
											autoHeight:true,
											labelWidth:80,
											defaults:{msgTarget:"side"},
											items:[
												new Ext.Panel({
													id:"BoardViewMentUser",
													border:false,
													layout:"form",
													items:[
														new Ext.form.TextField({
															fieldLabel:"작성자",
															name:"name",
															style:".margin-top:1px;",
															width:100
														}),
														new Ext.form.TextField({
															fieldLabel:"패스워드",
															name:"password",
															inputType:"password",
															width:100
														}),
														new Ext.form.TextField({
															fieldLabel:"이메일",
															name:"email",
															width:250
														}),
														new Ext.form.TextField({
															fieldLabel:"홈페이지",
															name:"homepage",
															width:350
														})
													]
												}),
												new Ext.form.Hidden({
													name:"action",
													value:"write_ment"
												}),
												new Ext.form.Hidden({
													name:"idx",
													value:""
												}),
												new Ext.form.TextArea({
													id:"wysiwyg",
													hideLabel:true,
													layout:"fit",
													name:"content",
													style:"width:100%;",
													height:100,
													allowBlank:false
												}),
												new Ext.Button({
													text:"등록하기",
													handler:function() {
														oEditors.getById["wysiwyg"].exec("UPDATE_IR_FIELD",[]);
														Ext.getCmp("BoardViewMentForm").getForm().submit({url:"/exec/board.php",waitMsg:"댓글을 등록중입니다."});
													}
												})
											]
										})
									],
									listeners:{actioncomplete:{fn:function(form,action) {
										if (action.type == "submit") {
											var idx = Ext.getCmp("BoardViewMentForm").getForm().findField("idx").getValue();
											form.reset();
											Ext.getCmp("BoardViewMentForm").getForm().findField("idx").setValue(idx);
											MentStore.reload();
											oEditors.getById["wysiwyg"].setIR("");
											Ext.getCmp("BoardListGrid").selModel.getSelections()[0].set("ment",parseInt(Ext.getCmp("BoardListGrid").selModel.getSelections()[0].get("ment"))+1);
											if (gMember != null) MemberInfoPrint(gMember);
										}
									}}}
								})
							]
						})
					],
					listeners:{expand:{fn:function () {
						if (Ext.getCmp("wysiwyg") && isCommentWysiwygRender == false) {
							isCommentWysiwygRender = true;
							nhn.husky.EZCreator.createInIFrame({
								oAppRef:oEditors,
								elPlaceHolder:"wysiwyg",
								sSkinURI:"/html/wysiwyg.php",
								fCreator:"createSEditorInIFrame"
							});
						}
					}}}
				})
			]
		})
	);
	Ext.getCmp("content").syncSize().doLayout();
	Ext.getCmp("BoardListGrid").getStore().baseParams.bid = bid;
	Ext.getCmp("BoardListGrid").getStore().baseParams.code = gCode;
	Ext.getCmp("BoardViewPanel").collapse(false);

	if (!page) {
		Ext.getCmp("BoardListGrid").getStore().load({params:{start:0,limit:50}});
	} else {
		Ext.getCmp("BoardListGrid").getStore().load({params:{start:(parseInt(page)*50),limit:50}});
	}
	Ext.getCmp("BoardListGrid").getStore().on("load",function() {
		if (idx) {
			var store = Ext.getCmp("BoardListGrid").getStore();
			for (var i=0, loop=store.getCount();i<loop;i++) {
				if (store.getAt(i).get("idx") == idx) {
					Ext.getCmp("BoardListGrid").selModel.selectRow(i);
					break;
				}
			}
		}
	});

	PostStore.on("beforeload",function() {
		if (!Ext.getCmp("PostViewLoading")) {
			new Ext.Window({
				id:"PostViewLoading",
				title:"글을 로딩중입니다.",
				width:250,
				closable:false,
				modal:true,
				resizable:false,
				items:new Ext.Panel({
					border:false,
					style:"background:#FFFFFF; padding:10px; line-height:150%;",
					html:"데이터를 서버로부터 로딩중입니다.<br />잠시만 기다려주십시오."
				})
			}).show();
		}
	});

	PostStore.on("load",function() {
		if (PostStore.getCount() == 0) {

		} else {
			var data = PostStore.getAt(0);

			if (data.get("is_allow") == "FALSE") {
				Ext.getCmp("PostViewLoading").close();
				if (data.get("mno") != "0") {
					Ext.Msg.show({title:"권한에러",msg:"비밀글을 읽을 수 있는 권한이 없습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});
				} else {
					Ext.Msg.show({title:"패스워드오류",msg:"패스워드가 일치하지 않습니다.<br />패스워드를 다시 입력하여 주십시오.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING,fn:function() {
						new Ext.Window({
							id:"SecretViewWindow",
							title:"비밀글보기",
							modal:true,
							width:280,
							height:105,
							modal:true,
							resizable:false,
							items:[
								new Ext.form.FormPanel({
									id:"SecretViewForm",
									border:false,
									labelWidth:60,
									style:"padding:5px; background:#FFFFFF;",
									items:[
										new Ext.form.TextField({
											name:"password",
											fieldLabel:"패스워드",
											inputType:"password",
											width:180,
											enableKeyEvents:true,
											listeners:{
												specialkey:{fn:function (form,e) {
													if (e.keyCode == 13) {
														PostStore.baseParams.idx = Ext.getCmp("BoardListGrid").getStore().getAt(row).get("idx");
														PostStore.baseParams.password = Ext.getCmp("SecretViewForm").getForm().findField("password").getValue();
														Ext.getCmp("SecretViewWindow").close();
														PostStore.load();
													}
												}}
											}
										})
									]
								})
							],
							buttons:[
								new Ext.Button({
									text:"확인",
									handler:function() {
										PostStore.baseParams.idx = Ext.getCmp("BoardListGrid").getStore().getAt(row).get("idx");
										PostStore.baseParams.password = Ext.getCmp("SecretViewForm").getForm().findField("password").getValue();
										Ext.getCmp("SecretViewWindow").close();
										PostStore.load();
									}
								})
							]
						}).show();
					}});
				}
			} else {
				var sHTML;
				sHTML = '<table cellspacing="0" cellspacing="0" style="table-layout:fixed; width:100%;">';
				sHTML+= '<col width="65" /><col width="100%" />';
				sHTML+= '<tr>';
				sHTML+= '<td><div style="border:1px solid #CCCCCC; width:60px; height:60px;"><img src="'+data.get("photo")+'" style="width:60px; height:60px;"></div></td>';
				sHTML+= '<td>';
				sHTML+= '<div style="height:3px; overflow:hidden;"></div>';
				sHTML+= data.get("title");
				sHTML+= '<div style="height:3px; overflow:hidden;"></div>';
				sHTML+= '<span class="board-view-date">이 게시물은 <span class="bold">'+data.get("date")+'</span>에 작성되었습니다.</span>';
				sHTML+= '<table cellspacing="0" cellspacing="0" style="table-layout:fixed; width:100%;">';
				sHTML+= '<col width="100%" /><col width="130" />';
				sHTML+= '<tr>';
				sHTML+= '<td style="font-size:12px; font-family:돋움; font-weight:normal; padding-left:2px;">';
				if (data.get("nickcon")) {
					sHTML+= '<img src="'+data.get("nickcon")+'" />';
				} else {
					if (data.get("mno") != "0") {
						sHTML+= '<span style="font-weight:bold;">'+data.get("name")+'</span>';
					} else {
						sHTML+= data.get("name");
					}
				}
				sHTML+= '</td>';
				sHTML+= '<td style="padding-left:3px;">';
				sHTML+= '<table cellpadding="0" cellspacing="0" class="Expbar" title="'+data.get("exp")+'/'+parseInt(data.get("next"))+'"><col width="40" /><col width="1" /><col width="'+Math.ceil(parseInt(data.get("exp"))/parseInt(data.get("next"))*100)+'%" /><col width="'+(100-Math.ceil(parseInt(data.get("exp"))/parseInt(data.get("next"))*100))+'%" /><col width="2" /><tr style="height:11px; overflow:hidden;"><td class="ExpbarLevel">LEV.<span style="color:#EF5600;">'+data.get("level")+'</span></td><td class="ExpbarStart"></td><td class="ExpbarExp"></td><td class="ExpbarRemain"></td><td class="ExpbarEnd"></td></tr></table>';
				sHTML+= '</td>';
				sHTML+= '</tr></table>';
				sHTML+= '</td>';
				sHTML+= '</tr></table>';

				Ext.getCmp("BoardViewMentForm").getForm().findField("idx").setValue(data.get("idx"));
				document.getElementById("BoardViewPanelTitle").innerHTML = data.get("title")+'<br />';
				document.getElementById("BoardViewPanelTitle").innerHTML = sHTML;

				var content = data.get("content");
				var paramReg = new RegExp("&quot;","gi");
				content = content.replace(paramReg,'"');
				document.getElementById("BoardViewPanelContent").innerHTML = content;

				var fHTML = "";
				if (data.get("file")) {
					var file = data.get("file").split("//");
					for (var i=0, loop=file.length;i<loop;i++) {
						var temp = file[i].split("/");
						fHTML+= '<div style="font-family:돋움; font-size:11px; margin:3px 0px 3px 0px;"><a href="/exec/download.php?type=board&idx='+temp[0]+'" target="downloadFrame"><span style="color:#15428B; font-weight:bold;">'+temp[1]+'</span></a> ('+AzUploaderFileSize(temp[2])+'), 다운로드 : '+temp[3]+'회</div>';
					}
					fHTML = '<div style="margin-top:10px; border:1px dashed #CCCCCC; padding:5px;"><div style="font-family:돋움; font-size:12px; font-weight:bold; padding-bottom:5px; border-bottom:1px solid #DDDDDD; margin-bottom:5px;">첨부파일목록 ('+file.length+'개)</div>'+fHTML+'</div>';
					document.getElementById("BoardViewPanelContent").innerHTML+= fHTML;
				}

				MentStore.baseParams.idx = data.get("idx");
				Ext.getCmp("BoardViewPanel").expand(true);
				MentStore.load();
			}
		}
	});

	MentStore.on("load",function() {
		Ext.getCmp("BoardViewMentUser").show();

		if (gMember != null) {
			Ext.Ajax.request({
				url:"/exec/member.php?action=check",
				success:function(XML) {
					var logged = XML.responseXML.getElementsByTagName("logged")[0].firstChild.nodeValue;
					if (logged == "TRUE") {
						Ext.getCmp("BoardViewMentUser").hide();
					} else {
						gMember = null;
						Ext.getCmp("MemberLoginForm").show();
						Ext.getCmp("BoardViewMentUser").show();
					}
				},
				failure:function() {},
				headers:{},
				params:{logged:gMember}
			});
		}

		if (MentStore.baseParams.idx) {
			var sHTML = "";
			for (var i=0, loop=MentStore.getCount();i<loop;i++) {
				sHTML+= '<div style="padding:5px; font-family:돋움; font-size:12px; background:#F4F4F4; border-bottom:1px solid #E6E6E6;';
				if (i!=0) sHTML+= ' border-top:1px solid #E6E6E6;';
				sHTML+= '">';
				sHTML+= '<table cellspacing="0" cellspacing="0" style="table-layout:fixed; width:100%;">';
				sHTML+= '<col width="35" /><col width="100%" /><col width="100" />';
				sHTML+= '<tr>';
				sHTML+= '<td><div style="border:1px solid #CCCCCC; width:30px; height:30px;"><img src="'+MentStore.getAt(i).get("photo")+'" style="width:30px; height:30px;"></div></td>';
				sHTML+= '<td>';
				if (MentStore.getAt(i).get("nickcon")) {
					sHTML+= '<img src="'+MentStore.getAt(i).get("nickcon")+'" />';
				} else {
					if (MentStore.getAt(i).get("mno") != "0") {
						sHTML+= '<span style="font-weight:bold;">'+MentStore.getAt(i).get("name")+'</span>';
					} else {
						sHTML+= MentStore.getAt(i).get("name");
					}
				}
				sHTML+= '<div style="height:5px; overflow:hidden;"></div>';
				sHTML+= '<table cellpadding="0" cellspacing="0" class="Expbar" title="'+MentStore.getAt(i).get("exp")+'/'+parseInt(MentStore.getAt(i).get("next"))+'"><col width="40" /><col width="1" /><col width="'+Math.ceil(parseInt(MentStore.getAt(i).get("exp"))/parseInt(MentStore.getAt(i).get("next"))*100)+'%" /><col width="'+(100-Math.ceil(parseInt(MentStore.getAt(i).get("exp"))/parseInt(MentStore.getAt(i).get("next"))*100))+'%" /><col width="2" /><tr style="height:11px; overflow:hidden;"><td class="ExpbarLevel">LEV.<span style="color:#EF5600;">'+MentStore.getAt(i).get("level")+'</span></td><td class="ExpbarStart"></td><td class="ExpbarExp"></td><td class="ExpbarRemain"></td><td class="ExpbarEnd"></td></tr></table>';
				sHTML+= '</td>';
				sHTML+= '<td style="text-align:right; font-size:10px; font-family:tahoma; color:#666666;"><span style="font-weight:bold; color:#960000; cursor:pointer;" onclick="DeleteBoard(\'ment\','+MentStore.getAt(i).get("idx")+','+MentStore.getAt(i).get("mno")+');">DELETE</span><br />'+MentStore.getAt(i).get("date")+'</td>';
				sHTML+= '</tr></table>';
				sHTML+= '</div>';

				sHTML+= '<div class="smartOutput" style="padding:5px;">'+MentStore.getAt(i).get("content")+'</div>';
			}
			Ext.getCmp("BoardViewMentPanel").getLayoutTarget().dom.innerHTML = sHTML;
		}

		if (Ext.getCmp("PostViewLoading")) Ext.getCmp("PostViewLoading").close();
	});

	var CategoryRecord = Ext.data.Record.create([{name:"values",type:"string"}]);
	if (bid == "notice") {
		Ext.getCmp("BoardListCategory").store.removeAll();
		var CategoryData = new Array(new CategoryRecord({values:"전체보기"}),new CategoryRecord({values:"공지사항"}),new CategoryRecord({values:"업데이트"}));
		Ext.getCmp("BoardListCategory").store.add(CategoryData);
		Ext.getCmp("BoardListCategory").setValue("전체보기");
	} else if (bid == "board") {
		Ext.getCmp("BoardListCategory").store.removeAll();
		var CategoryData = new Array(new CategoryRecord({values:"전체보기"}),new CategoryRecord({values:"의견"}),new CategoryRecord({values:"기능요청"}),new CategoryRecord({values:"평가"}),new CategoryRecord({values:"버그"}),new CategoryRecord({values:"문의"}),new CategoryRecord({values:"신고"}),new CategoryRecord({values:"기타"}));
		Ext.getCmp("BoardListCategory").store.add(CategoryData);
		Ext.getCmp("BoardListCategory").setValue("전체보기");
	} else if (bid == "freeboard") {
		Ext.getCmp("BoardListCategory").store.removeAll();
		var CategoryData = new Array(new CategoryRecord({values:"전체보기"}),new CategoryRecord({values:"일상다반사"}),new CategoryRecord({values:"자랑하기"}),new CategoryRecord({values:"도움요청"}),new CategoryRecord({values:"알짜정보"}),new CategoryRecord({values:"기타"}));
		Ext.getCmp("BoardListCategory").store.add(CategoryData);
		Ext.getCmp("BoardListCategory").setValue("전체보기");
	} else if (bid == "tip") {
		Ext.getCmp("BoardListCategory").store.removeAll();
		var CategoryData = new Array(new CategoryRecord({values:"전체보기"}),new CategoryRecord({values:"PHP"}),new CategoryRecord({values:"JavaScript"}),new CategoryRecord({values:"HTML"}),new CategoryRecord({values:"ActionScript"}),new CategoryRecord({values:"ASP"}),new CategoryRecord({values:"JSP"}),new CategoryRecord({values:"C/C++/C#"}),new CategoryRecord({values:"JAVA"}),new CategoryRecord({values:".NET"}),new CategoryRecord({values:"Python"}),new CategoryRecord({values:"OS"}),new CategoryRecord({values:"Design"}),new CategoryRecord({values:"기타"}));
		Ext.getCmp("BoardListCategory").store.add(CategoryData);
		Ext.getCmp("BoardListCategory").setValue("전체보기");
	} else if (bid == "qna") {
		Ext.getCmp("BoardListCategory").store.removeAll();
		var CategoryData = new Array(new CategoryRecord({values:"전체보기"}),new CategoryRecord({values:"개발관련"}),new CategoryRecord({values:"디자인관련"}),new CategoryRecord({values:"기타"}));
		Ext.getCmp("BoardListCategory").store.add(CategoryData);
		Ext.getCmp("BoardListCategory").setValue("전체보기");
	}
}

function CreateBoardPostPanel(bid,idx) {
	if (idx) gIdx = idx;
	else gIdx = false;

	Ext.getCmp("content").add(
		new Ext.Panel({
			id:"BoardPostPanel",
			layout:"border",
			border:false,
			autoScroll:true,
			items:[
				new Ext.Panel({
					region:"west",
					width:550,
					split:true,
					margins:"5 0 5 5",
					title:(idx ? "글 수정하기" : "글 작성하기"),
					layout:"fit",
					autoScroll:true,
					bbar:[
						new Ext.Button({
							text:(idx ? "수정하기" : "등록하기"),
							cls:"x-btn-text-icon details",
							icon:"/images/icon/icon_page_paste.png",
							handler:function() {
								oEditors.getById["wysiwyg"].exec("UPDATE_IR_FIELD",[]);
								var file = new Array();
								for (var i=0, loop=Ext.getCmp("AzFileList").getStore().getCount();i<loop;i++) {
									var server = Ext.getCmp("AzFileList").getStore().getAt(i).get("server");
									if (server) {
										var temp = server.split("|");
										file.push(temp[0]);
									}
								}
								Ext.getCmp("BoardPostForm").getForm().findField("file").setValue(file.join(","));
								Ext.getCmp("BoardPostForm").getForm().submit({url:"/exec/board.php",waitMsg:"게시물을 "+(idx ? "수정" : "등록")+"중입니다."});
							}
						})
					],
					items:[
						new Ext.form.FormPanel({
							id:"BoardPostForm",
							border:false,
							style:"padding:5px;",
							reader:new Ext.data.XmlReader({
								record:"form",
								success:"@success"
							},["title","file","content","name","is_secret","is_notice"]),
							errorReader:new Ext.form.XmlErrorReader(),
							labelWidth:80,
							autoHeight:true,
							autoWidth:true,
							layout:"fit",
							labelAlign:"right",
							items:[
								new Ext.form.FieldSet({
									title:"게시물 기본정보",
									autoWidth:true,
									autoHeight:true,
									defaults:{msgTarget:"side"},
									items:[
										new Ext.form.Hidden({
											name:"bid"
										}),
										new Ext.form.Hidden({
											name:"file"
										}),
										new Ext.form.Hidden({
											name:"code"
										}),
										new Ext.form.Hidden({
											name:"idx",
											value:idx
										}),
										new Ext.form.Hidden({
											name:"action",
											value:"write_post"
										}),
										new Ext.Panel({
											id:"BoardPostUser",
											border:false,
											layout:"form",
											items:[
												new Ext.form.TextField({
													name:"name",
													fieldLabel:"작성자",
													width:100
												}),
												new Ext.form.TextField({
													name:"password",
													fieldLabel:"패스워드",
													inputType:"password",
													width:100
												}),
												new Ext.form.TextField({
													fieldLabel:"이메일",
													name:"email",
													width:250
												}),
												new Ext.form.TextField({
													fieldLabel:"홈페이지",
													name:"homepage",
													width:350
												})
											]
										}),
										new Ext.form.ComboBox({
											name:"category",
											fieldLabel:"카테고리",
											width:100,
											typeAhead:true,
											triggerAction:"all",
											lazyRender:false,
											listClass:"x-combo-list-small",
											store:new Ext.data.SimpleStore({
												fields:["values"],
												data:[]
											}),
											editable:false,
											mode:"local",
											displayField:"values",
											valueField:"values",
											value:"의견"
										}),
										new Ext.form.TextField({
											name:"title",
											fieldLabel:"제목",
											width:"350",
											allowBlank:false
										})
									]
								}),
								new Ext.form.FieldSet({
									title:"게시물 옵션",
									items:[
										new Ext.form.Checkbox({
											hideLabel:true,
											name:"is_secret",
											boxLabel:"비밀글로 작성합니다. (작성자와 관리자만 볼 수 있습니다.)"
										}),
										new Ext.form.Checkbox({
											hideLabel:true,
											name:"is_notice",
											disabled:true,
											boxLabel:"공지사항으로 작성합니다. (관리자만 선택가능합니다.)"
										})
									]
								}),
								new Ext.form.TextArea({
									id:"wysiwyg",
									layout:"fit",
									name:"content",
									style:"width:100%;",
									height:300,
									allowBlank:false,
									listeners:{render:{fn:function() {
										nhn.husky.EZCreator.createInIFrame({
											oAppRef:oEditors,
											elPlaceHolder:"wysiwyg",
											sSkinURI:"/html/wysiwyg.php",
											fCreator:"createSEditorInIFrame"
										});

										if (gMember != null) {
											Ext.Ajax.request({
												url:"/exec/member.php?action=check",
												success:function(XML) {
													var logged = XML.responseXML.getElementsByTagName("logged")[0].firstChild.nodeValue;
													if (logged == "TRUE") {
														var is_admin = XML.responseXML.getElementsByTagName("is_admin")[0].firstChild.nodeValue;
														Ext.getCmp("BoardPostUser").hide();
														if (is_admin == "TRUE") {
															Ext.getCmp("BoardPostForm").getForm().findField("is_notice").enable();
														} else {
															Ext.getCmp("BoardPostForm").getForm().findField("is_notice").disable();
														}
													} else {
														gMember = null;
														Ext.getCmp("MemberLoginForm").show();
														Ext.getCmp("BoardPostUser").show();
													}
												},
												failure:function() {},
												headers:{},
												params:{logged:gMember}
											});
										}
									}}}
								})
							],
							listeners:{
								actioncomplete:{fn:function(form,action) {
									if (action.type == "submit") {
										var idx;
										Ext.each(action.result.errors,function(item,index,allItems) { idx = item.id; });
										if (gMember != null) MemberInfoPrint(gMember);
										MoveBoard(bid,"list",idx);
									}

									if (action.type == "load") {
										if (action.response.responseXML.getElementsByTagName("isLoad")[0].firstChild.nodeValue == "FALSE") {
											new Ext.Window({
												id:"SecretViewWindow",
												title:"비밀글수정",
												modal:true,
												width:280,
												height:105,
												modal:true,
												resizable:false,
												items:[
													new Ext.form.FormPanel({
														id:"SecretViewForm",
														border:false,
														labelWidth:60,
														style:"padding:5px; background:#FFFFFF;",
														items:[
															new Ext.form.TextField({
																name:"password",
																fieldLabel:"패스워드",
																inputType:"password",
																width:180,
																enableKeyEvents:true,
																listeners:{
																	specialkey:{fn:function (form,e) {
																		if (e.keyCode == 13) {
																			Ext.getCmp("BoardPostForm").getForm().load({url:"/exec/board.php?action=load&idx="+action.response.responseXML.getElementsByTagName("idx")[0].firstChild.nodeValue+"&password="+Ext.getCmp("SecretViewForm").getForm().findField("password").getValue(),waitMsg:"게시물을 로딩중입니다."});
																			if (Ext.getCmp("SecretViewWindow")) Ext.getCmp("SecretViewWindow").close();
																		}
																	}}
																}
															})
														]
													})
												],
												buttons:[
													new Ext.Button({
														text:"확인",
														handler:function() {
															Ext.getCmp("BoardPostForm").getForm().load({url:"/exec/board.php?action=load&idx="+action.response.responseXML.getElementsByTagName("idx")[0].firstChild.nodeValue+"&password="+Ext.getCmp("SecretViewForm").getForm().findField("password").getValue(),waitMsg:"게시물을 로딩중입니다."});
															if (Ext.getCmp("SecretViewWindow")) Ext.getCmp("SecretViewWindow").close();
														}
													})
												]
											}).show();
										} else {
											try {
												oEditors.getById["wysiwyg"].setIR(Ext.getCmp("BoardPostForm").getForm().findField("content").getValue());
											} catch (e) {}

											if (action.response.responseXML.getElementsByTagName("filedata")[0].firstChild) {
												var fileData = action.response.responseXML.getElementsByTagName("filedata")[0].firstChild.nodeValue.split("||");
												var record = Ext.data.Record.create([
													{name:"idx",type:"int"},
													{name:"filename",type:"string"},
													{name:"filesize",type:"string"},
													{name:"status",type:"string"},
													{name:"server",type:"string"}
												]);

												for (var i=0, loop=fileData.length;i<loop;i++) {
													var file = fileData[i].split(":");
													var list = new record({
														idx:file[0],
														filename:file[1],
														filesize:AzUploaderFileSize(file[2]),
														status:"업로드완료",
														server:file[0]+"|"+file[3]+"|"+file[1]+"|"+file[4]+"|"+file[2]
													});
													Ext.getCmp("AzFileList").getStore().add(list);
												}
											}
										}
									}
								}},
								render:{fn:function() {
									if (idx) {
										Ext.getCmp("BoardPostForm").getForm().load({url:"/exec/board.php?action=load&idx="+idx,waitMsg:"게시물을 로딩중입니다."});
									}
								}}
							}
						})
					]
				}),
				new Ext.Panel({
					region:"center",
					title:"파일첨부",
					margins:"5 5 5 0",
					layout:"border",
					tbar:[
						{xtype:"tbtext",text:"<span id='AzUploaderArea' style='color:#960000;'></span>",listeners:{render:{fn:function(){AzUploaderRenderer("uploader","AzUploaderArea");}}}},
						{xtype:"tbseparator"},
						new Ext.Button({
							text:"파일업로드",
							cls:"x-btn-text-icon details",
							icon:"/images/icon/icon_disk.png",
							handler:function () {
								Ext.getCmp("AzFileProgress").show();
								document.getElementById(AzUploaderID).FileUpload();
							}
						})
					],
					items:[
						new Ext.grid.GridPanel({
							id:"AzFileList",
							region:"center",
							autoWidth:true,
							border:false,
							autoScroll:true,
							style:"border-bottom:1px solid #99BBE8;",
							cm:new Ext.grid.ColumnModel([
								new Ext.grid.CheckboxSelectionModel(),
								{
									header:"인덱스",
									dataIndex:"idx",
									width:"60",
									hidden:true
								},{
									header:"파일명",
									dataIndex:"filename",
									width:290
								},{
									header:"용량",
									dataIndex:"filesize",
									width:50,
									css:"text-align:right;"
								},{
									header:"상태",
									dataIndex:"status",
									width:80,
									css:"text-align:right;"
								},{
									header:"서버리턴값",
									dataIndex:"server",
									width:80,
									css:"text-align:right;",
									hidden:true,
									hidable:false
								}
							]),
							sm:new Ext.grid.CheckboxSelectionModel({
								listeners:{beforerowselect : function (sm, rowIndex, keep, rec) {
									if (rec.data.status == "업로드완료") {

									}
								}}
							}),
							store:new Ext.data.SimpleStore({
								fields:["idx","filename","filesize","status","server"],
								data:[]
							}),
							listeners:{
								rowclick:{fn:function(grid,row,event) {
									if (grid.getStore().getAt(row).get("status") == "업로드완료") {
										Ext.getCmp("AzFilePreview").expand(true);

										var infor = grid.getStore().getAt(row).get("server").split("|");
										var idx = infor[0];
										var filetype = infor[1];
										var filename = infor[2];
										var filepath = infor[3];
										var filesize = infor[4];

										var sHTML = "";
										if (filetype == "IMG") {
											sHTML+= "<div style='padding:5px;'><img src='"+filepath+"' /></div>";
										} else {
											sHTML+= "<div style='padding:5px; border:1px solid #CCCCCC; background:#F4F4F4;'><a href='/exec/download.php?idx="+idx+"' />"+filename+" ("+AzUploaderFileSize(filesize)+")</a></div>";
										}
										Ext.getCmp("AzFilePreview").getLayoutTarget().dom.innerHTML = sHTML;
									}
								}}
							}
						}),
						new Ext.Panel({
							id:"AzFilePreview",
							title:"첨부파일 미리보기",
							collapsible:true,
							collapsed:true,
							border:false,
							height:400,
							style:"font-family:돋움; font-size:12px;",
							tbar:[
								new Ext.Button({
									text:"본문에 삽입하기",
									cls:"x-btn-text-icon details",
									icon:"/images/icon/icon_page_paste.png",
									handler:function () {
										oEditors.getById["wysiwyg"].exec("PASTE_HTML", [Ext.getCmp("AzFilePreview").getLayoutTarget().dom.innerHTML]);
									}
								})
							],
							html:"",
							autoScroll:true,
							region:"south"
						})
					]
				})
			]
		})
	);
	Ext.getCmp("content").syncSize().doLayout();
	Ext.getCmp("BoardPostForm").getForm().findField("bid").setValue(bid);
	Ext.getCmp("BoardPostForm").getForm().findField("code").setValue(gCode);

	var CategoryRecord = Ext.data.Record.create([{name:"values",type:"string"}]);
	if (bid == "notice") {
		Ext.getCmp("BoardPostForm").getForm().findField("category").store.removeAll();
		var CategoryData = new Array(new CategoryRecord({values:"공지사항"}),new CategoryRecord({values:"업데이트"}));
		Ext.getCmp("BoardPostForm").getForm().findField("category").store.add(CategoryData);
		Ext.getCmp("BoardPostForm").getForm().findField("category").setValue("공지사항");
	} else if (bid == "board") {
		Ext.getCmp("BoardPostForm").getForm().findField("category").store.removeAll();
		var CategoryData = new Array(new CategoryRecord({values:"의견"}),new CategoryRecord({values:"기능요청"}),new CategoryRecord({values:"평가"}),new CategoryRecord({values:"버그"}),new CategoryRecord({values:"문의"}),new CategoryRecord({values:"신고"}),new CategoryRecord({values:"기타"}));
		Ext.getCmp("BoardPostForm").getForm().findField("category").store.add(CategoryData);
		Ext.getCmp("BoardPostForm").getForm().findField("category").setValue("의견");
	} else if (bid == "freeboard") {
		Ext.getCmp("BoardPostForm").getForm().findField("category").store.removeAll();
		var CategoryData = new Array(new CategoryRecord({values:"일상다반사"}),new CategoryRecord({values:"자랑하기"}),new CategoryRecord({values:"도움요청"}),new CategoryRecord({values:"알짜정보"}),new CategoryRecord({values:"기타"}));
		Ext.getCmp("BoardPostForm").getForm().findField("category").store.add(CategoryData);
		Ext.getCmp("BoardPostForm").getForm().findField("category").setValue("일상다반사");
	} else if (bid == "tip") {
		Ext.getCmp("BoardPostForm").getForm().findField("category").store.removeAll();
		var CategoryData = new Array(new CategoryRecord({values:"PHP"}),new CategoryRecord({values:"JavaScript"}),new CategoryRecord({values:"HTML"}),new CategoryRecord({values:"ActionScript"}),new CategoryRecord({values:"ASP"}),new CategoryRecord({values:"JSP"}),new CategoryRecord({values:"C/C++/C#"}),new CategoryRecord({values:"JAVA"}),new CategoryRecord({values:".NET"}),new CategoryRecord({values:"Python"}),new CategoryRecord({values:"OS"}),new CategoryRecord({values:"Design"}),new CategoryRecord({values:"기타"}));
		Ext.getCmp("BoardPostForm").getForm().findField("category").store.add(CategoryData);
		Ext.getCmp("BoardPostForm").getForm().findField("category").setValue("PHP");
	} else if (bid == "qna") {
		Ext.getCmp("BoardPostForm").getForm().findField("category").store.removeAll();
		var CategoryData = new Array(new CategoryRecord({values:"개발관련"}),new CategoryRecord({values:"디자인관련"}),new CategoryRecord({values:"기타"}));
		Ext.getCmp("BoardPostForm").getForm().findField("category").store.add(CategoryData);
		Ext.getCmp("BoardPostForm").getForm().findField("category").setValue("개발관련");
	}
}