function CreateLogViewerPanel(code) {
	gSubcode = code;

	if (gMember == null) {
		Ext.Msg.show({title:"안내",msg:"먼저 로그인을 하여 주십시오.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO});
	} else {
		AllRemove();

		var temp = Ext.getCmp("content").title.split("-");
		var title = temp[0]+" - 채널로그뷰어";
		Ext.getCmp("content").setTitle(title);

		var ChannelStore = new Ext.data.Store({
			proxy:new Ext.data.ScriptTagProxy({url:"/exec/log.php?action=channel&code="+code}),
			reader:new Ext.data.JsonReader({
				root:"lists",
				totalProperty:"totalCount",
				fields:["name","channel"]
			}),
			remoteSort:false,
			sortInfo:{field:"channel", direction:"ASC"}
		});

		var LogStore = new Ext.data.Store({
			proxy:new Ext.data.ScriptTagProxy({url:"/exec/log.php?action=log&code="+code}),
			reader:new Ext.data.JsonReader({
				root:"lists",
				totalProperty:"totalCount",
				fields:["name","channel","talk",{name:"reg_date",type:"int"},"ip"]
			}),
			remoteSort:false,
			baseParams:{channel:"",date:"",keyword:"",time:"",page:"1"}
		});

		ChannelStore.load();

		Ext.getCmp("content").add(
			new Ext.Panel({
				id:"LogViewerPanel",
				border:false,
				autoScroll:true,
				tbar:[
					new Ext.Button({
						text:"이전일",
						cls:"x-btn-text-icon details",
						icon:"/images/icon/icon_prev.png",
						handler:function() {
							var today = Ext.getCmp("LogViewerToday").getValue().clearTime(true);
							var yesterday = today.add('d',-1);
							Ext.getCmp("LogViewerToday").setValue(yesterday);
							var thisDay = new Date(yesterday).format("Y-m-d");
							LogStore.baseParams.date = thisDay;
							LogStore.baseParams.page = "1";
							LogStore.load();
						}
					}),
					{xtype:"tbspacer"},
					new Ext.form.DateField({
						id:"LogViewerToday",
						format:"Y-m-d",
						width:100,
						value:new Date().format("Y-m-d"),
						menuListeners:{
							select:{fn:function(object,value) {
								var thisDay = new Date(value).format("Y-m-d");
								LogStore.baseParams.date = thisDay;
								LogStore.baseParams.page = "1";
								LogStore.load();
							}}
						}
					}),
					{xtype:"tbspacer"},
					new Ext.Button({
						text:"다음일",
						cls:"x-btn-text-icon-right details",
						icon:"/images/icon/icon_next.png",
						handler:function() {
							var today = Ext.getCmp("LogViewerToday").getValue().clearTime(true);
							var tomorrow = today.add('d',1);
							Ext.getCmp("LogViewerToday").setValue(tomorrow);
							var thisDay = new Date(tomorrow).format("Y-m-d");
							LogStore.baseParams.date = thisDay;
							LogStore.baseParams.page = "1";
							LogStore.load();
						}
					}),
					{xtype:"tbseparator"},
					new Ext.form.ComboBox({
						id:"LogViewerChannel",
						width:120,
						typeAhead:true,
						triggerAction:"all",
						lazyRender:true,
						listClass:"x-combo-list-small",
						store:ChannelStore,
						editable:false,
						mode:"local",
						displayField:"name",
						valueField:"channel",
						emptyText:"채널선택",
						listeners:{select:{fn:function() {
							LogStore.baseParams.channel = Ext.getCmp("LogViewerChannel").getValue();
							LogStore.baseParams.page = "1";
							LogStore.baseParams.date = new Date(Ext.getCmp("LogViewerToday").getValue()).format("Y-m-d");
							LogStore.load();
						}}}
					}),
					{xtype:"tbseparator"},
					new Ext.form.TimeField({
						id:"LogViewerTime",
						increment:30,
						emptyText:"시간",
						editable:false,
						format:"H:i",
						width:80
					}),
					{xtype:"tbspacer"},
					new Ext.form.TextField({
						id:"LogViewerSearch",
						width:150,
						emptyText:"검색어를 입력하세요."
					}),
					{xtype:"tbspacer"},
					new Ext.Button({
						text:"검색",
						cls:"x-btn-text-icon details",
						icon:"/images/icon/icon_magnifier.png",
						handler:function() {
							LogStore.baseParams.keyword = Ext.getCmp("LogViewerSearch").getValue();
							LogStore.baseParams.date = new Date(Ext.getCmp("LogViewerToday").getValue()).format("Y-m-d");
							LogStore.baseParams.time = Ext.getCmp("LogViewerTime").getValue();
							LogStore.baseParams.page = "1";
							LogStore.load();
						}
					}),
					new Ext.Button({
						text:"전체검색",
						cls:"x-btn-text-icon details",
						icon:"/images/icon/icon_magnifier.png",
						handler:function() {
							LogStore.baseParams.keyword = Ext.getCmp("LogViewerSearch").getValue();
							LogStore.baseParams.page = "1";
							LogStore.baseParams.date = "";
							LogStore.load();
						}
					}),
					{xtype:"tbseparator"},
					new Ext.Button({
						text:"검색취소",
						cls:"x-btn-text-icon details",
						icon:"/images/icon/icon_magifier_zoom_out.png",
						handler:function() {
							Ext.getCmp("LogViewerSearch").setValue("");
							Ext.getCmp("LogViewerTime").setValue("");
							LogStore.baseParams.keyword = Ext.getCmp("LogViewerSearch").getValue();
							LogStore.baseParams.page = "1";
							LogStore.baseParams.time = "";
							LogStore.baseParams.date = new Date(Ext.getCmp("LogViewerToday").getValue()).format("Y-m-d");
							LogStore.load();
						}
					})
				],
				html:""
			})
		);
		Ext.getCmp("content").setTitle(title);
		Ext.getCmp("content").syncSize().doLayout();

		ChannelStore.on("load",function() {
			if (ChannelStore.getCount() > 0) {
				Ext.getCmp("LogViewerChannel").setValue(ChannelStore.getAt(0).get("channel"));
				LogStore.baseParams.channel = ChannelStore.getAt(0).get("channel");
				LogStore.baseParams.date = new Date(Ext.getCmp("LogViewerToday").getValue()).format("Y-m-d");
				LogStore.baseParams.page = "1";
				LogStore.load();
			} else {
				Ext.Msg.show({title:"안내",msg:"로깅중인 채널을 찾을 수 없습니다.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO});
			}
		});

		LogStore.on("beforeload",function() {
			new Ext.Window({
				id:"LogViewerLoading",
				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();
		});

		LogStore.on("load",function() {
			Ext.getCmp("LogViewerLoading").close();

			if (LogStore.baseParams.page == "1") Ext.getCmp("LogViewerPanel").getLayoutTarget().dom.innerHTML = "";
			var sHTML = "<div style='padding:5px; font-size:12px; font-family:돋움; line-height:160%;'>";
			for (var i=0, loop=LogStore.getCount();i<loop;i++) {
				sHTML+= '<div>';
				sHTML+= '['+(LogStore.baseParams.date == "" ? new Date(LogStore.getAt(i).get("reg_date")*1000).format("Y-m-d H:i:s") : new Date(LogStore.getAt(i).get("reg_date")*1000).format("H:i:s"))+'] ';
				sHTML+= '&lt;'+LogStore.getAt(i).get("name")+(LogStore.baseParams.channel == "" ? '/<b>#'+LogStore.getAt(i).get("channel")+'</b>' : '')+'&gt; ';
				sHTML+= LogStore.getAt(i).get("talk");
				sHTML+= ' <span style="color:#CCCCCC;">('+LogStore.getAt(i).get("ip")+')</span>';
				sHTML+= '</div>';
			}
			sHTML+= '</div>';
			Ext.getCmp("LogViewerPanel").getLayoutTarget().dom.innerHTML+= sHTML;

			if (LogStore.baseParams.page == "1") Ext.getCmp("LogViewerPanel").getLayoutTarget().dom.scrollTop = 0;

			if (LogStore.getCount() == 200) {
				var isLoader = false;
				Ext.getCmp("LogViewerPanel").getLayoutTarget().dom.onscroll = function() {
					var thisScroll = Ext.getCmp("LogViewerPanel").getLayoutTarget().dom.scrollTop;
					var endScroll = Ext.getCmp("LogViewerPanel").getLayoutTarget().dom.scrollHeight-Ext.getCmp("LogViewerPanel").getLayoutTarget().dom.clientHeight;

					if (isLoader == false && thisScroll + 300 > endScroll) {
						isLoader = true;
						LogStore.baseParams.page = parseInt(LogStore.baseParams.page)+1;
						LogStore.load();
					}
				}
			} else {
				Ext.getCmp("LogViewerPanel").getLayoutTarget().dom.onscroll = null;
			}
		});
	}
}