//Æ÷ÅÍ½ºÀÚµ¿ÀÌµ¿
function focus_move(s_fm,e_fm,len)
{
	if(s_fm.value.length>=len) e_fm.focus();
}


//ÄíÅ°Ã¼Å©
function getCookie(name) {

	var found = false;
	var start,end;

	for(i = 0; i <= document.cookie.length; i++)
	{
		start = i;
		end = start + name.length;
		if(document.cookie.substring(start,end) ==name)
		{
			found = true;
			break;
		}
	}

	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 pop_show()
{
	if(!getCookie('Not_pop'))
	{
		window.open('pop/pop.html','pop_3','left=0,top=0,width=400,height=350');
	}
}

//ºÎ¸ðÃ¢ ÆäÀÌÁöÀÌµ¿ÈÄ Ã¢´Ý±â
function close_location(url)
{
	opener.location.href=url;
	self.close();
}


//¾ÆÀÌµð°Ë»öÃ¢
function id_find_window(fm)
{
	if(fm.m_id.value=="")	 alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
	else if(fm.m_id.value.length<5)	 alert("¾ÆÀÌµð´Â 4ÀÚ¸®ÀÌ»óÀÔ´Ï´Ù.");
	else if(check_text_code(fm.m_id.value))	alert("¾ÆÀÌµð´Â ÇÑ±ÛÀ» »ç¿ëÇÒ¼ö ¾ø½À´Ï´Ù.");
	else
	{
		window.open('id_check.html?check_id='+fm.m_id.value,'id_window','width=300,height=140');
	}
}

//ÁÖ¼ÒÃ¢
function juso_find_window(fm)
{
	window.open('juso.html?post='+fm.m_post1.value+"-"+fm.m_post2.value,'juso_window','width=440,height=200');
}

///ÁÖ¼ÒÀÔ·Â
function set_addr(pos_num,add_num)
{
	opener.write_form.m_post1.value=pos_num.substr(0,3);
	opener.write_form.m_post2.value=pos_num.substr(4,3);
	opener.write_form.m_addr.value=add_num;
	self.close();
}


function check_text_code(str)
{
	check_code=0;
	for(rof=0;rof<str.length;rof++)
	{
		if(str.charCodeAt(rof)>255)	check_code=1;
	}
	if(check_code==0)
		return 0;
	else
		return 1;
}

function byte_check(fm)
{
	text_data="";
	data=fm.b_title.value;
	tot_text_len=0;
	for(rof=0;rof<data.length;rof++)
	{
		if(data.charCodeAt(rof)>255)	tot_text_len++;
		tot_text_len++;

		if(tot_text_len>50)
		{
			alert("80Byte ÀÌ»ó±â·ÏºÒ°¡´ÉÇÕ´Ï´Ù.");
			fm.b_title.value=text_data;
			tot_text_len=tot_text_len-1;
			if(data.charCodeAt(rof)>255)	tot_text_len--;
			break;
		}
		text_data+=data.charAt(rof);
	}
	sign_size.innerHTML=tot_text_len;
}

//ÀÏ¹Ý ¼ýÀÚ¸¦ °¡°ÝÇü½ÄÀ¸·Î Ç¥Çö
function number_money(ibox,p_key)
{
	box_data=ibox.value;
	if(p_key<48||p_key>57)
	{
		ibox.value=box_data;
		return false;
	}
	else
	{
		key_data=String.fromCharCode(p_key);
		box_data=box_data+key_data;

		ibox.value=number_seting(box_data);
		return false;
	}
}
//¼ýÀÚ¸¸ ¹ÞÀ½
function number_format(ibox,p_key)
{
	box_data=ibox.value;
	if(p_key<48||p_key>57)
	{
		ibox.value=box_data;
		return false;
	}
	else
	{
		key_data=String.fromCharCode(p_key);
		box_data=box_data+key_data;
		ibox.value=box_data;
		return false;
	}
}

function jumin_check(jumin)
{
	pos_num=0;
	chk_num=0;
	for(rof=2;rof<10;rof++)
	{
		chk_num=chk_num+(jumin.substr(pos_num,1)*rof);
		pos_num++;
	}
	for(rof=2;rof<6;rof++)
	{
		chk_num=chk_num+(jumin.substr(pos_num,1)*rof);
		pos_num++;
	}
	chkis=11-(chk_num%11);
	if(chkis>9)	chkis-=10;

	if(chkis==jumin.substr(12,1))
		return 1;
	else
		return 0;
}

//ºñ¹Ð¹øÈ£ ÀÔ·ÂÃ¢
function password_change_window()
{
	window.open('passwd_change.html','password_window','width=300,height=200');
}

//¹ÙÀÌÆ®Ã¼Å©(»çÀÎº¸µå¿ë)
function byte_check_write_box(fm)
{
	text_data="";
	data=fm.sms_text.value;
	tot_text_len=0;
	for(rof=0;rof<data.length;rof++)
	{
		if(data.charCodeAt(rof)>255)	tot_text_len++;
		tot_text_len++;

		if(tot_text_len>80)
		{
			alert("80Byte ÀÌ»ó±â·ÏºÒ°¡´ÉÇÕ´Ï´Ù.");
			fm.sms_text.value=text_data;
			tot_text_len=tot_text_len-1;
			if(data.charCodeAt(rof)>255)	tot_text_len--;
			break;
		}
		text_data+=data.charAt(rof);
	}
}

//¹ÙÀÌÆ®Ã¼Å©(»çÀÎº¸µå¿ë)
function byte_check(fm)
{
	text_data="";
	data=fm.b_title.value;
	tot_text_len=0;
	for(rof=0;rof<data.length;rof++)
	{
		if(data.charCodeAt(rof)>255)	tot_text_len++;
		tot_text_len++;

		if(tot_text_len>80)
		{
			alert("80Byte ÀÌ»ó±â·ÏºÒ°¡´ÉÇÕ´Ï´Ù.");
			fm.b_title.value=text_data;
			tot_text_len=tot_text_len-1;
			if(data.charCodeAt(rof)>255)	tot_text_len--;
			break;
		}
		text_data+=data.charAt(rof);
	}
	sign_size.innerHTML=tot_text_len;
}


//¼ýÀÚ¸¦ ,·Î  º¯Çü
function number_seting(numbers_text)
{
	if(numbers_text=="") return 0;
	count=1;
	set_num="";

	numbers=pro_replace(numbers_text,",","");

	numbers=eval(numbers);
	numbers=numbers.toString();

	all_len=numbers.length;
	for(rof=all_len-1;rof>-1;rof--)
	{
		set_num=numbers.substr(rof,1)+set_num;
//		if(count%3==0&&rof!=0) set_num=","+set_num;
		count++;
	}
	return set_num;
}
//¹®ÀÚ º¯°æ
function pro_replace(str,org,cop)
{
	str_data="";
	if(str!="")
	{
		str_len=str.length;
		for(rof=0;rof<str_len;rof++)
		{
			if(str.substr(rof,1)==org) str_data=str_data+cop;
			else str_data=str_data+str.substr(rof,1);
		}
	}
	return str_data;
}

//´Ù¿î·Îµå½Ã Ä«¿îÅÍ Ã¼Å©
function Download_file_down_counts(nums)
{
	counts_check_box.innerHTML="<iframe src='download_counts_up.html?num="+nums+" width='0' height='0''></iframe>";
}

//ÆÐ¹Ð¸®»çÀÌÆ®ÀÌµ¿
function family_site_move(urls)
{
	if(urls)
		window.open(urls,'_blank');
}