function comma(the) { 
    var num = the.value;

        if (the.value.length >= 4) {
            re = /^$|,/g; 
            num = num.replace(re, ""); 
            fl="" 
        if(isNaN(num)) { alert("¹®ÀÚ´Â »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");return 0} 
        if(num==0) return num 
        if(num<0){ 
            num=num*(-1) 
            fl="-" 
        }
        else{ 
            num=num*1 //Ã³À½ ÀÔ·Â°ªÀÌ 0ºÎÅÍ ½ÃÀÛÇÒ¶§ ÀÌ°ÍÀ» Á¦°ÅÇÑ´Ù. 
        } 
            num = new String(num) 
            temp="" 
            co=3 
            num_len=num.length 
    while (num_len>0){ 
        num_len=num_len-co 
        if(num_len<0){co=num_len+co;num_len=0} 
        temp=","+num.substr(num_len,co)+temp 
        } 
       the.value =  fl+temp.substr(1);
    }
} 

function num_check() { 
    var keyCode = event.keyCode 
        if (keyCode < 48 || keyCode > 57){ 
            alert("¹®ÀÚ´Â »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù."+"["+keyCode+"]") 
            event.returnValue=false 
        } 
    } 


function isNumeric( inStr ) 
{
	if (inStr.length > 0) 
	{ 
		for (i=0; i < inStr.length; i++) {
		
			if (!(inStr.charAt(i) >= '0' && inStr.charAt(i) <= '9'))  {
			return false;
		
			}
		}
		return true;
		}
	else { return false; }		    
}


function isNum(){ 
   var key = event.keyCode; var messageArea = document.getElementById("ssnMessage"); 

   if(!(key==8||key==9||key==13||key==46||key==144||(key>=48&&key<=57)||key==110||key==190)){ 
        alert('¼ýÀÚ¸¸ ÀÔ·Â °¡´ÉÇÕ´Ï´Ù'); 
        event.returnValue = false; 
   } 
}

function clearField(field){
	if (field.value == field.defaultValue) {
		field.value = '';
	}
}

function checkField(field){ 
	if (field.value == '') {
		field.value = field.defaultValue;
	}
}


function doResize() 
{ 
  document.all("myframe").height = myframe.document.body.scrollHeight+5; 
  document.all("myframe").width = myframe.document.body.scrollWidth; 
} 

    function go(the)
	{
	  window.open("http://" + the,"_blank");
	}



function H_ImageSize(pic0) {
	pic = new Image();
	pic.src=pic0;
	eval(pic).height;
	eval(pic).width; 

	return eval(pic).height;
}

function W_ImageSize(pic0) {
	pic = new Image();
	pic.src=pic0;
	eval(pic).height;
	eval(pic).width; 

	return eval(pic).width;
}



//»çÁø ¹Ì¸® º¸¿©ÁÖ±â ////
var ImageOne = new Image();
function ChangeImage(objImg,showPic) {

//    myheight = 108;
//	mywidth  = 158;

    myheight = 90;
	mywidth  = 120;

	
	if(objImg.value.length > 1) {
		ImageOne.src = objImg.value;
			var f = objImg.value;

			if (f != "") {
					var r=f.match(/\.[^\.]*$/);
					if (r != ".jpg" && r != ".gif" && r != ".JPG" && r != ".GIF" && r != ".bmp"  && r != ".png")
					{
						alert("»çÁø¸¸ ¿Ã·ÁÁÖ¼¼¿ä");
						
					  return false;
					}
				} 


		document.all(showPic).src = ImageOne.src;


    }		
		
}

///////////////  »çÁø ¹Ì¸®º¸¿©ÁÖ±â ³¡ /////////////////////




////////////////////    ¾÷·Îµå½Ã º¸¿©ÁÜ Ã¢À» º¸¿©ÁÜ ÀÏ¹Ý..  ÆíÁý±â////////////////////////////
function send(myfile,myaction,myurl){
	strAppVersion = navigator.appVersion; 

			if (document.all(myfile).value != "") {
				if (strAppVersion.indexOf('MSIE')!=-1 && 
					strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4) { 

					winstyle = "dialogWidth=385px; dialogHeight:150px; center:yes"; 
					window.showModelessDialog(myurl + "/Progress/show_progress.asp?nav=ie", null, winstyle); 
				} 
				else { 
					winpos = "left=" + ((window.screen.width-380)/2)+",top=" +
								 ((window.screen.height-110)/2); 
					winstyle = "width=380,height=110,status=no,toolbar=no,menubar=no," + 
								 "location=no,resizable=no,scrollbars=no,copyhistory=no," + winpos; 
					window.open(myurl + "/Progress/show_progress.asp?nav=ns",null,winstyle);				
				} 
		        
				//mySlen = document.upform.my_file.value.length()
				//alert(mySlen)
          } 
    document.upform.action = myaction;
	document.upform.submit();

}
///////////////////////////////////////


////////////////////    ¾÷·Îµå½Ã º¸¿©ÁÜ Ã¢À» º¸¿©ÁÜ HTML  ÆíÁý±â////////////////////////////
function nofile_send(myaction){

	    strAppVersion = navigator.appVersion; 
        document.all.editBox.editmode = "html";  //³»¿ëÀ» text·Î ¹Ù²Ù°í 
        content = document.all.editBox.text;
	    document.all.editBox.editmode = "text";  //³»¿ëÀ» html·Î ¹Ù²Ù°í
	    document.upform.Content.value = document.all.editBox.text;  //¸ÖÆ¼Å¸ÀÔÀ¸·Î ÀÐ°Ô ¸¸µçµÚ
		document.upform.action = myaction;

		document.upform.submit();

}
///////////////////////////////////////


function Html_send(myfile,myaction,myurl){

	strAppVersion = navigator.appVersion; 

			if (document.all(myfile).value != "") {
				if (strAppVersion.indexOf('MSIE')!=-1 && 
					strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4) { 

					winstyle = "dialogWidth=385px; dialogHeight:150px; center:yes"; 
					window.showModelessDialog(myurl + "/Progress/show_progress.asp?nav=ie", null, winstyle); 
				} 
				else { 
					winpos = "left=" + ((window.screen.width-380)/2)+",top=" +
								 ((window.screen.height-110)/2); 
					winstyle = "width=380,height=110,status=no,toolbar=no,menubar=no," + 
								 "location=no,resizable=no,scrollbars=no,copyhistory=no," + winpos; 
					window.open(myurl + "/Progress/show_progress.asp?nav=ns",null,winstyle);				
				} 
		        
				//mySlen = document.upform.my_file.value.length()
				//alert(mySlen)
          } 
        document.all.editBox.editmode = "html";  //³»¿ëÀ» text·Î ¹Ù²Ù°í 
        content = document.all.editBox.text;
	    document.all.editBox.editmode = "text";  //³»¿ëÀ» html·Î ¹Ù²Ù°í
	    document.upform.Content.value = document.all.editBox.text;  //¸ÖÆ¼Å¸ÀÔÀ¸·Î ÀÐ°Ô ¸¸µçµÚ
		document.upform.action = myaction;

		document.upform.submit();

}
///////////////////////////////////////

   

////////////////////    ¾÷·Îµå½Ã º¸¿©ÁÜ Ã¢À» º¸¿©ÁÜ HTML  2°³ ÆÄÀÏ µ¿½Ã ÆíÁý±â////////////////////////////
function Html2send(myfile1,myfile2,myaction,myurl){
	strAppVersion = navigator.appVersion; 

			if (document.all(myfile1).value != "") {
				if (strAppVersion.indexOf('MSIE')!=-1 && 
					strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4) { 

					winstyle = "dialogWidth=385px; dialogHeight:150px; center:yes"; 
					window.showModelessDialog(myurl + "/Progress/show_progress.asp?nav=ie", null, winstyle); 
				} 
				else { 
					winpos = "left=" + ((window.screen.width-380)/2)+",top=" +
								 ((window.screen.height-110)/2); 
					winstyle = "width=380,height=110,status=no,toolbar=no,menubar=no," + 
								 "location=no,resizable=no,scrollbars=no,copyhistory=no," + winpos; 
					window.open(myurl + "/Progress/show_progress.asp?nav=ns",null,winstyle);				
				} 
		        
				//mySlen = document.upform.my_file.value.length()
				//alert(mySlen)
          } 

			if (document.all(myfile2).value != "") {
				if (strAppVersion.indexOf('MSIE')!=-1 && 
					strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4) { 

					winstyle = "dialogWidth=385px; dialogHeight:150px; center:yes"; 
					window.showModelessDialog(myurl + "/Progress/show_progress.asp?nav=ie", null, winstyle); 
				} 
				else { 
					winpos = "left=" + ((window.screen.width-380)/2)+",top=" +
								 ((window.screen.height-110)/2); 
					winstyle = "width=380,height=110,status=no,toolbar=no,menubar=no," + 
								 "location=no,resizable=no,scrollbars=no,copyhistory=no," + winpos; 
					window.open(myurl + "/Progress/show_progress.asp?nav=ns",null,winstyle);				
				} 
		        
				//mySlen = document.upform.my_file.value.length()
				//alert(mySlen)
          } 


		document.all.editBox.editmode = "html";  //³»¿ëÀ» text·Î ¹Ù²Ù°í 

//        content = document.all.editBox.text;
		document.all.editBox.editmode = "html";  //³»¿ëÀ» text·Î ¹Ù²Ù°í 
	    document.all.editBox.editmode = "text";  //³»¿ëÀ» html·Î ¹Ù²Ù°í
	    document.upform.Content.value = document.all.editBox.text;  //¸ÖÆ¼Å¸ÀÔÀ¸·Î ÀÐ°Ô ¸¸µçµÚ
		document.upform.action = myaction;
		document.upform.submit();

}


/* ¹Ìµð¾î °øÅë »ç¿ë */
function MediaObject(URL, Name, width, height) {

	document.write('<object ID="'+Name+'" name="'+Name+'" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"  standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" align="middle" width="'+width+'" height="'+height+'">');
	document.write('  <param name="CurrentPosition" value="1">');
	document.write('  <param name="SetCurrentEntry" value="1">');
	document.write('  <param name="ClickToPlay" value="1">');
	document.write('  <param name="AutoSize" value="0">');
	document.write('  <param name="AutoStart" value="1">');
	document.write('  <param name="ShowControls" value="1">');
	document.write('  <param name="ShowAudioControls" value="1">');
	document.write('  <param name="ShowDisplay" value="0">');
	document.write('  <param name="ShowStatusBar" value="1">');
	document.write('  <param name="EnableContextMenu" value="0">');
	document.write('  <param name="ShowPositionControls" value="1">');
	document.write('  <param name="DisplayBackColor" value="0">');
	document.write('  <param name="ShowTracker" value="1">');
	document.write('  <param name="ShowCaptioning" value="0">');
	document.write('  <param name="AutoRewind" value="0">');
	document.write('  <param name="EnableTracker" value="1">');
	document.write('  <param name="Volume" value="-1">');
	document.write('  <param name="Filename" value="'+URL+'">');
	document.write('</object>');
}
function SoundObject(URL, Name, width, height) {
	document.write('<object ID="'+Name+'" name="'+Name+'" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"  standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" align="middle" width="'+width+'" height="'+height+'">');
	document.write('  <param name="CurrentPosition" value="1">');
	document.write('  <param name="SetCurrentEntry" value="1">');
	document.write('  <param name="ClickToPlay" value="1">');
	document.write('  <param name="AutoSize" value="0">');
	document.write('  <param name="AutoStart" value="1">');
	document.write('  <param name="ShowControls" value="1">');
	document.write('  <param name="ShowAudioControls" value="1">');
	document.write('  <param name="ShowDisplay" value="0">');
	document.write('  <param name="ShowStatusBar" value="0">');
	document.write('  <param name="EnableContextMenu" value="0">');
	document.write('  <param name="ShowPositionControls" value="0">');
	document.write('  <param name="DisplayBackColor" value="0">');
	document.write('  <param name="ShowTracker" value="1">');
	document.write('  <param name="ShowCaptioning" value="0">');
	document.write('  <param name="AutoRewind" value="0">');
	document.write('  <param name="EnableTracker" value="1">');
	document.write('  <param name="Volume" value="-1">');
	document.write('  <param name="Filename" value="'+URL+'">');
	document.write('</object>');
}

function ShowProgress(obj) { 
	strAppVersion = navigator.appVersion; 
	if (obj.value != "") {
		if (strAppVersion.indexOf('MSIE')!=-1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4) { 
			winstyle = "dialogWidth=385px; dialogHeight:150px; center:yes"; 
			window.showModelessDialog("/Common/inc/show_progress.asp?nav=ie", null, winstyle); 
		} 
		else { 
			winpos = "left=" + ((window.screen.width-380)/2)+",top=" + ((window.screen.height-110)/2); 
			winstyle = "width=380,height=110,status=no,toolbar=no,menubar=no," + "location=no,resizable=no,scrollbars=no,copyhistory=no," + winpos; 
			window.open("/Common/inc/show_progress.asp",null,winstyle); 
		} 
	}
}

function openPopupWin(url, name, width, height) {
	window.open (url, name, 'scrollbars=yes, toolbar=no, location=no, directories=no, status=no, menubar=no, width=' + width + ', height=' + height) ;
}

function ebookView(url) {
	window.open (url,"ebook","left=0, top=0, toolbar=no, location=no,directories=no, status=no, fullscreen=no, menubar=no, scrollbars=no, resizable=yes,width="+eval(screen.availWidth-10)+", height="+eval(screen.availHeight-38)+"");
}

function getValueById(objId) {
	var resultVal = "";
	var resultObj = document.getElementById(objId);

	if(resultObj!=null)
		resultVal = resultObj.value;

	return resultVal;
}

function ChkLen(obj, len) {
	if(obj.value.length > len) {
		alert(len+"ÀÚ Á¦ÇÑÀÌ µÇ¾î ÀÖ½À´Ï´Ù");
		//obj.value = obj.value.substring(0,len);
		return false;
	}
}



	function CopyToClipboard(content) {
	   window.clipboardData.setData('Text', content); 
	   alert("Å¬¸³º¸µå¿¡ º¹»ç µÇ¾ú½À´Ï´Ù! º¹»çÇÏ·Á´Â À§Ä¡¿¡¼­ Ctrl+V¸¦ ´©¸£½Ã¸é µË´Ï´Ù");
   }


///////////////////////////////////////

