	function exceldown(n,p) {
		var url = "/exceldown.html?num="+n+"&pro="+p;
		window.open(url,'','width=500,height=400,left=1,top=1,scrollbars=yes');
	}
	function worddown(n,p) {
		var url = "/worddown.html?num="+n+"&pro="+p;
		window.open(url,'','width=500,height=400,left=1,top=1,scrollbars=yes');
	}

	function printPage(n,p) {
		var url = "/printPage.html?num="+n+"&pro="+p;
		window.open(url,'','width=250,height=400,left=1,top=1,scrollbars=yes');
	}

function getCookieVal(offset) {
	var endstr = document.cookie.indexOf(";", offset);
	if(endstr == -1) endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
	//return document.cookie.substring(offset, endstr);
}

function GetCookie(name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	
	while (i < clen) {
		var j = i + alen;
		if(document.cookie.substring(i, j) == arg) return getCookieVal(j);
		i = document.cookie.indexOf(" ", i) + 1;
		if(i == 0) break;
	}
	return null;
}

function SetCookie(name, value) {
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : "/";
//	var domain = (argc > 4) ? argv[4] : "<?echo("$siteID");?>";
//	var domain = (argc > 4) ? argv[4] : "61.81.223.214";
	var secure = (argc > 5) ? argv[5] : false;
	
	document.cookie = name + "=" + escape(value) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +
//	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}

var fontSize = eval(GetCookie('fontsize'));
var lineHeight = eval(GetCookie('lineheight'));

if(fontSize == null) fontSize = 12;
if(lineHeight == null) lineHeight = 22;

function setFont(fontSize) { 
	obj = document.getElementById("view_body");
	obj.style.fontSize = fontSize + "px";
	SetCookie("fontsize", fontSize);
}

function fontPlus() { 
	if (fontSize < 20) {
		fontSize = fontSize + 1; 
		setFont(fontSize); 
	} 
}

function fontMinus() { 
	if (fontSize > 12) {
		fontSize = fontSize - 1; 
		setFont(fontSize); 
	} 
}

function imgInput(n,t) {
	var ref = "imgUpload.html?uid="+n+"&TB="+t;
	window.open(ref, "ZipWin", "width=500, height=400, status=no, scrollbars=yes");
}


function f_backcolor(color){
	document.WriteForm.backcolor.value = color;
	document.WriteForm.FORSAVE.value = "<STYLE>P {margin-top:2px;margin-bottom:2px;font-size:9pt;}</STYLE><BODY oncontextmenu='return false;' BGCOLOR='"+color+"' style='font-size:11pt; font-family:±¼¸²;' topmargin=11 leftmargin=11>";
	ContentIframe.document.body.style.backgroundColor = '' + color + '';
}

function format(what, opt)
{
  if (opt == null) {
  ContentIframe.document.execCommand(what);
  }
  else {
  ContentIframe.document.execCommand(what,"", opt);
  }
  nowkong.selection = null;
}

function tchange(clk, opt){
	if (document.WriteForm.HTML.value == 'TEXT')
	{
		alert('\nTEXT ¸ðµå¿¡¼­´Â »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.        \n');
		return false;
	}

	var nowopened=0;
	if(document.all.colum.style.display!='none'){
		nowopened =1;
	}
	else {
		nowkong.SaveSelection();
	}
	if(document.WriteForm.sourceview.checked){
		alert('Á÷Á¢ÄÚµù Ã¼Å©¸¦ ÇØÁ¦ÇÏ°í »ç¿ëÇÏ¼¼¿ä');
		return;
	}

	nowkong.RestoreSelection();
	if(nowkong.selection){
		var aa = nowkong.selection.parentElement();
		if(aa.style.topmargin != "12px"){
			ContentIframe.focus();
		}
	}
	if (clk == "bgcol")
	{
		GetColor(document.WriteForm.backcolor);
		return;
	}
	if(clk == "backcol"){
		GetColor(document.WriteForm.bgcolor);
		return;
	}
	else if(clk == "fontcol"){
		GetColor(document.WriteForm.fontcolor);
		return;
	}
	else{
		format(clk, opt);
	}

	return true;
}
function plus_width() {
	if (parseInt(document.getElementById("ContentDiv").style.width) < 650)
	{
		document.getElementById("ContentDiv").style.width = 650;
		document.WriteForm.CONTENT.style.width = 650;
	}
	else {
		document.getElementById("ContentDiv").style.width = parseInt(document.getElementById("ContentDiv").style.width) + 30;
		document.WriteForm.CONTENT.style.width = parseInt(document.WriteForm.CONTENT.style.width) + 30;
	}
}
function minus_width() {
	if (parseInt(document.getElementById("ContentDiv").style.width) > 650)
	{
	document.getElementById("ContentDiv").style.width = parseInt(document.getElementById("ContentDiv").style.width) - 30;
	document.WriteForm.CONTENT.style.width = parseInt(document.WriteForm.CONTENT.style.width) - 30;
	}
}
function plus_height() {
	document.getElementById("ContentDiv").style.height = parseInt(document.getElementById("ContentDiv").style.height) + 100;	
	document.WriteForm.CONTENT.style.height = parseInt(document.WriteForm.CONTENT.style.height) + 100;
}
function minus_height() {
	if ( parseInt(document.getElementById("ContentDiv").style.height) > 330)
	{
	document.getElementById("ContentDiv").style.height = parseInt(document.getElementById("ContentDiv").style.height) - 100;
	document.WriteForm.CONTENT.style.height = parseInt(document.WriteForm.CONTENT.style.height) - 100;
	}
}
function aplus_size() {
	plus_width();
	plus_height();
}
function real_size() {
	document.getElementById("ContentDiv").style.width = "100%";
	document.getElementById("ContentDiv").style.height = 330;
	document.WriteForm.CONTENT.style.width = "100%";
	document.WriteForm.CONTENT.style.height = 330;
}
function srcview(flag){
	
	if(flag){
		if (document.WriteForm.HTML.value == 'TEXT')
		{
			alert('\nTEXT ¸ðµå¿¡¼­´Â »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.\n');
			document.WriteForm.sourceview.checked = false;
			return false;
		}

		document.WriteForm.bd_temp.value = ContentIframe.document.body.style.backgroundImage;
		document.WriteForm.bgcolor_temp.value = ContentIframe.document.body.style.backgroundColor;
		var tmp = ContentIframe.document.body.innerHTML;
		ContentIframe.document.body.innerText = tmp;
		ContentIframe.document.body.style.backgroundImage = '';
		ContentIframe.document.body.style.backgroundColor = '';
		ContentIframe.focus();
	}
	else{
		var tmp = ContentIframe.document.body.innerText;
		ContentIframe.document.body.innerHTML = tmp;
		ContentIframe.document.body.style.backgroundImage = document.WriteForm.bd_temp.value;
		ContentIframe.document.body.style.backgroundColor = document.WriteForm.bgcolor_temp.value;
		ContentIframe.focus();
	}
}

function edittext(){
	
	if(document.WriteForm.HTML.value == 'TEXT') {
		var conf = confirm("HTMLÈ¿°ú°¡ »ç¶óÁý´Ï´Ù. ½ÇÇàÇÏ½Ã°Ú½À´Ï±î?");
		if(!conf){
			document.WriteForm.HTML.value = "HTML";
			return;
		}

		document.getElementById("ContentDiv").style.display = "none";
		var str = ContentIframe.document.body.innerText;
		document.WriteForm.CONTENT.value = str;
		//document.WriteForm.CONTENT.value= str.replace(/&lt;?/g, '<').replace(/&gt;?/g, '>').replace(/&quot;?/g, '"').replace(/&amp;?/g, '&');
		document.WriteForm.CONTENT.style.display = "block";
	}
	else {
		var conf = confirm("HTMLÆíÁýÀ¸·Î ÀüÈ¯ÇÕ´Ï´Ù. ½ÇÇàÇÏ½Ã°Ú½À´Ï±î?");
		if(!conf){
			document.WriteForm.HTML.value = "TEXT";
			return;
		}

		document.getElementById("ContentDiv").style.display = "block";
		document.WriteForm.CONTENT.style.display = "none";
	}
}

function Edit_Start(html)
{
	var tag = "";
	nowkong = new kong();
	ContentIframe.document.open();
	ContentIframe.document.write(document.WriteForm.FORSAVE.value);
	ContentIframe.document.close();
	ContentIframe.document.designMode = 'on';
	if (html == "TEXT")
	{
		setTimeout("textstart()",10);
	}
}

function View_Start(html)
{
	var tag = "";
	nowkong = new kong();
	ContentIframe2.document.open();
	ContentIframe2.document.write(document.WriteForm.FORSAVE2.value);
	ContentIframe2.document.close();
	ContentIframe2.document.designMode = 'on';
	if (html == "TEXT")
	{
		setTimeout("textstart()",10);
	}
}

function kong()
{
	this.selection    = null;
	this.selection2    = null;
	this.RestoreSelection = Kong_RestoreSelection;
	this.SaveSelection  = Kong_SaveSelection;
	this.GetSelection  = Kong_GetSelection;
}

function Kong_RestoreSelection() 
{
	if (this.selection) {
		this.selection.select();
	}
}

function Kong_GetSelection() 
{
	var oSel = this.selection;
	if (!oSel) {
		oSel = ContentIframe.document.selection.createRange();
		oSel.type = ContentIframe.document.selection.type;
	}
	return oSel;
}

function Kong_SaveSelection() 
{
	nowkong.selection = ContentIframe.document.selection.createRange();
	nowkong.selection.type = ContentIframe.document.selection.type;
}

function textstart(){
	document.getElementById("ContentDiv").style.display = "none";
	var str = ContentIframe.document.body.innerText;
	//document.WriteForm.CONTENT.value= str.replace(/&lt;?/g, '<').replace(/&gt;?/g, '>').replace(/&quot;?/g, '"').replace(/&amp;?/g, '&');
	document.WriteForm.CONTENT.value = str;
	document.WriteForm.CONTENT.style.display = "block";
}