/**
 * JukeonBBS.js
 * zero@neowiz.com
 * ÁêÅ©¿Â °Ô½ÃÆÇ °ü·Ã ÀÚ¹Ù½ºÅ©¸³Æ®
 **/

/*************************************************************
 * ±âº» º¯¼ö ¼³Á¤
 *************************************************************/
var j_type;/*{{{*/
var j_category1;
var j_category2;/*}}}*/

/*************************************************************
 * Submit 
 *************************************************************/
var is_submit = false;

var aTextRange;

function disable_submit_button() {/*{{{*/
  if(is_submit==true) return false;
  is_submit = true;
  //obj.disabled = true;
  return check_submit(obj);
}/*}}}*/

function enable_submit_button() {/*{{{*/
  is_submit = false;
}/*}}}*/

function isBlank(str, obj) {/*{{{*/
	try{
		str = str.replace(/¡¡/g, ' ');
		obj.value = str;
	
		str = str.replace(/\s/g, '');
		if( str.length == 0 ) return true;
		else return false;
	}catch(e) {
		return false;
	}
}/*}}}*/

function ___check_board_submit() {/*{{{*/
	alert("½Ã½ºÅÛ ¿À·ù°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù.");
}

function check_board_submit() {/*{{{*/


  var form_obj = document.jukeon_board;

  if (is_submit)
    return false;
	
  // Á¦¸ñ °Ë»ç
  if (typeof(form_obj.title)!="undefined" && form_obj.title.value == "") 
  {
    open_alert("Á¦¸ñÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
    form_obj.title.focus();
    is_submit = false;
    return false;
  }

  if (isBlank(form_obj.title.value, form_obj.title)){ 
    open_alert('°ø¹é¾øÀÌ Á¦¸ñÀ»  ÀÔ·ÂÇÏ¼¼¿ä.'); 
    form_obj.title.focus(); 
    is_submit = false;
    return false; 
	} 
	  
	try{
		if (typeof(form_obj.title)!='undefined' && calc_strlen(form_obj.title.value) > 80)
		{
			open_alert("Á¦¸ñÀº ÃÖ´ë ÇÑ±Û 40ÀÚ, ¿µ¹® 80ÀÚ±îÁö¸¸ °¡´ÉÇÕ´Ï´Ù.","¾Ë¸²",340);
			form_obj.title.focus();
			is_submit = false;
			return false;
		}
	}catch(e) {
	}
	
  // ÀÌ¸§ °Ë»ç
  if (typeof(form_obj.nick_name) != "undefined" && form_obj.nick_name.value == "") 
  {
    open_alert("ÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
    form_obj.nick_name.focus();
    is_submit = false;
    return false;
  }
  

  if (typeof(form_obj.nick_name) != "undefined" && calc_strlen(document.jukeon_board.nick_name.value) > 12)
  {
    open_alert('ÀÌ¸§Àº ÃÖ´ë ÇÑ±Û 6ÀÚ, ¿µ¹® 12ÀÚ ±îÁö¸¸ °¡´ÉÇÕ´Ï´Ù.','¾Ë¸²',340);
    document.jukeon_board.nick_name.focus();
    return false;
  }
          
  // ºñ¹Ð¹øÈ£ °Ë»ç
  if (typeof(form_obj.passwd) != "undefined" && form_obj.passwd.value == "") 
  {
    open_alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
    form_obj.passwd.focus();
    is_submit = false;
    return false;
  }
  


	if(typeof(form_obj.boardgrp) != 'undefined' && form_obj.boardgrp.value == 'compil'){		// ¸®´º¾ó º¯°æµÈ °ø°³¾Ù¹ü editer »ç¿ë¾ÈÇÔ
	
		// ³»¿ë °Ë»ç
		if (typeof(form_obj.compil_comment)!="undefined" && form_obj.compil_comment.value == "") 
		  {
			open_alert("³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
			form_obj.compil_comment.focus();
			is_submit = false;
			return false;
		  }
		  
		  // ´ëÇ¥ ÀÌ¹ÌÁö ¼±ÅÃÈÄ »èÁ¦ ÇßÀ»°æ¿ìµµ ÀÖÀ¸¹Ç·Î..
		  /*
		  if(preview_img.innerHTML == "") form_obj.default_img.value = '0';
		  
		  alert(form_obj.default_img.value);
		*/
		
		 var memo = editorSpace.document.body.innerHTML+form_obj.compil_comment.value;

		 document.up.setimagethumbnailwidthheight(80, 80);		 
		 var result = document.up.uploadformhtml(form_obj, memo);
			

	}

	if(typeof(form_obj.boardgrp) != 'undefined' && form_obj.boardgrp.value == 'fm_cjface'){		// cj ¾óÂ¯ °Ô½ÃÆÇ (ÀÔ·Â½Ã ¿¡µðÅÍ »ç¿ë¾ÈÇÔ - ÀÌ¹ÌÁö º¹»ç ¹æÁö)

		// ³»¿ë °Ë»ç
		if (typeof(form_obj.cjface_comment)!="undefined" && form_obj.cjface_comment.value == "") 
		  {
			open_alert("³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
			form_obj.cjface_comment.focus();
			is_submit = false;
			return false;
		  }

		  // ÀÌ¹ÌÁö °Ë»ç
		  if (cjface_previewname.innerHTML == "") 
		  {
			open_alert("ÀÌ¹ÌÁö¸¦ µî·ÏÇØ ÁÖ¼¼¿ä");
			is_submit = false;
			return false;
		  }


		 var memo = editorSpace.document.body.innerHTML+form_obj.cjface_comment.value;

		 document.up.setimagethumbnailwidthheight(80, 80);		 
		 var result = document.up.uploadformhtml(form_obj, memo);
		

	}
	else if(typeof(form_obj.boardgrp) != 'undefined' && form_obj.boardgrp.value == 'fm_cjlive'){		// cj ¾óÂ¯ °Ô½ÃÆÇ (ÀÔ·Â½Ã ¿¡µðÅÍ »ç¿ë¾ÈÇÔ - ÀÌ¹ÌÁö º¹»ç ¹æÁö)

		 // ³»¿ë °Ë»ç
		  if (editorSpace.document.body.innerHTML == "" || editorSpace.document.body.innerHTML == "<DIV></DIV>") 
		  {
			open_alert("³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä!");
			editorSpace.focus();
			is_submit = false;
			return false;
		  }

		  // ÆÄÀÏ°Ë»ç
		  if (cjliv_previewname.innerHTML == "") 
		  {
			open_alert("ÆÄÀÏÀ» µî·ÏÇØ ÁÖ¼¼¿ä");
			is_submit = false;
			return false;
		  }


		 var memo = editorSpace.document.body.innerHTML;

		 // Ã·ºÎÆÄÀÏÇü½Ä ¼ÂÆÃ
		//  - Ã·ºÎÆÄÀÏ º¯¼ö¸í*Ã·ºÎÆÄÀÏ°æ·Î|Ã·ºÎÆÄÀÏ º¯¼ö¸í*Ã·ºÎÆÄÀÏ°æ·Î ... 
		var attatch_name = form_obj.livfile.name;   // Ã·ºÎÆÄÀÏº¯¼ö¸í
		var attatch_path = form_obj.livfile.value;  // Ã·ºÎÆÄÀÏÆÄÀÏ°æ·Î
		var files = attatch_name + "*" + attatch_path;

				
		 document.up.setimagethumbnailwidthheight(80, 80);		
		 document.up.setattachedfilelimitedmaxfilesizebytes(5242880);
	
		 var result = document.up.uploadformhtmlfile(form_obj, memo, files);
		
		 if(result.indexOf('ERROR_ATTACHED_FILE_SIZE_EXCEED') >=0){
			open_alert('Ã·ºÎÆÄÀÏÀº 5M ±îÁö¸¸ ¿Ã¸®½Ç¼ö ÀÖ½À´Ï´Ù.');
			return false;

		 }
		

	}
	else{

		// ÇÑÁÙ ÄÚ¸àÆ® (¿¡µðÅÍ »ç¿ë ¾ÈÇÔ )
	

		if(typeof(form_obj.talkcomment_text)!="undefined"){

			  if (form_obj.talkcomment_text.value =="") 
			  {
				open_alert("³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä!");
				form_obj.talkcomment_text.focus();
				is_submit = false;
				return false;
			  }

			var memo = form_obj.talkcomment_text.value;
		}
		else{

		  // ³»¿ë °Ë»ç
		  if (editorSpace.document.body.innerHTML == "") 
		  {
			open_alert("³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä!2");
			editorSpace.focus();
			is_submit = false;
			return false;
		  }

			var memo = editorSpace.document.body.innerHTML;
			
		}

		document.up.setimagethumbnailwidthheight(70, 70);
		var result = document.up.uploadformhtml(form_obj, memo);

	}

	


  if (result.indexOf('ERROR_IMAGE_COUNT_EXCEED') >= 0)
  {
    isSubmit = false; 
    arrResult = result.split(":");
    open_alert('ÃÑ '+arrResult[1]+'°³ÀÇ ÀÌ¹ÌÁö°¡ ¼±ÅÃµÇ¾ú½À´Ï´Ù.<br>ÀÌ¹ÌÁöµî·ÏÀº  20°³±îÁö¸¸ °¡´ÉÇÕ´Ï´Ù.');
    return false;
  }

	// °á°ú Ã³¸®
	//alert(result);
	eval(result);
	

  is_submit = false;
}/*}}}*/

function check_press_submit() {/*{{{*/

  var form_obj = document.jukeon_board;

 if (is_submit)
    return false;

  // Á¦¸ñ °Ë»ç
  if (typeof(form_obj.title)!="undefined" && form_obj.title.value == "") 
  {
    open_alert("Á¦¸ñÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
    form_obj.title.focus();
    is_submit = false;
    return false;
  }
  

  if (isBlank(form_obj.title.value, form_obj.title)){ 
    open_alert('°ø¹é¾øÀÌ Á¦¸ñÀ»  ÀÔ·ÂÇÏ¼¼¿ä.'); 
    form_obj.title.focus(); 
    is_submit = false;
    return false; 
	} 

	try{
		if (typeof(form_obj.title)!='undefined' && calc_strlen(form_obj.title.value) > 80)
		{
			open_alert("Á¦¸ñÀº ÃÖ´ë ÇÑ±Û 40ÀÚ, ¿µ¹® 80ÀÚ±îÁö¸¸ °¡´ÉÇÕ´Ï´Ù.","¾Ë¸²",340);
			form_obj.title.focus();
			is_submit = false;
			return false;
		}
	}catch(e) {
	}


	 // ³»¿ë °Ë»ç
	  if (editorSpace.document.body.innerHTML == "" || editorSpace.document.body.innerHTML == "<DIV></DIV>") 
	  {
		open_alert("³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä!");
		editorSpace.focus();
		is_submit = false;
		return false;
	  }

	 var memo = editorSpace.document.body.innerHTML;

	 // Ã·ºÎÆÄÀÏÇü½Ä ¼ÂÆÃ
	//  - Ã·ºÎÆÄÀÏ º¯¼ö¸í*Ã·ºÎÆÄÀÏ°æ·Î|Ã·ºÎÆÄÀÏ º¯¼ö¸í*Ã·ºÎÆÄÀÏ°æ·Î ... 
	var attatch_name = form_obj.file_nm.name;   // Ã·ºÎÆÄÀÏº¯¼ö¸í
	var attatch_path = form_obj.file_nm.value;  // Ã·ºÎÆÄÀÏÆÄÀÏ°æ·Î
	var files = attatch_name + "*" + attatch_path;

			
	 document.up.setimagelimitedmaxresizewidth(600);	
	 document.up.setimageneedthumbnail(0);	
	 document.up.setattachedfilelimitedmaxfilesizebytes(5242880);
	
	 var result = document.up.uploadformhtmlfile(form_obj, memo, files);
	
	 if(result.indexOf('ERROR_ATTACHED_FILE_SIZE_EXCEED') >=0){
		open_alert('Ã·ºÎÆÄÀÏÀº 5M ±îÁö¸¸ ¿Ã¸®½Ç¼ö ÀÖ½À´Ï´Ù.');
		return false;

	 }

  if (result.indexOf('ERROR_IMAGE_COUNT_EXCEED') >= 0)
  {
    isSubmit = false; 
    arrResult = result.split(":");
    open_alert('ÃÑ '+arrResult[1]+'°³ÀÇ ÀÌ¹ÌÁö°¡ ¼±ÅÃµÇ¾ú½À´Ï´Ù.<br>ÀÌ¹ÌÁöµî·ÏÀº  20°³±îÁö¸¸ °¡´ÉÇÕ´Ï´Ù.');
    return false;
  }

	// °á°ú Ã³¸®
	//window.alert(result);
	eval(result);
  	is_submit = false;
}/*}}}*/


function check_admin_zine_submit() {/*{{{*/

  var form_obj = document.zine_form;

 if (is_submit)
    return false;

  // Á¦¸ñ °Ë»ç
  if (typeof(form_obj.frmTitle)!="undefined" && form_obj.frmTitle.value == "") 
  {
    open_alert("Á¦¸ñÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
    form_obj.title.focus();
    is_submit = false;
    return false;
  }
  

  if (isBlank(form_obj.frmTitle.value, form_obj.frmTitle)){ 
    open_alert('°ø¹é¾øÀÌ Á¦¸ñÀ»  ÀÔ·ÂÇÏ¼¼¿ä.'); 
    form_obj.frmTitle.focus(); 
    is_submit = false;
    return false; 
	} 

	try{
		if (typeof(form_obj.frmTitle)!='undefined' && calc_strlen(form_obj.frmTitle.value) > 80)
		{
			open_alert("Á¦¸ñÀº ÃÖ´ë ÇÑ±Û 40ÀÚ, ¿µ¹® 80ÀÚ±îÁö¸¸ °¡´ÉÇÕ´Ï´Ù.","¾Ë¸²",340);
			form_obj.frmTitle.focus();
			is_submit = false;
			return false;
		}
	}catch(e) {
	}
	if (typeof(form_obj.frmArtist_id)!="undefined" && form_obj.frmArtist_id.value !=""  && IsNumber(form_obj.frmArtist_id.value) == false) 
	{
		open_alert("¾ÆÆ¼Æ¼½º ID´Â ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼Å¾ßÇÕ´Ï´Ù.");
		form_obj.frmArtist_id.focus();
		is_submit = false;
		return false;
	}
	
	if (typeof(form_obj.frmAlbum_id)!="undefined" && form_obj.frmAlbum_id.value !=""  && IsNumber(form_obj.frmAlbum_id.value) == false) 
	{
		open_alert("¾Ù¹ü ID´Â ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼Å¾ßÇÕ´Ï´Ù.");
		form_obj.frmAlbum_id.focus();
		is_submit = false;
		return false;
	}
	// ³»¿ë °Ë»ç
	try{
	  	if (editorSpace.document.body.innerHTML == "" || editorSpace.document.body.innerHTML == "<DIV></DIV>") 
	  	{
		  	if (typeof(form_obj.selEditor)=="undefined" || form_obj.selEditor.value == "E") {
		  	open_alert("³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä!");
			editorSpace.focus();
			is_submit = false;
			return false;
			}
	  	}

	 	var memo = editorSpace.document.body.innerHTML;
	}catch(e) {
	}
	document.up.setimageneedthumbnail(0);	
	var result = document.up.uploadformhtml(form_obj, memo);
	
	if (result.indexOf('ERROR_IMAGE_COUNT_EXCEED') >= 0)
  	{
	    isSubmit = false; 
	    arrResult = result.split(":");
	    open_alert('ÃÑ '+arrResult[1]+'°³ÀÇ ÀÌ¹ÌÁö°¡ ¼±ÅÃµÇ¾ú½À´Ï´Ù.<br>ÀÌ¹ÌÁöµî·ÏÀº  20°³±îÁö¸¸ °¡´ÉÇÕ´Ï´Ù.');
	    return false;
  	}

	// °á°ú Ã³¸®
	//window.alert(result);
	eval(result);
  	is_submit = false;
}/*}}}*/


/*************************************************************
 * ±Û¾²±â °ü·Ã ÇÔ¼ö
 *************************************************************/
 /*
 * BoardÁ¦ÇÑ ÆË¾÷Ã¢ ÄíÅ° Á¦¾î ÇÔ¼ö(ÃßÈÄ ¼öÁ¤ÇÊ¿ä)
 */
function getCookie_board(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
} 
 
 
function board_init(url, uploader) {/*{{{*/
  var memo = "<DIV></DIV>";

  if(typeof(url)!='undefined') {
    try {
      loadXmlDoc(url);
      var memo = getNode("/MEMO");
    } catch(e) {
    }
  }

  if (typeof(uploader) != 'undefined')
    uploader.beforemodifyhtml(memo);

  var strHTML = ""
    +"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"
    +"<HTML><HEAD>"
    +"<META http-equiv=Content-Type content=\"text/html;\" charset=\"ks_c_5601-1987\">"
    +"<link rel='stylesheet' type='text/css' href='http://file.rsrs.co.kr/css/common.css'>"
    +"</HEAD>"
    +"<BODY style='font-family:µ¸¿ò,Verdana,Arial; font-size:12px; color:#404040; text-align:justify; word-break:break-all;'>"+memo+"</BODY></HTML>";

  editorSpace.document.write(strHTML);
  editorSpace.document.onkeypress = key_check;
  editorSpace.document.designMode = 'On';
  //editorSpace.document.designMode = 'Off';
  //if( getCookie_board("service_ck") == null )
  	//open_window('http://imusic.ipop.co.kr/main/popup/popup_service_ck.jo', 'service_ck', 'width=416,height=371');
}/*}}}*/

function key_check() {/*{{{*/
  if (editorSpace.event.keyCode == 13) { 

      var obj = editorSpace.document.selection.createRange();
      obj.pasteHTML('<br>');

      editorSpace.event.returnValue = false;
      obj.select();

  } else {

      var sText = editorSpace.document.selection.createRange();
      if (sText.parentElement().all.editorSpace == null && sText.parentElement().all.papermain == null)  {
        var lineval = sText.parentElement().outerHTML;
            lineval = lineval.toLowerCase();

        var idx = lineval.indexOf("<font");
        if (idx > -1) { 
          if (sText.parentElement().face != null) { 
            if (sText.parentElement().face != "") {
              try{ document.all.fontname.value = sText.parentElement().face; }catch(e){}
            }
          }
          if (sText.parentElement().size != null) { 
            if (sText.parentElement().size != "") {
              try{document.all.fontsize.value = sText.parentElement().size;}catch(e){}
            }
          }
        }
        else {  
          if (lineval.indexOf("<p></p>") < 0) {
            try{
              document.all.fontname.value = "µ¸¿ò"; 
              document.all.fontsize.value = "2";
            } catch(e) {}
          }
        }
      }

  }
}/*}}}*/

function justifyCenter() {/*{{{*/
  editorSpace.document.execCommand('JustifyCenter', true, null);
  editorSpace.focus();
}/*}}}*/

function justifyRight() {/*{{{*/
  editorSpace.document.execCommand('JustifyRight', true, null);
  editorSpace.focus();
}/*}}}*/

function justifyLeft() {/*{{{*/
  editorSpace.document.execCommand('JustifyLeft', true, null);
  editorSpace.focus();
}/*}}}*/

function changeColor(color) {/*{{{*/
  aTextRange.select();
  editorSpace.focus();
  editorSpace.document.execCommand('ForeColor', true, color);
} /*}}}*/
  
function changeBgColor(color) {/*{{{*/
  aTextRange.select();
  editorSpace.focus();
  editorSpace.document.execCommand('BackColor', true, color);
} /*}}}*/

function changeSelectColor() {/*{{{*/
  if (document.all.colorChooser.style.display == "none")
      document.all.colorChooser.style.display = ""; 
  else
      document.all.colorChooser.style.display = "none";
}   /*}}}*/

function changeBold() {/*{{{*/
  editorSpace.focus();
  editorSpace.document.execCommand('Bold', false, null);
}   /*}}}*/

function changeItalic() {/*{{{*/
  editorSpace.document.execCommand('Italic', false, null);
  editorSpace.focus();
}   /*}}}*/

function changeUnderline() {/*{{{*/
  editorSpace.document.execCommand('Underline', false, null);
  editorSpace.focus();
} /*}}}*/

function changeStrike() {/*{{{*/
  editorSpace.document.execCommand('strikethrough', false, null);
  editorSpace.focus();
}/*}}}*/

function changeFont(fontname) {/*{{{*/
  if(fontname!= '') editorSpace.document.execCommand('fontname', false, fontname);
} /*}}}*/
  
function changeSize(fontsize) {/*{{{*/
      var obj = editorSpace.document.selection.createRange();
      var text = obj.htmlText;

      if(text) {
        editorSpace.document.execCommand('FontSize', false, fontsize);
      } 
}     /*}}}*/
  
function callColorPicker() {/*{{{*/
//  var x = event.screenX;
  var x = event.clientX;
//  var y = event.screenY;
  var y = event.clientY;
  showColorPicker(x,y,"color");
  return;
} /*}}}*/

function callBgColorPicker() {/*{{{*/
  var x = event.screenX;
  var y = event.screenY;

  showColorPicker(x,y,"bgcolor");
  return;
}/*}}}*/

function showColorPicker(type) {/*{{{*/
//  var Selcol = showModalDialog("/global/common/board/palbas.jo","","font-family:Verdana; font-size:12; dialogWidth:202px; dialogHeight:162px; dialogLeft:" + x + "px; dialogTop:" + y + "px; status:no; help:no; scroll:no"); 

  editorSpace.document.onmouseup = cancelPopup;
  aTextRange = editorSpace.document.selection.createRange();

  fgpalette.style.display="none";
  bgpalette.style.display="none";

  if(type == "color")
  {
    fgpalette.style.display="";
  }
  else
  {
    bgpalette.style.display="";
  }

/*
  if("undefined" != typeof(Selcol) && Selcol != "") { 
    if(type=="color") {
      //colorPicker.style.backgroundColor = Selcol;
      changeColor(Selcol)
    } else {
      //bgcolorPicker.style.backgroundColor = Selcol;
      changeBgColor(Selcol)
    }
  }
*/
  return;
}/*}}}*/


function cancelPopup(evt)
{
  fgpalette.style.display="none";
  bgpalette.style.display="none";
}

function setFGColor(selColor)
{
  fgpalette.style.display="none";
  changeColor(selColor);
}

function setBGColor(selColor)
{
  bgpalette.style.display="none";
  changeBgColor(selColor);
}


/*************************************************************
 * °á°ú Ã³¸®
 *************************************************************/

// ¿¡·¯ Ã³¸®
function board_error(str) {/*{{{*/
  open_alert(str);
}/*}}}*/

// ÄÚ¸àÆ® submitÈÄ ¼º°ø½Ã¿¡
function comment_post_success() {/*{{{*/
  history.go(0);
}/*}}}*/

// °Ô½Ã¹° submit ¼º°ø½Ã¿¡
function board_post_success() {/*{{{*/
  //history.go(0);
  open_alert('¼º°ø');
}/*}}}*/

/*************************************************************
 * ÀÌ¹ÌÁö ¾÷·Îµå °ü·Ã
 *************************************************************/
var imagename      = new Array;
var imageshortname = new Array;
var sizeX          = new Array;
var sizeY          = new Array;
var imageOption    = new Array;
var imageNum = 0;
var delCount = 0;

function image_search() {/*{{{*/
  result = up.loadmultiselectimagefiledlg("ÀÌ¹ÌÁö¼±ÅÃ");

  if (result == "") 
    return;

  var results = result.split("|");

  for (i in results) 
  {
    var x = results[i].split("*");
    imagename[imageNum] = x[0];
    sizeX[imageNum]     = x[1];
    sizeY[imageNum]     = x[2];

    imageshortname[imageNum] = imagename[imageNum].substring(imagename[imageNum].lastIndexOf("\\")+1);
    if (imagename[imageNum].substring(imagename[imageNum].lastIndexOf(".")+1) == "lnk")
      continue;

    var oOption = document.createElement("OPTION");
    oOption.text  = imageshortname[imageNum];
    oOption.value = imageNum;
    image_list.add(oOption);
    imageNum++;
  }
}/*}}}*/

function image_delete() {/*{{{*/
   if (image_list.value == "") {
     open_alert("»èÁ¦ÇÒ ÀÌ¹ÌÁö¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä");
     return;
   }

   i_num = image_list.value;
   for (i=0; i<(imageNum - delCount); i++) {
     if (image_list[i].value == image_list.value) {
        del_num = i;
     }
   }
   image_list.remove(del_num);

   imagename[i_num] = "";
   imageshortname[i_num] = "";
   sizeX[i_num] = 0;
   sizeY[i_num] = 0;
 
   delCount++;
}/*}}}*/

function image_insert() { /*{{{*/
  if (imageNum - delCount <= 0) 
  {
    open_alert("ÀÌ¹ÌÁö¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä");
    return;
  }

  if (align[1].checked)  
    alignText = " align=left style=padding-right:10px";
  else if (align[2].checked)  
    alignText = " align=right style=padding-left:10px";
  else 
    alignText = "";

  // ÀÌ¹ÌÁö ³Ö±â ²Ç¼öµé -_-
  imageCnt = imageNum - delCount;

  imghtmlAll = "";
  opener.editorSpace.focus();
  //var aTextRange = opener.editorSpace.document.body.createTextRange();
  //aTextRange.collapse(true);
  //aTextRange.select ();
  for (i=0; i<imageNum; i++) 
  {
    if (sizeX[i] > 480) 
    {
      imghtml =  imagename[i]+"\" width=480"+alignText+">";
      // <IMG ´Â ²À ´ë¹®ÀÚ·Î ÇÒ °Í ... 
      imghtml2 = "<IMG src=\""+imghtml;
    }
    else if (sizeX[i] > 0) 
    {
      imghtml =  imagename[i]+"\""+alignText+">";
      // <IMG ´Â ²À ´ë¹®ÀÚ·Î ÇÒ °Í ... 
      imghtml2 = "<IMG src=\""+imghtml;
    }
    else 
    {
      imghtml = "";
    }

    imghtmlAll += imghtml2+"<br><br>";

    if (imghtml != "")
      opener.editorSpace.document.execCommand("InsertImage", false, imghtml);
  }

  bodyhtml = opener.editorSpace.document.body.innerHTML.replace(/&amp;?/g, '&');
  opener.editorSpace.document.body.innerHTML = bodyhtml.replace(imghtml2, imghtmlAll);

  self.close();
}/*}}}*/

function show_image_uploader() {/*{{{*/
  var win = window.open('/global/common/board/image_uploader.jo','image_uploader' ,'width=340, height=425');
  win.focus();
}/*}}}*/

/*************************************************************
 * ¾óÂ¯°Ô½ÃÆÇ cj ÀÌ¹ÌÁö µî·Ï
 *************************************************************/

// º¯°æµÈ UI ¾÷·Îµå Ã³¸®
function cjimage_search() {

	 result = document.up.loadmultiselectimagefiledlg("ÀÌ¹ÌÁö¼±ÅÃ");

	 if (result == "") 
		return;

	  var x = result.split("*");
		imagename[0] = x[0];
		sizeX[0]     = x[1];
		sizeY[0]     = x[2];

		imageshortname[0] = imagename[0].substring(imagename[0].lastIndexOf("\\")+1);
		
	
		 alignText = "";		// Á¤·Ä
		  imghtmlAll = "";
		  editorSpace.focus();
		 
			
			if (sizeX[0] > 480) 
			{
			  imghtml =  imagename[0]+"\" width=480"+alignText+">";
			  // <IMG ´Â ²À ´ë¹®ÀÚ·Î ÇÒ °Í ... 
			  imghtml2 = "<IMG src=\""+imghtml;
			}
			else if (sizeX[0] > 0) 
			{
			  imghtml =  imagename[0]+"\""+alignText+">";
			  // <IMG ´Â ²À ´ë¹®ÀÚ·Î ÇÒ °Í ... 
			  imghtml2 = "<IMG src=\""+imghtml;
			}
			else 
			{
			  imghtml = "";
			}

			imghtmlAll += imghtml2+"<br><br>";

			if (imghtml != ""){
				  editorSpace.document.body.innerHTML = "";		// ÃÖ±Ù ÇÏ³ª¸¸ µî·Ï
				  editorSpace.document.execCommand("InsertImage", false, imghtml);
			}


		  if (sizeX[0] > 300) {
			  cjface_preview.innerHTML =  "<IMG src=\""+imagename[0]+"\" width=300>";
		  }
		  else{
			  cjface_preview.innerHTML =  "<IMG src=\""+imagename[0]+"\">";
		  }

		  cjface_previewname.innerHTML =  imageshortname[0];
		  jukeon_board.mc_addinfo1.value = imageshortname[0];

		  //cjface_delimgbtn.innerHTML =  "<a onclick='cjimage_delete()' style='cursor:hand'><img src='http://file.rsrs.co.kr/images/fm/common/btn_x.gif' width=11 height=11 border=0></a>"; // ÀÌ¹ÌÁö »èÁ¦ ¹öÆ°

		  bodyhtml = editorSpace.document.body.innerHTML.replace(/&amp;?/g, '&');
		  editorSpace.document.body.innerHTML = bodyhtml.replace(imghtml2, imghtmlAll);

}

function compil_image_search() {

	 result = document.up.loadmultiselectimagefiledlg("ÀÌ¹ÌÁö¼±ÅÃ");

	 if (result == "") 
		return;

	  var x = result.split("*");
		imagename[0] = x[0];
		sizeX[0]     = x[1];
		sizeY[0]     = x[2];

		imageshortname[0] = imagename[0].substring(imagename[0].lastIndexOf("\\")+1);		
	
		 alignText = "";		// Á¤·Ä
		  imghtmlAll = "";
		  editorSpace.focus();
		 			
			if (sizeX[0] > 480) 
			{
			  imghtml =  imagename[0]+"\" width=480"+alignText+">";
			  // <IMG ´Â ²À ´ë¹®ÀÚ·Î ÇÒ °Í ... 
			  imghtml2 = "<IMG src=\""+imghtml;
			}
			else if (sizeX[0] > 0) 
			{
			  imghtml =  imagename[0]+"\""+alignText+">";
			  // <IMG ´Â ²À ´ë¹®ÀÚ·Î ÇÒ °Í ... 
			  imghtml2 = "<IMG src=\""+imghtml;
			}
			else 
			{
			  imghtml = "";
			}

			imghtmlAll += imghtml2+"<br><br>";

			if (imghtml != ""){
				  editorSpace.document.body.innerHTML = "";		// ÃÖ±Ù ÇÏ³ª¸¸ µî·Ï
				  editorSpace.document.execCommand("InsertImage", false, imghtml);
			}
		 	
		  if (sizeX[0] > 70) {
			  preview_img.innerHTML =  "<IMG src=\""+imagename[0]+"\" width=70 height=70>";
		  }
		  else{
			  preview_img.innerHTML =  "<IMG src=\""+imagename[0]+"\">";
		  }
	
		  bodyhtml = editorSpace.document.body.innerHTML.replace(/&amp;?/g, '&');
		  editorSpace.document.body.innerHTML = bodyhtml.replace(imghtml2, imghtmlAll);

}


/*************************************************************
 * ¶óÀÌºêÂ¯°Ô½ÃÆÇ mp3 ÆÄÀÏ µî·Ï
 *************************************************************/

function livfile_insert() { /*{{{*/

	var form_obj = document.jukeon_board;

	if(form_obj.livfile.value != false){
		
		var live_file = form_obj.livfile.value;	
		
		var x = live_file.split("\\");
		

		document.all.cjliv_previewname.innerHTML = x[x.length-1];
		//document.all.cjliv_delimgbtn.innerHTML =  "<a onclick='cjliv_delete()' style='cursor:hand'><img src='http://file.rsrs.co.kr/images/fm/common/btn_x.gif' width=11 height=11 border=0></a>"; // ÆÄÀÏ »èÁ¦ ¹öÆ°
		form_obj.mc_addinfo1.value = x[x.length-1];

	}
}

function cjliv_delete(){
	document.all.cjliv_previewname.innerHTML = "";
	document.all.cjliv_delimgbtn.innerHTML = "";
}

function show_livfile_uploader() {/*{{{*/
  var win = window.open('/global/common/board/cjlive_file_uploader.jo','image_uploader' ,'width=340, height=425');
  win.focus();
}/*}}}*/


/*************************************************************
 * URL ÀÔ·Â
 *************************************************************/
function show_url_insert() {/*{{{*/
  var obj = editorSpace.document;
  if(obj.selection.type=="None") {
    open_alert("¸µÅ©¸¦ °É À§Ä¡¸¦ ÁöÁ¤ÇØ ÁÖ¼¼¿ä");
    return ;
  }  
  var win = window.open('/global/common/board/url_insert.jo','url_insert','width=335,height=195');
  win.focus();
}/*}}}*/

function add_url(url) {/*{{{*/

  if (url == "http://") 
  {
    open_alert("urlÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
    return;
  }

  var obj = opener.editorSpace.document;
  if (obj.selection.type == "None")
  {
    open_alert("¸µÅ©¸¦ °É À§Ä¡¸¦ ÁöÁ¤ÇØ ÁÖ¼¼¿ä");
    return;
  }

  obj.execCommand("CreateLink", false, url);
  obj.execCommand("foreColor", false, "#3968A8");

  self.close();
}/*}}}*/

/*************************************************************
 * À½¾Ç/ ¹Âºñ ÀÔ·Â
 *************************************************************/
function show_multimedia_insert() {/*{{{*/
  var win = window.open('/global/common/board/multimedia_insert.jo','multimedia_insert' ,'width=550, height=500');
  win.focus();
}/*}}}*/

function show_music_insert(mode) {/*{{{*/
  var win = window.open('/global/common/board/music_insert.jo?mode='+mode,'music_insert' ,'width=550, height=500');
  win.focus();
}/*}}}*/

function show_album_insert(mode) {/*{{{*/
  var win = window.open('/global/common/board/album_insert.jo?mode='+mode,'album_insert' ,'width=550, height=500');
  win.focus();
}/*}}}*/

function show_mv_insert() {/*{{{*/
  var win = window.open('/global/common/board/music_insert.jo?type=mv','music_insert' ,'width=550, height=500');
  win.focus();
}/*}}}*/

function error_hompyax() {/*{{{*/
}/*}}}*/

function view_photo(img_url)/*{{{*/
{
  window.open("http://mulog.jukeon.com/photo_view.jo?img_url="+img_url, "photo", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, width=900, height=600");
}/*}}}*/

/*************************************************************
 * °Ô½ÃÆÇ °ü·Ã
 *************************************************************/

function galleryUnfoldEditBox()/*{{{*/
{
  document.all.gallery_editbox.style.display = '';
}/*}}}*/

function galleryFoldEditBox()/*{{{*/
{
  document.all.gallery_editbox.style.display = 'none';
}/*}}}*/

function galleryToggleComment(asrl)/*{{{*/
{
  if (document.all['gallery_comment_'+asrl].style.display == 'none') 
  {
    document.all['gallery_comment_'+asrl].style.display = '';
    document.all['gallery_arrow_'+asrl].src = 'http://file.rsrs.co.kr/images/common/btn_uparr.gif';

    if (document.all['gallery_comment_'+asrl].src == '')
      document.all['gallery_comment_'+asrl].src = 'http://mulog.jukeon.com/board_comment.jo?asrl='+asrl;
  } 
  else 
  {
    document.all['gallery_comment_'+asrl].style.display = 'none';
    document.all['gallery_arrow_'+asrl].src = 'http://file.rsrs.co.kr/images/common/btn_dnarr.gif';
  }
}/*}}}*/

function PopupContent_FGCOLOR ()  //{{{
{
  var html = "";

  html = "<div id=fgpalette style='display:none;position:relative;top:35px;left:250px'>"
+ "<table width=152 border=0 cellspacing=0 cellpadding=0 height=81 background=http://file.rsrs.co.kr/images/common/dhtml/box_sline_bg.gif>"
  + "<tr>"
    + "<td><img src=http://file.rsrs.co.kr/images/common/dhtml/box_sline_up.gif width=152 height=6></td>"
  + "</tr>"
  + "<tr>"
    + "<td><img src=http://file.rsrs.co.kr/images/common/dhtml/text_color_title.gif width=152 height=19 border=0></td>"
  + "</tr>"
  + "<tr>"
    + "<td height=12>"
      + "<table width=152 height=12 border=0 cellspacing=0 cellpadding=0>"
        + "<tr> "
          + "<td width=7></td>"
          + "<td width=12 bgcolor=#008000>"
          +   "<a href=javascript:setFGColor('#008000') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#009966>"
          +   "<a href=javascript:setFGColor('#009966') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#99CC66>"
          +   "<a href=javascript:setFGColor('#99CC66') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#999966>"
          +   "<a href=javascript:setFGColor('#999966') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#CC9900>"
          +   "<a href=javascript:setFGColor('#CC9900') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#FF9900>"
          +   "<a href=javascript:setFGColor('#FF9900') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#D41A01>"
          +   "<a href=javascript:setFGColor('#D41A01') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#FF0000>"
          +   "<a href=javascript:setFGColor('#FF0000') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#FF7635>"
          +   "<a href=javascript:setFGColor('#FF7635') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#FF3399>"
          +   "<a href=javascript:setFGColor('#FF3399') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=7></td>"
        + "</tr>"
      + "</table>"
    + "</td>  "
  + "</tr>"
  + "<tr>"
    + "<td height=2></td>"
  + "</tr>  "
  + "<tr>"
    + "<td height=12> "
      + "<table width=152 height=12 border=0 cellspacing=0 cellpadding=0>"
        + "<tr> "
          + "<td width=7></td>"
          + "<td width=12 bgcolor=#9B18C1>"
          +   "<a href=javascript:setFGColor('#9B18C1') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#993366>"
          +   "<a href=javascript:setFGColor('#993366') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#666699>"
          +   "<a href=javascript:setFGColor('#666699') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#0000FF>"
          +   "<a href=javascript:setFGColor('#0000FF') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#177FCD>"
          +   "<a href=javascript:setFGColor('#177FCD') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#006699>"
          +   "<a href=javascript:setFGColor('#006699') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#003366>"
          +   "<a href=javascript:setFGColor('#003366') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#333333>"
          +   "<a href=javascript:setFGColor('#333333') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#8E8E8E>"
          +   "<a href=javascript:setFGColor('#8E8E8E') style='text-decoration:none'>&nbsp;&nbsp;&nbsp;</a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#FFFFFF><a href=javascript:setFGColor('#FFFFFF')><img src=http://file.rsrs.co.kr/images/common/dhtml/t_02.gif border=0></a></td>"
          + "<td width=7></td>"
        + "</tr>"
      + "</table>"
    + "</td>"
  + "</tr>"
  + "<tr>"
    + "<td height=4></td>"
  + "</tr>"
  + "<tr>"
    + "<td>"
      + "<table width=152 border=0 cellspacing=0 cellpadding=0>"
        + "<tr> "
          + "<td width=49><img src=http://file.rsrs.co.kr/images/common/dhtml/input_title.gif width=51 height=18 border=0></td>"
          + "<td width=55><input type=Text size=9 maxlength=7 style='width:58px; height:18px; border:1 solid; border-color:D4D4D4; background-color:#F5F5F5;' name=fontcolor_input value='#'></td>"
          + "<td width=48><img src=http://file.rsrs.co.kr/images/common/dhtml/space_demi.gif width=6 height=1><a href='javascript:do_fontcolor_input()'><img src=http://file.rsrs.co.kr/images/common/dhtml/btn_ok.gif width=30 height=18 border=0></a></td>"
        + "</tr>"
      + "</table>"
    + "</td>    "
  + "</tr>  "
  + "<tr>"
    + "<td><img src=http://file.rsrs.co.kr/images/common/dhtml/box_sline_down.gif width=152 height=6></td>"
  + "</tr>        "
+ "</table></div>";

  document.writeln(html);
} //}}}

function PopupContent_BGCOLOR ()
{
  var html = "";

  html = "<div id=bgpalette style='display:none;position:relative;top:35px;left:277px'>"
  + "<table width=152 border=0 cellspacing=0 cellpadding=0 height=81 background=http://file.rsrs.co.kr/images/common/dhtml/box_sline_bg.gif>"
  + "<tr>"
    + "<td><img src=http://file.rsrs.co.kr/images/common/dhtml/box_sline_up.gif width=152 height=6></td>"
  + "</tr>"
  + "<tr>"
    + "<td><img src=http://file.rsrs.co.kr/images/common/dhtml/text_bg_title.gif width=152 height=19 border=0></td>"
  + "</tr>"
  + "<tr>"
    + "<td height=12>"
      + "<table width=152 height=12 border=0 cellspacing=0 cellpadding=0>"
        + "<tr> "
          + "<td width=7></td>"
          + "<td width=12 bgcolor=#008000><a href=javascript:setBGColor('#008000')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#009966><a href=javascript:setBGColor('#009966')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#99CC66><a href=javascript:setBGColor('#99CC66')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#999966><a href=javascript:setBGColor('#999966')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#CC9900><a href=javascript:setBGColor('#CC9900')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#FF9900><a href=javascript:setBGColor('#FF9900')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#D41A01><a href=javascript:setBGColor('#D41A01')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#FF0000><a href=javascript:setBGColor('#FF0000')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#FF7635><a href=javascript:setBGColor('#FF7635')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#FF3399><a href=javascript:setBGColor('#FF3399')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=7></td>"
        + "</tr>"
      + "</table>"
    + "</td>  "
  + "</tr>"
  + "<tr>"
    + "<td height=2></td>"
  + "</tr>  "
  + "<tr>"
    + "<td height=12> "
      + "<table width=152 height=12 border=0 cellspacing=0 cellpadding=0>"
        + "<tr> "
          + "<td width=7></td>"
          + "<td width=12 bgcolor=#9B18C1><a href=javascript:setBGColor('#9B18C1')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#993366><a href=javascript:setBGColor('#993366')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#666699><a href=javascript:setBGColor('#666699')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#0000FF><a href=javascript:setBGColor('#0000FF')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#177FCD><a href=javascript:setBGColor('#177FCD')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#006699><a href=javascript:setBGColor('#006699')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#003366><a href=javascript:setBGColor('#003366')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#333333><a href=javascript:setBGColor('#333333')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#8E8E8E><a href=javascript:setBGColor('#8E8E8E')><img src=http://file.rsrs.co.kr/images/common/dhtml/t.gif border=0></a></td>"
          + "<td width=2></td>"
          + "<td width=12 bgcolor=#FFFFFF><a href=javascript:setBGColor('#FFFFFF')><img src=http://file.rsrs.co.kr/images/common/dhtml/t_01.gif border=0></a></td>"
          + "<td width=7></td>"
        + "</tr>"
      + "</table>"
    + "</td>"
  + "</tr>"
  + "<tr>"
    + "<td height=4></td>"
  + "</tr>"
  + "<tr>"
    + "<td>"
      + "<table width=152 border=0 cellspacing=0 cellpadding=0>"
        + "<tr> "
          + "<td width=49><img src=http://file.rsrs.co.kr/images/common/dhtml/input_title.gif width=51 height=18 border=0></td>"
          + "<td width=55><input type=Text size=9 maxlength=7 style='width:58px; height:18px; border:1 solid; border-color:D4D4D4; background-color:#F5F5F5;' name=bgcolor_input value='#'></td>"
          + "<td width=48><img src=http://file.rsrs.co.kr/images/common/dhtml/space_demi.gif width=6 height=1><a href='javascript:do_bgcolor_input()'><img src=http://file.rsrs.co.kr/images/common/dhtml/btn_ok.gif width=30 height=18 border=0></a></td>"
        + "</tr>"
      + "</table>"
    + "</td>    "
  + "</tr>  "
  + "<tr>"
    + "<td><img src=http://file.rsrs.co.kr/images/common/dhtml/box_sline_down.gif width=152 height=6></td>"
  + "</tr>        "
+ "</table></div>";

  document.writeln(html);
}


function do_fontcolor_input()
{
  if(is_valid_color(document.all.fontcolor_input.value))
    setFGColor(document.all.fontcolor_input.value);
  else
    return;
}

function do_bgcolor_input()
{
  if(is_valid_color(document.all.bgcolor_input.value))
    setBGColor(document.all.bgcolor_input.value);
  else
    return;
}

function is_valid_color(input_color)
{
  if(input_color.substr(0,1) != "#")
  {
    alert("»ö»ó¿¡ #À» ºÙ¿©ÁÖ¼¼¿ä");
    return false;
  }
  if(input_color.length != 7)
  {
    alert("»ö»ó °ªÀÌ Àß¸øµÇ¾ú½À´Ï´Ù");
    return false;
  }
  if(!validHexNum(input_color.substr(1)))
  {
    alert("»ö»ó °ªÀÌ Àß¸øµÇ¾ú½À´Ï´Ù");
    return false;
  }

  return true;
}

function validHexNum(objtext1){
    var inText = objtext1;
    var ret;
    for (var i = 0; i <= inText.length; i++) {
      ret = inText.charCodeAt(i);
      if ((ret <=47 && ret > 31) || (ret >= 58 && ret <=64 ) || (ret >=71 && ret <= 96) || ret >= 103) {
        return false;
      }
    } return true;
}

function getFileExtension( filePath ){
    var lastIndex = -1;
    lastIndex = filePath.lastIndexOf('.');
    var extension = "";
 
    if ( lastIndex != -1 ){
        extension = filePath.substring( lastIndex+1, filePath.len );
    } else {
        extension = "";
	}
    return extension;
}

function IsNumber(String) {
   for (var i=0; i < String.length; i++) {
      if ( (String.charAt(i) < "0") || (String.charAt(i) > "9") )
         return false;
   }
   return true;
}
