//ÇÃ·¡½¬ IEÆÐÄ¡¿¡ µû¸¥ Å×µÎ¸® ¾ø¾Ö±â
function MakeFlash(Url,Width,Height,Vars){                 
  document.writeln("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"" + Width + "\" height=\"" + Height + "\">"); 
  document.writeln("<param name=\"movie\" value=\"" + Url + "\">"); 
  document.writeln("<param name=\"quality\" value=\"high\" />");     
  document.writeln("<param name=\"wmode\" value=\"transparent\">"); 
  document.writeln("<param name=\"FlashVars\" value=\""+ Vars +"\">"); 
  document.writeln("<embed src=\"" + Url + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + Width + "\"  height=\"" + Height + "\" wmode=\"transparent\">"); 
  document.writeln("</object>");     
} 

//¼ýÀÚ¸¸ ÀÔ·ÂÇÏ´ÂÁö Ã¼Å©
function InputOnlyNumber()
{
	if((event.keyCode < 48)||(event.keyCode > 57))
	{
		event.returnValue=false;
	}
}


function InputNumberFormat(txtNum, value, x, y, comma)
{
	var tmpVal = value;
	var pointIndex;
	var negative = "";	// ºÎÈ£ Ã³¸®

	if (event.keyCode == 35 || event.keyCode == 36 ||event.keyCode == 37 || event.keyCode == 39)
		return;
/*
	if (tmpVal.search(/^-/) != -1)			// -ºÎÈ£ ÀÔ·Â ¿©ºÎ È®ÀÎ
	{
		tmpVal = tmpVal.replace(/^-/,"");
		negative = "-";
	}
*/
	
	//y(¼Ò¼ýÁ¡ÀÌÇÏÀÚ¸®¼ö)°¡ 0ÀÏ¶§ ¼Ò¼öÁ¡ Á¦°Å
	if(y == 0)	
	{
        while (tmpVal.search(/\./) != -1)
        {
        	tmpVal = tmpVal.replace(/\./,"");
        }
	}

	// Àß¸øµÈ ¹®ÀÚ¿­ Á¦°Å
	while (tmpVal.search(/[^0-9\.]/) != -1)
	{
		tmpVal = tmpVal.replace(/[^0-9\.]/,"");
	}
	
	pointIndex = tmpVal.indexOf(".");

	if (tmpVal != "0" && pointIndex != 1)
	{
		// Àß¸øµÈ ¹®ÀÚ¿­ Á¦°Å
		while (tmpVal.search(/^0/) != -1)
		{
			tmpVal = tmpVal.replace(/^0/,"");
		}
	}

	// ¼Ò¼öÁ¡ À¯»ç¹®ÀÚ ¹®ÀÚ¿­ Á¦°Å
	while (tmpVal.search(/\./) != -1)
	{
		tmpVal = tmpVal.replace(/\./,"");
	}
	
	if (comma)
	{
		if (pointIndex != -1)
		{
			if (pointIndex < x)
			{
				txtNum.value = negative + formatNumbers(tmpVal.substr(0,pointIndex)) + "." + tmpVal.substr(pointIndex,y);
			}
			else
			{
				txtNum.value = negative + formatNumbers(tmpVal.substr(0,x)) + "." + tmpVal.substr(x,y);
			}
		}
		else
		{
			if (tmpVal.length < x+1)
			{
				txtNum.value = negative + formatNumbers(tmpVal);// + ".";
			}
			else
			{
				txtNum.value = negative + formatNumbers(tmpVal.substr(0,x));// + "." + tmpVal.substr(x,y);
			}
		}
	}
	else
	{
		if (pointIndex != -1)
		{
			if (pointIndex < x)
			{
				txtNum.value = negative + tmpVal.substr(0,pointIndex) + "." + tmpVal.substr(pointIndex,y);
			}
			else
			{
				txtNum.value = negative + tmpVal.substr(0,x) + "." + tmpVal.substr(x,y);
			}
		}
		else
		{
			if (tmpVal.length < x+1)
			{
				txtNum.value = negative + tmpVal;// + ".";
			}
			else
			{
				txtNum.value = negative + tmpVal.substr(0,x);// + "." + tmpVal.substr(x,y);
			}
		}
	}
}


function InputNumberFormat2(txtNum, value, x, y, comma)
{
	var tmpVal = value;
	var pointIndex;
	var negative = "";	// ºÎÈ£ Ã³¸®

	
/*
	if (tmpVal.search(/^-/) != -1)			// -ºÎÈ£ ÀÔ·Â ¿©ºÎ È®ÀÎ
	{
		tmpVal = tmpVal.replace(/^-/,"");
		negative = "-";
	}
*/
	
	//y(¼Ò¼ýÁ¡ÀÌÇÏÀÚ¸®¼ö)°¡ 0ÀÏ¶§ ¼Ò¼öÁ¡ Á¦°Å
	if(y == 0)	
	{
        while (tmpVal.search(/\./) != -1)
        {
        	tmpVal = tmpVal.replace(/\./,"");
        }
	}

	// Àß¸øµÈ ¹®ÀÚ¿­ Á¦°Å
	while (tmpVal.search(/[^0-9\.]/) != -1)
	{
		tmpVal = tmpVal.replace(/[^0-9\.]/,"");
	}
	
	pointIndex = tmpVal.indexOf(".");

	if (tmpVal != "0" && pointIndex != 1)
	{
		// Àß¸øµÈ ¹®ÀÚ¿­ Á¦°Å
		while (tmpVal.search(/^0/) != -1)
		{
			tmpVal = tmpVal.replace(/^0/,"");
		}
	}

	// ¼Ò¼öÁ¡ À¯»ç¹®ÀÚ ¹®ÀÚ¿­ Á¦°Å
	while (tmpVal.search(/\./) != -1)
	{
		tmpVal = tmpVal.replace(/\./,"");
	}
	
	if (comma)
	{
		if (pointIndex != -1)
		{
			if (pointIndex < x)
			{
				txtNum.value = negative + formatNumbers(tmpVal.substr(0,pointIndex)) + "." + tmpVal.substr(pointIndex,y);
			}
			else
			{
				txtNum.value = negative + formatNumbers(tmpVal.substr(0,x)) + "." + tmpVal.substr(x,y);
			}
		}
		else
		{
			if (tmpVal.length < x+1)
			{
				txtNum.value = negative + formatNumbers(tmpVal);// + ".";
			}
			else
			{
				txtNum.value = negative + formatNumbers(tmpVal.substr(0,x));// + "." + tmpVal.substr(x,y);
			}
		}
	}
	else
	{
		if (pointIndex != -1)
		{
			if (pointIndex < x)
			{
				txtNum.value = negative + tmpVal.substr(0,pointIndex) + "." + tmpVal.substr(pointIndex,y);
			}
			else
			{
				txtNum.value = negative + tmpVal.substr(0,x) + "." + tmpVal.substr(x,y);
			}
		}
		else
		{
			if (tmpVal.length < x+1)
			{
				txtNum.value = negative + tmpVal;// + ".";
			}
			else
			{
				txtNum.value = negative + tmpVal.substr(0,x);// + "." + tmpVal.substr(x,y);
			}
		}
	}
}


function formatNumbers(value)
{
	var returnVal;
	var tmpVal;
	var headCnt;
	
	tmpVal = value;
	
	headCnt = (tmpVal.length) % 3;	// ¾ÕÀÚ¸® ¼ö
	
	if (headCnt > 0)
	{
		returnVal = tmpVal.substr(0, headCnt);
		tmpVal = tmpVal.substr(headCnt, tmpVal.length - headCnt);
	}
	else
		returnVal = "";

	while (tmpVal.length > 0)
	{
		returnVal += (returnVal == "" ? "" : ",");
		returnVal += tmpVal.substr(0, 3);
		tmpVal = tmpVal.substr(3, tmpVal.length - 3);
	}
	
	//À½¼öÀÎ °æ¿ì -,111,111°ú °°ÀÌ ³Ñ¾î¿À´Â °ÍÀ» -111,111Çü½ÄÀ¸·Î ¹Ù²Ù¾îÁÖ±â À§ÇÔ.	

	if ((returnVal.substr(0, 1) == "-") && (returnVal.substr(1, 1)==","))
	{
		returnVal = "-" +returnVal.substr(2, returnVal.length - 2); 
	}
		
	return returnVal;
}



function checkJuminNum(preJuminRegtNo, postJuminRegtNo)
{
	var isValidJuminRegtNo = false ;

	var yy = preJuminRegtNo.substring(0,2) ;	// »ý³â
	var mm = preJuminRegtNo.substring(2,4) ;	// »ý¿ù
	var dd = preJuminRegtNo.substring(4,6) ;	// »ýÀÏ
	var gender = postJuminRegtNo.substring(0,1) ;  // ¼ºº°

	// ±âº» Ã¼Å©
	if(preJuminRegtNo.length != 6 || postJuminRegtNo.length != 7 || yy < 20
	   || mm < 1 || mm > 12 || dd < 0 || dd > 31 || gender > 2 || gender < 1) {
		alert("Àß¸øµÈ ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù") ;
	   	return isValidJuminRegtNo ;
	}

	// ÁÖ¹Îµî·Ï¹øÈ£ °ø½Ä¿¡ ÀÇÇÑ Ã¼Å©
	var juminRegtNo = preJuminRegtNo + postJuminRegtNo ;

	var ck = 0 ;
	for(i = 0 ; i < 12 ; ++i) {
		var num = juminRegtNo.substring(i, i+1) ;
		ck += (i%8+2) * num ;
	}

	ck = (11-(ck%11))%10 ;

	if(parseInt(ck) != parseInt(juminRegtNo.substring(12,13))) {
		alert("Àß¸øµÈ ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù") ;
		return isValidJuminRegtNo ;
	} else isValidJuminRegtNo = true ;

	return isValidJuminRegtNo ;
}
