// JavaScript Document
function menuOn(imgEl) {
	imgEl.src = imgEl.src.replace("_off.gif", "_on.gif");
}

function menuOut(imgEl) {
	imgEl.src = imgEl.src.replace("_on.gif", "_off.gif");
}

//팝업스크립트
function popup(address, content) {
 popUpWin = window.open(address,'',content);
}

//팝업이름스크립트
function popupname(address,popupname,content) {
 popUpWin = window.open(address,popupname,content);
}

//팝업이름스크립트
function popup_ykbnc(address,popupname,top,left,height,width,scroll) {
	var opt = "width=" + width + ",height="+ height +",top="+ top +",left="+ left +",location:no,toolbar=no,scrollbars="+ scroll +",menubar=no,status=no,resizable=no";
	popupname = window.open(address,popupname,opt);
	popupname.focus();
}

//플래시 스크립트

function openflash(width,height,src){ 
    return "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width="+width+" height="+height+"><param name=movie value="+src+"><param name=quality value=high ><PARAM NAME=wmode VALUE=transparent><embed src="+src+" quality=high  pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width="+width+" height="+height+"></embed></object>"; 
} 

function writeflash(src){ 
    document.write(src); 
} 

/*
* 입력받을 수 있는 값을 필터링한다.
* ex : <input type="text" ..... onkeypress="filterKey('[0-9]')"> ; 숫자만 키입력이 가능한 text filed
* ex : <input type="text" ..... onkeypress="filterKey('[0-9a-zA-Z]')"> ; 영문,숫자만 키입력이 가능한 text filed
* @create 2004-07-28
* @param filter : 필터링할 정규표현식 ex) '[0-9]':0~9의 값만 허용, '[a-zA-Z]':알파벳만 허용
* @return 
* @browser IE6, NS7
*/
function filterKey(filter) {
	if(filter){
		var sKey = String.fromCharCode(event.keyCode);
		var re = new RegExp(filter);
		if(!re.test(sKey))
		{
			event.returnValue=false;
		}
	}
}

/** ============================================= 
Return : boolean 
Comment: 영문자/숫자만 입력했는지 체크한다. 
Usage : 
============================================= **/ 
function alpha_num_check(obj)
{
	str = obj.value; 
	len = str.length; 
	ch = str.charAt(0); 
	chk = 0;
	for(i = 0; i < len; i++) 
	{
		ch = str.charAt(i); 
		if( (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ) 
		{ 
			chk = chk + 0;
		} 
		else 
		{ 
			chk = chk + 1;
		} 
	}
	if (chk == 0)
	{
		return true; 
	}
	else
	{
		return false;
	}
}

function id_value(str)
{
    var chk;
    var chk2 = 0;
    var id_length = str.value.length;
    for(i = 0 ; i < id_length ; i++)
	{
        chk = str.value.charCodeAt(i)
        if((chk >= 65 && chk <= 90) || (chk >= 97 && chk <= 122) || (chk >= 48 && chk <= 57))
		{
		}
        else 
		{
			chk2++
		}
	}
	if(chk2 != 0)
	{
		alert('아이디에는 a~z , 0~9 만 입력할 수 있습니다.');
		str.focus();
	}
//    else if(id_length < 5)
//	{
//		alert('아이디는 최소 5자 이상입니다.');
//		str.focus();
//	}
}


// 2011.04.18 Edit by NeoSin
///////////////////////수정시작///////////////////////
//설명 : 아이디는 영문, 숫자 4자 이상 15자 이하만 가능합니다
function checkID(obj){
    var pattern = /(^[a-zA-Z0-9\-_]+$)/;
	tmpstr = obj.value;
/*    if(!pattern.test(tmpstr)){
		alert("아이디는 영문, 숫자만 가능합니다.");
		strlen = tmpstr.length -1;
		obj.value = tmpstr.substring(0, strlen);
    }*/
    if(tmpstr.length > 15)
	{
		alert('아이디는 4자 이상 15자 이하만 가능합니다.');
		strlen = tmpstr.length -1;
		obj.value = tmpstr.substring(0, strlen);
		obj.focus();
	}
}

//팝업이름스크립트
function popupname2(address,popupname,content) {
	tmpstr = member_form.member_id_old.value;
	
	if(member_form.member_id_old.value == "") {
		alert("\n아이디를 입력하십시오");
		member_form.member_id_old.focus();
		return false;
	}


	if(tmpstr.length < 4)
	{
		alert('아이디는 4자 이상 15자 이하만 가능합니다.');
		return false;
	}

 popUpWin = window.open(address,popupname,content);
}
///////////////////////수정종료///////////////////////
