function ProgressBar()
{
	strAppVersion = navigator.appVersion;

	if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4) {
		winstyle = "dialogWidth=385px; dialogHeight:215px; center:yes";
		window.showModelessDialog("/Progress/show_progress.asp?nav=ie", null, winstyle);
	}
	else {
		winpos = "left=" + ((window.screen.width-380)/2) + ",top=" + ((window.screen.height-180)/2);
		winstyle="width=380,height=180,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,copyhistory=no," + winpos;
		window.open("/Progress/show_progress.asp?nav=ns",null,winstyle);}

}
//-->

function Check(keyword) 
{
	var st_num, key_len;
	st_num = keyword.indexOf(" ");	
	while (st_num != -1)
	{
		keyword = keyword.replace(" ", "");
		st_num  = keyword.indexOf(" ");
	}
	key_len=keyword.length;
	return key_len;
}

function checkEN(str)
{ 

	var check = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-.';
	var temp; 
	
	for (var i=0; i<str.length; i++) 
	{
		temp = '' + str.substring(i, i+1); 
		if (check.indexOf(temp) == '-1'){ 
			return false;
		}
	} 
	return true;
}

function imgNameCk(theText)
{
	var filename = theText.value.toString();
	var filelen = filename.length;
	var imgName;
	var ch = 0;
	var temp = "";
	var retemp = "";
	
	//filename = filename.toUpperCase();

	for (ch=filelen-1;ch>=0;ch--)
	{
		if (filename.charAt(ch)=="\\")
		{
			break;
		}
		else
		{
			temp = temp + '' + filename.charAt(ch)
		}
	}

	for (ch=temp.length-1;ch>=0;ch--)
	{
		retemp = retemp + '' + temp.charAt(ch)
	}

	if (!checkEN(retemp))
	{
		return false;
	}
	return true;
}

function CheckImageFile(theForm)
{
	var filename = theForm.value;
	var filelen = filename.length;
	var imgName;

	if (Check(filename) == 0)  // ÆÄÀÏ ¼±ÅÃÀ» ¾ÈÇÑ°æ¿ì
	{
		return true;
	}
	else	// ÆÄÀÏ¼±ÅÃÀ» ÇÑ °æ¿ì
	{
		imgName = filename.substring(filelen-4,filelen)

		if (imgName.toUpperCase() == ".GIF" || imgName.toUpperCase() == ".JPG")
		{
			return true;
		}
		else
		{
			return false;
		}
	}
}

function checkform_insert(theForm)
{

	if (Check(theForm.title.value) < 2)
	{
		alert("Á¦¸ñÀ» ½á ÁÖ¼¼¿ä~");
		theForm.title.focus();
		return (false);
	}  

	if (Check(theForm.fileupload2.value) < 2)
	{
		alert("Å«ÀÌ¹ÌÁöÆÄÀÏÀ» ¿Ã·ÁÁÖ¼¼¿ä~");
		theForm.fileupload2.focus();
		return (false);
	} 

	if(CheckImageFile(theForm.fileupload2) == false)
	{
		alert("ÀÌ¹ÌÁöÆÄÀÏÀº GIF,JPG ±×¸²ÆÄÀÏ¸¸ °¡´ÉÇÕ´Ï´Ù.");
		theForm.fileupload2.focus();
		return false;
	}

	if (!imgNameCk(theForm.fileupload2)) 
	{
		alert("ÀÌ¹ÌÁö¸íÀº ¿µ¹® ¶Ç´Â ¼ýÀÚ¸¸ °¡´ÉÇÕ´Ï´Ù.");
		theForm.fileupload2.focus();
		return false;
	}


	if (Check(theForm.password.value) < 2)
	{
		alert("ºñ¹Ð¹øÈ£¸¦ ½á ÁÖ¼¼¿ä~ ¼öÁ¤,»èÁ¦½Ã ÇÊ¿äÇÕ´Ï´Ù.");
		theForm.password.focus();
		return (false);
	}  		 

	var f = document.af;
	f.boardkey.value = eval(f.name.value.length) + eval(f.title.value.length) + eval(f.password.value.length);

	ProgressBar();
	return (true);
}


var stateFlag = 0;
thumbnail = new Image;

function showImg(img_url)
{
        thumbnail.src = img_url;
        newSize = ( 200/200 > thumbnail.width/thumbnail.height ) ? 200 / thumbnail.height : 200 / thumbnail.width;
        newWidth = thumbnail.width * newSize;

        if ( thumbnail.width > newWidth )
                document.previewImg.width = newWidth;
        else
                document.previewImg.width = thumbnail.width;
}


function checkImgFormat(imgPath)
{
        if ( imgPath.indexOf(".JPG") != -1 ||
             imgPath.indexOf(".GIF") != -1 ||
             imgPath.indexOf(".gif") != -1 ||
             imgPath.indexOf(".jpg") != -1 )
        {
                stateFlag = 1;
                document.previewImg2.src = imgPath;
        }
        else
        {
                stateFlag = 0;
                if ( imgPath != "" )
                        alert("GIF,JPG ±×¸²ÆÄÀÏ¸¸ °¡´ÉÇÕ´Ï´Ù.");
        }
}

function showImg2(img_url)
{
        thumbnail.src = img_url;
        newSize = ( 550/550 > thumbnail.width/thumbnail.height ) ? 550 / thumbnail.height : 550 / thumbnail.width;
        newWidth = thumbnail.width * newSize;

        if ( thumbnail.width > newWidth )
                document.previewImg2.width = newWidth;
        else
                document.previewImg2.width = thumbnail.width;
}


function checkImgFormat2(imgPath)
{
        if ( imgPath.indexOf(".JPG") != -1 ||
             imgPath.indexOf(".GIF") != -1 ||
             imgPath.indexOf(".gif") != -1 ||
             imgPath.indexOf(".jpg") != -1 )
        {
                stateFlag = 1;
                document.previewImg2.src = imgPath;
        }
        else
        {
                stateFlag = 0;
                if ( imgPath != "" )
                        alert("GIF,JPG ±×¸²ÆÄÀÏ¸¸ °¡´ÉÇÕ´Ï´Ù.");
        }
}

function authRegist()
{
	if (document.af.autoregist.checked==false)
	{
		AutoImgInput.style.display = "";
		//AutoImgInput[1].style.display = "none";
	}
	else
	{
		AutoImgInput.style.display = "none";
		//AutoImgInput[1].style.display = "";
	}
}



	//**	¿¡µðÅÍ ÆÄÀÏÀÌ ÀÖ´Â °æ·Î ¸Ç µÚ¿¡ / Æ÷ÇÔ
		var appName		= navigator.appName;											//**	ºê¶ó¿ìÀú¸í
		var appVersion	= parseFloat(navigator.appVersion.split("MSIE")[1]);			//**	ºê¶ó¿ìÀú ¹öÀü
		var bitUseEditor																//**	¿¡µðÅÍ »ç¿ë À¯¹«
	
			if(appName != "Microsoft Internet Explorer" || appVersion < 5.5){
				bitUseEditor	= false;												//**	ÀÍ½ºÇÃ·Î¾î°¡ ¾Æ´Ï°í ¹öÀüÀÌ 5.5º¸´Ù ÀÛÀ»¶§´Â "»ç¿ë ¾ÈÇÔ"
			}else{
				bitUseEditor	= true;													//**	¿¡µðÅÍ »ç¿ëÇÔ
			}
			
		if(bitUseEditor){
			document.write('<scrip'+'t language="JScript" src="/common/js/KNEditor.js"></scrip'+'t>');
		}