
function len_chk(){  
  var frm = document.memberForm.selfInfo; 
    
  if(frm.value.length > 400){  
       alert("글자수는 영문400, 한글200자로 제한됩니다.!");  
       frm.value = frm.value.substring(0,400);  
       frm.focus();  
  }  

} 

 
function ChangeUserState(obj, obj_txt)
	{
		var obj1 = document.getElementById("user_locate_nm");
		var obj2 = document.getElementById("user_locate_en_cd");
		var obj3 = document.getElementById("user_locate_cn_cd");
		var obj4 = document.getElementById("user_locate_kr_cd");
		var obj5 = document.getElementById("user_locate_jp_cd");
 		
		if(obj.options[obj.selectedIndex].value== "USA") {
			obj2.style.display = "inline";
			obj2.focus();
			}	else	{
			obj2.style.display = "none";
 			}
		if(obj.options[obj.selectedIndex].value== "CHN") {
			obj3.style.display = "inline";
			obj3.focus();
			}	else	{
			obj3.style.display = "none";
 			}
		if(obj.options[obj.selectedIndex].value== "KOR") {
			obj4.style.display = "inline";
			obj4.focus();
			}	else	{
			obj4.style.display = "none";
 			}
		if(obj.options[obj.selectedIndex].value== "JPN") {
			obj5.style.display = "inline";
			obj5.focus();
			}	else	{
			obj5.style.display = "none";
 			}

		if (obj2.style.display == "inline" || obj3.style.display == "inline"|| obj4.style.display == "inline" ||obj5.style.display == "inline") {
			obj1.style.display = "none";
			}	else	{
			obj1.style.display = "inline";
			obj1.focus();
 			}
	}

function ChangeStudyTarget(obj, obj_txt)
	{
		var obj2 = document.getElementById(obj_txt);
		
		if(obj.options[obj.selectedIndex].value == "60")
		{
			obj2.style.display = "inline";
			obj2.focus();
		}
		else
		{
			obj2.style.display = "none";
		}
	}
 
function ChangeStudyTarget_modify(obj, obj_txt)
	{
		var obj2 = document.getElementById(obj_txt);
		
		if(obj.options[obj.selectedIndex].value == "60")
		{
			obj2.style.display = "inline";
			obj2.focus();
		}
		else
		{
			obj2.style.display = "none";
		}
	}
function changefield1(i1)
{
  var j1 = i1.value;
  if (j1.length == 6){
     document.memberForm.regno2.focus();
  }
  return;
}

function changefield2(i2)
{
  var j2 = i2.value;
  if (j2.length == 7){
     //document.memberForm.firmcode.focus();
  }
  return;
}
function OnlyNumber()
{
    if(( (event.keyCode>47)&&(event.keyCode<58) ) || (event.keyCode == 45)){
    
		event.returnValue = true;
	}
	else
	{
        event.returnValue = false;
    }
}
 
function win_op() {
	var win_location = "/member/pop/id_check.ASP";
	var win_name = "sno";
	var win_property = "width=425,height=250,status=no,scrollbars=no";
	var selfZipCode = window.open(win_location, win_name, win_property);
}
 
function win_pwd() {
	var win_location = "/member/pop/pwd_check.ASP";
	var win_name = "pwd";
	var win_property = "width=425,height=250,status=no,scrollbars=no";
	var selfZipCode = window.open(win_location, win_name, win_property);
}

function validCharacter(nowValue){		//숫자,문자 조합
	
if (nowValue.length != 0 ){

	var checkNumber = "1234567890";
	var checkAlphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var checkNumberFlag = 0;
	var checkAlphabetFlag = 0;

		for ( i = 0 ; i < nowValue.length ; i++ ){
			 if (-1 != checkNumber.indexOf(nowValue.charAt(i))) {				
				checkNumberFlag = 1;
			 }
			 if (-1 != checkAlphabet.indexOf(nowValue.charAt(i))) {				
				checkAlphabetFlag = 1;
			 }
		}
		
		if ( checkNumberFlag + checkAlphabetFlag != 2 ){
			return false;		
		} 
	}

	return true;

}

 function valNum(exp)
{
  if(exp.substr(0,1) == "0")
  	if(exp.lastIndexOf("0") == (exp.length-1))
  		exp = exp.substring(1,exp.length); 
  	else
  		exp = exp.substring(exp.lastIndexOf("0")+1,exp.length);
  
  if(isNaN(parseInt(exp)))
    return 0;
  else
    return parseInt(exp);
} 
 
function sendit(){
 	if( document.memberForm.loginid.value == ""){
		alert("Please type in the ID.");
		document.memberForm.loginid.focus();
	 
	}
	else if( document.memberForm.loginid.value.length < 8 || document.memberForm.loginid.value.length > 8){
		alert("The ID can only be an 8-digit number. ");
		document.memberForm.loginid.focus();
	}
	else if( document.memberForm.loginid.value.charAt(0) == "0"){
		alert("An ID beginning with the number 0 is not valid. Please use an 8-digit number. ");
		document.memberForm.loginid.focus();
	}
	else if( document.memberForm.loginpw.value == ""){
		alert("Please type in the password.");
		document.memberForm.loginpw.focus();
	}
	else if(!((document.memberForm.loginpw.value.length<20) && (document.memberForm.loginpw.value.length>5)))
	{
		alert( "Please type in the password with between 6 and 20 characters or numbers. " );
		document.memberForm.loginpw.focus();
	}
//	else if (!(validCharacter(document.memberForm.loginpw.value)))
//	{
//		alert( "비밀번호는 영문과 숫자의 조합으로 이루어 져야 합니다." );
//		document.memberForm.loginpw.focus();
//	}
	else if( document.memberForm.loginpw1.value == ""){
		alert("In order to confirm the password, please type in the password once again.");
		document.memberForm.loginpw1.focus();
	}
	else if( document.memberForm.loginpw.value != document.memberForm.loginpw1.value ){
		alert("The password does not coincide.  Please check it once again.");
		document.memberForm.loginpw1.focus();
	}
	else if( document.memberForm.hname.value == ""){
		alert("Please type in your name.");
		document.memberForm.hname.focus();
	}
	else if (document.memberForm.birth_mm[document.memberForm.birth_mm.options.selectedIndex].value == "0" ){
		alert("Please select the month of your birth date");
		document.memberForm.birth_mm.focus();
 	}	
	else if (document.memberForm.birth_dd[document.memberForm.birth_dd.options.selectedIndex].value == "0" ){
		alert("Please select the day of your birth date");
		document.memberForm.birth_dd.focus();
 	}	
	else if (document.memberForm.birth_yy[document.memberForm.birth_yy.options.selectedIndex].value == "0" ){
		alert("Please select the year of your birth date.");
		document.memberForm.birth_yy.focus();
 	}	

	else if (document.memberForm.user_nation_cd[document.memberForm.user_nation_cd.options.selectedIndex].value == "0" ){
		alert("Please select your nationality.");
		document.memberForm.user_nation_cd.focus();
 	}	

	else if (document.memberForm.user_state_cd[document.memberForm.user_state_cd.options.selectedIndex].value == "0" ){
		alert("Please type in the country in which you are currently residing.");
		document.memberForm.user_state_cd.focus();
 	}	

	else if (document.memberForm.state_lang_cd[document.memberForm.state_lang_cd.options.selectedIndex].value == "0" ){
		alert("Please select your native language.");
		document.memberForm.state_lang_cd.focus();
 	}	

	else if (document.memberForm.time_zone_cd[document.memberForm.time_zone_cd.options.selectedIndex].value == "0" ){
		alert("Please select your time zone.");
		document.memberForm.time_zone_cd.focus();
 	}	

	else if( document.memberForm.email.value == ""){
		alert("Please type in your e-mail address.");
		document.memberForm.email.focus();
	}
	else if (document.memberForm.img.value == "") {
		alert("Please register your photo image..");
	}
	else if( document.memberForm.selfInfo.value == ""){
		alert("Please fill in your self-introduction.");
		document.memberForm.selfInfo.focus();
	}
//	else if(document.memberForm.selfInfo.value.length > 200){  
//		   alert("글자수는 영문200, 한글100자로 제한됩니다.!");  
//		   document.memberForm.selfInfo.value = document.memberForm.selfInfo.value.substring(0,200);  
//		   document.memberForm.selfInfo.focus();  
//	  }  
	else if (document.memberForm.study_lang_cd1[document.memberForm.study_lang_cd1.options.selectedIndex].value == "0" ){
		alert("Please select the language you want to study.");
		document.memberForm.study_lang_cd1.focus();
 	}	
 	else if (document.memberForm.study_age_cd1[document.memberForm.study_age_cd1.options.selectedIndex].value == "0" ){
		alert("Please select the level of the language you want to study.");
		document.memberForm.study_age_cd1.focus();
 	}	
//	else if (document.memberForm.study_target_cd1[document.memberForm.study_target_cd1.options.selectedIndex].value == "0" ){
//		alert("Please select the purpose of the study.");
//		document.memberForm.study_target_cd1.focus();
// 	}	
 	else if( document.memberForm.stateTelno.value == ""){
		alert("Please type in the country code.");
		document.memberForm.stateTelno.focus();
	}
	else if ((document.memberForm.locateTelno.value == "")) {
		alert("Please type in the area code.");
		document.memberForm.locateTelno.focus();
	}
 
	else if ((document.memberForm.telno.value == "")) {
		alert("Please type in the telephone number for getting contacted.");
		document.memberForm.telno.focus();
	}
 
// 	else if( document.memberForm.job.value == ""){
//		alert("Please type in your occupation.");
//		document.memberForm.job.focus();
//	}
//	else if (document.memberForm.user_state_cd[document.memberForm.user_state_cd.options.selectedIndex].value =! "0" ){
//	 	document.memberForm.user_state.value=document.memberForm.user_state_cd[document.memberForm.user_state_cd.options.selectedIndex].text;
//  	}	
//
//	else if (document.memberForm.state_lang_cd[document.memberForm.state_lang_cd.options.selectedIndex].value =! "0" ){
//		document.memberForm.state_lang.value=document.memberForm.state_lang_cd[document.memberForm.state_lang_cd.options.selectedIndex].text;
// 	}	
	else
		document.memberForm.submit();
}

function edit_sendIt(){

    if( document.memberForm.loginpw.value == ""){
		alert("Please type in the password.");
		document.memberForm.loginpw.focus();
	}
	else if(!((document.memberForm.loginpw.value.length<20) && (document.memberForm.loginpw.value.length>5)))
	{
		alert( "Please type in the password with between 6 and 20 characters or numbers. " );
		document.memberForm.loginpw.focus();
	}
//	else if (!(validCharacter(document.memberForm.loginpw.value)))
//	{
//		alert( "비밀번호는 영문과 숫자의 조합으로 이루어 져야 합니다." );
//		document.memberForm.loginpw.focus();
//	}
	else if( document.memberForm.loginpw1.value == ""){
		alert("In order to confirm the password, please type in the password once again.");
		document.memberForm.loginpw1.focus();
		return;
	}
	else if( document.memberForm.loginpw.value != document.memberForm.loginpw1.value ){
		alert("The password does not coincide.  Please check it once again.");
		document.memberForm.loginpw1.focus();
		return;
	}

	else if (document.memberForm.birth_mm[document.memberForm.birth_mm.options.selectedIndex].value == "0" ){
		alert("Please select the month of your birth date");
		document.memberForm.birth_mm.focus();
		return;
 	}	
	else if (document.memberForm.birth_dd[document.memberForm.birth_dd.options.selectedIndex].value == "0" ){
		alert("Please select the day of your birth date");
		document.memberForm.birth_dd.focus();
		return;
 	}	
	else if (document.memberForm.birth_yy[document.memberForm.birth_yy.options.selectedIndex].value == "0" ){
		alert("Please select the year of your birth date.");
		document.memberForm.birth_yy.focus();
		return;
 	}	

	else if (document.memberForm.user_nation_cd[document.memberForm.user_nation_cd.options.selectedIndex].value == "0" ){
		alert("Please select your nationality.");
		document.memberForm.user_nation_cd.focus();
		return;
 	}	

	else if (document.memberForm.user_state_cd[document.memberForm.user_state_cd.options.selectedIndex].value == "0" ){
		alert("Please type in the country in which you are currently residing.");
		document.memberForm.user_state_cd.focus();
		return;
 	}	

	else if (document.memberForm.state_lang_cd[document.memberForm.state_lang_cd.options.selectedIndex].value == "0" ){
		alert("Please select your native language.");
		document.memberForm.state_lang_cd.focus();
		return;
 	}	

	else if (document.memberForm.time_zone_cd[document.memberForm.time_zone_cd.options.selectedIndex].value == "0" ){
		alert("Please select your time zone.");
		document.memberForm.time_zone_cd.focus();
		return;
 	}	

	else if( document.memberForm.email.value == ""){
		alert("Please type in your e-mail address.");
		document.memberForm.email.focus();
		return;
	}
	else if ((document.memberForm.del_chk.checked == true)&&(document.memberForm.img.value == "")) {
		alert("Please register your photo image.");
		return;
	}
	else if( document.memberForm.selfInfo.value == ""){
		alert("Please fill in your self-introduction.");
		document.memberForm.selfInfo.focus();
		return;
	}
//	else if(document.memberForm.selfInfo.value.length > 200){  
//		   alert("글자수는 영문200, 한글100자로 제한됩니다.!");  
//		   document.memberForm.selfInfo.value = document.memberForm.selfInfo.value.substring(0,200);  
//		   document.memberForm.selfInfo.focus();  
//	  }  
	else if (document.memberForm.study_lang_cd1[document.memberForm.study_lang_cd1.options.selectedIndex].value == "0" ){
		alert("Please select the language you want to study.");
		document.memberForm.study_lang_cd1.focus();
		return;
 	}	
 	else if (document.memberForm.study_age_cd1[document.memberForm.study_age_cd1.options.selectedIndex].value == "0" ){
		alert("Please select the level of the language you want to study.");
		document.memberForm.study_age_cd1.focus();
		return;
 	}	
//	else if (document.memberForm.study_target_cd1[document.memberForm.study_target_cd1.options.selectedIndex].value == "0" ){
//		alert("Please select the purpose of the study.");
//		document.memberForm.study_target_cd1.focus();
// 	}	
 	else if( document.memberForm.stateTelno.value == ""){
		alert("Please type in the country code.");
		document.memberForm.stateTelno.focus();
		return;
	}
	else if ((document.memberForm.locateTelno.value == "")) {
		alert("Please type in the area code.");
		document.memberForm.locateTelno.focus();
		return;
	}
 
	else if ((document.memberForm.telno.value == "")) {
		alert("Please type in the telephone number for getting contacted.");
		document.memberForm.telno.focus();
		return;
	}
 
	var SH = eval("memberForm.talk_stime");
 	var Shour = valNum(SH.value);
	var EH = eval("memberForm.talk_etime");
 	var Ehour = valNum(EH.value);
	var timeval = ((Ehour*60) ) - ((Shour*60) );

 	  if( Shour > Ehour ) {
 		  alert("The starting time is later than the ending time.  Please select the time range accurately.");
		 document.memberForm.talk_stime.focus();
		 return  ;
	}  
	  if( timeval == "0" ) {
 		  alert("The starting time is the same as the ending time. \n\nPlease select the time range accurately.");
		  document.memberForm.talk_etime.focus();
		  return  ;
	}  
// 	else if( document.memberForm.job.value == ""){
//		alert("Please type in your occupation.");
//		document.memberForm.job.focus();
//	}
	else
		
		document.memberForm.submit();
}
function slide(){
	document.all['moveLayer'].style.visibility = 'visible';
	document.all['moveLayer'].style.top = event.y - 2 + document.body.scrollTop;
	document.all['moveLayer'].style.left = event.x - 2 + document.body.scrollLeft;
}

//input=file의 값을 input=text에 보여준다
function input_textn() {
	str = eval("document.all.img");
	document.all.file_text.value = str.value;
}


function tutor_term() {
	var win_location = "Tutor_term.ASP";
	var win_name = "sno";
	var win_property = "width=600,height=592,status=no,scrollbars=no";
	var selfZipCode = window.open(win_location, win_name, win_property);
}
 


 function go_tutor(){

	var frm = document.tutorForm

	if (frm.tutor_lang_cd1[frm.tutor_lang_cd1.options.selectedIndex].value == "0" ){
		alert("Please select the language you intend to teach.");
		frm.tutor_lang_cd1.focus();
		return;
 	}	
 	if (frm.tutor_age_cd1[frm.tutor_age_cd1.options.selectedIndex].value == "0" ){
		alert("Please select the level of the language you intend to teach.");
		frm.tutor_age_cd1.focus();
		return;
 	}	
//	if( frm.pr1.value == ""){
	//	alert("가르치실 언어에 대한 PR을 입력해주세요.");
	//	frm.pr1.focus();
 	 // 	return;
//	}

 	if (frm.tutorLang1[frm.tutorLang1.options.selectedIndex].value == "0" ){
		alert("Please select the language that can be used during the course.");
		frm.tutorLang1.focus();
		return;
 	}	
 
  	if (frm.tutorLang2[frm.tutorLang2.options.selectedIndex].value == "0" ){
		alert("Please select the language that can be used during the course.");
		frm.tutorLang2.focus();
		return;
 	}	

 	var err = false;
	var err2 = false;

	for (var i=0; i<frm.agree.length; i++) {
			if (frm.agree[i].checked == true) {			
				err = true;
			}
			if (frm.agree[0].checked == true) {
				err2 = true;
			}
		}
		
	if (err == false) {
		alert("Please make sure you have read the terms. and then select whether or not you agree.");
		return;
	}
 
 	if (err2 == false) {
		alert("You can join as a member only if you agree with the stipulations.");
		return;
	}
	    else   frm.submit();
	}
 


 function course_stop(lang_nm, educd) {
	var f = document.stateForm;
	f.educd.value = educd;
	f.flag.value="stop";
	if(confirm("You have the partners who are studying now.\n\nWould you like to stop the tutor activities?" )){
		f.action = "/Tutor/tutor_state_C.asp";
		f.submit();
	}
}

 function course_cancel(lang_nm, educd) {
	var f = document.stateForm;
	f.educd.value = educd;
	f.flag.value="cancel";
	if(confirm(lang_nm +" Would you like to cancel your application for lecturer activities?")){
		f.action = "/Tutor/tutor_state_C.asp";
		f.submit();
	}
}

 function course_restart(lang_nm, educd) {
	var f = document.stateForm;
	f.educd.value = educd;
	f.flag.value="restart";
	if(confirm(lang_nm +" Would you like to begin your lecturer activities again?")){
		f.action = "/Tutor/tutor_state_C.asp";
		f.submit();
	}
}

 function term_agree() {
	var frm = document.tutorForm

 	var err = false;
 
 
			if (frm.agree.checked == true) {			
				err = true;
			}

		 
		
	if (err == false) {
		alert("Please make sure you have read the terms. and then select whether or not you agree.\n\nYou can join as a member only if you agree with the stipulations.");
		return;
	}
 
	    else   
		 opener.tutorForm.agree[0].checked=true;

		self.close();
	}
 

 
function payinfo_msg(){
	alert("You can select Paypal only if you are an overseas lecturer.");
	event.returnValue = false;
	document.tutorFee.COST_OUT_CL_CD[0].checked=true;
}
 
function payinfo_msg_kr(){
	alert("You can select Transfer only if you are a korean.");
	event.returnValue = false;
	document.tutorFee.COST_OUT_CL_CD[1].checked=true;
}

function payinfo_form() {
	var frm = document.tutorFee
 	var err = false;
 
	for (var i=0; i<frm.COST_OUT_CL_CD.length; i++) {
			if (frm.COST_OUT_CL_CD[i].checked == true) {			
				err = true;
			}
 
		}

	if (err == false) {
		alert("Please select the method for the payment of the Tutor’s fee.");
		return;
	}
 

 if (frm.COST_OUT_CL_CD[0].checked ==true)
 {
 	if (frm.bank_cd[frm.bank_cd.options.selectedIndex].value == "0" ){
		alert("Please select the name of the bank.");
		frm.bank_cd.focus();
		return;
 	}	
 
	 if(frm.bank_account.value == ""){
		alert("Please type in your bank account number.");
		frm.bank_account.focus();
		return;
	}

	if( frm.bank_hname.value == ""){
		alert("Please type in the name of the holder of the bank account.");
		frm.bank_hname.focus();
		return;
	}

	if( frm.id_num1.value == ""){
		alert("Please type in your id number.");
		frm.id_num1.focus();
		return;
	}

	if( frm.id_num2.value == ""){
		alert("Please type in your id number.");
		frm.id_num2.focus();
		return;
	}

	    else   
	 	 frm.bank_name.value = frm.bank_cd[frm.bank_cd.options.selectedIndex].text
		 frm.submit();
 }

	else

	 if(frm.paypal_email.value == ""){
		alert("Please type in the e-mail address for Paypal payment.");
		frm.paypal_email.focus();
		return;
	}
	if( frm.id_num1.value == ""){
		alert("Please type in your id number.");
		frm.id_num1.focus();
		return;
	}

	if( frm.id_num2.value == ""){
		alert("Please type in your id number.");
		frm.id_num2.focus();
		return;
	}
		else   
	 	 frm.bank_name.value = frm.bank_cd[frm.bank_cd.options.selectedIndex].text
		 frm.submit();


	}	