//-----------------------------------------------------> ±Û¾²±â Ã¼Å©
function go_write(f,mode) {
	f.comment.value = connetText();
	texts = f.comment.value;

	if(f.writer.value == '') {
		alert('ÀÌ¸§À» ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.writer.focus();
		return;
	}

	if(f.pass.value == '') {
		alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.pass.focus();
		return;
	}

	if(f.title.value == '') {
		alert('Á¦¸ñÀ» ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.title.focus();
		return;
	}

	if (f.comment.value.split(" ").join("") == ""){

		alert('³»¿ëÀ» ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		ifname.focus();
		return;
	}

	if(mode == 'modify') getFileList();
	f.submit();
}

//-----------------------------------------------------> ±Û¾²±â Ã¼Å©
function go_write_news(f,mode) {
	f.comment.value = connetText();
	texts = f.comment.value;

	if(f.newsno.value == '') {
		alert('¼Ò½ÄÁö¹øÈ£¸¦ ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.newsno.focus();
		return;
	}

	if(f.year.value == '') {
		alert('¹ßÇà³âµµ¸¦ ¼±ÅÃ¹Ù¶ø´Ï´Ù.');
		f.year.focus();
		return;
	}

	if(f.title.value == '') {
		alert('Á¦¸ñÀ» ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.title.focus();
		return;
	}

	if (f.comment.value.split(" ").join("") == ""){

		alert('³»¿ëÀ» ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		ifname.focus();
		return;
	}

	f.submit();
}



//-----------------------------------------------------> ±Û¾²±â Ã¼Å©
function go_write_gogo(f,mode) {
	f.comment.value = connetText();
	texts = f.comment.value;

	departvalue = f.depart.options[f.depart.selectedIndex].value;

	if(f.title.value == '') {
		alert('Á¦¸ñÀ» ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.title.focus();
		return;
	}

	if(departvalue == '') {
		alert('ºÐ°ú¸¦ ¼±ÅÃ¹Ù¶ø´Ï´Ù.');
		f.depart.focus();
		return;
	}

	if(f.outdate.value == '') {
		alert('Á¦ÃâÀÏÀÚ¸¦ ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.outdate.focus();
		return;
	}

	if (f.comment.value.split(" ").join("") == ""){

		alert('³»¿ëÀ» ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		ifname.focus();
		return;
	}

	f.submit();
}

//-----------------------------------------------------> ±Û¾²±â Ã¼Å©
function go_write_basic(f,code) {
	f.comment.value = connetText();
	texts = f.comment.value;

if(code == 'data1') {
	if(f.str.value == '') {
		alert('´ëÈ¸¸¦ ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.str.focus();
		return;
	}
} else {
	if(f.number.value == '') {
		alert('¹ßÇà¹øÈ£¸¦ ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.number.focus();
		return;
	}
}
	if (f.comment.value.split(" ").join("") == ""){

		alert('³»¿ëÀ» ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		ifname.focus();
		return;
	}
	f.submit();
}

//-----------------------------------------------------> ±Û¾²±â Ã¼Å©
function go_writetr(f,mode) {
	//f.comment.value = connetText();
	//texts = f.comment.value;

	if(f.writer.value == '') {
		alert('ÀúÀÚ¸¦ ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.writer.focus();
		return;
	}

	if(f.title.value == '') {
		alert('Á¦¸ñÀ» ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.title.focus();
		return;
	}


	if(f.email.value != '') {
		var emailEx1 = /^([A-Za-z0-9]{0,1})([A-Za-z0-9]{1,15})([A-Za-z0-9\-_.]{0,1})([A-Za-z0-9]{1,15})([A-Za-z0-9]{0,1})(@{1})([A-Za-z0-9_]{1,15})(.{1})([A-Za-z0-9_]{2,10})(.{1}[A-Za-z]{2,10})?(.{1}[A-Za-z]{2,10})?$/;
		if(!emailEx1.test(f.email.value)) {
			alert ('E-mail Çü½ÄÀÌ Àß¸øµÇ¾ú½À´Ï´Ù.');
			f.email.value = '';
			f.email.focus();
			return;
		}
	}else{
		alert ('E-mail À» ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.email.value = '';
		f.email.focus();
		return;
	}

	if(f.passwd.value == '') {
		alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.passwd.focus();
		return;
	}


/*
if (f.comment.value.split(" ").join("") == ""){
		alert('³»¿ëÀ» ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		ifname.focus();
		return;
	}
}
*/

	if(mode == 'modify') getFileList();
	f.submit();
}
//-----------------------------------------------------> ±Û¾²±â Ã¼Å©
function go_basic(f,mode) {
	f.comment.value = connetText();
	texts = f.comment.value;

	if(f.writer.value == '') {
		alert('ÀúÀÚ¸¦ ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.writer.focus();
		return;
	}

	if(f.title.value == '') {
		alert('Á¦¸ñÀ» ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.title.focus();
		return;
	}

	if(f.depart.value == '') {
		alert('ºÐ°ú¸¦ ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.depart.focus();
		return;
	}

	if(f.outdate.value == '') {
		alert('Á¦ÃâÀÏÀ» ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.outdate.focus();
		return;
	}

	if (f.comment.value.split(" ").join("") == ""){

		alert('³»¿ëÀ» ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		ifname.focus();
		return;
	}

	if(mode == 'modify') getFileList();
	f.submit();
}
//-----------------------------------------------------> ±Û¾²±â Ã¼Å©
function go_write2(f) {

	f.comment.value = connetText();
	texts = f.comment.value;



	if(f.name.value == '') {
		alert('ÀÌ¸§À» ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.name.focus();
		return;
	}

	if(f.subject.value == '') {
		alert('Á¦¸ñÀ» ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		f.subject.focus();
		return;
	}

	if (f.comment.value.split(" ").join("") == ""){

		alert('³»¿ëÀ» ÀÔ·Â¹Ù¶ø´Ï´Ù.');
		ifname.focus();
		return;
	}



		f.submit();
}

//------------------------------------------------------------------------> ±Û¾´ ³»¿ëÀ» content·Î ÀÌµ¿
function connetText(){

var HTMLSOURCE = "";
try{
   HTMLSOURCE = ifname.document.body.innerHTML;
}
catch(e){
}
return HTMLSOURCE;
			
}


function ContentsDecode(str){

    str = str.replace(/&lt;/gi,"<");
    str = str.replace(/&gt;/gi,">");
    str = str.replace(/&amp;/gi,"&");
	return str;

}
//------------------------------------------------------------------------> Ã³À½ ±Û¾²´Â °÷ ¼³Á¤
function writeinit(){

var source = "<html><head><style>P {margin-top:2px;margin-bottom:2px;} table {border:1 solid C6C3C6}</style></head><body></body></html>"
ifname.document.designMode="On"
ifname.document.open("text/html");
ifname.document.write(source);
ifname.document.close();
ifname.document.body.style.fontSize = "9pt";
ifname.document.body.style.fontFamily = "µ¸¿ò";

tdoc=ifname.document;



  if (document.all.modycontent != null) {
     //ifname.document.body.innerHTML = ContentsDecode(document.write_f.ssssa.value);
	 //ifname.document.body.innerHTML = ContentsDecode(document.all.modycontent.innerHTML);

	 //document.getElementById("ifname").contentWindow.document.write(document.write_f.ssssa.value);
	 ifname.document.body.innerHTML = ContentsDecode(document.all.modycontent.innerHTML);
  }

}



//------------------------------------------------------------------------> 

function fontsize_change(size)
{
   	TargetText=tdoc.selection.createRange();
    TargetText.execCommand('FontSize', '', size);
    ifname.focus();
}


function font_face_change(fname)
{
   	TargetText=tdoc.selection.createRange();
   	TargetText.execCommand('FontName', '', fname);
   	ifname.focus();
}

function font_height_change(fname)
{
   	TargetText=tdoc.document;
   	TargetText.lineHeight=fname;
   	ifname.focus();
}

function bold_text()
{
  	TargetText=tdoc.selection.createRange();
    TargetText.execCommand('Bold');
    ifname.focus();

}      

function italic_tex()
{
    TargetText=tdoc.selection.createRange();
    TargetText.execCommand('Italic');
    ifname.focus();

}


function url_ch()
{

    TargetText=tdoc.selection.createRange();

	if (TargetText.text == '') {
		return;
	}


    ifname.focus();
    TargetText.execCommand("CreateLink",1); 


}

function underline_tex()
{
    TargetText=tdoc.selection.createRange();
    TargetText.execCommand('Underline');
    ifname.focus();

}
function Set_fontcolor(color){

 	TargetText=tdoc.selection.createRange();
    if (color != null)
    {
         TargetText.execCommand('ForeColor', '', color);
		 ifname.focus();
    }



    //if (Selection!=null)Selection.select();
	//TargetText=tdoc.selection.createRange();
    //TargetText.execCommand("forecolor", null, color);
    document.all["TableFontColor"].style.display = "none";
	//ifname.document.selection.empty()
	
}


function color_sels()
{
 	TargetText=tdoc.selection.createRange();
    var color = showModalDialog("../lib/textarea.php?stype=colors",0,"dialogHeight=186px;dialogWidth=236px; scrollbars=no; status=0; help=0");
    if (color != null)
    {

        TargetText.execCommand('ForeColor', '', color);

    }

}


function color_back()
{
 	TargetText=tdoc.selection.createRange();
    var color = showModalDialog("../lib/textarea.php?stype=colors",0,"dialogHeight=186px;dialogWidth=236px; scrollbars=no; status=0; help=0");
    if (color != null)
    {

        TargetText.execCommand('BackColor', '', color);

    }

}

//---------------------------------> ¿ÞÂÊ Á¤·Ä
function justifyleft()
{
  	TargetText=tdoc.selection.createRange();
    TargetText.execCommand('justifyleft');
    ifname.focus();

}      
//---------------------------------> °¡¿îµ¥ Á¤·Ä
function justifycenter()
{

	TargetText=tdoc.selection.createRange();
	 ifname.document.execCommand("justifycenter");
	 ifname.focus();

}      

//---------------------------------> ¿À¸¥ÂÊ Á¤·Ä
function justifyright()
{
  	TargetText=tdoc.selection.createRange();
    TargetText.execCommand('justifyright');
    ifname.focus();

}      

//---------------------------------> ¼ýÀÚ ¹øÈ£ Á¤·Ä
function insertorderedlist()
{
  	TargetText=tdoc.selection.createRange();
    TargetText.execCommand('insertorderedlist');
    ifname.focus();

}      

//---------------------------------> Á¡ ¹øÈ£ Á¤·Ä
function insertunorderedlist()
{
  	TargetText=ifname.document.selection.createRange();
    TargetText.execCommand('insertunorderedlist');
    ifname.focus();

}      

//---------------------------------> ÀÌ¹ÌÁö ¸µÅ© »ðÀÔ
function imgview() {

	ifname.focus();
    var imageUrl = showModalDialog("../lib/textarea.php?stype=imgss","","font-family:±¼¸²; font-size:10; dialogWidth: 40em; dialogHeight: 20em");
    if (imageUrl != null) 
    {
		var ssssz = ifname.document.selection.createRange();
		ssssz.pasteHTML(imageUrl);
		//s.select();
    }
    ifname.focus();
}

//---------------------------------> ÀÌ¹ÌÁö ÆÄÀÏ »ðÀÔ (°Ô½ÃÆÇ)

function imgfile(tabN) {

		var filesize = document.write_f.totalsize.value;
		window.open('../lib/textarea.php?stype=bodyfile&filesize=' + filesize + "&tasb=" + tabN,'','width=400,height=230,menubar=0,toolbar=0,status=0,resizable=1,scrollbars=no');


}
//---------------------------------> ÀÌ¹ÌÁö ÆÄÀÏ »ðÀÔ (ÀÌ¹ÌÁö °Ô½ÃÆÇ)

function imgfile2(tabN) {

		var filesize = document.write_f.totalsize.value;
		var filenj = document.write_f.filej.value;
		window.open('/proc/func/textarea_img.php?stype=imgfile&filesize=' + filesize + "&filenj=" + filenj + "&tasb=" + tabN,'','width=400,height=230,menubar=0,toolbar=0,status=0,resizable=1,scrollbars=no');


}

function imgfile1(tabN) {

		var filesize = document.write_f.totalsize.value;
		var filenj = document.write_f.filej.value;
		window.open('./textarea.php?stype=imgfile&filesize=' + filesize + "&filenj=" + filenj + "&tasb=" + tabN,'','width=400,height=230,menubar=0,toolbar=0,status=0,resizable=1,scrollbars=no');


}

function movie(tabN) {
		var filesize = document.write_f.totalsize.value;
		var filenj = document.write_f.filej.value;
		window.open('movie.html?filesize=' + filesize + "&filenj=" + filenj + "&tasb=" + tabN,'','width=400,height=200,menubar=0,toolbar=0,status=0,resizable=1,scrollbars=no');


}

function movie_file(tabN) {

		var filesize = document.write_f.totalsize.value;
		var filenj = document.write_f.filej.value;

		window.open('movie_file.html?filesize=' + filesize + "&filenj=" + filenj + "&tasb=" + tabN,'','width=400,height=200,menubar=0,toolbar=0,status=0,resizable=1,scrollbars=no');


}

//---------------------------------> Å×ÀÌºí »ðÀÔ
function tableview() {

	ifname.focus();

   var tablepro = showModalDialog("./textarea.php?stype=tabless","","font-family:±¼¸²; font-size:10; dialogWidth: 35em; dialogHeight: 20em");

    if (tablepro != null) 
    {
		var s = tdoc.selection.createRange();
		s.pasteHTML(tablepro);
		s.select();
    }
    ifname.focus();

}








//----------------------------------------------------------->  ÆùÆ® »ö±ò ÁöÁ¤ÇÏ´Â ºÎºÐ



function FontColor(ch){

if (navigator.userAgent.indexOf("MSIE 5.0") > 0)
{
     //alert("´ç½ÅÀÇ ºê¶ó¿ìÁ®´Â 5.0 ÀÌ±º¿ä!");
	 document.all["TableFontColor"].style.top = "65";
     document.all["TableFontBackColor"].style.top = "65";
}

	if (ch=="1")
	{

		document.all["TableFontColor"].style.display = "";
		document.all["TableLink"].style.display = "none";
		document.all["TableFontBackColor"].style.display = "none";


	}
	if (ch=="2")
	{
		document.all["TableLink"].style.display = "none";
		document.all["TableFontColor"].style.display = "none";
		document.all["TableFontBackColor"].style.display = "";

	}
}










//----------------------------------------------- °á°ú Ã³¸® ÇÏ±â 
function test()
{
    d=tdoc.body.createTextRange();
    document.write_f.content.value=d.htmlText;
}

function load_in()
{
    d=tdoc.body.createTextRange();
    abc=document.write_f.content.value;
    d.pasteHTML(abc);
}


function MM_swapImgRestore() { //v3.0
  	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}