﻿	var NA_STATE_CODE = ["","AL", "AK", "AS", "AZ", "AR", "AE", "AA", "AP", "CA", "CO", "CT", "DE", "DC", "FM", "FL", "GA", "GU", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MH", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "MP", "OH", "OK", "OR", "PW", "PA", "PR", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VI", "VA", "WA", "WV", "WI", "WY"];
	var CA_STATE_CODE = ["","AB", "BC", "MB", "NB", "NL", "NT", "NS", "ON", "PE", "QC", "SK", "YT","NU"];
	var NA_STATE_NAME = ["---Select---","Alabama", "Alaska", "American Samoa", "Arizona", "Arkansas", "Armed Forces", "Armed Forces Americas", "Armed Forces Pacific", "California", "Colorado", "Connecticut", "Delaware", "District of Columbia", "Federated States of Micronesia", "Florida", "Georgia", "Guam", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Marshall Islands", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Northern Mariana Islands", "Ohio", "Oklahoma", "Oregon", "Palau", "Pennsylvania", "Puerto Rico", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virgin Islands", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming"];
	var CA_STATE_NAME = ["---Select---","Alberta", "British Columbia", "Manitoba", "New Brunswick", "Newfoundland and Labrador", "North West Territories", "Nova Scotia", "Ontario", "Prince Edward Island", "Quebec", "Saskatchewan", "Yukon","Nunavut"];
var BR_STATE_CODE=["AC","AL","AP","AM","BA","CE","DF","ES","GO","MA","MT","MS","MG","PA","PB","PR","PE","PI","RJ","RN","RS","RO","RR","SC","SP","SE","TO"];
var BR_STATE_NAME=["Acre","Alagoas","Amapa","Amazonas","Bahia","Ceara","Distrito Federal","Espirito Santo","Goias","Maranhao","Mato Grosso","Mato Grosso do Sul","Minas Gerais","Para","Paraiba","Parana","Pernambuco","Piaui","Rio de Janeiro","Rio Grande do Norte","Rio Grande do Sul","Rondonia","Roraima","Santa Catarina","Sao Paulo","Sergipe","Tocantins"];
function validateName(length1, length2)
{
	if((length1+length2)>22)
	{
		alert("이름과 성을 합쳐 길이가 22자를 초과할 수 없습니다.");
		document.f1.firstname.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function getStrLen(str)
{
	if(str==null || str=='') return 0;
	var strlen=0;
	for(var i=0; i<str.length; i++)
	{
		var c=str.charCodeAt(i);
		if( c < 0xac00 || 0xd7a3 < c ) strlen++;
		else strlen+=2; 
	}
	return strlen;
}	

function selState(theform,ctry)
{
	for(var k = 0; k<theform.addr_state.options.length;k++)
	{
	theform.addr_state.options[k] = null;
	}
	if(ctry == "USa")
	{
		for(var r = 0; r <NA_STATE_CODE.length; r++)
		{
		theform.addr_state.options[r] = new Option(NA_STATE_NAME[r],NA_STATE_CODE[r]);
		}
	}
	else if(ctry == "CAa")
	{
		for(var r = 0; r <CA_STATE_CODE.length; r++)
		{
		theform.addr_state.options[r] = new Option(CA_STATE_NAME[r],CA_STATE_CODE[r]);
		}
	}
	else if(ctry == "BRa")
	{
		for(var r = 0; r <BR_STATE_CODE.length; r++)
		{
		theform.addr_state.options[r] = new Option(BR_STATE_NAME[r], BR_STATE_CODE[r]);
		}
	}
	else
	{
	// don't display sate;
	}	
}
function	is_num( str )		
{
	if( str >= '0' && str <= '9' )
		return true;
		
	return false;
}
function	are_num( str )
{
	var	pos;

	for( pos = 0; pos < str.length; pos++ )
	{
		if( is_num( str.charAt(pos) ) != true ) break;
	}

	if( pos == str.length )
		return true;

	return false;
}
function	are_same_num( str )
{
	var	pos;

	for( pos = 0; pos < str.length; pos++ )
	{
		if( is_num( str.charAt(pos) ) )
		{
			if( is_num( str.charAt(pos+1) ) )
			{
				if( is_num( str.charAt(pos+2) ) )
				{			
					if( str.charAt(pos).indexOf(str.charAt(pos+1))>-1 && str.charAt(pos+1).indexOf(str.charAt(pos+2))>-1)
					{
						break;
					}
				}
			}
		}
	}

	if( pos == str.length )
//	alert(pos);
		return true;

	return false;
}
function	compare_id_pass( str1, str2 )
{
	var	pos1;
	var	pos2;
	
	for( pos1 = 0; pos1 < str1.length; pos1++ )
	{
		for( pos2 = 0; pos2 < str2.length; pos2++ )
		{
			if( str1.charAt(pos1).indexOf(str2.charAt(pos2))>-1 && (pos1 < str1.length-2) && (pos2 < str2.length-2))
			{
				if( str1.charAt(pos1+1).indexOf(str2.charAt(pos2+1))>-1 )
				{
					if( str1.charAt(pos1+2).indexOf(str2.charAt(pos2+2))>-1) 
					{
						return false;
					}
				}
			}
		}
	}

	if( pos1 == str1.length )
		return true;
}
/// end 
function upper(obj,str){
	obj.value = obj.value.toUpperCase();
}
function onlyNumber2(loc) {
	if(/[^0123456789]/g.test(loc.value)) {
		alert("숫자만 입력하십시오.");
		loc.value = "";
		loc.focus();
	}
}
function isEng(str) { 
				for(var i=0;i<str.length;i++){                 
								achar = str.charCodeAt(i);                  
								if( achar > 255 ){ 
												return false; 
								} 
				} 
				return true; 
}
function changeaddrform(fname,theform)
{
	if(fname == "USa" || fname== "CAa"|| fname== "BRa")
	{
	document.all.addrUSa1.style.display = "block";
	document.all.addrUSa2.style.display = "block";
	document.all.addrUSa3.style.display = "block";
	document.all.addrUSa4.style.display = "block";

	document.all.addrKOr1.style.display = "none";
	document.all.addrKOr2.style.display = "none";
	document.all.addrKOr3.style.display = "none";

	document.all.addrElse1.style.display = "none";
	document.all.addrElse2.style.display = "none";
	document.all.addrElse3.style.display = "none";
	}
	else if(fname == "KOr")
	{
		if(theform.nationality.value == "KOr")
	
		{
			document.all.addrUSa1.style.display = "none";
			document.all.addrUSa2.style.display = "none";
			document.all.addrUSa3.style.display = "none";
			document.all.addrUSa4.style.display = "none";

			document.all.addrKOr1.style.display = "block";
			document.all.addrKOr2.style.display = "block";
			document.all.addrKOr3.style.display = "block";

			document.all.addrElse1.style.display = "none";
			document.all.addrElse2.style.display = "none";
			document.all.addrElse3.style.display = "none";
			
			if(theform.keaction.value == "createnewaccount")
			{		
				document.all.koreanform1.style.display = "block";			
				document.all.koreanform2.style.display = "block";		
			}
		}
		else
		{
			document.all.addrUSa1.style.display = "none";
			document.all.addrUSa2.style.display = "none";
			document.all.addrUSa3.style.display = "none";
			document.all.addrUSa4.style.display = "none";

			document.all.addrKOr1.style.display = "block";
			document.all.addrKOr2.style.display = "block";
			document.all.addrKOr3.style.display = "block";

			document.all.addrElse1.style.display = "none";
			document.all.addrElse2.style.display = "none";
			document.all.addrElse3.style.display = "none";
			
			if(theform.keaction.value == "createnewaccount")
			{		
				document.all.koreanform1.style.display = "none";			
				document.all.koreanform2.style.display = "none";		
			}
		}
							
	}
	else if(fname != "KOr")
	{
		if(theform.nationality.value == "KOr")
		{	
			document.all.addrUSa1.style.display = "none";
			document.all.addrUSa2.style.display = "none";
			document.all.addrUSa3.style.display = "none";
			document.all.addrUSa4.style.display = "none";
	
			document.all.addrKOr1.style.display = "none";
			document.all.addrKOr2.style.display = "none";
			document.all.addrKOr3.style.display = "none";
	
			document.all.addrElse1.style.display = "block";
			document.all.addrElse2.style.display = "block";
			document.all.addrElse3.style.display = "block";
		
			if(theform.keaction.value == "createnewaccount")
			{
			document.all.koreanform1.style.display = "block";			
			document.all.koreanform2.style.display = "block";			
			}
		}
		else
		{	
			document.all.addrUSa1.style.display = "none";
			document.all.addrUSa2.style.display = "none";
			document.all.addrUSa3.style.display = "none";
			document.all.addrUSa4.style.display = "none";
	
			document.all.addrKOr1.style.display = "none";
			document.all.addrKOr2.style.display = "none";
			document.all.addrKOr3.style.display = "none";
	
			document.all.addrElse1.style.display = "block";
			document.all.addrElse2.style.display = "block";
			document.all.addrElse3.style.display = "block";
		
			if(theform.keaction.value == "createnewaccount")
			{
			document.all.koreanform1.style.display = "none";			
			document.all.koreanform2.style.display = "none";			
			}
		}
	
	}
	else
	{
	document.all.addrUSa1.style.display = "none";
	document.all.addrUSa2.style.display = "none";
	document.all.addrUSa3.style.display = "none";
	document.all.addrUSa4.style.display = "none";

	document.all.addrKOr1.style.display = "none";
	document.all.addrKOr2.style.display = "none";
	document.all.addrKOr3.style.display = "none";

	document.all.addrElse1.style.display = "block";
	document.all.addrElse2.style.display = "block";
	document.all.addrElse3.style.display = "block";
	}
}
function selectregbox(theform)
{	
	var time=new Date();
	var year=time.getYear();
	var age;
		
	if (year < 2000)
	{    // Y2K Fix, Isaac Powell
		year = year + 1900; // http://onyx.idbsu.edu/~ipowell		
	}
	age = year - theform.birthdayyyyy.value ;	

	var natval;
	natval=theform.nationality.value;
	
	if(natval == "KOr" )
	{	
		if (age<14)  
		{
			alert("Please input the junior member additional information")
			document.all.under14_1.style.display = "block";
			document.all.under14_2.style.display = "block";
		}
		else
		{
			document.all.under14_1.style.display = "none";
			document.all.under14_2.style.display = "none";
		}
		if(theform.addr_country.value == "KOr")
		{
			document.all.addrUSa1.style.display = "none";
			document.all.addrUSa2.style.display = "none";
			document.all.addrUSa3.style.display = "none";
			document.all.addrUSa4.style.display = "none";
	
			document.all.addrKOr1.style.display = "block";
			document.all.addrKOr2.style.display = "block";
			document.all.addrKOr3.style.display = "block";
	
			document.all.addrElse1.style.display = "none";
			document.all.addrElse2.style.display = "none";
			document.all.addrElse3.style.display = "none";
		
			if(theform.keaction.value == "createnewaccount")
			{
				document.all.koreanform1.style.display = "block";			
				document.all.koreanform2.style.display = "block";			
			}
			
		}
		else
		{
			if(theform.addr_country.value== "USa"  ||theform.addr_country.value=="CAa"||theform.addr_country.value=="BRa")
			{
				document.all.addrUSa1.style.display = "block";
				document.all.addrUSa2.style.display = "block";
				document.all.addrUSa3.style.display = "block";
				document.all.addrUSa4.style.display = "block";
		
				document.all.addrKOr1.style.display = "none";
				document.all.addrKOr2.style.display = "none";
				document.all.addrKOr3.style.display = "none";

				document.all.addrElse1.style.display = "none";
				document.all.addrElse2.style.display = "none";
				document.all.addrElse3.style.display = "none";
			}
			else
			{
				document.all.addrUSa1.style.display = "none";
				document.all.addrUSa2.style.display = "none";
				document.all.addrUSa3.style.display = "none";
				document.all.addrUSa4.style.display = "none";
	
				document.all.addrKOr1.style.display = "none";
				document.all.addrKOr2.style.display = "none";
				document.all.addrKOr3.style.display = "none";
	
				document.all.addrElse1.style.display = "block";
				document.all.addrElse2.style.display = "block";
				document.all.addrElse3.style.display = "block";
		
				if(theform.keaction.value == "createnewaccount")
				{
					document.all.koreanform1.style.display = "block";			
					document.all.koreanform2.style.display = "block";			
				}
			}
		}	
	}
	//
	else if(natval!= "KOr" )
	{
		document.all.under14_1.style.display = "none";
		document.all.under14_2.style.display = "none";
		if(theform.addr_country.value == "KOr")
		{
			document.all.addrUSa1.style.display = "none";
			document.all.addrUSa2.style.display = "none";
			document.all.addrUSa3.style.display = "none";
			document.all.addrUSa4.style.display = "none";
	
			document.all.addrKOr1.style.display = "block";
			document.all.addrKOr2.style.display = "block";
			document.all.addrKOr3.style.display = "block";
	
			document.all.addrElse1.style.display = "none";
			document.all.addrElse2.style.display = "none";
			document.all.addrElse3.style.display = "none";
		
			if(theform.keaction.value == "createnewaccount")
			{
				document.all.koreanform1.style.display = "none";			
				document.all.koreanform2.style.display = "none";			
			}
			if (age<14 && natval == "KOr")  
			{
				alert("Please input the junior member additional information")
				document.all.under14_1.style.display = "block";
				document.all.under14_2.style.display = "block";
			}
			else
			{
				document.all.under14_1.style.display = "none";
				document.all.under14_2.style.display = "none";
			}	
		}
		else
		{
			if(theform.addr_country.value== "USa"  ||theform.addr_country.value=="CAa"||theform.addr_country.value=="BRa")
			{
				document.all.addrUSa1.style.display = "block";
				document.all.addrUSa2.style.display = "block";
				document.all.addrUSa3.style.display = "block";
				document.all.addrUSa4.style.display = "block";
		
				document.all.addrKOr1.style.display = "none";
				document.all.addrKOr2.style.display = "none";
				document.all.addrKOr3.style.display = "none";

				document.all.addrElse1.style.display = "none";
				document.all.addrElse2.style.display = "none";
				document.all.addrElse3.style.display = "none";
			}
			else
			{
				document.all.addrUSa1.style.display = "none";
				document.all.addrUSa2.style.display = "none";
				document.all.addrUSa3.style.display = "none";
				document.all.addrUSa4.style.display = "none";
	
				document.all.addrKOr1.style.display = "none";
				document.all.addrKOr2.style.display = "none";
				document.all.addrKOr3.style.display = "none";
	
				document.all.addrElse1.style.display = "block";
				document.all.addrElse2.style.display = "block";
				document.all.addrElse3.style.display = "block";
		
				if(theform.keaction.value == "createnewaccount")
				{
					document.all.koreanform1.style.display = "none";			
					document.all.koreanform2.style.display = "none";			
				}
			}
		}	
	}
	//
	else
	{
		if(theform.addr_country.value == "USa" || theform.addr_country.value == "CAa"|| theform.addr_country.value == "BRa")
		{ 
		document.all.addrUSa1.style.display = "block";
		document.all.addrUSa2.style.display = "block";
		document.all.addrUSa3.style.display = "block";
		document.all.addrUSa4.style.display = "block";
	
		document.all.addrKOr1.style.display = "none";
		document.all.addrKOr2.style.display = "none";
		document.all.addrKOr3.style.display = "none";
	
		document.all.addrElse1.style.display = "none";
		document.all.addrElse2.style.display = "none";
		document.all.addrElse3.style.display = "none";		
		}
		else
		{
		document.all.addrUSa1.style.display = "none";
		document.all.addrUSa2.style.display = "none";
		document.all.addrUSa3.style.display = "none";
		document.all.addrUSa4.style.display = "none";
	
		document.all.addrKOr1.style.display = "none";
		document.all.addrKOr2.style.display = "none";
		document.all.addrKOr3.style.display = "none";
	
		document.all.addrElse1.style.display = "block";
		document.all.addrElse2.style.display = "block";
		document.all.addrElse3.style.display = "block";		
		}
		if(theform.keaction.value == "createnewaccount")
		{
		document.all.koreanform1.style.display = "none";			
		document.all.koreanform2.style.display = "none";			
		}
	}
}

function checkAge(theform)
{
	var time=new Date();
	var year=time.getYear();
	var age;
		
	if (year < 2000)
	{    // Y2K Fix, Isaac Powell
		year = year + 1900; // http://onyx.idbsu.edu/~ipowell		
	}
	age = year - theform.birthdayyyyy.value ;	
	var natval;
	natval=theform.nationality.value;

	if (age<14 && natval == "KOr")  
	{
		alert("주니어 멤버 추가 정보를 입력하십시오.")
		document.all.under14_1.style.display = "block";
		document.all.under14_2.style.display = "block";
	}
	else
	{
		document.all.under14_1.style.display = "none";
		document.all.under14_2.style.display = "none";
	}
}


function sel1970()
{
	var i;
	i=0;
	for(i=0;i<document.f1.birthdayyyyy.options.length;i++)
	{
		if(document.f1.birthdayyyyy.options[0].selected == true)
		{
			if(document.f1.birthdayyyyy.options[i].value == 1970 )
			{
			document.f1.birthdayyyyy.options[i].selected = true;
			}
		}
	}
}
function checkBirthDate(theform)
{
    alert("등록 후에는 생년월일을 수정할 수 없습니다.");
    theform.birthdaymm.value = theform.PreBirthMonth.value;
    theform.birthdaydd.value   = theform.PreBirthDay.value;
    theform.birthdayyyyy.value  = theform.PreBirthYear.value;
    return;        
}

function upper(obj,str){
	obj.value = obj.value.toUpperCase();
}
function onlyNumber2(loc) {
	if(/[^0123456789]/g.test(loc.value)) {
		alert("숫자만 입력하십시오.");
		loc.value = "";
		loc.focus();
	}
}

function	is_num( str )		
{
	if( str >= '0' && str <= '9' )
		return true;
		
	return false;
}
function	are_num( str )
{
	var	pos;

	for( pos = 0; pos < str.length; pos++ )
	{
		if( is_num( str.charAt(pos) ) != true ) break;
	}

	if( pos == str.length )
		return true;

	return false;
}

function	compare_id_pass( str1, str2 )
{
	var	pos1;
	var	pos2;
	
	for( pos1 = 0; pos1 < str1.length; pos1++ )
	{
		for( pos2 = 0; pos2 < str2.length; pos2++ )
		{
			if( str1.charAt(pos1).indexOf(str2.charAt(pos2))>-1 && (pos1 < str1.length-2) && (pos2 < str2.length-2))
			{
				if( str1.charAt(pos1+1).indexOf(str2.charAt(pos2+1))>-1 )
				{
					if( str1.charAt(pos1+2).indexOf(str2.charAt(pos2+2))>-1) 
					{
						return false;
					}
				}
			}
		}
	}

	if( pos1 == str1.length )
		return true;
}
function zipPop()
{
	window.open("http://www.koreanair.com/global/bl/mp/mp_zipCode.jsp","zippop","width=540,height=300, scrollbars=yes");
}
function isEmail(theForm)
{
	var s = theForm.EMAIL0.value+"@"+theForm.EMAIL1.value;
	if(s.search(/^\s*[\w\~\-\.]+\@[\w\~\-]+(\.[\w\~\-]+)+\s*$/g)>=0)
	{
	}else
	{
		alert("이메일 주소 오류");
		theForm.EMAIL0.focus()
	}
}
function validateform(theform)
{

		if (!isValidStringType1(theform.username.value))
		{
		   alert("특수문자는 사용할 수 없습니다.");
			theform.username.focus();
			return false;
		}  
		
		if (theform.password.value.length < 6 || theform.password.value.length >10)
		{ 
			alert("비밀번호는 6-10자리까지 가능합니다.");
			theform.password.focus();
			return false;
		} 

		if (!isValidStringType1(theform.password.value))
		{
			alert("특수문자는 사용할 수 없습니다." + theform.password.value);
			theform.password.focus();
			return false;
		}

		if (isEmpty(theform.confirmpassword.value))
		{ 
			 alert("비밀번호는 6-10자리까지 가능합니다.");
			 theform.confirmpassword.focus();
		     return false;
		} 

		if (theform.password.value != theform.confirmpassword.value)
		{ 
			alert("비밀번호 확인 실패. 다시 입력하십시오.");
			theform.confirmpassword.focus();
			return false;
		}
	// 2005.05.30 New Password check start	- ok 

		if(theform.username.value.toUpperCase() == theform.password.value.toUpperCase())
		{
			alert("패스워드는 아이디와 3자리 이상의 동일한 문자열을 사용하실 수 없습니다. 다시 입력하십시오.");
			theform.password.focus();
			return false;
		}
		if(are_num(theform.password.value))
		{
			alert("패스워드는 최소 한 자 이상의 알파벳을 포함하고 있어야 합니다. 다시 입력하십시오.");
			theform.password.focus();
			return false;
		}
		if(!are_same_num(theform.password.value))
		{
			alert("패스워드에는 3회 연속 동일한 문자를 사용하실 수 없습니다. 다시 입력하십시오.");
			theform.password.focus();
			return false;
		}
		if(!compare_id_pass( theform.username.value.toUpperCase(), theform.password.value.toUpperCase()))
		{
			alert("패스워드는 아이디와 3자리 이상의 동일한 문자열을 사용하실 수 없습니다. 다시 입력하십시오.");
			theform.password.focus();
			return false;
		}
	if((theform.firstname.value.length+theform.lastname.value.length)>22)
	{
		alert("성명은 22자리 까지 가능합니다.");
		theform.firstname.focus();
		return false;
	}
		if(!isEmpty(theform.TELEPHONE0.value) && !isEmpty(theform.TELEPHONE1.value) && !isEmpty(theform.TELEPHONE2.value))
		{
			var tempphone;
			tempphone = theform.TELEPHONE0.value + theform.TELEPHONE1.value + theform.TELEPHONE2.value;

			if(!compare_id_pass( tempphone ,  theform.password.value.toUpperCase()))
			{
				alert("패스워드는 전화번호와 3자리 이상의 동일한 문자열을 사용하실 수 없습니다. 다시 입력하십시오.");
				theform.password.focus();
				return false;
			}
		}	
		if(!isEmpty(theform.HAND_PHONE0.value) && !isEmpty(theform.HAND_PHONE1.value) && !isEmpty(theform.HAND_PHONE2.value))
		{
			var temphphone;
			temphphone = theform.HAND_PHONE0.value + theform.HAND_PHONE1.value + theform.HAND_PHONE2.value;

			if(!compare_id_pass( temphphone ,  theform.password.value.toUpperCase()))
			{
				alert("패스워드는 전화번호와 3자리 이상의 동일한 문자열을 사용하실 수 없습니다. 다시 입력하십시오.");
				theform.password.focus();
				return false;
			}
		}
		if(!isEmpty(theform.resno1.value) && !isEmpty(theform.resno2.value))
		{
			var tempres;
			tempres = theform.resno1.value + theform.resno2.value;

			if(!compare_id_pass( tempres ,  theform.password.value.toUpperCase()))
			{
				alert("패스워드는 주민등록번호와 3자리 이상의 동일한 문자열을 사용하실 수 없습니다. 다시 입력하십시오.");
				theform.password.focus();
				return false;
			}
		}
	if( !isEng(theform.firstname.value))
	{
		alert("이름-영어 알파벳 (최대 20) 필요");
		theform.firstname.focus();
        return false;	
	}	
	if (isEmpty(theform.firstname.value))
	{ 
		alert("이름-영어 알파벳 (최대 20) 필요");
		theform.firstname.focus();
        return false;
	} 
	if (theform.firstname.value.length < 1 || theform.firstname.value.length > 20)
	{ 
		alert("이름-영어 알파벳 (최대 20) 필요");
		theform.firstname.focus();
        return false;
	}
		if( !isEng(theform.lastname.value))
	{
		alert("성-영어 알파벳 (최대 30) 필요");
		theform.lastname.focus();
        return false;	
	}			
	if (isEmpty(theform.lastname.value))
	{ 
		allvalid = 0;
		alert("성-영어 알파벳 (최대 30) 필요");
		theform.lastname.focus();
        return false;
	} 
	if (theform.lastname.value.length <= 1 || theform.lastname.value.length > 30)
	{ 
		alert("성-영어 알파벳 (최대 30) 필요");
		theform.lastname.focus();
        return false;
	}
	if (isEmpty(theform.birthdaymm.value))
	{ 
		alert("생년월일 오류 - 월");
		theform.birthdaymm.focus();
        return false;
	}
	
	if (isEmpty(theform.birthdaydd.value))
	{ 
		alert("생년월일 오류 - 일");
		theform.birthdaydd.focus();
        return false;
	}
	
	if (isEmpty(theform.birthdayyyyy.value))
	{ 
		alert("생년월일 오류 - 연도");
		theform.birthdayyyyy.focus();
        return false;
	}	
//	nationality
	if (theform.nationality.value == "KOr" && theform.addr_country.value == "KOr")
	{
		if(isEmpty(theform.koreanname.value))
		{
			alert("한국 성명 오류");
			theform.koreanname.focus();
			return false;		
		}
		if(isEmpty(theform.resno1.value))
		{
			alert("주민등록번호 오류");
			theform.resno1.focus();
			return false;		
		}
		if(isEmpty(theform.resno2.value))
		{
			alert("주민등록번호 오류");
			theform.resno2.focus();
			return false;		
		}		
	}	
	if (theform.addr_country.value == "KOr")
	{
		if(isEmpty(theform.KOR_ADDRESS_ZIP1.value))
		{
			alert("우편번호 오류");
			theform.KOR_ADDRESS_ZIP1.focus();
			return false;		
		}	
		if(isEmpty(theform.KOR_ADDRESS_ZIP2.value))
		{
			alert("우편번호 오류");
			theform.KOR_ADDRESS_ZIP2.focus();
			return false;		
		}				
		if(isEmpty(theform.KOR_ADDRESS0.value))
		{
			alert("주소 오류");
			theform.KOR_ADDRESS0.focus();
			return false;		
		}	
		if(isEmpty(theform.KOR_ADDRESS1.value))
		{
			alert("주소 오류");
			theform.KOR_ADDRESS1.focus();
			return false;		
		}
		if((getStrLen(theform.KOR_ADDRESS0.value)+getStrLen(theform.KOR_ADDRESS1.value))>85)
		{
			alert("주소 오류, 한글주소는 42자까지 입력할 수 있습니다.");
			theform.KOR_ADDRESS0.focus();
			return false;
		}
	}	
	else if	(theform.addr_country.value == "USa" || theform.addr_country.value == "CAa"|| theform.addr_country.value == "BRa")
	{
		if(isEmpty(theform.USA_ADDRESS_ZIP.value))
		{
			alert("우편번호 오류");
			theform.USA_ADDRESS_ZIP.focus();
			return false;		
		}	
		if(isEmpty(theform.USA_ADDRESS1.value))
		{
			alert("주소 오류");
			theform.USA_ADDRESS1.focus();
			return false;		
		}	
		if(isEmpty(theform.USA_ADDRESS_CITY.value))
		{
			alert("주소 오류 - 도시");
			theform.USA_ADDRESS_CITY.focus();
			return false;		
		}				
		if(isEmpty(theform.addr_state.value))
		{
			alert("주소 오류 - 주");
			theform.addr_state.focus();
			return false;		
		}						
	}
	else
	{
		if(isEmpty(theform.addr_zip.value))
		{
			alert("우편번호 오류");
			theform.addr_zip.focus();
			return false;		
		}										
		if(isEmpty(theform.address1.value))
		{
			alert("주소 오류");
			theform.address1.focus();
			return false;		
		}							
		if(isEmpty(theform.addr_city.value))
		{
			alert("주소 오류 - 도시");
			theform.addr_city.focus();
			return false;		
		}									
	}
	if(getStrLen(theform.address1.value)>85)
	{
		alert("Invalid address, length limitation of address is to 85 characters.");
		theform.address1.focus();
		return false;
	}
	if(getStrLen(theform.USA_ADDRESS1.value)>85)
	{
		alert("Invalid address, length limitation of address is to 85 characters.");
		theform.USA_ADDRESS1.focus();
		return false;
	}
	if (isEmpty(theform.username.value))
	{ 
		alert("게스트 ID는 4-10자리까지 가능합니다.");
		theform.username.focus();
        return false;
	}

	if (theform.username.value.length < 4 || theform.username.value.length > 10) 
	{ 
		alert("게스트 ID는 4-10자리까지 가능합니다.");
		theform.username.focus();
        return false;
	} 

	if (isEmpty(theform.password.value))
	{ 
		alert("비밀번호는 6-10자리까지 가능합니다.");
		theform.password.focus();
        return false;
	}

	if (isEmpty(theform.EMAIL0.value))
	{ 
		alert("이메일 주소 오류");
		theform.EMAIL0.focus();
        return false;
	} 
	if (isEmpty(theform.EMAIL1.value))
	{ 
		alert("이메일 주소 오류");
		theform.EMAIL1.focus();
        return false;
	} 	
	if(theform.emailnotify.checked) {
			theform.emailnotify.value = "on";
	} else {
			theform.emailnotify.value = "";
	}
           
  if(isEmpty(theform.TELEPHONE0.value))
	{
        alert("전화번호를 입력하십시오!");
        theform.TELEPHONE0.focus();
        return false;
  }
  if(isEmpty(theform.TELEPHONE1.value))
	{
        alert("전화번호를 입력하십시오!");
        theform.TELEPHONE1.focus();
        return false;
  }
  if(isEmpty(theform.TELEPHONE2.value))
	{
        alert("전화번호를 입력하십시오!");
        theform.TELEPHONE2.focus();
        return false;
  }			
	if (theform.keaction.value == "createnewaccount" && theform.agreecheck.checked == false)
	{ 
			alert("약관을 읽고 내용을 확인하십시오.");
			theform.agreecheck.focus();
			return false;
	} 	
	
	theform.submit();
}
function ValidatedChar(inString)
{

	if (inString.length < 4)
	{
		alert("게스트 ID는 4-10자리까지 가능합니다.");
		return false;
	}
	if (inString.length > 10)
	{
		alert("게스트 ID는 4-10자리까지 가능합니다.");
		return false;
	}

   if (!isValidStringType1(inString))
   {
	   alert("특수문자는 사용할 수 없습니다.");
	   return false;
   }

	window.open('http://www.koreanair.com/global/gp/kor/ft/mb/mp_checkID.jsp?username=' + 
	document.forms[0].username.value,'','width=400,height=200,top=250,left=300');

    return true;
}
function checkHangul(val,obj)
{
	if(!isEng(val))
	{
		var thename;
		thename = eval("document.f1."+obj);
		 	
		alert("주소 - 영어 알파벳 필요");
		thename.value = "";
		thename.focus();
	}
}
