function aeClass(name,event,fn)
{
	$("." + name).bind(event, eval(fn)).css({cursor : "pointer"}) ;
	
}

function aeClassNonCursor(name,event,fn)
{
	$("." + name).bind(event, eval(fn)) ;
}

function iNumber()
{		
	var number = $(this).val() ;		
	if(number != "")
	{
		if(!isNumber(number))
		{
			alert('숫자만 기입하여 주십시요.') ;			
			$(this).val('').focus();
			return ;
		}
	}		
}

/*************************************************************************
   함수명 : containsCharsOnly
   기  능 : 특정문자가 존재하는지 체크
   인  수 : input, chars - 객체, 찾고자하는 문자
   리턴값 : 존재하면 true
**************************************************************************/
function containsCharsOnly(input,chars) {
    for (var inx = 0; inx < input.length; inx++) {
       if (chars.indexOf(input.charAt(inx)) == -1)
           return false;
    }
    return true;
}

/*************************************************************************
   함수명 : isNumber
   기  능 : 입력값이 숫자인지를 체크
   인  수 : input - 입력값
   리턴값 :
**************************************************************************/
function isNumber(input) {
    var chars = "0123456789.";
    if(input == "") return false;
    return containsCharsOnly(input,chars);
}

function focusMove()
{

	if($(this).val().length >= $(this).attr("maxlength"))
			 $(this).next().focus() ;		
}

function iCheckChar()
{
	var value = $(this).val() ; 
	if(value != "")
	{
		if(!checkChars(value))
		{
			alert('띄어쓰기 없이 영문,숫자,특수문자(_)만 사용 가능합니다.') ;			
			$(this).val('').focus();
			return ;
		}
	}
}

function checkChars( message )
{

    for ( var i=0; i<message.length; i++ )
    {
        var c = message.charAt(i);
		if(c.search(/[0-9|a-z|A-Z|_]/) == -1) 
			return false ;
        if( escape(c).length == 3 ) // 특수문자일 경우...
        {
            return false;
        }
    }
	/*
	var str = message;

	for (var i=0; i < str.length; i++) { 
		ch_char = str .charAt(i);
		ch = ch_char.charCodeAt();
		if( (ch >= 33 && ch <= 47) || (ch >= 58 && ch <= 64) || (ch >= 91 && ch <= 96) || (ch >= 123 && ch <= 126) ) {
			return false;
		}
	}
	*/



    return true;
}


// 링크 외곽선 없에기
function bluring(){ 
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); 
} 
document.onfocusin=bluring; 

// 플래쉬 사용
function defSwf(swfSrc,swfW,swfH)
{
//swfSrc=escape(swfSrc);
//swfSrc=ReplaceStr(swfSrc," & ",escape(" & "));

var src = '<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" WIDTH="'+swfW+'" HEIGHT="'+ swfH +'" VIEWASTEXT>'
+ '<PARAM NAME="movie" VALUE="'+ swfSrc + '">'
+ '<PARAM NAME="quality" VALUE="high">'
+ '<param name="wmode" value="transparent">'
+ '<EMBED SRC="'+ swfSrc + '" wmode="transparent" QUALITY="high" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" TYPE="application/x-shockwave-flash" WIDTH="'+ swfW +'" HEIGHT="'+ swfH +'"></EMBED>'
+ '</OBJECT>'

document.write(src);


}

//아이프레임 자동 리사이징
function reSize() {
    try {
        var objBody = auto_iframe.document.body;
        var objFrame = document.all["auto_iframe"];
        ifrmHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
        objFrame.style.height = ifrmHeight;
    }
        catch(e) {}
}

function init_iframe() {
    reSize();
    setTimeout('init_iframe()',1) ;
}

init_iframe();

function s_reSize() {
    try {
        var objBody = s_auto_iframe.document.body;
        var objFrame = document.all["s_auto_iframe"];
        ifrmHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
        objFrame.style.height = ifrmHeight;
    }
        catch(e) {}
}

function s_init_iframe() {
    reSize();
    setTimeout('s_init_iframe()',1) ;
}
s_init_iframe();


function popup(theURL,winName,width,height) { //v2.0

Left = (screen.availWidth - width) / 2 ;
Top  = (screen.availHeight - height) / 2 ;
window.open(''+theURL+'',winName,'width='+width+',height='+height+',left=500,top=180,scrollbars=yes') ;
}
function popup2(theURL,winName,width,height) { //v2.0

Left = (screen.availWidth - width) / 4 ;
Top  = (screen.availHeight - height) / 4 ;
window.open(''+theURL+'',winName,'width='+width+',height='+height+',left=50,top=180,scrollbars=yes') ;
}
function popup3(theURL,winName,width,height) { //v2.0

Left = (screen.availWidth - width) / 1.5 ;
Top  = (screen.availHeight - height) / 4 ;
window.open(''+theURL+'',winName,'width='+width+',height='+height+',left=' + Left + ',top=' + Top + ',scrollbars=yes') ;
}
function getCookie( name )
{
	  var nameOfCookie = name + "=";
	  var x = 0;
	  while ( x <= document.cookie.length )
	  {
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie )
		{
		  if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
			endOfCookie = document.cookie.length;
		  return unescape( document.cookie.substring( y, endOfCookie ) );
		}
		x = document.cookie.indexOf( " ", x ) + 1;
		if ( x == 0 )
		break;
	  }
	  return "";
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//주민등록번호 유효성 검사
function isIdentifyNo(sID){

   if (sID == null || sID == '')
   {
		return false; 
   }
   if (sID.length != 13) 
   {
		return false;
   }

   if (isNaN(sID)) return false;  //sID가 숫자가 아닐겨우 return

    if  (sID.charAt(6) <= "4"){          //내국인     
        cBit = 0;
        sCode="234567892345";
        for(i=0;i<12;i++)   {
            cBit = cBit+parseInt(sID.substring(i,i+1))*parseInt(sCode.substring(i,i+1));
        }    
        cBit=11-(cBit%11);
        cBit=cBit%10;
   
        if(parseInt(sID.substring(12,13))==cBit) 
		  {
				   return true;
		  }
				else
		  {
				  return false;
		  }
    }else{                       //외국인

		return false ; 
         if   ((sID.charAt(6) == "5") || (sID.charAt(6) == "6")) birthYear = "19";
         else if ((sID.charAt(6) == "7") || (sID.charAt(6) == "8")) birthYear = "20";
         else if ((sID.charAt(6) == "9") || (sID.charAt(6) == "0")) birthYear = "18";
         else  return false;

        
         birthYear  += sID.substr(0, 2);
         birthMonth = sID.substr(2, 2) - 1;
         birthDate   = sID.substr(4, 2);
         birth         = new Date(birthYear, birthMonth, birthDate);
        
         if (birth.getYear() % 100 != sID.substr(0, 2) || birth.getMonth() != birthMonth || birth.getDate() != birthDate) {
              return false;
         }
         if (fgn_no_chksum(sID) == false)
             return false;
         else            
             return true;         
    }
 }

function fgn_no_chksum(reg_no) {
     var sum = 0;
     var odd = 0;
     
     buf = new Array(13);
     for (i = 0; i < 13; i++) buf[i] = parseInt(reg_no.charAt(i));
     odd = buf[7]*10 + buf[8];    
     if (odd%2 != 0)       return false;
     
     if ((buf[11] != 6)&&(buf[11] != 7)&&(buf[11] != 8)&&(buf[11] != 9))  return false;
      
     multipliers = [2,3,4,5,6,7,8,9,2,3,4,5];
     for (i = 0, sum = 0; i < 12; i++) sum += (buf[i] *= multipliers[i]);
     sum=11-(sum%11);    
     if (sum>=10) sum-=10;
     sum += 2;
     if (sum>=10) sum-=10;
     if ( sum != buf[12]) return false;
     else  return true;
 }



 function pop(theURL, winName, winWidth, winHeight , isScroll ) {


    var tmp_focus;
    var winSize;

	if ((winWidth=="" || winWidth==null) && (winHeight=="" || winHeight==null)) {
		tmpFocus = window.open(theURL, winName );
 	}
	else {
	
		if (winWidth=="" || winWidth==null)
	      winSize = "height="+winWidth;
		else if (winHeight=="" || winHeight==null)
	      winSize = "height="+winWidth;
		else
	      winSize = "width="+winWidth+",height="+winHeight;
	      
	    if( isScroll == true )
	    	winSize += ",scrollbars=yes" ;
	    else
	    	winSize += ",scrollbars=no" ;

        tmpFocus = window.open(theURL, winName, winSize );
	}

 	//this.movePop(tmpFocus,winWidth) ;

 	tmpFocus.focus() ;

	return tmpFocus ;
}


