
function win_open(url, name, option)
{
	var popup = window.open(url, name, option);
	popup.focus();
}

// ¿ìÆí¹øÈ£ Ã¢
function zipCode(gubun)
{
	url = "/popup/post_search.php?gubun="+gubun;
	win_open(url, "zipCode", "left=50,top=50,width=420,height=393,scrollbars=1");
}

// ¾ÆÀÌµðÁßº¹È®ÀÎ
function idCheck(gubun, strId)
{
	url = "/popup/id_check.php?gubun="+gubun+"&strId="+strId;
	win_open(url, "idCheck", "left=50,top=50,width=420,height=393,scrollbars=1");
}

// ¾ÆÀÌµðÁßº¹È®ÀÎ
function idCheckEng(gubun, strId)
{
	url = "/eng/popup/id_check.php?gubun="+gubun+"&strId="+strId;
	win_open(url, "idCheck", "left=50,top=50,width=420,height=393,scrollbars=1");
}

// ¼ýÀÚ ÀÌ¿ÜÀÇ Ä³¸¯ÅÍ°¡ ÀÖÀ»°æ¿ì false
function checkDigitOnly( str ) {

	if ( str == null ) return false ;

	for(var i=0;i<str.length;i++){
	   var c=str.charCodeAt(i);
	   if( !(  0x30 <= c && c <= 0x39 ) ) {
		return false ;
	   }
	 }
	return true ;

}

// ¿µ¹® ÀÌ¿ÜÀÇ Ä³¸¯ÅÍ°¡ ÀÖÀ»°æ¿ì false
function checkEnglishOnly( str ) {

    if ( str == null ) return false ;

    for( var i=0; i < str.length;i++){
       var c=str.charCodeAt(i);
       if( !( (  0x61 <= c && c <= 0x7A ) || ( 0x41 <= c && c <= 0x5A ) ) ) {
        return false ;
       }
     }
    return true ;

}

function checkInutId( str) {
	if(str == null ) return false;

    for( var i=0; i < str.length;i++){
       var c=str.charCodeAt(i);
       if( !( (  0x61 <= c && c <= 0x7A ) ||  ( 0x41 <= c && c <= 0x5A ) ) && !(  0x30 <= c && c <= 0x39 ) ) {
        return false ;
       }
     }
    return true ;
}

function email_chk(str){
	if(str == "")	return false;
	var i = str.indexOf("@");
	if(i < 0)	return false;
	i = str.indexOf(".");
	if(i < 0)	return false;

	return true;

}

//process_info_company.php ¿¡¼­ Ã·ºÎÆÄÀÏ Ãß°¡.
//consulting/consulting_write.php ¿¡¼­ Ã·ºÎÆÄÀÏ Ãß°¡.
function add_file(frm){

	var fileCnt = frm.fileCnt.value;
	if(!fileCnt ) fileCnt = 1;
	frm.fileCnt.value = fileCnt;

	if(fileCnt ==5  ) {
		alert(fileCnt+"°³ ±îÁö¸¸ ÆÄÀÏ ¾÷·Îµå°¡ °¡´ÉÇÕ´Ï´Ù.");
		return;
	}

	var objTbl;
	var objRow;
	var objCell;
	if (document.getElementById)
		objTbl = document.getElementById("variableFiles");
	else
		objTbl = document.all["variableFiles"];

	objRow = objTbl.insertRow(objTbl.rows.length);
	objCell = objRow.insertCell(0);

	objCell.innerHTML = "<input type='file'  name='bf_file[]' class='inputFile wid460'>";

	fileCnt++;

	frm.fileCnt.value = fileCnt;

}
//process_info_company.php ¿¡¼­ Ã·ºÎÆÄÀÏ »èÁ¦.
//consulting/consulting_write.php ¿¡¼­ Ã·ºÎÆÄÀÏ »èÁ¦.
function del_file(frm, inja)
{
	var fileCnt = frm.fileCnt.value;
	if(inja == 0 ) { inja = 1;}
	if(fileCnt == inja) {
		alert('´õÀÌ»ó »èÁ¦ÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.');
	}
	else {
		var objTbl = document.getElementById("variableFiles");
		objTbl.deleteRow(objTbl.rows.length - 1);
		fileCnt--;
		frm.fileCnt.value = fileCnt;
	}
}

/*************************************************************************/
//ÄíÅ°°ü·Ã
function setCookie (name, value, expiredays)
{
 var todayDate = new Date();
 todayDate.setDate( todayDate.getDate() + expiredays );
 document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() +";";
}

function getCookie(name)
{
 var Found = false;
 var start, end;
 var i = 0;

 while (i <= document.cookie.length)
 {
  start = i;
  end = start + name.length;
  if (document.cookie.substring(start, end) == name)
  {
   Found = true;
   break;
  }
  i++;
 }

 if (Found == true)
 {
  start = end + 1;
  end = document.cookie.indexOf(';', start);
  if (end < start) end = document.cookie.length;
  return document.cookie.substring(start, end);
 }
 return '';
}

function setValue()
{
 var fm = document.memberLogin;
 setCookie ('id', fm.id.value, 1);
}

function getValue()
{
 var fm = document.memberLogin;
 fm.id.value = getCookie('id');
}



//¹ÙÀÌÆ® ¼ö Ã¼Å©
function calculateBytes(str)
{
  var tcount = 0;
  var tmpStr = new String(str);
  var temp = tmpStr.length;
  var onechar;
  for ( k=0; k<temp; k++ )
  {
    onechar = tmpStr.charAt(k);
    if (escape(onechar).length > 4)
    {
      tcount += 2;
    }
    else
    {
      tcount += 1;
    }
  }
  return tcount;
}

//°ø¹éÁ¦°Å
function trim(str)
{
 return str.replace(/(^\s*)|(\s*$)/g, "");
}


