/********************************************************************************
	@ ÇÁ·ÎÁ§Æ®¸í :	¹Â¿Â¶óÀÎ Ver 3.0

	@ ÆäÀÌÁö¸í    : Script/jsCommonFunction.js

	@ ±â    ´É      : MuOnline °øÅë Javascript º¸°ü

	@ ÀÌ    ·Â      : 2005.02.23 ½ÉÀÇÁØ. ÆäÀÌÁö »ý¼º.
		
						ÇØ´ç script¿¡ ´ëÇÑ ÁÖ¼®À» ¹Ýµå½Ã ¸í±âÇÒ °Í!!!
*********************************************************************************/

//Input Box °ø¹é Ã¼Å© ÇÔ¼ö. 2005.02.23 ½ÉÀÇÁØ
function fnCheckInput (content){
	var result ='0';
	
	for (var i = 0 ; i < content.length ; i++ ){
		if (content.substring( i, i+1 ) != " " ) {
			result = '1';
		}
	}
	
	if (result == '0') {
		return false;	//¸ðµÎ °ø¹éÀÎ °æ¿ì
	}
	return true;
}

// TextArea °ø¹é Ã¼Å©. 2005.02.23 ½ÉÀÇÁØ
function fnCheckTextArea (content) {
	var temp;
	var result='0';
	temp = content;
	temp = temp.replace( /\r\n/g, " ");
	for (i=0;i<temp.length;i++) {
		if (temp.charAt(i) != " ") {
			result = '1'
		}
	}
	
	if (result =='0') {
		return false;
	}
	return true;		
}

// ÇÑ±Û ÀÔ·Â Á¦ÇÑ Ã¼Å©
function blnCheckFieldLen(fldInput, intMaxLen, strMsg)
{
	var blnCheck = false;
	
	var intContentLen = 0;
    	
    	for (var i=0; i<fldInput.value.length; i++) 
    	{
        intContentLen += (fldInput.value.charCodeAt(i) > 128) ? 2 : 1;
	}
	
	if (intContentLen >= 0 && intContentLen <= intMaxLen)
	{
			blnCheck = true;
	}
		
	if (blnCheck == false)
	{
		alert(strMsg);
		fldInput.focus();
	}
	
	return blnCheck;
}

// ¿øÇÏ´Â ±æÀÌ¸¸Å­ ±ÛÀÚ ¹ÝÈ¯
function substringKor2(str,lengths)
{
	var len = 0;
	var newStr = '';
  
	for (var i=0;i<str.length; i++) 
	{
		var n = str.charCodeAt(i);
		var nv = str.charAt(i);
		if ((n>= 0)&&(n<256)) len ++;
		else len += 2;
		if (len>lengths) break;
		else newStr = newStr + nv;
	}
	return newStr;
}
//ÀÌ¸ðÆ¼ÄÜ ¸ñ·Ï º¸¿©ÁÖ±â 2005.04.18 ÃÖ¿ì¼®

function showEmoticonBox()
{
	if (document.all.DviEmoticon.style.display == "none")
	{		
		xPos = window.document.body.scrollLeft + window.event.clientX;
		yPos = window.event.clientY + window.document.body.scrollTop;
		screen_height = window.document.body.offsetHeight;
		screen_width = window.document.body.offsetWidth;
		mouse_top = window.event.y;
		mouse_left = window.event.x;
		mainmenu_top_indent = eval("document.getElementById('DviEmoticon').childNodes.length");
		mainmenu_top_indent = mainmenu_top_indent * 18;
		if (screen_height > mouse_top + mainmenu_top_indent) 
			yPos = window.event.clientY + window.document.body.scrollTop;
		else
			yPos = (window.event.clientY + window.document.body.scrollTop) - mainmenu_top_indent;

		if (mouse_top - mainmenu_top_indent < 0) 
			yPos = window.event.clientY + window.document.body.scrollTop;

		var objMenu = eval("document.getElementById('DviEmoticon')");
		objMenu.style.top = yPos-16;
		objMenu.style.left = xPos;
		objMenu.style.display = "";
	}
	else
	{
		document.all.DviEmoticon.style.display = "none";
	}
}

function setEmoticon(intSel,strImageDir)
{
	document.all.ImgSelEmoticon.src = strImageDir+"images/c_common/emoti/" + intSel + ".gif";
	document.all.ImgSelEmoticon.hspace = "3";
	document.all.chrEmoticon.value = intSel;
	document.all.DviEmoticon.style.display = "none";
	
}

function SetImageSize(num)
{
    var oImg = eval("document.getElementById('ImgUserUpload" + num + "')");
    
    if (oImg.width > 678)
       oImg.width = 678;
}

function ImageView(simg)
{
	window.open('/Community/Common/ImagePopupView.asp?fileurl=' + simg,'ImageView','scrollbars=yes, resizable=yes,width=100,height=100, top=100, left=100');
}