function portsendform_submit(type){

	checkok='';

	if(type){
		obj=document.getElementsByName('star_value');

		for(i=0;i<obj.length;i++){
			if(obj[i].checked==true){
				val=obj[i].value;
				checkok=true;
			}
		}

		if(checkok==false){
			alert("Ã¹ ´ñ±ÛÀº Æò°¡°ªÀ» ¼±ÅÃÇØÁÖ¼Å¾ß ÇÕ´Ï´Ù. \n\nÀ§ Æò°¡°ªÀ» ¼±ÅÃÈÄ ´ñ±Û ³»¿ëÀÔ·ÂÇÏ½Ã¸é µî·Ï°ú µ¿½Ã¿¡ Æò°¡°¡ ÀÌ·ç¾îÁý´Ï´Ù.");
			location.href='#moneybox';
			return false;
		}
		
		document.send_form.star_value.value=val	

	}

	if(document.send_form.contents.value==false){
		alert("³»¿ëÀ» ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù.")
		if(document.send_form.contents) document.send_form.contents.focus();
		return false;
	}

	document.send_form.submit();

	return true;
}

function sendform_submit(){

	returnValue=check_str_length(document.getElementById('editor'), 'remain', 1000, 1000)

	if(returnValue==true){

		document.send_form.contents.value = document.getElementById('editor').innerHTML;

	/*
		if (document.getElementsByName('remain')[0].innerHTML > 1000 ){

			inputLength=document.getElementsByName('remain')[0].innerHTML;

			alert('ÀÔ·Â±ÛÀÚ¼ö : '+inputLength+'\n\n±ÛÀÚ¼ö´Â 1000¹ÙÀÌÆ®¸¦ ³ÑÀ» ¼ö ¾ø½À´Ï´Ù.');
			return false;
		}
		*/

		

		if(document.send_form.contents.value==false){
			alert("³»¿ëÀ» ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù.")
			//if(document.send_form.contents) document.send_form.contents.focus();
			document.getElementById('editor').focus();
			return false;
		}

		document.send_form.submit();
	}else return false;
}

function check_str_length(el_textarea, taget_id, init_length, max_length){
	var el_target = document.getElementById(taget_id);

	strlen=el_textarea.innerHTML.length	
	
	el_target.innerHTML = strlen;

	if(strlen > max_length){
		alert('ÃÑ ÀÔ·ÂÇÑ ¼ö : '+strlen+'\n\n¿µ¹® '+ max_length + 'ÀÚ ÇÑ±Û ' + max_length / 2  + 'ÀÚ ±îÁö ¾²½Ç ¼ö ÀÖ½À´Ï´Ù.');

		return false;
	
	}else{

		document.getElementById('editor').nodeValue = 998;
	}

	return true;

	//  if(document.getElementById('editor').style.overflowY=='scroll') document.getElementById('editor').style.height='500'

}




function delete_ok(str,no){
	if(confirm(str)==true){
		document.delete_article.no.value=no;
		document.delete_article.submit();
	}
}	


function textsubmit(mode,no,ct,mid){
	
	document.send_form.contents.style.color='#FFFFFF';

	//document.send_form.contents.value=document.getElementsByName(ct)[0].value;
	

	document.send_form.contents.value=document.getElementById(ct).innerHTML;	

	returnValue=check_str_length(document.getElementById(ct), 'remain'+no, 1000, 1000)

	if(returnValue==true){
		
		if(document.getElementById(ct).value==false){
			alert("³»¿ëÀ» ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù.")
			document.getElementById(ct).focus();
			return false;
		}

		
		if(document.send_form.secret){
		

			if(document.getElementsByName('secret'+no)[0].checked) document.send_form.secret.checked=true;
			else document.send_form.secret.checked=false;
		}
		
		document.send_form.no.value=no;

		document.send_form.submit();
	}
}

function commentexe(no,mode,secret,mno,type,mid){

	ct='contents'+no;
	ed='editor'+no;
	rm='remain'+no;
	sc='secret'+no;

	if(mode=="modify") writestr='<font color=47b349>¼öÁ¤ÇÏ±â</font>';
	else if(mode=="reply") writestr='<font color=478eb3>´äº¯ÇÏ±â</font>';
	else writestr='ÀÛ¼ºÇÏ±â';

	if(secret==true) {
		if(mode=="reply") secret='checked disabled';
		else secret='checked';
	}
	else secret='';

	if(!document.getElementById("ansbox_"+no).style.display && document.send_form.mode.value==mode) {		

		document.getElementById("ansbox_"+no).style.display='none';
		return false;
	}else if(document.send_form.no.value==no && document.send_form.mode.value=="modify" && mode=="reply" && document.getElementById("ansbox_"+no).style.display!='none') alert("»õ ´ñ±ÛÀ» ÀÛ¼ºÇÕ´Ï´Ù.");

	var tmp=document.getElementById("contentsOrigin_"+no).innerHTML;

	memobox=tmp.replace(/<br>/gim,""); 	

	str="<table border=0 cellspacing=0 cellpadding=3 width=100% style=table-layout:fixed><col width=><col width=90>";
	
	str+="<tr><td colspan=2><select name=sel0 onchange=ex('ForeColor',this.value)><option value='555555'>ÆùÆ®»ö</option>";
	str+="<option value='black'>°ËÁ¤</option><option value='blue'>ÆÄ¶û</option><option value='red'>»¡°­</option>";
	str+="<option value='yellow'>³ë¶û</option><option value='orange'>¿À·»Áö</option><option value='cyan'>ÇÏ´Ã</option></select>";
	str+="<select name=sel1 onchange=ex('BackColor',this.value)><option value='#ffffff'>¹è°æ»ö</option><option value='black'>°ËÁ¤</option>";
	str+="<option value='blue'>ÆÄ¶û</option><option value='red'>»¡°­</option><option value='yellow'>³ë¶û</option>";
	str+="<option value='orange'>¿À·»Áö</option><option value='cyan'>ÇÏ´Ã</option></select>";

	str+="<select name=sel2 onchange=ex('FontName',this.value)><option value='Gulim'>ÆùÆ®</option><option value='Gulim'>±¼¸²</option>";
	str+="<option value='Dotum'>µ¸¿ò</option><option value='Gothic'>°íµñ</option><option value='Arial'>Arial</option>";
	str+="<option value='Tahoma'>Tahoma</option><option value='Verdana'>Verdana</option><option value='Trebuchet MS'>Trebuchet MS</option></select> ";

	str+="<select name=sel3 onchange=ex('FontSize',this.value)><option value='pt'>Å©±â</option><option value='1pt'>1</option>";
	str+="<option value='2pt'>2</option><option value='3pt'>3</option><option value='4pt'>4</option>"; 
	str+="<option value='5pt'>5</option><option value='6pt'>6</option><option value='7pt'>7</option></select>";


	str+="<input type=button onclick=ex('Bold') value='±½°Ô'><input type=button onclick=ex('Italic') value='±â¿ï±â'><input type=button onclick=ex('Underline') value='¹ØÁÙ'></td></tr>";

	str+="<tr><td><div id="+ed+" style='overflow:auto;height:75;width:100%;border-width:2px;border-style:solid;border-color:dddddd;background-color:ffffff' contenteditable>";
	
	if(mode=="modify") str+=memobox;

	str+="</div>";

	str+="<textarea name="+ct

	if(type!="port") str+=" onkeyup=check_str_length(this,'"+rm+"',1000,1000)";

	str+=" rows=3 cols=5 style=height:75;width:100%;border-width:2px;border-style:solid;border-color:dddddd;background-color:ffffff;display:none>";

	if(mode=="modify") str+=memobox;

	str+="</textarea></td>"+
	"<td background='../images/blog/bt_send_fr.gif' style='background-repeat:no-repeat;background-position:center;' align=center"+
	" onclick=textsubmit('"+mode+"',"+no+",'"+ed+"','"+mid+"')"+
	" style='cursor:pointer'>"+writestr+"</td>"+
	"</tr><tr><td align=right>";
	if(!type) str+="<span id="+rm+" name="+rm+">0</span>/1000 byte <input type=checkbox name="+sc+" value=1 "+secret+"> ºñ¹Ð±Û»ç¿ë";
	str+="</td></tr></table>";

	document.getElementById("ansbox_"+no).style.display='';

	document.getElementById("ansbox_"+no).innerHTML=str;

	document.send_form.no.value=no;
	document.send_form.mode.value=mode;	
	if(mid) document.send_form.mid.value=mid;	
}

function move_blog(){

	name=document.getElementsByName('artist_inputname')[0].value;

/*
	if(!name){
		alert("¾ÆÀÌµð,ÀÌ¸§,´Ð³×ÀÓÁß ÇÏ³ª¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		document.getElementsByName('artist_inputname')[0].value='';
		document.getElementsByName('artist_inputname')[0].focus();
		return false;
	}
	*/

	if(document.getElementsByName('artist_search')[0].checked) location.href='http://www.eyecg.com/blog/?searchInputName='+name+'&p=artistSearch';
	else location.href='http://www.eyecg.com/blog/?searchInputName='+name;
}

function mainTableHeight (){

	if(document.getElementById('background_table')){
		background_table.height=document.body.scrollHeight; 
		background_table.width=document.body.scrollWidth; 
		document.body.scrolling="no"; 
		
	}
}

if(window.addEventListener){
	window.addEventListener("onload",mainTableHeight);
}else if(window.attachEvent){
	window.attachEvent("onload",mainTableHeight);
}



function cmtOpenClose(name) {
	if(document.getElementById(name).style.display=='none') document.getElementById(name).style.display='block';
	else document.getElementById(name).style.display='none';

	mainTableHeight();
}


