<!--
var isIE  = (document.all) ? true : false;
var editor_focus = false;
var save_draft_timer;
var palette_mode;

function set_editor() {
	var source = '<style> body { margin:10px; line-height:150%; font-family:arial } .bd1 { border: solid 1px black; } p { margin:0; font-size:9pt; line-height:150%; } .caption { color:#FF6131; letter-spacing:-1px; vertical-align:top; } ul { margin-top:0; margin-bottom:0px; } li { list-style-type:square; margin:10px 0; } a:link { color:#CB7916; text-decoration:none; } a:visited { color:#CB7916; text-decoration:none; } a:hover { color:#CB7916; text-decoration:underline; } </style>';
	htmleditor.document.designMode = 'On';
	htmleditor.document.open('text/html');
	htmleditor.document.write(source);
	htmleditor.document.close();
	htmleditor.document.body.style.fontSize = '9pt';
	htmleditor.document.body.style.color = '#393624';
	var innerBody = htmleditor.document.body;
	innerBody.onblur = function() { save_pos(); }
	innerBody.onfocus = function() { save_pos(); editor_focus = true; }
	innerBody.onkeydown = function() { onkeypress_html_body(); }
	set_body();
	keepalive();
}

function save_pos() {
	try { htmleditor.document.currentPos =  htmleditor.document.selection.createRange().duplicate(); }
	catch(e) { }
}

function onclick_editor_com(com) {
	htmleditor.document.execCommand(com, false, null);
	htmleditor.focus();
}

function onclick_editor_font(com, val) {
	htmleditor.document.execCommand(com, null, val);
	htmleditor.focus();
}

function display_palette() {
	document.getElementById('editor_palette').style.display = 'block';
}

function ck_color(color) {
	htmleditor.focus();
	if (palette_mode == '1') {
		htmleditor.document.execCommand('ForeColor', false, color);
	} else {
	       if (isIE){
			htmleditor.document.execCommand('BackColor', null, color );
		}else{
			htmleditor.document.execCommand('hilitecolor', null, color );
		}
	}
	document.getElementById('editor_palette').style.display = 'none';
}

function set_text(text) {
	if (isIE) {
		var sText = htmleditor.document.currentPos;
		if (!sText) return false;
		htmleditor.document.body.focus();
		sText.pasteHTML(text);
		sText.select();
	} else {
		htmleditor.focus();
		htmleditor.document.execCommand('insertHTML', false, 'text');
		htmleditor.focus();
	}
}

function set_emoticon(src) {
	htmleditor.focus();

	if (isIE) {
		save_pos();
		var sText = htmleditor.document.currentPos;
		if (!sText) return false;
		htmleditor.document.body.focus();
		sText.pasteHTML('<img src="'+src+'">');
		sText.select();
	} else {
		htmleditor.focus();
		htmleditor.document.execCommand('insertHTML', false, '<img src="'+src+'" align="absmiddle">');
		htmleditor.focus();
	}
}

function set_image(path, width, height, caption, align) {
	htmleditor.focus();

	var paste_text = '<img class="bd1" src="'+fs_path+path+'">';
	if (caption != '') caption = '<tr><td class="caption"><p>'+caption+'</p></td></tr>';
	if (align == '1') paste_text = '<table cellspacing="0" style="float:left; margin-right:10px"><tr><td>' + paste_text + '</td></tr>'+caption+'</table>';
	if (align == '2') paste_text = '<table cellspacing="0" align="center" style="width:'+width+'px;"><tr><td>' + paste_text + '</td></tr>'+caption+'</table>';
	if (align == '3') paste_text = '<table cellspacing="0" style="float:right; margin-left:10px"><tr><td>' + paste_text + '</td></tr>'+caption+'</table>';
	if (isIE) {
		save_pos();
		var sText = htmleditor.document.currentPos;
		if (!sText) return false;
		htmleditor.document.body.focus();
		sText.pasteHTML(paste_text);
		sText.select();
	} else {
		htmleditor.focus();
		htmleditor.document.execCommand('insertHTML', false, paste_text);
		htmleditor.focus();

	}
}

function set_image2(path1, width1, height1, caption1, path2, width2, height2, caption2, align) {
	var paste_text1 = '<img class="bd1" src="'+fs_path+path1+'">';
	var paste_text2 = '<img class="bd1" src="'+fs_path+path2+'">';
	
	htmleditor.focus();

	var align_str = '';
	if (align == '1') align_str = 'left';
	if (align == '2') align_str = 'center';
	if (align == '3') align_str = 'right';
	paste_text = '<table cellspacing="0" align="'+ align_str +'"><tr><td>' + paste_text1 + '</td><td>' + paste_text2 + '</td></tr><tr><td class="caption"><p>'+caption1+'</p></td><td class="caption"><p>'+caption2+'</p></td></tr></table></div>';
	if (isIE) {
		save_pos();

		var sText = htmleditor.document.currentPos;
		if (!sText) return false;
		htmleditor.document.body.focus();
		sText.pasteHTML(paste_text);
		sText.select();
	} else {
		htmleditor.focus();
		htmleditor.document.execCommand('insertHTML', false, paste_text);
		htmleditor.focus();
	}
}


function onclick_attach_image() {
	window.open('editor_pop_attach_image.php','a_i','width=400,height=370');
}

function onclick_editor_link(obj) {
	viewObj('div_link_keyword');
	document.getElementById('link_keyword').focus();
	document.getElementById('link_keyword').value = obj.text;
	onkeyup_kwsub2(document.getElementById('link_keyword'));
}

var ctrl_mode = 0;
function onkeypress_html_body() {
	var kc = htmleditor.event.keyCode;
	
	if (ctrl_mode == 1 && (kc == 32 || kc == 49)) { htmleditor.document.currentPos2 =  htmleditor.document.selection.createRange().duplicate();	 onclick_editor_link(htmleditor.document.currentPos2); }
	if (kc == 17) ctrl_mode = 1; else ctrl_mode = 0;  

	// if (save_draft_timer) window.clearInterval(save_draft_timer);
	// save_draft_timer = window.setInterval('save_draft()', 5000);
}

function onclick_move_page(fid) {
	/*
	var cursor_obj = document.getElementById('kwsub_cursor');
	if (cursor_obj.value != '') {
		document.getElementById('kwsub').value = document.getElementById('hd_li_'+cursor_obj.value).value;
	}
	var kw = (!fid) ? $('kwsub').value : $('kwsub2').value;
	var url = src_path + 'ajax_exe.php';
	pars = 'mode=get_urlencode';
	pars += '&keyword='+trim(kw);
	var myAjax = new Ajax.Request(url, { method: 'post', postBody: pars, onComplete: get_move_page });*/
	if(!fid){
		var kw = $('suggest').value;
		// var kw = $('kwsub').value;
	}else if(fid=='footsearch'){
		var kw = $('kwsub2').value;
	}else{
		var kw = $('kwsub3').value;
		window.location.href='http://qna.plaync.co.kr/aion/list.php?ts='+kw;
		return;
	}
	var url = src_path + 'ajax_exe.php';
	pars = 'mode=get_urlencode';
	pars += '&keyword='+trim(kw);
	var myAjax = new Ajax.Request(url, { method: 'post', postBody: pars, onComplete: get_move_page });
}

function get_move_page(originalRequest) {
	var result = originalRequest.responseText;
	// alert(result); alert(src_path);
	window.location.href=src_path+'doc_create.php?kw='+result;
}

function onkeyup_kwsub(obj) {
	if (event.keyCode == '38') {
		onkeyup_kwsub_up();
		return false;
	} else if (event.keyCode == '40') {
		onkeyup_kwsub_down();
		return false;
	} else document.getElementById('kwsub_cursor').value = '';
	
	var url = src_path + 'ajax_exe.php';
	pars = 'mode=auto_suggest';
	pars += '&keyword='+obj.value;
	
	var myAjax = new Ajax.Request(url, { method: 'post', postBody: pars, onComplete: receive_onkeyup_kwsub });
}

function receive_onkeyup_kwsub(originalRequest) {
	var result = originalRequest.responseText;
	document.getElementById('kwsub_result').style.display = 'none';
	document.getElementById('kwsub_result').innerHTML=result;
	if (result.length != 0) document.getElementById('kwsub_result').style.display = 'block';
}

function onkeyup_kwsub_up() {
	var cursor_obj = document.getElementById('kwsub_cursor');
	if (cursor_obj.value == '') cursor_obj.value = -1;
	var li1 = document.getElementById('kw_li_'+cursor_obj.value);
	cursor_obj.value = parseInt(cursor_obj.value)-1;
	var li2 = document.getElementById('kw_li_'+(cursor_obj.value));
	if (li2 != null) {
		li2.className='on'; 		// li2.style.backgroundColor='#FEE6CA';
		if (li1 != null) li1.className=''; 		// li1.style.backgroundColor='#FFFFFF';
	} else cursor_obj.value = parseInt(cursor_obj.value)+1;
}
	
function onkeyup_kwsub_down() {
	var cursor_obj = document.getElementById('kwsub_cursor');
	if (cursor_obj.value == '') cursor_obj.value = -1;
	var li1 = document.getElementById('kw_li_'+cursor_obj.value);
	cursor_obj.value = parseInt(cursor_obj.value)+1;
	var li2 = document.getElementById('kw_li_'+(cursor_obj.value));
	if (li2 != null) {
		li2.className='on'; 		// li2.style.backgroundColor='#FEE6CA';
		if (li1 != null) li1.className=''; 		// li1.style.backgroundColor='#FFFFFF';
	} else cursor_obj.value = parseInt(cursor_obj.value)-1;
}

function onkeyup_kwsub2(obj) {
	if (event != null) {
		if (event.keyCode == '38') {
			onkeyup_kwsub_up2();
			return false;
		} else if (event.keyCode == '40') {
			onkeyup_kwsub_down2();
			return false;
		} else document.getElementById('kwsub_cursor2').value = '';
	}
		
	var url = src_path + 'ajax_exe.php';
	pars = 'mode=auto_suggest2';
	pars += '&keyword='+obj.value;
	var myAjax = new Ajax.Request(url, { method: 'post', postBody: pars, onComplete: receive_onkeyup_kwsub2 });
}

function receive_onkeyup_kwsub2(originalRequest) {
	var result = originalRequest.responseText;
	document.getElementById('kwsub_result2').style.display = 'none';
	document.getElementById('kwsub_result2').innerHTML=result;
	if (result.length != 0) document.getElementById('kwsub_result2').style.display = 'block';
	
}

function onkeyup_kwsub_up2() {
	var cursor_obj = document.getElementById('kwsub_cursor2');
	if (cursor_obj.value == '') cursor_obj.value = -1;
	var li1 = document.getElementById('kw2_li_'+cursor_obj.value);
	cursor_obj.value = parseInt(cursor_obj.value)-1;
	var li2 = document.getElementById('kw2_li_'+(cursor_obj.value));
	if (li2 != null) {
		li2.className='on'; 
		if (li1 != null) li1.className=''; 
	} else cursor_obj.value = parseInt(cursor_obj.value)+1;
}
	
function onkeyup_kwsub_down2() {
	var cursor_obj = document.getElementById('kwsub_cursor2');
	if (cursor_obj.value == '') cursor_obj.value = -1;
	var li1 = document.getElementById('kw2_li_'+cursor_obj.value);
	cursor_obj.value = parseInt(cursor_obj.value)+1;
	var li2 = document.getElementById('kw2_li_'+(cursor_obj.value));
	if (li2 != null) {
		li2.className='on'; 
		if (li1 != null) li1.className=''; 
	} else cursor_obj.value = parseInt(cursor_obj.value)-1;
}

function onclick_paste_keyword2() {
	var cursor_obj = document.getElementById('kwsub_cursor2');
	if (cursor_obj.value != '') {
		htmleditor.document.body.focus();
		if (htmleditor.document.currentPos2) htmleditor.document.currentPos = htmleditor.document.currentPos2;
		set_text('<a href="' + doc_path + document.getElementById('hd2_li_'+cursor_obj.value).value+'">'+document.getElementById('hd3_li_'+cursor_obj.value).value+'</a>');
		hideObj('div_link_keyword');
	} else {
		var url = src_path + 'ajax_exe.php';
		pars = 'mode=get_urlencode';
		pars += '&keyword='+document.getElementById('link_keyword').value;
		var myAjax = new Ajax.Request(url, { method: 'post', postBody: pars, onComplete: get_link_keyword });
	}
	
}

function get_link_keyword(originalRequest) {
	var result = originalRequest.responseText;
	htmleditor.document.body.focus();
	if (htmleditor.document.currentPos2) htmleditor.document.currentPos = htmleditor.document.currentPos2;
	set_text('<a href="' + doc_path + result+'">'+trim(document.getElementById('link_keyword').value)+'</a>');
	hideObj('div_link_keyword');
}

-->