<!--

//-------------------------------------------------------------------//
//  °ø¹éÁ¦°ÅÈÄ ±æÀÌ Ã¼Å© (±æÀÌ¹ÝÈ¯)                                  //
//-------------------------------------------------------------------//
function ReplaceStr(strOriginal, strFind, strChange)
{
	var position, strOri_Length;
  position = strOriginal.indexOf(strFind);  
    
  while (position != -1)
  {
		strOriginal = strOriginal.replace(strFind, strChange);
    position    = strOriginal.indexOf(strFind);
  }
  
  strOri_Length = strOriginal.length;
  return strOri_Length;
}

//-------------------------------------------------------------------//
//  ¹®ÀÚ¿­¿¡¼­ ÁöÁ¤µÈ ¹®ÀÚ À¯¹« Ã¼Å© (À§Ä¡°ª¹ÝÈ¯)                    //
//-------------------------------------------------------------------//
function Checkstr(strOriginal, strFind)
{    
  var position;
  position = strOriginal.indexOf(strFind); 

  return position;
}

//-------------------------------------------------------------------//
//  ÀÔ·ÂÅ°°ª ¼ýÀÚ¿©ºÎ Ã¼Å© (true,false¹ÝÈ¯)                          //
//-------------------------------------------------------------------//
function onlynumber()
{
	if((event.keyCode<48) || (event.keyCode>57))
	event.returnValue=false;
}

//-------------------------------------------------------------------//
//  ÁöÁ¤µÈ °´Ã¼ÀÇ ¹®ÀÚ¿­ÀÇ ±æÀÌ¸¦ °è»êÇÏ´Â ºÎºÐ                      //
//-------------------------------------------------------------------//
function CheckByte(str)
{
	var strByte;
	var strLen = str.length;
	
	for(var i=0, strByte=0;i<strLen;i++)
	{
		if(str.charAt(i) >= ' ' && str.charAt(i) <= '~' )
			strByte++;
		else
			strByte += 2;
	}
	
	return strByte;
}

//-------------------------------------------------------------------//
//  ¹®ÀÚ¿­ÀÇ ±æÀÌ¿¡ µû¸¥ Ã³¸® ÇÔ¼ö                                   //
//-------------------------------------------------------------------//
function check_length(comp, str, len)
{
	if ( comp.value.length > len-2 )
	{
		// ÀÌ¹Ì ÃÊ°ú ÇÏ¿´´Ù¸é...
		alert(str + ' ' + len + 'ÀÚ(Byte)¸¦ ÃÊ°úÇÒ¼ö ¾ø½À´Ï´Ù.');
		comp.focus();
		return false;
	}
	
	complen = CheckByte(comp.value);
	if ( complen > len-2 )
	{
		alert(str + ' ' + len + 'ÀÚ(Byte)¸¦ ÃÊ°úÇÒ¼ö ¾ø½À´Ï´Ù. ÇöÀç ' + (complen) + '±ÛÀÚ(Byte)ÀÔ´Ï´Ù.');
		comp.focus();
		return false;
	}
	
	return true;
}

//-------------------------------------------------------------------//
//  ¿µ¹® ´ë¹®ÀÚ·Î º¯È¯ÇÏ´Â ÇÔ¼ö                                      //
//-------------------------------------------------------------------//
function ToUpper(comp) 
{

	var strNew; 
	var str = comp.value;
	
	if (comp.value != 0) 
	{
		for( var i =0 ; i<str.length; i++ )
		{
			if( str.charAt(i) >= 'a' && str.charAt(i) <= 'z' )
				strNew = strNew + str.charAt(i).toUpperCase() ;
			else
				strNew = strNew + str.charAt(i);
		}
		comp.value = strNew.substring(9);
	}
	return;
}

//-------------------------------------------------------------------//
//  ¿µ¹® ¼Ò¹®ÀÚ·Î º¯È¯ÇÏ´Â ÇÔ¼ö                                      //
//-------------------------------------------------------------------//
function ToLower(comp) 
{
	var strNew; 
	var str = comp.value;
	
	if (comp.value != 0) 
	{
		for( var i =0 ; i<str.length; i++ )
		{
			if( str.charAt(i) >= 'A' && str.charAt(i) <= 'Z' )
				strNew = strNew + str.charAt(i).toLowerCase() ;
			else
				strNew = strNew + str.charAt(i);
		}
		comp.value = strNew.substring(9);
	}
	return;
}

//-------------------------------------------------------------------//
//  ÅëÈ­Ç¥½Ã ÇÔ¼ö                                                    //
//-------------------------------------------------------------------//
function formatCurrency(comp)
{
	var num = comp.value ;
	
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num)) num = "0"; 
	cents = Math.floor((num*100+0.5)%100); 
	num = Math.floor((num*100+0.5)/100).toString(); 
	if(cents < 10) cents = "0" + cents; 
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) 
	num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3)); 
	
	comp.value = num ;
	return ;
}

//-------------------------------------------------------------------//
//  ¼Ò¼öÁ¡ÀÌÇÏ ¹Ý¿Ã¸² ÇÔ¼ö                                           //
//-------------------------------------------------------------------//
function point_round(num, len)
{
	num = eval(num) ;
	len = eval(len) ;

	plus_value = "0." ;
	for(i=0; i<len; i++)
	{
		plus_value = plus_value + "0" ;
	}
	plus_value = plus_value + "5" ;
	plus_value = eval(plus_value) ;
	
	temp  = num + plus_value ;
	temp  = temp + "" ;
	temp  = temp.split(".") ;
	temp1 = temp[0] ;
	temp2 = temp[1] ;
	temp2 = temp2.substring(0,len) ;
	temp  = temp1 + "." + temp2 ;
	return temp;
}

//-------------------------------------------------------------------//
//  ¼Ò¼öÁ¡ÀÌÇÏ ÀÚ¸£±â ÇÔ¼ö                                           //
//-------------------------------------------------------------------//
function point_cut(num, len)
{	
	num = eval(num) ;
	len = eval(len) ;
	
	temp  = num ;
	temp  = temp + "" ;
	imsi  = temp.split(".") ;
	if ( imsi.length == 1 )
	{
		temp1 = temp ;
		temp2 = "" ;
		for(i=0; i<len; i++)
		{
			temp2 = temp2 + "0" ;
		}
	}
	else
	{
		temp1 = imsi[0];
		temp2 = imsi[1] ;
		for(i=temp2.length; i<len; i++)
		{
			temp2 = temp2 + "0" ;
		}
		temp2 = temp2.substring(0,len) ;
	}
	temp  = temp1 + "." + temp2 ;
	return temp;
}

//-------------------------------------------------------------------//
//  ÀÚ¸®¼ö ¹Ý¿Ã¸² ÇÔ¼ö                                               //
//-------------------------------------------------------------------//
function money_round(num, len)
{	

	num = eval(num) ;
	len = eval(len) ;

	plus_value = (len/10) * 5

	temp  = num + plus_value ;
	temp  = temp / len ;
	temp  = temp + "" ;
	temp  = temp.split(".") ;
	temp  = temp[0] ;
	temp  = eval(temp) * len ;
	return temp;
}

//-------------------------------------------------------------------//
//  ÀÚ¸®¼ö ÀÚ¸£±â ÇÔ¼ö                                               //
//-------------------------------------------------------------------//
function money_cut(num, len)
{	
	num = eval(num) ;
	len = eval(len) ;
	
	temp  = num / len ;
	temp  = temp + "" ;
	temp  = temp.split(".") ;
	temp  = temp[0] ;
	temp  = eval(temp) * len ;
	return temp;
}

//-------------------------------------------------------------------//
//  ³¯ÀÚ ºñ±³ ÇÔ¼ö                                                   //
//-------------------------------------------------------------------//
function Date_Compare(y1, m1, d1, y2, m2, d2)
{
	var MinMilli = 1000 * 60         //º¯¼ö¸¦ ÃÊ±âÈ­ÇÕ´Ï´Ù.
	var HrMilli  = MinMilli * 60
	var DyMilli  = HrMilli * 24

	d = new Date;

	d1 = new Date(y1, m1-1, d1);
	d2 = new Date(y2, m2-1, d2);

	d3 = d1 - d2;

	r = Math.round(d3 / DyMilli);
	
	return r ;
}

//-------------------------------------------------------------------//
//  ¾÷·Îµå ÁøÇàÀ² Ç¥½Ã±â ÇÔ¼ö                                        //
//-------------------------------------------------------------------//
function ShowProgress(a) 
{ 
	strAppVersion = navigator.appVersion; 
	if (a != "")
	{
		if (strAppVersion.indexOf('MSIE')!=-1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
		{
			winstyle = "dialogWidth=385px; dialogHeight:150px; center:yes"; 
			window.showModelessDialog("/korean/include/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("/korean/include/show_progress.asp",null,winstyle); 
		} 
	}
	
	return true; 
}

//-------------------------------------------------------------------//
//  È®ÀåÀÚ Ã¼Å© ÇÔ¼ö                                                 //
//-------------------------------------------------------------------//
function uploadfile_check(a)
{
	var str_value,str_low,str_dotlocation,str_ext_low;
	str_value=a;
	str_low=str_value.toLowerCase(str_value);
	str_dotlocation=str_low.lastIndexOf(".");
	str_ext=str_low.substring(str_dotlocation+1);
	
	switch(str_ext)
	{
		case "asp":
		case "ASP":
		case "php":
		case "PHP":
		case "html":
		case "HTML":
		case "htm":
		case "HTM":
		alert("¹®¼­ÆÄÀÏÀÌ³ª ÀÌ¹ÌÁöÆÄÀÏÀ» ¿Ã¸®¼¼¿ä.");
		return false;
		break;
		default:		
		return true;
	}
}

//-------------------------------------------------------------------//
//  ÀÌ¹ÌÁö Ã¼Å© ÇÔ¼ö                                                 //
//-------------------------------------------------------------------//
function imagefile_check(a)
{
	var str_value,str_low,str_dotlocation,str_ext_low;
	str_value=a;
	str_low=str_value.toLowerCase(str_value);
	str_dotlocation=str_low.lastIndexOf(".");
	str_ext=str_low.substring(str_dotlocation+1);
	
	switch(str_ext)
	{
		case "jpg":
		case "jpeg":
		case "JPG":
		case "JPEG":
		case "GIF":
		case "gif":
		case "BMP":
		case "bmp":
		return true;
		break;
		default:
		alert("ÀÌ¹ÌÁö ÆÄÀÏ·Î ¿Ã¸®¼¼¿ä.");
		return false;
	}
}

//-------------------------------------------------------------------//
//  ÀÔ·Â ´ÙÀ½Ç×¸ñ Æ÷Ä¿½ºÀÌµ¿ ÇÔ¼ö                                    //
//-------------------------------------------------------------------//
function focus_next()
{
	if(event.keyCode==13)
	{
		event.keyCode = 9 ;
	}
}

//-------------------------------------------------------------------//
//  ÀÔ·Â ´ÙÀ½Ç×¸ñ Æ÷Ä¿½ºÀÌµ¿ ÇÔ¼ö (¶óµð¿À¹Ú½º¿¡¼­)                   //
//-------------------------------------------------------------------//
function focus_next1(a)
{
	if(event.keyCode==13)
	{
		document.all[a].focus();
		return true;
	}
	return;
}

//-------------------------------------------------------------------//
//  ¿£ÅÍÅ° ÀÔ·Â½Ã È£Ãâ ÇÔ¼ö                                          //
//-------------------------------------------------------------------//
function focus_function(e)
{
	if(event.keyCode==13)
	{
		eval(e);
	}
}

//-------------------------------------------------------------------//
//  ¿ìÆí¹øÈ£ÀÔ·ÂÄ­ Å¬¸¯½Ã ½ÇÇà  ÇÔ¼ö                                 //
//-------------------------------------------------------------------//
function Bchk()
{
	alert("¿ìÆí¹øÈ£ °Ë»ö¹öÆ°À» »ç¿ëÇØ ÁÖ½Ê½Ã¿ä.");
	return;
}

//-------------------------------------------------------------------//
//  ÇÑ±ÛÀÌ¸§ Ã¼Å©													 //
//-------------------------------------------------------------------//
function check_H_filename(str_name){	
	img=new Object();
	img.aa=new Image();
	img.aa.src=str_name ;
	var s = img.aa.src.split("/") ;
	var temp_Filename = s[s.length-1];

	var str_tmp="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_."; 
	for (i=0;i<temp_Filename.length;i++)	{
		if (temp_Filename.substring(i,i+1)==" "){
			return false;
			break;
		}else if (str_tmp.indexOf(temp_Filename.substring(i,i+1))<0){
			return false;
			break;
		}
	}
	return true;
}

//-------------------------------------------------------------------//
//¿µ¹®¸¸ÀÔ·Â Ã¼Å©													 //
//-------------------------------------------------------------------//
function check_eng_value(str_name)
{
	var temp_Filename = str_name.toUpperCase();

	var str_tmp="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	for (i=0;i<temp_Filename.length;i++)
	{
		if (temp_Filename.substring(i,i+1)==" ")
		{
			return false;
			break;
		}
		else if (str_tmp.indexOf(temp_Filename.substring(i,i+1))<0)
		{
			return false;
			break;
		}
	}
	return true;
}


//-------------------------------------------------------------------//
//  AJAX ÇÔ¼ö                                                        //
//-------------------------------------------------------------------//

var xmlHttp;
var requestType = "";

function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
}

function handleStateChange() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
			eval(requestType);
        }
    }
}

function startRequestGet(requestedList,userUrl) {

    requestType = requestedList;
    createXMLHttpRequest();
    xmlHttp.onreadystatechange = handleStateChange;
    xmlHttp.open("GET", userUrl, true);
    xmlHttp.send(null);
}

//-->

