//<![CDATA[
String.prototype.trim = function () {
	return this.replace(/^\s*/g, "").replace(/\s*$/g, "");
}

function urimalSpellCheck_Start(content, pluginURL_TMP, actionURL_TMP, tempURL_TMP) {
	if(content.trim() == "") {
		alert("본문을 입력해 주세요"); 
		return false;
	}
	var pathURL = pluginURL_TMP + "/lib/tempaction.php";
	var _width	= 448;
	var _height = 520;
	var _left	= (screen.width - _width - 30);
	var _top	= 30;

	var tempWin	= window.open("about:blank", "tempWindow", "width="+_width+", height="+_height+", left="+_left+",top="+_top+", scrollbars=yes,	status=no");
	tempWin.focus();

	var formObj = document.createElement('form');
	formObj.setAttribute('name','spellCheckForm');
	formObj.setAttribute('action',pathURL);
	formObj.setAttribute('method','post');
	formObj.setAttribute('target','tempWindow');
	
	var spellText1 = document.createElement('input');
	spellText1.setAttribute('type', 'hidden');
	spellText1.setAttribute('name', 'content');
	spellText1.setAttribute('value', content);

	var spellText2 = document.createElement('input');
	spellText2.setAttribute('type', 'hidden');
	spellText2.setAttribute('name', 'actionURL');
	spellText2.setAttribute('value', actionURL_TMP);

	var spellText3 = document.createElement('input');
	spellText3.setAttribute('type', 'hidden');
	spellText3.setAttribute('name', 'tempURL');
	spellText3.setAttribute('value', tempURL_TMP);
	
	formObj.appendChild(spellText1);
	formObj.appendChild(spellText2);
	formObj.appendChild(spellText3);
	document.body.appendChild(formObj);
	formObj.submit();
}

function getSpellcheck(caller, entryId_TMP) {
	var content = "";
	var checkByID = document.getElementById("comment_" + entryId_TMP);
	var oForm = getFindFormObject(caller);
	if (!oForm) return false;
	if (!entryId_TMP || entryId_TMP == "") entryId_TMP = 0;

	for (i=0; i<oForm.elements.length; i++) {
		if (oForm.elements[i].disabled == true)
			continue;	
		if (oForm.elements[i].tagName.toLowerCase() == "textarea") {
				content = oForm.elements[i].value;
		}
	}

	urimalSpellCheck_Start(content, pluginURL_USC, actionURL_USC, tempURL_USC);
}

function getFindFormObject(caller) {
	for (var obj = caller; obj; obj = obj.parentNode) {
		if (obj.nodeName == "FORM")
			return obj;
	}
	return null;
}
//]]>