/*==================================================================================================
°øÅë
==================================================================================================*/
var MKReturnUrl = "http://mk.dev.mcircle.co.kr"

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/*==================================================================================================
¹®ÀÚ¿­ Á¶ÀÛ
==================================================================================================*/
function PopupPrivate()
{
	window.open('/skin/member/tplmemberprivate.html','PopupPrivate','width=550, height=700, top=0 , left=0 ,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no');
}

// LEFT
function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

// RIGHT
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

// trim
function Trim(str){
	return String(str).rereplace(/^\s+|\s+$/g,'');
}

// ¼ýÀÚÃ¼Å©
function Global_numbercheck(obj)
{
    obj.value = obj.value.replace(/^\s+|\s+$/g,'');
    var strValue = obj.value;
    if(isNaN(strValue))
	{
		alert('¼ýÀÚ¸¦ ÀÔ·ÂÇÏ¼¼¿ä.');
        obj.value = "";
        obj.focus();
		return false;
	}
    else
	{
		return true;
	}
}

// ÄÞ¸¶
function addComma(obj,fLen)
{

	if(event.keyCode == 37 || event.keyCode == 39 )
	{
		return;
	}

	var fLen = fLen || 2;

	var strValue = obj.value.replace(/,|\s+/g,'');
	var strBeforeValue = (strValue.indexOf('.') != -1)? strValue.substring(0,strValue.indexOf('.')) :strValue ;
	var strAfterValue = (strValue.indexOf('.') != -1)? strValue.substr(strValue.indexOf('.'),fLen+1) : '' ;


	if(isNaN(strValue))
	{
		alert(strValue.concat(' : ¼ýÀÚ°¡ ¾Æ´Õ´Ï´Ù.'));
		return false;
	}

	var intLast = strBeforeValue.length-1;

	var arrValue = new Array;
	var strComma = '';

	for(var i=intLast,j=0; i >= 0; i--,j++)
	{

		if( j !=0 && j%3 == 0)
		{
			strComma = ',';
		}
		else
		{
			strComma = '';
		}

		arrValue[arrValue.length] = strBeforeValue.charAt(i) + strComma ;
	}

	obj.value= arrValue.reverse().join('') + strAfterValue;
}

/*==================================================================================================
À©µµ¿ì
==================================================================================================*/
// Window Open
function GrobalOpenWindow(JWinName,JOpenedFile,JWidth,JHeight)
{
	var x = (screen.width/2) - (JWidth/2);
	var y = (screen.height/2) - (JHeight/2);
	var NewWin = window.open('', JWinName, 'toolbar=no,resizable=no,scrollbars=yes,status=0,width='+JWidth+',height='+JHeight+',left='+x+',top='+y);
	NewWin.location = JOpenedFile;

	if(NewWin == null)
		alert("¸ÕÀú ÆË¾÷Ã¢ ±ÝÁö¸¦ ÇØÁ¦ ÇÏ½Ê½Ã¿À.");
}

// Ã¢Å©±â Á¶Àý
function WinSize(strW, strH)
{
	window.resizeTo(strW,strH);
}

// Ã¤³Î¸ðµå·Î À©µµ¿ì ¿ÀÇÂ
function ChannelModeWindowOpen(url)
{
    window.open(url,"","channelmode,scrollbars")
}

/*==================================================================================================
ÆÄ¶ó¸ÞÅÍ ¹Þ±â
==================================================================================================*/
// QueryString
function RequestQueryString(valuename)
{
    var rtnval = "";
    var nowAddress = unescape(location.href);
    var parameters = (nowAddress.slice(nowAddress.indexOf("?")+1,nowAddress.length)).split("&");

    for(var i = 0 ; i < parameters.length ; i++){
        var varName = parameters[i].split("=")[0];
        if(varName.toUpperCase() == valuename.toUpperCase())
        {
            rtnval = parameters[i].split("=")[1];
            break;
        }
    }

    return rtnval;
}

/*==================================================================================================
ÆûÃ¼Å©
==================================================================================================*/
// NULLÃ¼Å©
function CheckValue(controlid,message)
{
	var thisValue = document.all[controlid];
	var temp = "";
	string = '' + thisValue.value;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
	temp += splitstring[i];

	if(temp=="")
	{
		alert(message);
		thisValue.value="";
		thisValue.focus();
		return false;
	}
	else
	{
		return true;
	}
}

// NULL Ã¼Å© -> Nofocus
function CheckValue2(controlid,message)
{
	var thisValue = document.form2[controlid];
	var temp = "";
	string = '' + thisValue.value;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
	temp += splitstring[i];

	if(temp=="")
	{
		alert(message);
		thisValue.value="";
		return false;
	}
	else
	{
		return true;
	}
}

// »èÁ¦ Ã³¸®
function DelYN (locationURL)
{
	if (confirm('Á¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?')) {

		document.location = locationURL;
	}
}

// Array ¿©ºÎ
function IsArray(controlid)
{
    var thisValue = document.all[controlid];

    if(!eval(thisValue.length))
    {
        return false;
    }
    else
    {
        return true;
    }
}

// ¾ÆÀÌµðÃ¼Å©
function CheckID( controlName )
{
	searchko = document.all[controlName].value;

	for (i = 0 ; i < searchko.length ; i++)
	{
		sko = searchko.charAt(i);

		if ((sko < '0' || sko > '9')&&(sko < 'a' || sko > 'z')&&(sko < 'A' || sko > 'Z'))
		{
			alert('È¸¿ø ID´Â ¿µ¹®°ú ¼ýÀÚ¸¸ °¡´ÉÇÕ´Ï´Ù.');
			document.all[controlName].value = "";
			document.all[controlName].focus();
			return false;
		}
	}

	return true;
}

// ÀÌ¸ÞÀÏÃ¼Å©
function EmailCheck2( controlName )
{
	if(document.all[controlName] != null)
	{
		if(Global_TrimSpaces(document.all[controlName].value) != "")
		{
			var chkEmail = document.all[controlName].value.match(/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/);

			if (chkEmail == null)
			{
				alert("¸ÞÀÏ ÁÖ¼Ò°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
				document.all[controlName].value = "";
				return false;
			}
			else
			{
				return true;
			}
		}
		else
		{
			return true;
		}
	}
	else
	{
		return true;
	}
}

// ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å©
function Global_CheckRegno( controlName1, controlName2 )
{
	var NUM = "0123456789";

	var PID1 = document.all[controlName1].value;
	var PID2 = document.all[controlName2].value;

	var chk = 0;

	var nYear = PID1.substring(0,2);

	var nMondth = PID1.substring(2,4);

	var nDay = PID1.substring(4,6);

	var nSex = PID2.charAt(0);

	if (!IsValid(PID1, NUM))
	{
		alert("ÁÖ¹Î¹øÈ£°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
		document.all[controlName1].select();
		return false//-1;
	}

	if ( PID1.length!=6 ||  nMondth<1 || nMondth>12 || nDay<1 || nDay>31)
	{
		alert("ÁÖ¹Î¹øÈ£°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
		document.all[controlName1].select();
		return false//-1;
	}

	if (!IsValid(PID2, NUM))
	{
		alert("ÁÖ¹Î¹øÈ£°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
		document.all[controlName1].select();
		return false//1;
	}

	if ( PID2.length!=7 || (nSex!=1 && nSex!=2 && nSex!=3 && nSex!=4 && nSex!=5 && nSex!=6 && nSex!=7 && nSex!=8) )
	{
		alert("ÁÖ¹Î¹øÈ£°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
		document.all[controlName1].select();
		return false//1;
	}

	if ( nSex==5 || nSex==6 || nSex==7 || nSex==8 )
	{
		var sum=0;
		var odd=0;
		var PID = PID1 + PID2;
		buf = new Array(13);
		for (i=0; i<13; i++) buf[i] = parseInt(PID.charAt(i));
		odd = buf[7]*10 + buf[8];
		if (odd%2 != 0)
		{
			alert("ÁÖ¹Î¹øÈ£°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
			document.all[controlName1].select();
			return false//-1;
		}

		multipliers = [2,3,4,5,6,7,8,9,2,3,4,5];
		for (i=0, sum=0; i<12; i++) sum += (buf[i] *= multipliers[i]);
		sum = 11-(sum%11);
		if (sum >= 10) sum-= 10;
		sum += 2;
		if (sum >= 10) sum -= 10;
		if ( sum != buf[12] )
		{
			alert("ÁÖ¹Î¹øÈ£°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
			document.all[controlName1].select();
			return false//-1;
		}
	}
	else
	{
		var i;
		for (i=0; i<6; i++)
		{
			chk += ( (i+2) * parseInt( PID1.charAt(i) ));
		}

		for (i=6; i<12; i++)
		{
			chk += ( (i%8+2) * parseInt( PID2.charAt(i-6) ));
		}

		chk = 11 - (chk%11);
		chk %= 10;

		if (chk != parseInt( PID2.charAt(6)))
		{
			alert("ÁÖ¹Î¹øÈ£°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
			document.all[controlName1].select();

			return false//-1;
		}
	}

	return true//0;
}

// ÁÖ¹Îµî·ÏÃ¼Å©ÀÇ ¼­ºê ÇÔ¼ö·Î »ç¿ëµË´Ï´Ù.
function IsValid(s,spc)
{
	var i;
	if (s.length<1) return false;
	for(i=0; i<s.length; i++)
	{
		if (spc.indexOf( s.substring(i, i+1)) < 0)
		{
			return false;
		}
	}

	return true;
}

// ¼ýÀÚÃ¼Å©
function MumberCheck(controlid,max)
{
	var thisValue = document.all[controlid];
	var age_value = thisValue.value;
	for (i = 0; i < age_value.length; i++)
	{
		if (!(age_value.charAt(i) >= '0' && age_value.charAt(i) <= '9')){
			alert("¼ýÀÚ¸¸ °¡´ÉÇÕ´Ï´Ù.");
			thisValue.value="";
			thisValue.focus();
			return false;
		}
	}

    if(parseFloat(age_value) > parseFloat(max)){
        alert("ÀÔ·ÂÇÏ½Å ¹øÈ£°¡ ³Ê¹« ¸¹½À´Ï´Ù.");
        thisValue.value="";
        thisValue.focus();
        return false;
    }
}

// ¶óµð¿À ¹öÆ° ¼±ÅÃ¿©ºÎ Ã¼Å©
function RadioCheck(controlid,message) {
	var thisValue = document.all[controlid];
	
	for(var i=0; i<thisValue.length; i++) {
		if(thisValue[i].checked) {
			return 	true;				
		}
	}
	alert(message);
	return false;
}

/*==================================================================================================
Ã¼Å©¹Ú½º
==================================================================================================*/
// ÀüÃ¼¼±ÅÃ
function SelAllY(var1) {

    fm = var1;

    total = (fm.elements.length);
    
    if (total == undefined)
	{
		total += 1;
	} 
		
    //alert(total);

    for( i = 0 ; i < total ; i++) {

        fm.elements[i].checked = true;

    }
}

// ¼±ÅÃÇØÁ¦
function SelAllN(var1) {

    fm = var1;
    total = (fm.elements.length);

    if (total == undefined)
	{
		total += 1;
	} 
    //alert(total);

    for( i = 0 ; i < total ; i++) {

        fm.elements[i].checked = false;

    }
}

/*==================================================================================================
Cookie Ã³¸®
==================================================================================================*/
// Cookie°¡Á®¿À±â
function GetCookie( name )
{
	
    var nameOfCookie = name + "=";
    var x = 0;
    while ( x <= document.cookie.length )
    {
            var y = (x+nameOfCookie.length);
            if ( document.cookie.substring( x, y ) == nameOfCookie ) {
                    if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
                            endOfCookie = document.cookie.length;
                    return unescape( document.cookie.substring( y, endOfCookie ) );
            }
            x = document.cookie.indexOf( " ", x ) + 1;
            if ( x == 0 )
                    break;
    }

    return "";
}

// Cookie³Ö±â
function SetCookie( name, value, expiredays )
{
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

/*==================================================================================================
±âÅ¸
==================================================================================================*/
//¸Þ´º È¿°ú(blendtrans)
function bt(id,after)
{
eval(id+'.filters.blendtrans.stop();');
eval(id+'.filters.blendtrans.apply();');
eval(id+'.src="'+after+'";');
eval(id+'.filters.blendtrans.play();');
}

// ÇØ´ç ÅØ½ºÆ® °ª¿¡¼­ È®ÀåÀÚ¸¦ ÃßÃâÇÕ´Ï´Ù.
function Global_GetFileExtension( controlObject )
{
	var contolValue = controlObject.value;

	var index = contolValue.lastIndexOf(".")

	if ( ( Global_TrimSpaces(contolValue) != "" ) && ( contolValue.length != 0 ) )
	{
		return contolValue.substring(index+1).toLowerCase();
	}
	else
	{
		return '';
	}
}

//·Î±×ÀÎ °æ°íÃ¢
//function Global_LoginAlert(){
//    alert("·Î±×ÀÎ ÈÄ ÀÌ¿ëÇÏ½Ê½Ã¿À.");
//    location.href = "http://member.mk.co.kr/member_login.php?successUrl=" + window.location;
//}

//·Î±×ÀÎ °æ°íÃ¢
function Global_LoginAlert(){
    alert("·Î±×ÀÎ ÈÄ ÀÌ¿ëÇÏ¿© ÁÖ¼¼¿ä.");
    location.href = "/Login/Login.asp?UserBackURL=" + window.location;
}

//¼ýÀÚ Ã¼Å©
function onlyNumber( el ) {
    el.value = el.value.replace( /\D/g, '' );

    //onkeyup="onlyNumber(this);"
}

// ÆË¾÷ ´Þ·Á ¶ç¿ì±â
var ObjectName;

function PopUpCalendal(objName)
{
	ObjectName = objName;
	
	objName.value = "";
	var n=window.open('/Class/CalendarPopup.asp' ,'window','width=300,height=260,status=no,menubar=no,scrollbars=no,resizable=no,left=455,top=180');
}

function setCalDate(dateTime) {

	ObjectName.value = dateTime.substring(0,4) + "-" + dateTime.substring(4, 6) + "-" + dateTime.substring(6, 8);
    ObjectName = null;
}

// °ø°£ °ª Ã¼Å©
function Global_TrimSpaces( text )
{
	var temp = "";

	text = '' + text.toUpperCase();

	splitstring = text.split(" ");

	for(i = 0; i < splitstring.length; i++)

	temp += splitstring[i];

	return temp;
}

function ViewFlashSelfTest(srno)
{
    Global_WindowCenterOpen("http://www.hidoc.co.kr//SelfTest/FlashSelfTest.aspx?srno="+srno, "FlashSelfTest", 900, 731, true, true)
}

// Ã¢À» Áß¾Ó/ÀÌº¥Æ® ¹ß»ý À§Ä¡ÇÏµµ·Ï ¿±´Ï´Ù.
function Global_WindowCenterOpen(url, name, width, height, enableScroll, isCenter)
{   
    var properties = "width="+width;
    properties += ", height="+height;
    
    if(isCenter)
    {
        properties += ", left="+Global_Width(width);
        properties += ", top="+Global_Height(height);
    }
    else
    {
        properties += ", left="+(window.event.clientX+10);
        properties += ", top="+(window.event.clientY+height);
    }
    
    if(enableScroll)
        properties += ", scrollbars=1";
    
    
    var popWindow = window.open(url,name,properties);    
}

// ÇØ´ç Ã¢ Å©±âÀÇ Á¤ Áß¾Ó ÁÂÇ¥¸¦ °¡Áö°í ¿É´Ï´Ù.
function Global_Width(popupWindowWidth)
{
    return (document.body.clientWidth/2) - (popupWindowWidth/2);
}

function Global_Height(popupWindowHeight)
{
    return (document.body.clientHeight/2) - (popupWindowHeight/2);
}

function ViewAnimation(fileName)
{
	var pop = window.open('http://www.hidoc.co.kr/animation/'+fileName,'animation','width=766,height=640');

	if(pop = null)
	{
		alert("ÆË¾÷Â÷´ÜÀ» ÇØÁöÇØ¾ß ÇÕ´Ï´Ù.");	
	}
}

// Áñ°ÜÃ£±â
function AddFav()
{
    var title = document.getElementById("strTitle").value;
    
    window.external.AddFavorite(location.href,"[MKHicare] " + title);
}

//Åä±Û
function toggle(answerNumber, total_answer) {
 var totalAnswer = total_answer;
 
 curId = "menu" + answerNumber;
 curMenu = eval("document.all." + curId + ".style")
 
 for(i=1; i<=totalAnswer; i++) {
  answerId = "menu" + i;
  if(answerId != curId)
   eval("document.all." + answerId + ".style").display = "none";
 }
 if(curMenu.display == 'none')
  curMenu.display = "block";
 else if(curMenu.display == 'block')
  curMenu.display = "none";
}

//ÀÌ¸ÞÀÏ Host º¯°æ
function EmailInputCheck(SelectValue){
    if(SelectValue == "etc")
        document.getElementById("email2").style.display = "block";
    else
        document.getElementById("email2").style.display = "none";
}

//ÇÏÀÌ´Ú ÃâÃ³ Ç¥±â
function HidocLicensePrint(){
    HidocLicenseImage = "<table><tr><td height=50></td></tr></table>";
    HidocLicenseImage += "<a href=\"http://www.hidoc.co.kr\" target=\"_blank\"><img src=\"/Images/HidocLicense.bmp\" border=\"0\"></a>";
    document.getElementById("HidocLicenseDiv").innerHTML = HidocLicenseImage;
}
/*==================================================================================================
µðÀÚÀÌ³Ê ½ºÅ©¸³Æ®
==================================================================================================*/
function changeColor(idName, color){
    idName.style.backgroundColor = color;
}

var nowtab = 1; 

function ChangeLayer(num) { 
    document.getElementById('mainnav'+nowtab).style.display = "none"; 
    document.getElementById('mainnav'+num).style.display = "block"; 
    
    for(i = 1; i <= 6; i++){
        if(i == num)
            document.getElementById("top0" + i).src = "/Images/m_on_0" + i + ".gif";
        else
            document.getElementById("top0" + i).src = "/Images/m_off_0" + i + ".gif";
    }

    nowtab = num; 
} 

/*
var m = '1';

var loc = String(document.location);
if( loc.indexOf('hguide') != -1 || loc.indexOf('money_riches') != -1 || loc.indexOf('finance_qna') != -1 || loc.indexOf('best_consulting') != -1 || loc.indexOf('book.php') != -1) m = '1';
if( loc.indexOf('v2/news') != -1 ) m='3';
if( loc.indexOf('v2/fund') != -1 || loc.indexOf('fundkang') != -1 || loc.indexOf('fundwang') != -1 ) m='4';
if( loc.indexOf('insurance') != -1 ) m='5';
if( loc.indexOf('v2/fp') != -1 ||loc.indexOf('insbbs') != -1 || loc.indexOf('fpsales') != -1 || loc.indexOf('fpintro') != -1 || loc.indexOf('weekly') != -1) m='6';
if( loc.indexOf('v2/seminar') != -1 || loc.indexOf('jtech_seminar_01') != -1 || loc.indexOf('jtech_comm_noti') != -1 || loc.indexOf('jtech_comm_free') != -1 || loc.indexOf('jtech_comm_data') != -1) m='2';

switch( m ) {
    case '1':
        ChangeLayer(1);
        break;
    case '2':
        ChangeLayer(2);
        break;
    case '3':
        ChangeLayer(3);
        break;
    case '4':
        ChangeLayer(4);
        break;
    case '5':
        ChangeLayer(5);
        break;
    case '6':
        ChangeLayer(6);
        break;
}

*/

/*==================================================================================================
´Þ·Â°ü·Ã ½ºÅ©¸³Æ®
==================================================================================================*/
var ObjectName;

// ÆË¾÷ ´Þ·Á ¶ç¿ì±â
function Global_PopUpCalendal(objName)
{
	ObjectName = objName;	
	objName.value = "";
	var n=window.open('/Class/CalendarPopup.asp' ,'window','width=300,height=300,status=no,menubar=no,scrollbars=no,resizable=no,left=455,top=180');
}

// ´Þ·Â ³¯Â¥ ¼¼ÆÃ
function setCalDate(dateTime) {

	ObjectName.value = dateTime.substring(0,4) + "-" + dateTime.substring(4, 6) + "-" + dateTime.substring(6, 8);
    ObjectName = null;
}

function Global_Replace(str, original, replacement) 
{ 
    var result; 
    result = ""; 
    while(str.indexOf(original) != -1) 
    { 
        if (str.indexOf(original) > 0) 
            result = result + str.substring(0, str.indexOf(original)) + replacement; 
        else 
            result = result + replacement; 
            str = str.substring(str.indexOf(original) + original.length, str.length); 
    } 
    return result + str; 
} 
/*==================================================================================================
´Þ·Â°ü·Ã ½ºÅ©¸³Æ®
==================================================================================================*/
//=====================================================================================================
// ¼ýÀÚ¸¸ ÀÔ·Â (S) : Global_CheckInt(string)
//=====================================================================================================
function Global_StripComma(data)
{
    var flag = 1;
    var valid = "1234567890";
    var output = '';
    if (data.charAt(0) == '-')
    {
        flag = 0;
        data = data.substring(1);
    }
    
    for (var i=0; i<data.length; i++)
    {
        if (valid.indexOf(data.charAt(i)) != -1)
            output += data.charAt(i)
    }
    
    if (flag == 1)
        return output;
    else if (flag == 0)
        return ('-' + output);
}

function Global_AddComma(what)
{
    var flag = 1;
    var data = what;
    var len = data.length;
    
    if (data.charAt(0) == '-')
    {
        flag = 0;
        data = data.substring(1);
    }
    if (data.charAt(0) == '0' && data.charAt(1) == '-')
    {
        flag = 0;
        data = data.substring(2);
    }
    
    var number = Global_StripComma(data);
    number = '' + number;
    if (flag == 0)
    {
        return ('-' + number);
    }
    else
    {
        return (number);
    }
}

function Global_Replace(str, original, replacement) 
{ 
    var result; 
    result = ""; 
    while(str.indexOf(original) != -1) 
    { 
        if (str.indexOf(original) > 0) 
            result = result + str.substring(0, str.indexOf(original)) + replacement; 
        else 
            result = result + replacement; 
            str = str.substring(str.indexOf(original) + original.length, str.length); 
    } 
    return result + str; 
} 

function Global_CheckInt(what)
{
    var data = what.value;
    
    if ((event.keyCode == 107) || (event.keyCode == 187))
    {
        if ((data == "+") || (data == "0+") || (Math.floor(replace((Global_Replace(data,"+","")),",","")) == 0))
        {
            dataval = "";
        }
        else
        {
            dataval = data
        }
    }
    else
    {
  //      if (Math.floor(data) == 0)
  //      {
  //          dataval = "";
  //      }
  //      else
  //      {
            var dataval = data;
  //      }
    }
    
    what.value = Global_AddComma(dataval);
}

function Global_CheckComma(what)
{
    var flag = 1;
    var number = what.toString(); ;

    if (number.length > 3)
    {
        var mod = number.length % 3;
        var output = (mod > 0 ? (number.substring(0,mod)) : '');
        for (i=0; i<Math.floor(number.length/3); i++)
        {
            if ((mod == 0) && (i == 0))
                output += number.substring(mod+3*i, mod+3*i+3);
            else
                output += ',' + number.substring(mod+3*i, mod+3*i+3);
        }
        if (flag == 0)
        {
            return ('-' + output);
        }
        else
        {
            return (output);
        }
    }
    else
    {
        return (number);
    }

    return (number);
}
//=====================================================================================================
// ¼ýÀÚ¸¸ ÀÔ·Â (E)
//=====================================================================================================
// ÇÁ·¹ÀÓ ¸ÞÀÎ ¸µÅ©
function Global_FrmaeMainLink(gotoURL)
{
	parent.location.href=gotoURL;
}

//=============================================================================================
// controlNameÀÇ Ã¼Å©Ç×¸ñÀÌ Á¸ÀçÇÏ¸éÀº °ªÀ» ºñ±³ ¹ÌÀÔ·Â½Ã ¸Þ¼¼Áö
//=============================================================================================
// NULLÃ¼Å©
// ÀÔ·Â °ª Ã¼Å© : Ver 1.0
function Global_ControlValueCheck(controlName, message)
{
	if ( Global_TrimSpaces(controlName.value) == '' )
	{
		alert(message);
		controlName.value = '';
		controlName.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function Global_ElementByIdCheck(controlName)
{
	if (document.getElementById(controlName) != null)
	{
		return true;
	}
	else
	{
		return false;
	}
}

// °ø°£ °ª Ã¼Å©
function Global_TrimSpaces( text )
{
	var temp = "";

	text = '' + text.toUpperCase();

	splitstring = text.split(" ");

	for(aai = 0; aai < splitstring.length; aai++)

	temp += splitstring[aai];

	return temp;
}
//=====================================================================================
// Window Open
//=====================================================================================

// Window Open (Å©±âÁöÁ¤)
function Global_OpenWindow(JWinName,JOpenedFile,JWidth,JHeight)
{
	var x = (screen.width/2) - (JWidth/2);
	var y = (screen.height/2) - (JHeight/2);
	var NewWin = window.open('', JWinName, 'toolbar=no,resizable=no,scrollbars=yes,status=0,width='+JWidth+',height='+JHeight+',left='+x+',top='+y);
	NewWin.location = JOpenedFile;
}

// Window Open
function Global_OpenWindow1(JWinName,JOpenedFile)
{
	var NewWin = window.open('', JWinName, 'toolbar=yes,resizable=yes,scrollbars=yes,status=0,width='+screen.width+',height='+screen.height+',left=0,top=0');
	NewWin.location = JOpenedFile;
}

//=====================================================================================
// ¿ìÆí¹øÈ£Ã£±â
//=====================================================================================
// ¿ìÆí¹øÈ£Ã£±â ÆË¾÷
function Global_ZipSearch()
{
	var obj = window.open('/Class/SearchZipCode.asp','zip','scrollbars=1,width=467,height=220',false);

	document.FrmBasic.txtZipCode.value = "";
	document.FrmBasic.txtAddress1.value = "";

	if(obj == null)
		alert("¸ÕÀú ÆË¾÷Ã¢ ±ÝÁö¸¦ ÇØÁ¦ ÇÏ½Ê½Ã¿À.");
}

// ¿ìÆí¹øÈ£Ã£±â µ¿ Ã¼Å©
function Global_CheckSearchZipCode()
{
	var f = document.FrmBasic;

	if(!Global_ControlValueCheck(f.txtDong,"µ¿ÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.")) return false;

	document.all["result"].innerHTML = "<img src='/BasicClass/BasicImages/searching.gif'>";
}

function Global_PreloadImage()
{ 
	var img_list = Global_PreloadImage.arguments;
	if (document.preloadlist == null) 
		document.preloadlist = new Array();
	var top = document.preloadlist.length;
	for (var i=0; i < img_list.length; i++)
	{
		document.preloadlist[top+i]     = new Image;
		document.preloadlist[top+i].src = img_list[i+1];
	} 
}

// ÁÖ¼ÒÃ¢ ÀÔ·ÂÇÏ±â
function Global_ZipSearch2(objName1,objName2,objName3)
{
	objName1.value = "";
	objName2.value = "";
	objName3.value = "";
	ObjectName1 = objName1;
	ObjectName2 = objName2;
	ObjectName3 = objName3;

	var obj = window.open('/Class/SearchZipCode2.asp','GlobalZipCode','scrollbars=1,width=467,height=220',false);

	if(obj == null)
		alert("¸ÕÀú ÆË¾÷Ã¢ ±ÝÁö¸¦ ÇØÁ¦ ÇÏ½Ê½Ã¿À.");
}

function Global_ZipCodeInsert(objName1,objName2)
{
	ObjectName1.value = objName1;
	ObjectName2.value = objName2;
	ObjectName3.focus();
    ObjectName1 = null;
    ObjectName2 = null;
    ObjectName3 = null;
}

function Global_SearchMember()
{
	var obj = window.open('/Class/SearchMember.asp','MemberSearch','scrollbars=1,width=446,height=200',false);

	if(obj == null)
		alert("¸ÕÀú ÆË¾÷Ã¢ ±ÝÁö¸¦ ÇØÁ¦ ÇÏ½Ê½Ã¿À.");
}

function Global_SearchMember1(objValue)
{
	var obj = window.open('/Class/SearchMember.asp?sTypeGubun='+objValue,'MemberSearch','scrollbars=1,width=446,height=200',false);

	if(obj == null)
		alert("¸ÕÀú ÆË¾÷Ã¢ ±ÝÁö¸¦ ÇØÁ¦ ÇÏ½Ê½Ã¿À.");
}
//=====================================================================================
// ÁÖ¹Îµî·Ï¹øÈ£Ã¼Å©
//=====================================================================================
// ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å©
function Global_CheckRegno2( RegNo1, RegNo2 )
{
	var chk = 0;
	
	for (var i = 0; i <=5 ; i++) {          
		chk = chk + ((i%8+2) * parseInt(RegNo1.value.substring(i,i+1)));        
	}
	
	for (var i = 6; i <=11 ; i++) {
		chk = chk + ((i%8+2) * parseInt(RegNo2.value.substring(i-6,i-5)));
	}	
	var chk = 11 - (chk %11)
	chk = chk % 10
		
	if (chk != RegNo2.value.substring(6,7))
	{
		alert ("À¯È¿ÇÏÁö ¾ÊÀº ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù.");
		return false;
	}
	return true;
}
//=====================================================================================
// CheckBox Ã¼Å©
//=====================================================================================
function Global_CheckboxChk(FormName, objName){
	var temp_form_info = eval("document." + FormName + "['" + objName + "']");
	var obj = temp_form_info
	choiceCount = obj.length - 1;
	checkBit = "0";

	if(!choiceCount) {
		if(obj.checked == true) {
			checkBit = "1";
		}
	} else {
		for(i = 0 ; i <= choiceCount ; i++)
		{
			if(obj[i].checked == true) {
				checkBit = "1";
			}
		}
	}
	
	if(checkBit == "0")
		return false;
	else
		return true;
}

//=====================================================================================
// ¾ÆÀÌµð Áßº¹ Ã¼Å©
//=====================================================================================
function Global_SearchMemberID(objName)
{
	ObjectName = objName;
	ObjectName.value = "";

	var obj = window.open('/Class/SearchMemberID.asp','GlobalMemberID','scrollbars=1,width=320,height=200',false);

	if(obj == null)
		alert("¸ÕÀú ÆË¾÷Ã¢ ±ÝÁö¸¦ ÇØÁ¦ ÇÏ½Ê½Ã¿À.");
}

function Global_SearchMemberIDInsert(objName)
{
	ObjectName.value = objName;
}

// ¾ÆÀÌµð Ã¼Å©
function Global_IdFormCheck(source)
{
	searchko = source.value;

	switch (searchko.toLowerCase())
	{
		case "anonymouse":
			alert("±ÝÁöµÈ ¾ÆÀÌµð¸¦ »ç¿ëÇÏ¿´½À´Ï´Ù. ´Ù¸¥ ¾ÆÀÌµð¸¦ °Ë»ö ÇØ ÁÖ½Ê½Ã¿À.");return false;
			return false;

		case "admin":
			alert("±ÝÁöµÈ ¾ÆÀÌµð¸¦ »ç¿ëÇÏ¿´½À´Ï´Ù. ´Ù¸¥ ¾ÆÀÌµð¸¦ °Ë»ö ÇØ ÁÖ½Ê½Ã¿À.");
			return false;

		case "administrator":
			alert("±ÝÁöµÈ ¾ÆÀÌµð¸¦ »ç¿ëÇÏ¿´½À´Ï´Ù. ´Ù¸¥ ¾ÆÀÌµð¸¦ °Ë»ö ÇØ ÁÖ½Ê½Ã¿À.");
			return false;

		case "siteadmin":
			alert("±ÝÁöµÈ ¾ÆÀÌµð¸¦ »ç¿ëÇÏ¿´½À´Ï´Ù. ´Ù¸¥ ¾ÆÀÌµð¸¦ °Ë»ö ÇØ ÁÖ½Ê½Ã¿À.");
			return false;

		case "boardadmin":
			alert("±ÝÁöµÈ ¾ÆÀÌµð¸¦ »ç¿ëÇÏ¿´½À´Ï´Ù. ´Ù¸¥ ¾ÆÀÌµð¸¦ °Ë»ö ÇØ ÁÖ½Ê½Ã¿À.");
			return false;
	}
		
	for (i = 0 ; i < searchko.length ; i++) 
	{
		sko = searchko.charAt(i);
		
		if ((sko < '0' || sko > '9')&&(sko < 'a' || sko > 'z')&&(sko < 'A' || sko > 'Z')) 
		{
			alert('¿µ¹®°ú ¼ýÀÚ¸¸ °¡´ÉÇÕ´Ï´Ù.');
			source.value = '';
			source.focus();
			
			return false;
		}
		else if (searchko.length < 4 || searchko.length > 10)
		{
			alert('4~10ÀÚ¸®¸¸ °¡´ÉÇÕ´Ï´Ù.');
			source.focus();
			
			return false;
		}
	}
        return true;
}

//=====================================================================================
// Select ¼±ÅÃ°ª °¡Á®¿À±â
//=====================================================================================
function Global_SelectValuePrint(objName,PrintType)
{
	if(PrintType == "text")
		return objName[objName.selectedIndex].text;
	else
		return objName[objName.selectedIndex].value;
//	alert(objName[objName.selectedIndex].text);
//	alert(objName[objName.selectedIndex].value);
}
function open_eventpopup(JOpenName,strSiteModuleSrno,strMainSrno,JWidth,JHeight,NLeft,NTop) {
    if (getCookie( JOpenName ) != 'Y' ) 
     {
		window.open('/NoticeBoard/PopupView.asp?SiteModuleSrno='+strSiteModuleSrno+'&MainSrno='+strMainSrno,JOpenName,'toolbar=no,resizable=no,scrollbars=yes,status=0,width='+JWidth+',height='+JHeight+',left='+NLeft+',top='+NTop);
	 }
}

function getCookie( name )
{
  var nameOfCookie = name + "=";
  var x = 0;
  while ( x <= document.cookie.length )
  {
    var y = (x+nameOfCookie.length);
    if ( document.cookie.substring( x, y ) == nameOfCookie )
    {
      if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
        endOfCookie = document.cookie.length;
      return unescape( document.cookie.substring( y, endOfCookie ) );
    }
    x = document.cookie.indexOf( " ", x ) + 1;
    if ( x == 0 )
    break;
  }
  return "";
}
//·Î±×ÀÎÆË¾÷
function PopupLogin()
{
    window.open("/Login/Login.asp", 'PopupLogin', 'status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=300');
}
//·Î±×¾Æ¿ôÆË¾÷
function PopupLogout()
{
    window.open("/Login/Logout.asp", 'PopupLogout', 'status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=350');
}


//=====================================================================================
// Made in Korea Start
//=====================================================================================

function AlertMsg(objectName, AlertMent){
    if(!$get(objectName).value){
        alert(AlertMent);
        $get(objectName).focus();
        return false;
    }

    return true;
}

function radio_chk(form_name, field_name){
    var ilength = eval("document." + form_name + "." + field_name + ".length");
    var i = 0;
    var ichecked ;
    var ichk_cnt = 0;
    
    for(i = 0; i < ilength; i++){
        ichecked = eval("document." + form_name + "." + field_name + "[i].checked");
        
        if (ichecked == true)
            ichk_cnt = ichk_cnt + 1;
    }
    
    if(ichk_cnt < 1){
        eval("document." + form_name + "." + field_name + "[0].focus();");

        return false;
    }else
        return true;
}

//=====================================================================================
// Made in Korea Finish
//=====================================================================================
//Contets ÆäÀÌÁö¿¡¼­..
function OpenGalleryPopup(strGubun)
{
	window.open('/MBoard/AlbumList2.asp?Gubun='+strGubun,'AlbumList2'+strGubun,'width=640,height=570,left=0,top=0,scrollbars=yes,resizable',false);
}


//=====================================================================================
// ¸®½ºÆ® ¼±ÅÃ ¹× »èÁ¦ (S)
//=====================================================================================

function SetSelectListAll()
{
    total = (document.FrmList.elements.length - 2);
    
    //alert(total);
    
    if (document.FrmList.HdnSelYN.value == "N") {
        for( i = 0 ; i < total ; i++) {
                document.FrmList.elements[i].checked = true;
                document.FrmList.hdnDeleteSrno.value = document.FrmList.hdnDeleteSrno.value + document.FrmList.elements[i].value + ",";
        }
        document.FrmList.HdnSelYN.value = "Y";
    }
    else
    {
        for( i = 0 ; i < total ; i++) {
                document.FrmList.elements[i].checked = false;
        }
        document.FrmList.HdnSelYN.value = "N";
        document.FrmList.hdnDeleteSrno.value = "";
    }
}

function SetSelectAllDelete() {
        
    total = (document.FrmList.elements.length - 3);
//    alert(total);
    document.FrmList.hdnDeleteSrno.value = "";
    
    cnt = 0;
    
    for( i = 0 ; i < total ; i++) {
        if (document.FrmList.elements[i].checked == true) {
            document.FrmList.hdnDeleteSrno.value = document.FrmList.hdnDeleteSrno.value + document.FrmList.elements[i].value + ",";
//			alert(document.FrmList.elements[i].value);
            cnt = cnt + 1;
        }
    }
    
//    alert(cnt);
    if (cnt == 0 ) {
        alert('¼±ÅÃÇÑ °Ô½Ã¹°ÀÌ ¾ø½À´Ï´Ù.');
    }
    else
    {
        if (confirm('¼±ÅÃÇÑ °Ô½Ã¹°À» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?\nÇÑ¹ø »èÁ¦ÇÏ½Ã¸é º¹±¸ÇÒ ¼ö ¾ø½À´Ï´Ù.'))
        {
            document.FrmList.submit();        
        }
    }
}

function PopUpCalendal_Small(objName)
{
	ObjectName = objName;
	
	objName.value = "";
	var n=window.open('/Class/CalendarPopup_Small.asp' ,'window','width=300,height=260,status=no,menubar=no,scrollbars=no,resizable=no,left=455,top=180');
}

//Ã·ºÎÆÄÀÏ »èÁ¦
function Global_FileDelete(SitModuleSrno,MainSrno,controlName)
{	
	//alert(filename);
	//alert(FileSrno);
	if (confirm('Á¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?'))
	{
		window.open('FileDelete.asp?SiteModuleSrno='+SitModuleSrno+'&MainSrno='+MainSrno+'&FileName='+controlName,'FileDelete','scrollbars=1,width=0,height=0');
	}
	return true;
}

function ProgramMoviePlay(ProgramName, TotalNum, Num)
{
	window.open('/Class/PopupMovie.asp?ProgramName='+ProgramName+'&TotalNum='+TotalNum+'&Num='+Num,'ProgramMoviePlay','status=no,menubar=no,scrollbars=no,resizable=no,width=687,height=485');    
}


//ÆË¾÷ Å©±â Á¶Àý
function PopupResize(p_width, p_height){
	if (p_width > 1024) p_width = 1024;
	if (p_height > 768) p_height = 768;

	self.resizeTo(p_width, p_height);
}

//=====================================================================================
// Made in Korea Start (JQuery)
//=====================================================================================
    function ReturnFieldValue(FieldName, FieldType){   // ÇÊµå¿¡ ÀÔ·ÂµÈ °ªÀ» ¹ÝÈ¯ÇÑ´Ù
        if(FieldName == null){
            alert("ÇÊµå Á¤º¸¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
        }else if(FieldType == "input" || FieldType == "textarea" || FieldType == "select"){
            return $.trim($(FieldType + "[name=" + FieldName+ "]").val());
        }else if(FieldType == "radio" || FieldType == "checkbox"){
            return $.trim($(":input:" + FieldType + "[name=" + FieldName + "]:checked").val());
        }
    }

    function FieldCheckAlert(FieldName, AlertMent, FieldType, FocusYN){ // ÇÊµå¿¡ °ªÀÌ ÀÔ·Â‰ç´ÂÁö Ã¼Å©
        var ReturnValue = false;

        if(FieldName == null){
            alert("ÇÊµå Á¤º¸¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
        }else if(!ReturnFieldValue(FieldName, FieldType)){
            alert(AlertMent);

            if(FocusYN == "Y"){
                if(FieldType == "input" || FieldType == "textarea" || FieldType == "select"){
                    $(FieldType + "[name=" + FieldName + "]").focus();
                }else if(FieldType == "radio" || FieldType == "checkbox"){
                    $(":input:" + FieldType + "[name=" + FieldName + "]").focus();
                }
            }

            ReturnValue = false;
        }else{
            ReturnValue = true;
        }

        return ReturnValue;
    }

    function ButtonValueReturn(FieldName){ // Radio,CheckboxÀÇ ¼±ÅÃµÈ °ªÀ» ¹ÝÈ¯ÇÑ´Ù
        var ReturnValue;

        $("input[name=" + FieldName + "]").each(function(){
            if(this.checked == true){
                ReturnValue = this.value;
            }
        });

        return ReturnValue
    }

    function chkPatten(field, patten){ // ÀÔ·ÂµÈ °ªµéÀÇ Çü½Ä Ã¼Å©
        var idCheck = /^[a-zA-Z]{1}[a-zA-Z0-9_-]{0,12}$/;
        var pwCheck = /^[a-zA-Z0-9_-]{4,12}$/;
        var mailCheck = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        var telCheck = /^[0-9]{8,11}$/;
        
        patten = eval(patten);

        if(!patten.test(ReturnFieldValue(field, "input"))){
            return false;
        } else {
            return true;
        }
    }
    
    function EmailCheck(FieldName){
        var EmailValue = $("input[name=" + FieldName + "1]").val() + '@' + $("input[name=" + FieldName + "2]").val();
        var mailCheck = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

        if(!mailCheck.test(EmailValue)){
            alert("¿Ã¹Ù¸¥ ÀÌ¸ÞÀÏ Çü½ÄÀÌ ¾Æ´Õ´Ï´Ù.");
            return false;
        } else {
            return true;
        }
    }

    function NumberCheck(CheckObject){ // ÀÔ·Â ÇÊµå¿¡ ¼ýÀÚ ÀÌ¿ÜÀÇ °ªÀº »èÁ¦
        CheckObject.value = CheckObject.value.replace( /\D/g, '' );

        //$(".NumberCheck").bind("keyup", function(event){ NumberCheck(this); });
    }

    function ShowHidden(Type, Name, ChangeState, Option){
        /*
            ´ë»óÀÇ Display »óÅÂ¸¦ º¯°æÇÑ´Ù.
            Type : Class, Id
            Name : class ³ª id ¸í
            ChangeState : show, hide
            Option : slow
        */        
            
        if(ChangeState != "show" && ChangeState != "hide"){
            alert(Name + " " + Type + "ÀÇ º¯°æÇÒ Display ¼Ó¼ºÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
            return;
        }

        var Oj;

        if(Type == "Class"){
            Type = ".";
        }else if(Type == "Id"){
            Type = "#";
        }
        
        Oj = "$(\"" + Type + Name + "\")";
        eval(Oj + "." + ChangeState + "(\"" + Option+ "\")");
    }

    function ZipcodeSearch(FieldName){
        window.open("/Etc/ZipcodeSearch.asp?FieldName=" + FieldName, "ZipcodeSearch", "scrollbars=yes, width=100, height=100");
    }

    function ZipcodeSearchCheck(){
        var SearchText = ReturnFieldValue("SearchText", "input");

        if(!FieldCheckAlert("SearchText", "°Ë»öÇÒ Áö¿ªÀ» ÀÔ·ÂÇÏ¼¼¿ä.", "input", "Y")){ return false; }

        $.ajax({
            type : "post",
            url : "/Etc/Ajax_ZipcodeSearch.asp",
            data : "SearchText=" + SearchText,
            error: function(html){
                alert("½ÇÇàÁß ¿¡·¯ ¹ß»ý");
            },
            success: function(html){
                if(html == "Not Found"){
                    $(".ResultFail").show();
                    $("input[name=SearchText]").attr({"value" : ""});
                }else{
                    $(".ResultSuccess").show();
                    $("#ZipcodeList").html(html);
                }
            }
        });

        return false;
    }

    function AddressSend(SeqNum){
        ZipCode = $("#Zipcode" + SeqNum).text().split("-");
        
        ReturnValue = Array();

        ReturnValue[0] = ZipCode[0];
        ReturnValue[1] = ZipCode[1];
        ReturnValue[2] = $("#Address" + SeqNum).text();

        var FieldName = ReturnFieldValue("FieldName", "input");

        for(var i = 1; i <= 3; i++){
            opener.$("input[name=" + FieldName + i + "]").attr({"value" : ReturnValue[i - 1]});
        }

        opener.$("input[name=" + FieldName + "4]").focus();
        self.close();
    }
    
    function JuminOverlapCheckPopup(Gubun){
        $("input[name=JuminOverlapCheckState]").attr({"value" : "" });
        
        if(!JuminCheck("Jumin")){ return; }

        window.open("/Etc/JuminOverlapCheckPopup.asp?Gubun=" + Gubun, "JuminOverlapCheckPopup", "scrollbars=yes, width=100, height=100");
    }

    function JuminOverlapCheck(Gubun){
        $("#ResultFail").hide();
        $("#ResultSuccess").hide();

        if(!FieldCheckAlert("Jumin1", "ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.", "input", "Y")){ return false; }
        if(!FieldCheckAlert("Jumin2", "ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.", "input", "Y")){ return false; }
        if(!JuminCheck("Jumin")){ return false; }

        var Jumin1 = ReturnFieldValue("Jumin1", "input");
        var Jumin2 = ReturnFieldValue("Jumin2", "input");
        
        $.ajax({
            type : "post",
            url : "/Etc/Ajax_JuminOverlapCheck.asp",
            data : "Gubun=" + Gubun + "&Jumin1=" + Jumin1 + "&Jumin2=" + Jumin2,
            error: function(html){
                alert("½ÇÇàÁß ¿¡·¯ ¹ß»ý");
            },
            success: function(html){
                if(html == "Not Found"){
                    $("#ResultSuccess").show();
                    
                    if(Gubun == "Donator"){
                        DonateApplicantInfomaintLoad();
                    }
                }else{
                    $("#ResultFail").show();
                }
            }
        });

        return false;
    }

    function JuminOverlapCheck2(Gubun){
        var OverlapCheck = "Y";

        if(!FieldCheckAlert("Jumin1", "ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.", "input", "Y")){ return false; }
        if(!FieldCheckAlert("Jumin2", "ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.", "input", "Y")){ return false; }
        if(!JuminCheck("Jumin")){ return false; }

        var Jumin1 = ReturnFieldValue("Jumin1", "input");
        var Jumin2 = ReturnFieldValue("Jumin2", "input");
        var OldJumin1 = ReturnFieldValue("OldJumin1", "input");
        var OldJumin2 = ReturnFieldValue("OldJumin2", "input");
        
        if((OldJumin1 != "" && OldJumin2 != "") && (OldJumin1 == Jumin1 && OldJumin2 == Jumin2)){
            OverlapCheck = "N";
        }

        if(OverlapCheck == "Y"){
            $.ajax({
                type : "post",
                url : "/Etc/Ajax_JuminOverlapCheck.asp",
                data : "Gubun=" + Gubun + "&Jumin1=" + Jumin1 + "&Jumin2=" + Jumin2,
                error: function(html){
                    alert("½ÇÇàÁß ¿¡·¯ ¹ß»ý");
                },
                success: function(html){
                    if(html == "Not Found"){
                        $("input[name=JuminOverlapCheckState]").attr({value: "Y"});
                        JuminSend3(Gubun);
                    }else{
                        $("input[name=JuminOverlapCheckState]").attr({value: "N"});
                        alert("ÀÌ¹Ì µî·ÏÀÌ µÇ¾î ÀÖ´Â ÁÖ¹Î¹øÈ£ÀÔ´Ï´Ù.");
                    }
                }
            });
        }
    }

    function JuminSend(Gubun){
        var Jumin1 = ReturnFieldValue("Jumin1", "input");
        var Jumin2 = ReturnFieldValue("Jumin2", "input");
        
        opener.$("input[name=Jumin1]").attr({"value" : Jumin1 });
        opener.$("input[name=Jumin2]").attr({"value" : Jumin2 });
        opener.$("input[name=JuminOverlapCheckState]").attr({"value" : "Y" });

        if(Gubun == "DonateApplicant"){
            opener.RepresentativeDisplay();
        }else if(Gubun == "Donator"){
            var BirthCheck = Jumin2.substr(0, 1);

            if(BirthCheck == 1 || BirthCheck == 2){
                Jumin1 = 19 + Jumin1;
            }else{
                Jumin1 = 20+ Jumin1;
            }

             opener.$("select[name=BirthYear]").attr({value: Jumin1.substr(0, 4)});
             opener.$("select[name=BirthMonth]").attr({value: Jumin1.substr(4, 2)});
             opener.$("select[name=BirthDay]").attr({value: Jumin1.substr(6, 2)});
        }

        self.close();
    }

    function JuminSend2(){
        var Jumin1 = ReturnFieldValue("Jumin1", "input");
        var Jumin2 = ReturnFieldValue("Jumin2", "input");
        
        opener.$("input[name=Jumin1]").attr({"value" : Jumin1 });
        opener.$("input[name=Jumin2]").attr({"value" : Jumin2 });
        opener.$("input[name=JuminOverlapCheckState]").attr({"value" : "Y" });

        DonateApplicantInfoSendning()

        var BirthCheck = Jumin2.substr(0, 1);

        if(BirthCheck == 1 || BirthCheck == 2){
            Jumin1 = 19 + Jumin1;
        }else{
            Jumin1 = 20+ Jumin1;
        }

         opener.$("select[name=BirthYear]").attr({value: Jumin1.substr(0, 4)});
         opener.$("select[name=BirthMonth]").attr({value: Jumin1.substr(4, 2)});
         opener.$("select[name=BirthDay]").attr({value: Jumin1.substr(6, 2)});

        self.close();
    }

    function JuminSend3(Gubun){
        var Jumin1 = ReturnFieldValue("Jumin1", "input");
        var Jumin2 = ReturnFieldValue("Jumin2", "input");
        
        $("input[name=Jumin1]").attr({"value" : Jumin1 });
        $("input[name=Jumin2]").attr({"value" : Jumin2 });
        $("input[name=JuminOverlapCheckState]").attr({"value" : "Y" });

        if(Gubun == "DonateApplicant"){
            RepresentativeDisplay();
        }else if(Gubun == "Donator"){
            var BirthCheck = Jumin2.substr(0, 1);

            if(BirthCheck == 1 || BirthCheck == 2){
                Jumin1 = 19 + Jumin1;
            }else{
                Jumin1 = 20+ Jumin1;
            }

             $("select[name=BirthYear]").attr({value: Jumin1.substr(0, 4)});
             $("select[name=BirthMonth]").attr({value: Jumin1.substr(4, 2)});
             $("select[name=BirthDay]").attr({value: Jumin1.substr(6, 2)});
        }
    }

    function DonateApplicantInfoSendning(){
        var Name = ReturnFieldValue("Name", "input");
            
        if(Name != ""){
            var OldJumin1 = opener.ReturnFieldValue("OldJumin1", "input");
            var OldJumin2 = opener.ReturnFieldValue("OldJumin2", "input");
            var DonateApplicantInfoSendingYN = "N";

            if(OldJumin1 == "" && OldJumin2 == ""){
                DonateApplicantInfoSendingYN = "Y";
            }else if((OldJumin1 != "" && OldJumin2 != "") && (OldJumin1 != Jumin1 && OldJumin2 != Jumin2)){
                DonateApplicantInfoSendingYN = "Y";
            }
        }

        if(DonateApplicantInfoSendingYN == "Y"){
            opener.$("input[name=Name]").attr({value: ReturnFieldValue("Name", "input")});
            opener.$("select[name=Tel1]").attr({value: ReturnFieldValue("Tel1", "input")});
            opener.$("input[name=Tel2]").attr({value: ReturnFieldValue("Tel2", "input")});
            opener.$("input[name=Tel3]").attr({value: ReturnFieldValue("Tel3", "input")});
            opener.$("select[name=Hp1]").attr({value: ReturnFieldValue("Hp1", "input")});
            opener.$("input[name=Hp2]").attr({value: ReturnFieldValue("Hp2", "input")});
            opener.$("input[name=Hp3]").attr({value: ReturnFieldValue("Hp3", "input")});
            opener.$("input[name=Zipcode1]").attr({value: ReturnFieldValue("Zipcode1", "input")});
            opener.$("input[name=Zipcode2]").attr({value: ReturnFieldValue("Zipcode2", "input")});
            opener.$("input[name=Zipcode3]").attr({value: ReturnFieldValue("Address", "input")});
            opener.$("input[name=Zipcode4]").attr({value: ReturnFieldValue("DetailAddress", "input")});
        }
    }

    function AllCheck(FormName, FieldName){ // Checkbox ÀüÃ¼ ¼±ÅÃ, ¼±ÅÃ »óÅÂ°ªÀº AllCheck ÇÊµå¿¡ ÀúÀå
        var AllCheckState, CheckState, CheckStateValue;

        AllCheckState = ReturnFieldValue("AllCheck", "input");

        if(AllCheckState == ""){
            CheckState = true;
            CheckStateValue = "Y";
        }else{
            CheckState = false;
            CheckStateValue = "";
        }

         $(":form:" + FormName + ":input[name=AllCheck]").attr({ value : CheckStateValue});

        $(":form:" + FormName + ":input[name=" + FieldName + "]").each(
            function(){
                this.checked = CheckState;
            }
        );
    }

	function setComma(str){
		str = "" + str + "";
		var retValue = "";
		
		for(i = 0; i < str.length; i++)
			if(i > 0 && (i % 3) == 0)
				retValue = str.charAt(str.length - i -1) + "," + retValue;
			else
				retValue = str.charAt(str.length - i -1) + retValue;
		
		return retValue;
	}

    function CheckValueReset(FieldName){
        $("input[name=" + FieldName + "]").attr({checked : false });
    }

    function JuminCheck(FieldName){
        var Number = $("input[name=" + FieldName + "1]").val() + $("input[name=" + FieldName + "2]").val();
		var Sum=0;
		var Chk=0;
	
		for	(i=0;i<12;i++)	{
			if(i<8)
				Sum+=parseInt(Number.charAt(i))*(i+2);

			if(i>7)
				Sum+=parseInt(Number.charAt(i))*(i-6);
		}
		
		Chk = (Sum%11) + parseInt(Number.charAt(12));

        if(!(Chk == 1 || Chk == 11))	{
            alert("¿Ã¹Ù¸¥ ÁÖ¹Îµî·Ï¹øÈ£°¡ ¾Æ´Õ´Ï´Ù.");
			return false;
		}else{
            return true;
        }
    }

    function JuminCheck2(Number){
		var Sum=0;
		var Chk=0;
	
		for	(i=0;i<12;i++)	{
			if(i<8)
				Sum+=parseInt(Number.charAt(i))*(i+2);

			if(i>7)
				Sum+=parseInt(Number.charAt(i))*(i-6);
		}
		
		Chk = (Sum%11) + parseInt(Number.charAt(12));

        if(!(Chk == 1 || Chk == 11))	{
            alert("¿Ã¹Ù¸¥ ÁÖ¹Îµî·Ï¹øÈ£°¡ ¾Æ´Õ´Ï´Ù.");
			return false;
		}else{
            return true;
        }
    }

    function EmailInputFieldDisplay(FieldName){ // ÀÌ¸ÞÀÏ µµ¸ÞÀÎ ¼±ÅÃ
        var Value = $("select[name=EmailDomain" + FieldName + "]").val();

        if(Value == "W"){
            $("input[name=txtEmail" + FieldName + "2]").css({width: "35%"});
        }else{
            $("input[name=txtEmail" + FieldName + "2]").css({width: 0});
            $("input[name=txtEmail" + FieldName + "2]").attr({value: Value});
        }
    }
//=====================================================================================
// Made in Korea Finish (JQuery)
//=====================================================================================

document.writeln("<sc" + "ript ty" + "pe='te" + "xt/jav" + "ascr" + "ipt' src='/BasicJs/jquery.js'></sc" + "ript>");

function ImagePopup(FileName, Width, Height){
    window.open("/BasicClass/ImagePopup.asp?FileName=" + FileName + "&Width=" + Width + "&Height=" + Height, "ImagePopup", "scrollbars=yes, width=100, height=100")
}

function Global_Request(valuename)    //javascript·Î ±¸ÇöÇÑ Request
{
    var rtnval = "";
    var nowAddress = unescape(location.href);
    var parameters = (nowAddress.slice(nowAddress.indexOf("?")+1,nowAddress.length)).split("&");

 	for(var i = 0 ; i < parameters.length ; i++)
 	{
        var varName = parameters[i].split("=")[0];
        if(varName.toUpperCase() == valuename.toUpperCase())
        {
            rtnval = parameters[i].split("=")[1];
            break;
        }
    }
    return rtnval;
}
