//=============================================================
// member.agreement.asp
function go_next(val) {
	var form = document.form;
	var select_val = getRadioValue(form.radio);
	if(select_val == "N") {
		alert("약관에 동의하셔야 합니다.");
		return;
	}		

	form.target = "_self";
	form.action = "/member/me.realname.asp";
	form.submit();
}

// radio object의 값을 return
function getRadioValue(radioObject){
	var ret = null;
	for (var i=0; i<radioObject.length; i++) 
	{
		if (radioObject[i].checked) 
		{
			ret = radioObject[i].value;
			break;
		}
	}
	return ret;
}

//=============================================================
// member.idCheck.asp

function again() {
	if(check_memberID(frm.member_id)) {
		frm.target = "checkid";
		frm.action = "/member/me.idCheck.asp";
		frm.submit();
	}
	return;
}

//----------------------------------------
//회원아이디 - 유효문자체크 : 키업
//----------------------------------------
function check_memberID_keyup(obj) {
	if(!isAlphaNumCheck(obj.value)) {
		alert("영문과 숫자로만 입력하세요.");
		obj.value="";
		obj.focus();
	}
}

// check alphabet and number
function isAlphaNumCheck(value)
{
	if (value.match(/^[a-zA-Z0-9]*$/g))
		return true;
	else
		return false;
}

//----------------------------------------
//회원아이디 - 유효성체크
//----------------------------------------
function check_memberID(obj) {
	var valueStr = obj.value.trim();
	if (valueStr.length < 4)	{
		alert("회원아이디 길이는 4 이상 입니다.");
		obj.value="";
		obj.focus();
		return;
	}

	obj.value = wordchkuserid(valueStr);
	if (valueStr!=obj.value) return;

	if (!checkNull(obj, "유저 아이디를 입력하세요", true)) return;
	if (!checkAlphaNum(obj, "영문자 숫자만 입력하세요", true)) 
	{
		obj.value = "";
		obj.focus();
		return;
	}
	return true;
}

// string String::trim();
String.prototype.trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, ""); 
}
String.prototype.ltrim = function() {
	return this.replace(/(^ *)/g, "");
}
String.prototype.rtrim = function() {
	return this.replace(/( *$)/g, "");
}

function checkNull(oField, strMsg, blnFocus)
{
	var isNotNull = false;
	
	switch (_getField(oField).type)
	{
		case "text" :
		case "password" :
		case "file" :
			isNotNull = _hasValue(oField);
			break;
		case "textarea" :
			isNotNull = _hasEditerValue(oField);
			break;
		case "checkbox" :
		case "radio" :		
			isNotNull = _isChecked(oField);
			break;		
		case "select-one" :
		case "select-multiple" :
			isNotNull = _isNotSelected(oField);
			break;
	}

	if (!isNotNull)
	{
		_alertMessage(strMsg);
		_focusField(oField, blnFocus);
	}
	
	return isNotNull;
}

// Common
function _getField(oField)
{
	if (typeof(oField.type) == 'undefined' && typeof(oField.length) != 'undefined')
		return oField[0];
	else
		return oField;
}

// FORM FIELD CHECK 1. NULL CHECK
function _hasValue(oField)
{
	if (oField.value.replace(/(^\s*)|(\s*$)/g, "") == "")
		return false;
	else
		return true;
}

function _hasEditerValue(oField)
{
	if (oField.value.replace(/&nbsp;/g, " ").replace(/(^\s*)|(\s*$)/g, "") == "")
		return false;
	else
		return true;
}

function _isChecked(oField)
{	
	var checked = false;

	if (typeof(oField.length) != 'undefined')
	{
		for (var i=0; i<oField.length; i++)
		{
			if (oField[i].checked)
				return true;
		}
	}
	else
	{
		return oField.checked;
	}
}

function _isNotSelected(oField)
{
	if (oField.selectedIndex == -1)
	{
		return false;
	}
	else
	{
		if (oField.value == -1)
			return false;
		else
			return true;
	}
}

function _alertMessage(strMsg)
{
	if (typeof(strMsg) != 'undefined' && strMsg != "")
		alert(strMsg);
}

function _focusField(oField, blnFocus)
{
	if (typeof(blnFocus) != 'undefined' && blnFocus != null && blnFocus == true)
		_getField(oField).focus();
}

function checkAlphaNum(oField, strMsg, blnFocus) // for text and textbox
{
	var isAlphaNum = false;

	switch (_getField(oField).type)
	{
		case "text" :
		case "textarea" :
			isAlphaNum = _isLowAlphaNumCheck(oField.value);
			break;
	}
	
	if (!isAlphaNum)
	{
		_alertMessage(strMsg);
		_focusField(oField, blnFocus);
	}
	
	return isAlphaNum;
}

// FORM FIELD CHECK 5. ALPHA NUMERIC CHARACTER CHECK (if value has alphabet and number true)
function _isLowAlphaNumCheck(value)
{
	if (value.match(/^[A-z0-9_]*$/g))
		return true;
	else
		return false;
}



function wordchkuserid(msg) {
	arrList = new Array();
/*
	arrList[arrList.length]  = "warez";
	arrList[arrList.length]  = "porno";
	arrList[arrList.length]  = "sex";
	arrList[arrList.length]  = "fuck";
	*/
	arrList[arrList.length]  = "009sex";
	arrList[arrList.length]  = "100boG";
	arrList[arrList.length]  = "100bozy";
	arrList[arrList.length]  = "10sextv";
	arrList[arrList.length]  = "18sex";
	arrList[arrList.length]  = "18sexTV";
	arrList[arrList.length]  = "18x";
	arrList[arrList.length]  = "33sexymall";
	arrList[arrList.length]  = "3sextv";
	arrList[arrList.length]  = "4SEX";
	arrList[arrList.length]  = "4kkasi";
	arrList[arrList.length]  = "588";
	arrList[arrList.length]  = "588show";
	arrList[arrList.length]  = "5sexshop";
	arrList[arrList.length]  = "69Time";
	arrList[arrList.length]  = "69sex";
	arrList[arrList.length]  = "69timepornsex";
	arrList[arrList.length]  = "ADULTMANA";
	arrList[arrList.length]  = "AVmolca";
	arrList[arrList.length]  = "AdultSearch";
	arrList[arrList.length]  = "AdultSexshop";
	arrList[arrList.length]  = "Adulthumor";
	arrList[arrList.length]  = "Adultzone";
	arrList[arrList.length]  = "Bojyty";
	arrList[arrList.length]  = "Bozicam";
	arrList[arrList.length]  = "GO588TV";
	arrList[arrList.length]  = "HOTWEB";
	arrList[arrList.length]  = "HOTZONE";
	arrList[arrList.length]  = "HardcorePorno";
	arrList[arrList.length]  = "IJSEX";
	arrList[arrList.length]  = "KRTV";
	arrList[arrList.length]  = "MANABOZI";
	arrList[arrList.length]  = "MolcaPornoTV";
	arrList[arrList.length]  = "MolcaTV";
	arrList[arrList.length]  = "Molcanara";
	arrList[arrList.length]  = "Molcaparty";
	arrList[arrList.length]  = "Mulyosex";
	arrList[arrList.length]  = "NEVER-SEX";
	arrList[arrList.length]  = "PleyboG";
	arrList[arrList.length]  = "Pleyboy";
	arrList[arrList.length]  = "SEXBBS";
	arrList[arrList.length]  = "SEXEROS";
	arrList[arrList.length]  = "SEXJAPAN";
	arrList[arrList.length]  = "SEXMOLCA";
	arrList[arrList.length]  = "SEXPDS";
	arrList[arrList.length]  = "SEXWAREZ";
	arrList[arrList.length]  = "SEXYMAP";
	arrList[arrList.length]  = "SEXYX";
	arrList[arrList.length]  = "SOSSEX";
	arrList[arrList.length]  = "SexGoods";
	arrList[arrList.length]  = "SexPorno";
	arrList[arrList.length]  = "Sexpia";
	arrList[arrList.length]  = "Sexwal";
	arrList[arrList.length]  = "Sexyadong";
	arrList[arrList.length]  = "YASATV";
	arrList[arrList.length]  = "Yahanbozi";
	arrList[arrList.length]  = "adult";
	arrList[arrList.length]  = "adultlife";
	arrList[arrList.length]  = "adultvideo";
	arrList[arrList.length]  = "adultzon";
	arrList[arrList.length]  = "awoodong";
	arrList[arrList.length]  = "backbojytv";
	arrList[arrList.length]  = "bbagury";
	arrList[arrList.length]  = "bestbozi";
	arrList[arrList.length]  = "binya";
	arrList[arrList.length]  = "byuntaesex";
	arrList[arrList.length]  = "carporno";
	arrList[arrList.length]  = "carsex";
	arrList[arrList.length]  = "clubero";
	arrList[arrList.length]  = "condom";
	arrList[arrList.length]  = "cosex";
	arrList[arrList.length]  = "damoimsex";
	arrList[arrList.length]  = "enterchannel";
	arrList[arrList.length]  = "ero2030";
	arrList[arrList.length]  = "ero69";
	arrList[arrList.length]  = "eroasia";
	arrList[arrList.length]  = "erocine";
	arrList[arrList.length]  = "erosasia";
	arrList[arrList.length]  = "erosian";
	arrList[arrList.length]  = "erostyle";
	arrList[arrList.length]  = "fetish";
	arrList[arrList.length]  = "fetish7";
	arrList[arrList.length]  = "fetishwoman";
	arrList[arrList.length]  = "gabozi";
	arrList[arrList.length]  = "gagasexy";
	arrList[arrList.length]  = "goadult";
	arrList[arrList.length]  = "gocinepia";
	arrList[arrList.length]  = "gojasex";
	arrList[arrList.length]  = "hotbojy";
	arrList[arrList.length]  = "hotsex";
	arrList[arrList.length]  = "hotsexkorea";
	arrList[arrList.length]  = "ilovesex";
	arrList[arrList.length]  = "joungyang";
	arrList[arrList.length]  = "jungyang";
	arrList[arrList.length]  = "kgirlmolca";
	arrList[arrList.length]  = "kingsex";
	arrList[arrList.length]  = "ksex";
	arrList[arrList.length]  = "kukikorea";
	arrList[arrList.length]  = "live10tv";
	arrList[arrList.length]  = "molca";
	arrList[arrList.length]  = "molca365";
	arrList[arrList.length]  = "molca588";
	arrList[arrList.length]  = "molcaCD";
	arrList[arrList.length]  = "molcaav";
	arrList[arrList.length]  = "molcasex";
	arrList[arrList.length]  = "molcasexnipon";
	arrList[arrList.length]  = "noode";
	arrList[arrList.length]  = "nopants";
	arrList[arrList.length]  = "nudcouple";
	arrList[arrList.length]  = "nude";
	arrList[arrList.length]  = "nudlnude";
	arrList[arrList.length]  = "oiotv";
	arrList[arrList.length]  = "oralsextv";
	arrList[arrList.length]  = "playboy";
	arrList[arrList.length]  = "porno";
	arrList[arrList.length]  = "porno-tape";
	arrList[arrList.length]  = "pornomana";
	arrList[arrList.length]  = "pornoplayboy";
	arrList[arrList.length]  = "pornsex";
	arrList[arrList.length]  = "runsex";
	arrList[arrList.length]  = "sex";
	arrList[arrList.length]  = "sex-sayclub";
	arrList[arrList.length]  = "sex123";
	arrList[arrList.length]  = "sex18";
	arrList[arrList.length]  = "sex1818";
	arrList[arrList.length]  = "sex4969";
	arrList[arrList.length]  = "sexTV";
	arrList[arrList.length]  = "sexboard";
	arrList[arrList.length]  = "sexbuin";
	arrList[arrList.length]  = "sexcorea";
	arrList[arrList.length]  = "sexhangame";
	arrList[arrList.length]  = "sexjj";
	arrList[arrList.length]  = "sexkorea";
	arrList[arrList.length]  = "sexkorea21";
	arrList[arrList.length]  = "sexkoreasexkorea";
	arrList[arrList.length]  = "sexmaxx";
	arrList[arrList.length]  = "sexmolka";
	arrList[arrList.length]  = "sexmovie";
	arrList[arrList.length]  = "sexmusa";
	arrList[arrList.length]  = "sexnipon";
	arrList[arrList.length]  = "sexsexy";
	arrList[arrList.length]  = "sexwall";
	arrList[arrList.length]  = "sexxmolcatv";
	arrList[arrList.length]  = "sexy";
	arrList[arrList.length]  = "sexyclik";
	arrList[arrList.length]  = "sexyjapan";
	arrList[arrList.length]  = "sexynmall";
	arrList[arrList.length]  = "sexysoul";
	arrList[arrList.length]  = "soraguide";
	arrList[arrList.length]  = "sorasguide";
	arrList[arrList.length]  = "sunginsite";
	arrList[arrList.length]  = "togoero";
	arrList[arrList.length]  = "tvbozi";
	arrList[arrList.length]  = "twistkim";
	arrList[arrList.length]  = "videokiller";
	arrList[arrList.length]  = "vip24";
	arrList[arrList.length]  = "whoissex";
	arrList[arrList.length]  = "wonjosex";
	arrList[arrList.length]  = "worldsex";
	arrList[arrList.length]  = "yadong";
	arrList[arrList.length]  = "yadongclub";
	arrList[arrList.length]  = "yadongmolca";
	arrList[arrList.length]  = "yagood";
	arrList[arrList.length]  = "yahanbamtv";
	arrList[arrList.length]  = "yahannom";
	arrList[arrList.length]  = "yasine";
	arrList[arrList.length]  = "yesmolca";
	arrList[arrList.length]  = "yessex";
	arrList[arrList.length]  = "youngsex";
	arrList[arrList.length]  = "zotte";
	arrList[arrList.length]  = "zungyang";
	arrList[arrList.length]  = "seheene";
	arrList[arrList.length]  = "bubunara";
	arrList[arrList.length]  = "x386";
	arrList[arrList.length]  = "tprtm";
	arrList[arrList.length]  = "59time";
	arrList[arrList.length]  = "69tv";
	arrList[arrList.length]  = "sexy588";
	arrList[arrList.length]  = "live69tv";
	arrList[arrList.length]  = "warez";
	arrList[arrList.length]  = "bdsm";
	arrList[arrList.length]  = "bozi";
	arrList[arrList.length]  = "c2joy";
	arrList[arrList.length]  = "dildo";
	arrList[arrList.length]  = "haduri";
	arrList[arrList.length]  = "hardcore";
	arrList[arrList.length]  = "hentai";
	arrList[arrList.length]  = "jaji";
	arrList[arrList.length]  = "jgirls";
	arrList[arrList.length]  = "kgirls";
	arrList[arrList.length]  = "nallari";
	arrList[arrList.length]  = "playbog";
	arrList[arrList.length]  = "porn";
	arrList[arrList.length]  = "1090tv";
	arrList[arrList.length]  = "2c8";
	arrList[arrList.length]  = "99bb";
	arrList[arrList.length]  = "fuck";
	arrList[arrList.length]  = "gangbang";
	arrList[arrList.length]  = "jfantasy";
	arrList[arrList.length]  = "jasal";
	arrList[arrList.length]  = "playbozi";
	arrList[arrList.length]  = "prno";
	arrList[arrList.length]  = "asiangirl";
	arrList[arrList.length]  = "ecstasy";
	arrList[arrList.length]  = "oral";
	arrList[arrList.length]  = "penis";
	arrList[arrList.length]  = "penthouse";
	arrList[arrList.length]  = "porner";
	arrList[arrList.length]  = "suck";
	arrList[arrList.length]  = "swaping";
	arrList[arrList.length]  = "jawi";


	var ohno = 0;
	for(i=0; i < arrList.length; i++){
		var badWord = arrList[i];
/*		var re = new RegExp(badWord, "ig");
		msg = msg.replace(re,"");
*/
      while(true){
		if(msg.indexOf(badWord) != -1){
			msg = msg.replace(badWord, "");
			ohno = 1;
		}
		else{
			break;
		}
	  }
	}
	if (ohno==1)
	{
		alert("금칙어(예약어)가 입력되었습니다.");
	}
	return msg;
}

//=====================================================
// member.idPassSearch.asp
//------------------------------------------

//실명 - 유효문자 체크
//------------------------------------------
function user_realname_keyup(obj) {
	if(isNotOnlyKorean(obj.value)) {
		alert("한글을 입력하세요.");		
		obj.value = "";
		obj.focus();
	}
}

// 한글로만 되어있는지 체크 (한글외의 다른 글자가 있으면 true, 한글로만 되어 있어야 false)
function isNotOnlyKorean(id_text)
{
	for ( var i=0; i < id_text.length; i++ ) 
	{
		if ( id_text.charCodeAt(i) < 0xAC00 || id_text.charCodeAt(i) > 0xD7A3)
		{
			if (( id_text.charCodeAt(i) < 12593 || id_text.charCodeAt(i) > 12643 ) && ( id_text.charCodeAt(i) != 32)) 
			{
				return true;
			}
		}
	}

	return false;
}

//------------------------------------------
//주민번호- 입력값 체크(숫자만)
//------------------------------------------
function user_resno_keyup(obj, obj2, position) {
	if(position == 1) {
		if(obj.value.length == 6) {
			obj2.focus();
		}
	} 

	if(!onlyNum(obj)) {
		return;
	}
}

// 숫자만 입력 가능하게 하는 스크립트..
function onlyNum(objtext1){
	var inText = objtext1.value;
	var ret;

	for (var i = 0; i < inText.length; i++) {
	    ret = inText.charCodeAt(i);
		if (!((ret > 47) && (ret < 58)))  {
			alert("숫자만 입력 가능합니다.");
			objtext1.value = "";
			objtext1.focus();
			return false;
		}
	}
	return true;
}

function go_find() {
	var form = document.frm1;
	if(!checkNull2(form.real_name, "실명")) return;
	
	if(!checkNull2(form.resno01, "주민번호 앞자리")) return;
	if(form.resno01.value.length  != 6) {
		alert("주민번호 앞자리 길이는 6입니다."); return;
	}

	if(!checkNull2(form.resno02, "주민번호 뒷자리")) return;
	if(form.resno02.value.length  != 7) {
		alert("주민번호 뒷자리 길이는 7입니다."); return;
	}
	if(!reg_numchek2(form.resno01, form.resno02)) {
		return;
	}
	form.kind.value="ID";
	form.target = "_self";
	form.action = "/member/me.idPassSearch.asp";
	form.submit();
}

// oObj의 value가 비어있는지 check하고, 
// 만약 비어있다면 sWhere로 error 메시지를 보여준다.
function checkNull2(oObj, sWhere){
	if (oObj.value == "" || oObj.value == 0)
	{
		err_msg_focus(sWhere, oObj);
		return false;
	}
	return true;
}

// sWhere에서 오류가 나타났음을 알려주고, oObj로 focus를 이동한다.
function err_msg_focus(sWhere, oObj)
{
	alert(sWhere + " 항목이 누락되었습니다.");
	oObj.focus();
}

//--------------------------------------
//주민 등록 번호 검사
//--------------------------------------
function reg_numchek2(obj, obj2) {       
		 var NUM = "0123456789";	
         var reg_ID_1=obj.value;		//주민번호 앞번호
         var reg_ID_2=obj2.value;		//주민번호 뒷번호
		 var Year = reg_ID_1.substring(0,2);
	     var Mondth = reg_ID_1.substring(2,4);
	     var Day = reg_ID_1.substring(4,6);
	     var Sex = reg_ID_2.charAt(0);

	    if (!CheckType(reg_ID_1, NUM)) {
		      alert("주민등록번호 앞부분에 잘못된 문자가 있습니다.");
			  obj.focus();
              return false;
	    }
	    if ( reg_ID_1.length!=6 ||  Mondth<1 || Mondth>12 || Day<1 || Day>31) {
		      alert("주민등록번호 앞부분이 잘못되었습니다.");
			  obj.focus();
              return false;
	    }
	    if (!CheckType(reg_ID_2, NUM)) {
		       alert("주민등록번호 뒷부분에 잘못된 문자가 있습니다.");
			   obj2.focus();
               return false;
	    }
	    if ( reg_ID_2.length!=7 || (Sex!=1 && Sex!=2 && Sex!=3 && Sex!=4) ) {
		       alert("주민등록번호 뒷부분이 잘못되었습니다.");
               obj2.focus();
			   return false;
	    }
	    var i;
		var chk=0;
 	    for (i=0; i<6; i++) {
		       chk += ((i+2) * parseInt(reg_ID_1.charAt(i)));
	    }
	    for (i=6; i<12; i++) {
		       chk += ((i%8+2) * parseInt(reg_ID_2.charAt(i-6)));
	    }
	   chk = 11 - (chk%11);
	   chk %= 10;
	   if (chk != parseInt( reg_ID_2.charAt(6))) {
		       alert("잘못된 주민등록번호 입니다.");
			   obj.focus();
			   return false;
       }
	   return true;
}

//--------------------------------------
//숫자 여부 검사
//--------------------------------------
function CheckType(reg_num,num) {
	var i;
	for(i=0; i<reg_num.length; i++) {
		if (num.indexOf(reg_num.substring(i, i+1)) < 0) {
			return false;
		}
	}
	return true;
}

function go_find2() {
	var form = document.frm2;
	if(!checkNull2(form.mem_id, "회원아이디")) return;

	if(!checkNull2(form.real_name, "실명")) return;
	
	if(!checkNull2(form.resno01, "주민번호 앞자리")) return;
	if(form.resno01.value.length  != 6) {
		alert("주민번호 앞자리 길이는 6입니다."); return;
	}

	if(!checkNull2(form.resno02, "주민번호 뒷자리")) return;
	if(form.resno02.value.length  != 7) {
		alert("주민번호 뒷자리 길이는 7입니다."); return;
	}
	if(!reg_numchek2(form.resno01, form.resno02)) {
		return;
	}
	form.kind.value="PASSWORD";
	form.target = "_self";
	form.action = "/member/me.idPassSearch.asp";
	form.submit();
}

//=====================================================
// member.login.asp
//------------------------------------------

//------------------------------------
// 로그인
//------------------------------------
function login(form) {
	if(!checkNull2(form.member_id, "회원아이디")) return;
	if(!check_length(form.member_id, "회원아이디",  4, 12))  return;
	if(!checkNull2(form.member_passwd, "비밀번호")) return;
	if(!check_length(form.member_passwd, "비밀번호",  4, 12))  return;
	form.target = "_self";
	form.action= "/member/me.login.check.asp";
	form.submit();
}

//-----------------------------------------
// 문자길이 
//-----------------------------------------
function check_length(obj, msg, min, max) {
	if(obj.value.length < min || obj.value.length > max) {
			alert(msg + " 입력값 길이를 확인하세요.");
			obj.value = "";
			obj.focus();
			return false;
	} else {
		return true;
	}
}

//=====================================================
// member.realname.asp
//------------------------------------------

//---------------------------------------------
//  회원 가입 - 주민번호 유효성 -> 실명인증
//---------------------------------------------
 function public_member(form){ 
		if (form.name.value.length < 2)  {
               alert("성명을 입력해 주세요");
               form.name.focus();
               return ;
        }
        
		if (reg_numchek(form) ){             
  			form.action="/member/checkRealname.asp";
		    form.submit();
		} else {
			  return;
		}
 } 

//--------------------------------------
//주민 등록 번호 검사
//--------------------------------------
function reg_numchek(form) {       
		 var NUM = "0123456789";	
         var reg_ID_1=form.jumin1.value;		//주민번호 앞번호
         var reg_ID_2=form.jumin2.value;		//주민번호 뒷번호
		 var Year = reg_ID_1.substring(0,2);
	     var Mondth = reg_ID_1.substring(2,4);
	     var Day = reg_ID_1.substring(4,6);
	     var Sex = reg_ID_2.charAt(0);

	    if (!CheckType(reg_ID_1, NUM)) {
		      alert("주민등록번호 앞부분에 잘못된 문자가 있습니다.");
			  form.jumin1.focus();
              return false;
	    }
	    if ( reg_ID_1.length!=6 ||  Mondth<1 || Mondth>12 || Day<1 || Day>31) {
		      alert("주민등록번호 앞부분이 잘못되었습니다.");
			  form.jumin1.focus();
              return false;
	    }
	    if (!CheckType(reg_ID_2, NUM)) {
		       alert("주민등록번호 뒷부분에 잘못된 문자가 있습니다.");
			   form.jumin2.focus();
               return false;
	    }
	    if ( reg_ID_2.length!=7 || (Sex!=1 && Sex!=2 && Sex!=3 && Sex!=4) ) {
		       alert("주민등록번호 뒷부분이 잘못되었습니다.");
               form.jumin2.focus();
			   return false;
	    }
	    var i;
		var chk=0;
 	    for (i=0; i<6; i++) {
		       chk += ((i+2) * parseInt(reg_ID_1.charAt(i)));
	    }
	    for (i=6; i<12; i++) {
		       chk += ((i%8+2) * parseInt(reg_ID_2.charAt(i-6)));
	    }
	   chk = 11 - (chk%11);
	   chk %= 10;
	   if (chk != parseInt( reg_ID_2.charAt(6))) {
		       alert("잘못된 주민등록번호 입니다.");
			   form.jumin1.focus();
			   return false;
       }
	   return true;
}

//=====================================================
// member.write.form.asp
//------------------------------------------
function select_member(val) {
	if(val == 0) {
		document.all.item("mem1").style.display = "block";
		document.all.item("mem2").style.display = "none";
		document.all.item("mem3").style.display = "none";
		document.all.item("mem4").style.display = "none";

	} else if(val == 1) {
		document.all.item("mem1").style.display = "block";
		document.all.item("mem2").style.display = "block";
		document.all.item("mem3").style.display = "none";
		document.all.item("mem4").style.display = "block";
	} else {
		document.all.item("mem1").style.display = "none";
		document.all.item("mem2").style.display = "none";
		document.all.item("mem3").style.display = "block";
		document.all.item("mem4").style.display = "block";
	}
}

//-----------------------------------------
//회원아이디 - 중복체크창 
//-----------------------------------------
function go_checkmemberid(form, obj) {
	if(!check_length(obj, "회원아이디",  4, 12))
		return;

	if(check_memberID(obj)) {
		var wind = open_wnd('','checkid',420, 400);
		wind.focus();
		form.target = "checkid";
		form.action = "/member/me.idCheck.asp";
		form.submit();
	}
}

function open_wnd(url, name, width, height)
{
    var oWnd = open_window(url, name, width, height, "toolbar=0,menubar=0,resizable=yes,scrollbars=no");
    return oWnd;
}

// Browse Type
// IE Script
var NS4;
var IE4;
if (document.all)
{
    IE4 = true;
    NS4 = false;
}
else
{
    IE4 = false;
    NS4 = true;
}
isWin = (navigator.appVersion.indexOf("Win") != -1)

/* 팝업 관련 함수 */
function open_window(url, name, width, height, feature)
{
    var oWnd;

    if (IE4 && width < window.screen.width && height < window.screen.height) 
    {
        var windowX = Math.ceil( (window.screen.width  - width) / 2 );
        var windowY = Math.ceil( (window.screen.height - height) / 2 );

        oWnd = window.open(url, name, feature+",width=" + width +",height=" + height+",left="+windowX+",top="+windowY + ",resizable=no");
    }
    else 
    {
        oWnd = window.open(url, name, feature+",width=" + width +",height=" + height + ",resizable=yes");
    }

    return oWnd;
}

//------------------------------------
// 비번질문 선택 - onChange
//------------------------------------
//function chg_hint(form){
//	if (form.passwd_hint.value == "direct_input"){
//		form.direct_hint.readOnly = false;
//		form.direct_hint.focus();
//	}else{
//		form.direct_hint.readOnly = true;
//		form.direct_hint.value = "";
//		return;
//	}
//}

//---------------------------------------------
// 회원가입확인
//---------------------------------------------
function join_ok(form) {
	if(!checkNull2(form.member_id, "회원아이디")) return;
    if(form.member_id.value.trim().length < 4) {
		alert("회원아이디 길이는 4~12자입니다.");
		return;
	}
	if(form.memidck.value != "0") {
		alert("회원아이디 중복확인을 하세요");
		return;
	}

	if(!checkNull2(form.member_passwd, "비밀번호")) return;

	if(form.member_passwd.value.trim().length < 4) {
		alert("비밀번호 길이는 4~12입니다.");
		return;
	}

	if(!checkNull2(form.passwd_chk, "비밀번호확인")) return;

	if(form.member_passwd.value != form.passwd_chk.value) {
		alert("비밀번호가 일치하는지 확인하세요.");
		return;
	}

//	if(form.passwd_hint[form.passwd_hint.selectedIndex].value == "direct_hint") {
//		if(!checkNull2(form.direct_hint, "직접입력")) return;
//	}
//	if(form.passwd_hint[form.passwd_hint.selectedIndex].value == "") {
//		alert("비밀번호 힌트를 확인하세요.");
//		return;
//	}
//	if(!checkNull2(form.hint_answer, "힌트답변")) return;

	if(!checkNull2(form.member_addr, "주소")) return;
	if(!checkNull2(form.member_addr_other, "상세주소")) return;

	var local_tel;
	if(form.member_telno_1[form.member_telno_1.selectedIndex].value == "") {
		alert("전화지역번호를 선택하세요.");		
		return;
	} else {
		local_tel = form.member_telno_1[form.member_telno_1.selectedIndex].text;
	}

	if(!checkNull2(form.member_telno_2, "전화번호 앞자리")) return;
	if(!checkNull2(form.member_telno_3, "전화번호 뒷자리")) return;
	local_tel = local_tel + "-" + form.member_telno_2.value.trim() + "-" + form.member_telno_3.value.trim();		


	var mail;
	if(!checkNull2(form.member_email_h, "메일계정")) return;

	if(form.member_email_b[form.member_email_b.selectedIndex].value == "direct_input") {
		if(!checkNull2(form.member_email_d, "직접입력")) return;
		mail = form.member_email_h.value.trim() + "@" + form.member_email_d.value.trim();
	} else {
		mail = form.member_email_h.value.trim() + "@" + form.member_email_b[form.member_email_b.selectedIndex].text;
	}

	if(!checkEmail(mail))  {
		alert("올바른 이메일 형식이 아닙니다.");
		return;
	}

	if(form.member_job[form.member_job.selectedIndex].value == "") {
		alert("직업을 선택하세요.");
		return;
	}

//	form.fax.value = fax;
//	form.birthday.value = birthday;
	form.local_tel.value = local_tel;
//	form.cellular.value = cellular;
	form.email.value = mail;
	form.target = "_self";
	form.action = "/member/me.write.proc.asp";
	form.submit();
}

//이메일 유효성 검사
function checkEmail(Email){
	//email 체크
	var strEmail = Email;
    var i;
    var strCheck1 = false;
    var strCheck2 = false;
	var iEmailLen = strEmail.length
	
	if (iEmailLen > 0) {
		// strEmail 에 '.@', '@.' 이 있는 경우 에러메시지.
		// strEmail의 맨앞 또는 맨뒤에  '@', '.' 이 있는 경우 에러메시지.
		if ((strEmail.indexOf(".@") != -1) || (strEmail.indexOf("@.") != -1) ||
			(strEmail.substring(0,1) == ".") || (strEmail.substring(0,1) == "@") ||
			(strEmail.substring(iEmailLen-1,iEmailLen) == ".") || (strEmail.substring(iEmailLen-1,iEmailLen) == "@"))
		{	
			return false;
		}
	    for ( i=0; i<iEmailLen; i++ ) {
	        if ( (strEmail.substring(i,i+1) == ".") || (strEmail.substring(i,i+1) == "-") || (strEmail.substring(i,i+1) == "_") ||
				((strEmail.substring(i,i+1) >= "0") && (strEmail.substring(i,i+1) <= "9")) ||
				((strEmail.substring(i,i+1) >= "@") && (strEmail.substring(i,i+1) <= "Z")) ||
				((strEmail.substring(i,i+1) >= "a") && (strEmail.substring(i,i+1) <= "z")) ) {
	                if (strEmail.substring(i,i+1) == ".")
						strCheck1 = true;
	                if (strEmail.substring(i,i+1) == "@")
						strCheck2 = true;
	        }
	        else {
				return false;
	        }
	    }
	
	    if ((strCheck1 == false) || (strCheck2 == false)) {
			return false;
	    }
	}
    return true;
}

