//지사연락처안내 내용 보여주기/감추기 시작
var bb = 0;															//작동값을 초기화합니다. 0 보임 / 1 감춤

function viewBranch() {
		
	if(bb==0) {
		document.getElementById('BranchTelInfo').style.display = 'block'; // ID BranchTelInfo 의 DIV블록을 보입니다.
		//document.getElementById('BranchTelInfo').style.z-index = 50;
		bb = bb+1;														//초기값을 0 이외의 값으로 변경합니다.
		xLeft("BranchTelInfo", 570);
		xTop("BranchTelInfo", 110);
	}else{
		document.getElementById('BranchTelInfo').style.display = 'none';  // ID BranchTelInfo 의 DIV블록을 감춥니다.
		bb = bb-1;														//초기값을 1로 변경합니다.
	}
}

function xGetElementById(e)
{
  if(typeof(e)!='string') return e;
  if(document.getElementById) e=document.getElementById(e);
  else if(document.all) e=document.all[e];
  else e=null;
  return e;
}

function xDef()
{
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}
  return true;
}

function xStr(s)
{
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])!='string') return false;}
  return true;
}

function xNum()
{
  for(var i=0; i<arguments.length; ++i){if(isNaN(arguments[i]) || typeof(arguments[i])!='number') return false;}
  return true;
}

function xLeft(e, iX)
{
  if(!(e=xGetElementById(e))) return 0;
  var css=xDef(e.style);
  if (css && xStr(e.style.left)) {
    if(xNum(iX)) e.style.left=iX+'px';
    else {
      iX=parseInt(e.style.left);
      if(isNaN(iX)) iX=0;
    }
  }
  else if(css && xDef(e.style.pixelLeft)) {
    if(xNum(iX)) e.style.pixelLeft=iX;
    else iX=e.style.pixelLeft;
  }
  return iX;
}

function xTop(e, iY)
{
  if(!(e=xGetElementById(e))) return 0;
  var css=xDef(e.style);
  if(css && xStr(e.style.top)) {
    if(xNum(iY)) e.style.top=iY+'px';
    else {
      iY=parseInt(e.style.top);
      if(isNaN(iY)) iY=0;
    }
  }
  else if(css && xDef(e.style.pixelTop)) {
    if(xNum(iY)) e.style.pixelTop=iY;
    else iY=e.style.pixelTop;
  }
  return iY;
}
//지사연락처안내 내용 보여주기/감추기 끝



function hasonlystring(checkstr,validString) {
	ThisString = checkstr;
	for(var i=0;i<ThisString.length;i++) {
		if(validString.indexOf(ThisString.charAt(i)) == -1)
			return false;
	}
	return true;
}

function checkSpace( str ){	
	if(str.search(/\s/) != -1)
	{		
		return true;	
	}
	
	else
	{
		return false;	
	}
}

function Ncheck(obj){
	var num="0123456789";
	var cnt_chk=0;
	for (var i=0;i< obj.value.length;i++){
		if (-1 == num.indexOf(obj.value.charAt(i))){
			cnt_chk += 1;
		}
	}
	if(cnt_chk > 0){
		return false;
	}
	else{
		return true;
	}
}

function isNotChar(id_text){
	var nonchar = '~`!@#$%^&*()-_=+\|<>?,./;:"';
	var numeric = ' ';
	var nonkorean = nonchar+numeric; 
		
	var i ; 
	for ( i=0; i < id_text.length; i++ )  {
		if( nonkorean.indexOf(id_text.substring(i,i+1)) > 0) {
			break ; 
		}
	}
	if ( i != id_text.length ) {
		return false ; 
	}
	else{
		return true ;
	} 

	return false;
}

function check_form(){
	
	if (document.mem_reg.f_name.value == "")	{
		alert("이름을 입력하세요.");
		document.mem_reg.f_name.focus();
		return;
	}
	if (document.mem_reg.tel2.value == ""){
		alert("전화번호를 입력하세요.");
		document.mem_reg.tel2.focus();
		return;
	}
	if (document.mem_reg.tel3.value == "")	{
		alert("전화번호를 입력하세요.");
		document.mem_reg.tel3.focus();
		return;
	}
	if(document.mem_reg.emailaddr1.value == "")
	{		
		alert("이메일 주소를 입력하세요.");		
		document.mem_reg.emailaddr1.focus();		
		return;	
	}
	if(document.mem_reg.emailaddr2.value == "")
	{		
		alert("이메일 주소를 입력하세요.");		
		document.mem_reg.emailaddr2.focus();		
		return;	
	}
	var emailaddr = document.mem_reg.emailaddr1.value+'@'+document.mem_reg.emailaddr2.value
	var retVal = checkSpace( emailaddr );	
	if( retVal != "")
	{		
		alert("이메일 주소를 빈공간 없이 넣으세요.");		
		document.mem_reg.emailaddr1.focus();		
		return;	
	}
	
	var isEmail = /[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+(\.[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+)*@[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+(\.[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+)*/;
	
	if( !isEmail.test(emailaddr) )
	{		
		alert("이메일 형식이 잘못 되었습니다.");		
		document.mem_reg.emailaddr1.focus();		
		return;	
	}	
	if( emailaddr.length > 40 )
	{		
		alert("이메일 주소는 40자까지 유효합니다.");		
		document.mem_reg.emailaddr1.focus();		
		return;	
	}

	if (document.mem_reg.zip1.value == "" || document.mem_reg.zip2.value == "")	{
		alert("우편번호를 입력하세요.");
		document.mem_reg.zip1.focus();
		return;
	}
	if (document.mem_reg.addr1.value == ""){
		alert("주소를 입력하세요.");
		document.mem_reg.addr1.focus();
		return;
	}
	if (document.mem_reg.addr2.value == ""){
		alert("나머지 주소를 입력하세요.");
		document.mem_reg.addr2.focus();
		return;
	}

	if (document.mem_reg.f_industry.value == "")	{
		alert("업종을 입력하세요.");
		document.mem_reg.f_industry.focus();
		return;
	}

	document.mem_reg.action = "apply_proc.asp"
	document.mem_reg.submit();
} 
