// ============================================================================0
// Mecromedia Dreamwaver
// ============================================================================0
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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
// ============================================================================0
// ============================ Form °ü·Ã ÇÔ¼ö ================================0

function checkValue(f)
{
    var j = f.elements.length
    var i;
    var re;
    var args;
    var result;


    for (i=0; i<j; i++) {
        if (typeof(f.elements[i].TAG) == "undefined" && typeof(f.elements[i].tag) == "undefined" ) continue;
	        if (typeof(f.elements[i].TAG) == "undefined") { args = f.elements[i].tag.split("||"); }
	        else { args = f.elements[i].TAG.split("||");}
	        
		        if (((args[0]=='M') || (args[0]=='C')) && f.elements[i].value.length == 0 && args.length == 4) { // 4¹øÂ° °ªÀ» Ãâ·Â
					result = false;
			//alert(f.elements[i].name);			//-----------
					f.elements[i].focus();
					alert(args[3]);
					return false;
		        } else if (args[0]=='C') {														// Ä¿½ºÅÍ¸Ó ÀÎ°æ¿ì
		            result = eval(args[1]+"(f.elements[i], f.elements[i].value);");
		        } else if ((args[0]=='M') || ((args[0]=='O') && (f.elements[i].value.length > 0))) { // ÇÊ¼ö ¶Ç´Â ¿É¼Ç
		            re = new RegExp(args[1], "gi");
		            result = re.test(f.elements[i].value);
		        }
	
		        if (result == false) {
		        //    f.elements[i].focus();
		       
		        alert( f.elements[i].name);
		            alert(args[2]);
		            return false;
		        }
	    }
	        
	      try{
			   		if (f.idchk.ckecked == true) {
						alert("chkeck");
        			setCookie( "save_joins_id",document.frm_login.txtId.value, 15); 
        			}
			  }catch(e){}
			

      
       
    return true;
}


/* ÁÖ¹Îµî·Ï ¹øÈ£ Ã¼Å© ÇÔ¼ö (true, false) */
function ValidateJumin(val1, val2) {
    var chk=0;
    var jumin = val1 + '-' + val2;
    for (var i = 0; i <=5 ; i++) { chk = chk + ((i%8+2) * parseInt(jumin.substring(i,i+1))) }
    for (var i = 6; i <=11 ; i++) { chk = chk + ((i%8+2) * parseInt(jumin.substring(i+1,i+2))) }
    chk = 11 - (chk %11);
    chk = chk % 10;

    if ( chk != jumin.substring(13,14) ) {
        return false;
    } else {
        return true;
    }
}

/* E-Mail ÁÖ¼Ò Ã¼Å© ÇÔ¼ö (true, false)*/
function ValidateEmail(email) {
    if(! email) return false;
    emailEx1 = /[^@]+@[A-Za-z0-9_\-]+\.[A-Za-z]+/;
    emailEx2 = /[^@]+@[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z]+/;
    emailEx3 = /[^@]+@[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z]+/;
    emailEx4 = /[^@]+@[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z]+/;
    if(emailEx1.test(email)) return true;
    if(emailEx2.test(email)) return true;
    if(emailEx3.test(email)) return true;
    if(emailEx4.test(email)) return true;
    return false;
} 

//============================================================================0
// ============================ Form °ü·Ã ÇÔ¼ö ===============================0
function open_win(size, url, option, win_name) {
    var sizes, w, h, t, l, opt;

    if (! url) return;                                                          // Url ÀÌ ¾øÀ¸¸é ³¡
    size = size.toString();                                                     // ¹®ÀÚ¿­·Î ¹øÈ¯
	size = size.toLowerCase();
    sizes = size.split("x");                                                    // ¹®ÀÚ¿­À» "x"·Î ±¸¹ÝÇÏ¿© ¹è¿­·Î µÇµ¹·Á ÁØ´Ù.
    if (sizes.length > 1) {                                                     // ¹è¿­ÀÇ ±æÀÌ°¡ 1ÀÌ»óÀÏ°æ¿ì
        w = sizes[0];                                                               
        h = sizes[1];
    } else {
        switch(parseInt(sizes[0])) {                                            // Á¤¼öÇüÀ¸·Î º¯È¯
            case 640:   w=640;h=480; break;
            case 800:   w=800;h=600;  break;
            case 1024:  w=1024;h=768;  break;
            default :   w=sizes[0];h=480; break;                                // Å©±â Á¤ÀÇ
        }
    }
    t = (screen.height-h)/2;                                                    // È­º¯ÀÇ Å©±â¿¡´Ù°¡ À©µµ¿ì Å©±â¸¦ »«°ª¿¡ /2
    l = (screen.width-w)/2;

    if (! option) {                                                             // Option ÀÌ ¾øÀ¸¸é ±âº» °ªÀ¸·Î
        opt = "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,top="+t+",left="+l+",width="+w+",height="+h;
    } else if (option =="scroll=no") {
		opt = "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,top="+t+",left="+l+",width="+w+",height="+h;    
	} else {
        opt = "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,top="+t+",left="+l+",width="+w+",height="+h;
        opt += "," + option;
    }

	if (!win_name) {
		win_name = "openw";
	}

    //openw = window.open("about:mozilla", win_name, opt);                          // openw ¶ó´Â °´Ã¼·Î ºóÆäÀÌÁö ¿ÀÇÂ
	openw = window.open("/public/dummy.asp", win_name, opt);                          // openw ¶ó´Â °´Ã¼·Î ºóÆäÀÌÁö ¿ÀÇÂ
	//if (url.length > 0 && url != "about:blank") {
	if (url.length > 0) {
	    openw.location.href = url;                                              // openw À©µµ¿ìÀÇ À§Ä¡¸¦ ÀÌµ¿
	}

    openw.focus();                                                              // À©µµ¿ì Focus();

	if (arguments.length > 3) {													// 3¹ø Â° ÆÄ¶ó¸ÞÅ¸°¡ ÀÖ´Â°æ¿ì
		return openw;
	}
}

function study_win(size, url, option) {
    var sizes, w, h, t, l, opt;

    if (! url) return;                                                          // Url ÀÌ ¾øÀ¸¸é ³¡
    size = size.toString();                                                     // ¹®ÀÚ¿­·Î ¹øÈ¯
	size = size.toLowerCase();
    sizes = size.split("x");                                                    // ¹®ÀÚ¿­À» "x"·Î ±¸¹ÝÇÏ¿© ¹è¿­·Î µÇµ¹·Á ÁØ´Ù.
    if (sizes.length > 1) {                                                     // ¹è¿­ÀÇ ±æÀÌ°¡ 1ÀÌ»óÀÏ°æ¿ì
        w = sizes[0];                                                               
        h = sizes[1];
    } else {
        switch(parseInt(sizes[0])) {                                            // Á¤¼öÇüÀ¸·Î º¯È¯
            case 640:   w=640;h=480; break;
            case 800:   w=800;h=600;  break;
            case 1024:  w=1024;h=768;  break;
            default :   w=sizes[0];h=480; break;                                // Å©±â Á¤ÀÇ
        }
    }
    t = (screen.height-h)/2;                                                    // È­º¯ÀÇ Å©±â¿¡´Ù°¡ À©µµ¿ì Å©±â¸¦ »«°ª¿¡ /2
    l = (screen.width-w)/2;
    if (! option) {                                                             // Option ÀÌ ¾øÀ¸¸é ±âº» °ªÀ¸·Î
        opt = "resizable=no,scrollbars=no,top="+t+",left="+l+",width="+w+",height="+h;
    } else {
        opt = "resizable=no,scrollbars=no,top="+t+",left="+l+",width="+w+",height="+h;
        opt += "," + option;
    }
    //openw = window.open("about:mozilla", 'study', opt);                          // openw ¶ó´Â °´Ã¼·Î ºóÆäÀÌÁö ¿ÀÇÂ
	openw = window.open("/public/dummy.asp", 'study', opt);                          // openw ¶ó´Â °´Ã¼·Î ºóÆäÀÌÁö ¿ÀÇÂ
    openw.location.href = url;                                                  // openw À©µµ¿ìÀÇ À§Ä¡¸¦ ÀÌµ¿
    openw.focus();                                                              // À©µµ¿ì Focus();
}

function study2_win(size, url, option) {
    var sizes, w, h, t, l, opt;
    var study2_win;

    if (! url) return;                                                          // Url ÀÌ ¾øÀ¸¸é ³¡
    size = size.toString();                                                     // ¹®ÀÚ¿­·Î ¹øÈ¯
    sizes = size.split("x");                                                    // ¹®ÀÚ¿­À» "x"·Î ±¸¹ÝÇÏ¿© ¹è¿­·Î µÇµ¹·Á ÁØ´Ù.
    if (sizes.length > 1) {                                                     // ¹è¿­ÀÇ ±æÀÌ°¡ 1ÀÌ»óÀÏ°æ¿ì
        w = sizes[0];                                                               
        h = sizes[1];
    } else {
        switch(parseInt(sizes[0])) {                                            // Á¤¼öÇüÀ¸·Î º¯È¯
            case 640:   w=640;h=480; break;
            case 800:   w=800;h=600;  break;
            case 1024:  w=1024;h=768;  break;
            default :   w=sizes[0];h=480; break;                                // Å©±â Á¤ÀÇ
        }
    }
    t = (screen.height-h)/2;                                                    // È­º¯ÀÇ Å©±â¿¡´Ù°¡ À©µµ¿ì Å©±â¸¦ »«°ª¿¡ /2
    l = (screen.width-w)/2;
    if (! option) {                                                             // Option ÀÌ ¾øÀ¸¸é ±âº» °ªÀ¸·Î
        opt = "resizable=no,scrollbars=no,top="+t+",left="+l+",width="+w+",height="+h;
    } else {
        opt = "resizable=no,scrollbars=no,top="+t+",left="+l+",width="+w+",height="+h;
        opt += "," + option;
    }
    //study2_win = window.open("about:mozilla", 'study2_win', opt);                          // openw ¶ó´Â °´Ã¼·Î ºóÆäÀÌÁö ¿ÀÇÂ
	study2_win = window.open("/public/dummy.asp", 'study2_win', opt);                          // openw ¶ó´Â °´Ã¼·Î ºóÆäÀÌÁö ¿ÀÇÂ
    study2_win.location.href = url;                                             // openw À©µµ¿ìÀÇ À§Ä¡¸¦ ÀÌµ¿
    study2_win.focus();                                                         // À©µµ¿ì Focus();
}

// ===========================================================================0
// ============================ Cookie °ü·Ã ÇÔ¼ö =============================0
function delCookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" + escape (value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function setCookie (name,value,expires,path,domain,secure) {
    document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function getCookieVal (offset) {
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1)  endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}

function getCookie (name) {
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
        return getCookieVal (j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break;
    }
    return null;
}

// ============================ Cookie °ü·Ã ÇÔ¼ö =============================0
function page_reload() {
    setTimeout("window.reload();", 500);
    return true;
}

function window_name_setting(name) {
    if (name.length > 0)
    {
        window.name = name;
    }
}

function get_window_name() {
    var name = null;

    if (window.name.length > 0)
    {
        name = window.name;
    }
    return name;
}
//============================================================================0
function login_check() {
	var  loginstatus = getCookie('Joins_LoginStatus'); 			
	if (loginstatus == null) {
		window.location.href= "/study/member/login.asp?rurl=" + location.href.replace('&','|');
		return false;
	}
		return true;
}

function open_add_check3() {
	var post1=frm_membercheck.Post1.value;
	var post2=frm_membercheck.Post2.value;
	var win_post3
	win_post3 = window.open("/intoone/addressCheck.asp?post1="+post1+"&post2="+post2,"win_post3","width=363,height=350,toolbar=no,scrollbars=yes" );
	win_post3.focus();
}

function return_pay() {
		var f = document.frmCancel;
		var pay = ""; 
		for(i=0;i<f.paytype.length;i++)
		{
		if(f.paytype[i].checked) {pay = f.paytype[i].value;} 
		}
		
		if (pay == "online" || pay == "bank")
		{
			if (!f.bank_owner.value)
			{
				alert("¿¹±ÝÁÖ¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
				f.bank_owner.focus();
				return;
			}
			if (!f.bank_name.value)
			{
				alert("ÀºÇà¸íÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä.");
				f.bank_name.focus();
				return;
			}
			if (!f.bank_code.value)
			{
				alert("°èÁÂ¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
				f.bank_code.focus();
				return;
			}
		}
		f.submit();
}