// JavaScript Document
// 최종수정 by hsmtree (2008-01-18)

/*
■ 개체를 자동으로 찾아 사용할 수 있도록 해주는 함수 ; findObj()
■ 레이어를 보였다 안보였다 ; showHideLayers()
■ 이미지 캐쉬에 미리 읽어 놓기 ; preloadImages()
■ 마우스 위치값 ; getMouseLoc(e)
■ 마우스 이동에 레이어 ; moveLayerToMouseLoc(theLayer, offsetH, offsetV)

■ 이미지 개체의 이미지 소스를 원하는 이미지 소스로 치환줍니다. ; MM_swapImage()
■ 바뀐 이미지 소스를 원래 상태의 이미지 소스로 되돌려 줍니다. ; MM_swapImgRestore()
■ 윈도우 창 열기 ; MM_openBrWindow(theURL,winName,features)
■ 페이지 이동을 자바로 하는 함수 ; MM_goToURL()
■ 자바스크립트를 부르는 함수 ; MM_callJS(jsStr)
■ 브라우저의 종류와 버전을 확인 한 후 해당 주소로 이동하게 함. ; MM_checkBrowser(NSvers,NSpass,NSnoPass,IEvers,IEpass,IEnoPass,OBpass,URL,altURL)
■ 플러그인이 있는 지 체크하는 함수 ; MM_checkPlugin(plgIn, theURL, altURL, autoGo)
■ 배경음악 컨트롤 ; MM_controlSound(x, _sndObj, sndFile)
■ alert 메시지 띄우기 ; MM_popupMsg(msg)
■ 스테이터스 바에 메시지 띄우기 ; MM_displayStatusMsg(msgStr)
■ 레이어에 메시지 띄우기 ; MM_setTextOfLayer(objName,x,newText)

■ 단순 이미지 롤오버 ; over(obj,type)
■ IE 6 에서 PNG 렌더링 하기 ; setPng24(obj)
■ onload event 중복 실행 ; addLoadEvent(func)
■ 인용(blockquote) 요소의 cite라는 속성을 화면에 적절히 표시해주는 함수 ; displayCitations()
■ 레이어요소를 보였다 안보였다(display속성) ; displayLayers()
■ 개체에 마우스 동작에 따라 투명도가 점점 사라집니다. ;  fadeIt(this,1); fadeIt(this,2);
■ 자바스크립트로 parent 창 닫을때 warning message 안보이게 하기 ; winClose()
■ iframe 사이즈 조절 ; Resize_Frame(name)
■ javascript로 구현한 Request ; Request(valuename)
■ input 요소의 입력글자수 제한 ; enforcechar(what)
■ 단순패스워드방지함수 ; ban_simplepass(strid,strpass)
■ 주민등록번호가 형식에 맞는지 아닌지를 확인하는 함수 ; check_jumin(frmID)
■ ctrl + N 막기 ; KeyEventHandle()
■ 게시판 등의 내용 보여주는 부분에서 이미지가 큰 경우 자동으로 이미지 크기를 줄여준다. ; addLoadEvent(zb_img_check);
■ 간단하게 팝업만드는 방법 ;  onClick="popup()" target="popup"
■ 옛날 방식으로 팝업 띄우기 ; startwindow(theURL,winName,features) 
■ eolas해결 ; writeObj(code)
■ floating div : Floating v1.1 Source By Bermann

*/


document.oncontextmenu = function() {return true};
document.onselectstart = function() {return true};
document.ondragstart = function() {return false};
document.oncontrolselect = function() {return false};


// Example: obj = findObj("image1");


function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
 
  return foundObj;
}


// * Dependencies * 
// this function requires the following snippets:
// JavaScript/readable_MM_functions/findObj
//
// Accepts a variable number of arguments, in triplets as follows:
// arg 1: simple name of a layer object, such as "Layer1"
// arg 2: ignored (for backward compatibility)
// arg 3: 'hide' or 'show'
// repeat...
//
// Example: showHideLayers(Layer1,'','show',Layer2,'','hide');
function showHideLayers()
{ 
  var i, visStr, obj, args = showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  {
    if ((obj = findObj(args[i])) != null)
    {
      visStr = args[i+2];
      if (obj.style)
      {
        obj = obj.style;
        if(visStr == 'show') visStr = 'visible';
        else if(visStr == 'hide') visStr = 'hidden';
      }
      obj.visibility = visStr;
    }
  }
}


// Example: preloadImages('file.gif', 'http://www.x.com/y.gif');
function preloadImages()
{
  if(document.images)
  {
    if(!document.imageArray) document.imageArray = new Array();
    var i,j = document.imageArray.length, args = preloadImages.arguments;
    
    for(i=0; i<args.length; i++)
    {
      if (args[i].indexOf("#")!=0)
      {
        document.imageArray[j] = new Image;
        document.imageArray[j++].src = args[i];
      }
    }
  }
}


/* 
Example:
function test()
{
  if (document.layers) getMouseLoc;     //NS
  else if (document.all) getMouseLoc(); //IE
  alert(mouseLocation.x+","+mouseLocation.y);
}
in the BODY:
<a href="#" onmouseover="test()">test</a>
*/
function Point(x,y) {  this.x = x; this.y = y; }
mouseLocation = new Point(-500,-500);
function getMouseLoc(e)
{
  if(!document.all)  //NS
  {
    mouseLocation.x = e.pageX;
    mouseLocation.y = e.pageY;
  }
  else               //IE
  {
    mouseLocation.x = event.x + document.body.scrollLeft;
    mouseLocation.y = event.y + document.body.scrollTop;
  }
  return true;
}
//NS init:
if(document.layers){ document.captureEvents(Event.MOUSEMOVE); document.onMouseMove = getMouseLoc; }


// * Dependencies * 
// this function requires the following snippets:
// JavaScript/readable_MM_functions/findObj
// JavaScript/readable_MM_functions/showHideLayers
// JavaScript/events/getMouseLoc
function moveLayerToMouseLoc(theLayer, offsetH, offsetV)
{
  var obj;
  if ((findObj(theLayer))!=null)
  {
    if (document.layers)  //NS
    {
      document.onMouseMove = getMouseLoc;
      obj = document.layers[theLayer];
      obj.left = mLoc.x +offsetH;
      obj.top  = mLoc.y +offsetV;
    }
    else if (document.all)//IE
    {
      getMouseLoc();
      obj = document.all[theLayer].style;
      obj.pixelLeft = mLoc.x +offsetH;
      obj.pixelTop  = mLoc.y +offsetV;
    }
    showHideLayers(theLayer,'','show');
  }
}
// get mouse location
function Point(x,y) {  this.x = x; this.y = y; }
mLoc = new Point(-500,-500);
function getMouseLoc(e)
{
  if(!document.all)  //NS
  {
    mLoc.x = e.pageX;
    mLoc.y = e.pageY;
  }
  else               //IE
  {
    mLoc.x = event.x + document.body.scrollLeft;
    mLoc.y = event.y + document.body.scrollTop;
  }
  return true;
}
//NS init:
if(document.layers){ document.captureEvents(Event.MOUSEMOVE); document.onMouseMove = getMouseLoc; }


// ======== ======== ======== ========

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
	// Usage:
	// MM_openBrWindow(theURL,winName,features);
	// theURL = 새로운 문서파일 이름
	// winName = 새로운 문서창의 이름
	// features = 새창의 속성 (레퍼런스참조-_-;;;)
  var TMsgWnd = window.open(theURL,winName,features);
  TMsgWnd.focus();
}


function MM_goToURL() { //v3.0
	// 페이지 이동을 자바로 하는 함수
	// onClick="javascript:MM_goToURL('parent','index.html');return document.MM_returnValue"
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}


function MM_callJS(jsStr) { //v2.0
	// 자바스크립트를 부르는 함수
	// onMouseOver="MM_callJS('test')"
  return eval(jsStr)
}


function MM_checkBrowser(NSvers,NSpass,NSnoPass,IEvers,IEpass,IEnoPass,OBpass,URL,altURL) { //v4.0
	// 브라우저의 종류와 버전을 확인 한 후 해당 주소로 이동하게 함.
	// 리턴값이 0이면 그자리에 있음.
	// NSvers 넷스케이프버전 2.0~4.0
	// NSpass 버전이후이면 0=stay, 1=통과주소로, 2=경고주소로
	// NSnoPass 버전이전이면  0=stay, 1=통과주소로, 2=경고주소로
	// IEvers 익스플로러버전 2.0~4.0
	// IEpass 버전이후이면  0=stay, 1=통과주소로, 2=경고주소로
	// IEnoPass 버전이전이면  0=stay, 1=통과주소로, 2=경고주소로
	// OBpass 다른브라우저버전일때  0=stay, 1=통과주소로, 2=경고주소로
	// URL 버전체크후 통과되었을때 이동할 주소
	// altURL 버전체크후 통과되지 않았을 때 이동할 주소
	// onLoad="MM_checkBrowser(4.0,1,2,4.0,0,2,2,'index.html','test.htm');return document.MM_returnValue"
  var newURL='', verStr=navigator.appVersion, app=navigator.appName, version = parseFloat(verStr);
  if (app.indexOf('Netscape') != -1) {
    if (version >= NSvers) {if (NSpass>0) newURL=(NSpass==1)?URL:altURL;}
    else {if (NSnoPass>0) newURL=(NSnoPass==1)?URL:altURL;}
  } else if (app.indexOf('Microsoft') != -1) {
    if (version >= IEvers || verStr.indexOf(IEvers) != -1)
     {if (IEpass>0) newURL=(IEpass==1)?URL:altURL;}

    else {if (IEnoPass>0) newURL=(IEnoPass==1)?URL:altURL;}
  } else if (OBpass>0) newURL=(OBpass==1)?URL:altURL;
  if (newURL) { window.location=unescape(newURL); document.MM_returnValue=false; }
}


function MM_checkPlugin(plgIn, theURL, altURL, autoGo) { //v4.0
	// 플러그인이 있는 지 체크하는 함수
	// onMouseOver="MM_checkPlugin('Shockwave Flash','index.html','test.htm',false);return document.MM_returnValue"
	// 
	// Shockwave Flash, Shockwave for Director, LiveAudio, Netscape Media Player, QuickTime Plug-In
	// 
  var ok=false; document.MM_returnValue = false;
  with (navigator) if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)) {
    ok=(plugins && plugins[plgIn]);
  } else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
    if (plgIn.indexOf("Flash")!=-1 && window.MM_flash!=null) ok=window.MM_flash;
    else if (plgIn.indexOf("Director")!=-1 && window.MM_dir!=null) ok=window.MM_dir;
    else ok=autoGo; }
  if (!ok) theURL=altURL; if (theURL) window.location=theURL;
}
/* 이부분을 </body> 태그 뒤에 삽입해야 위의 코드를 사용할 수 있음
<script name="Used by MM_checkPlugin" language="javascript">
<!--
with (navigator) if (appName.indexOf('Microsoft')!=-1 && appVersion.indexOf('Mac')==-1) document.write(''+
'<scr'+'ipt language="VBScript">\nOn error resume next\n'+
'MM_dir = IsObject(CreateObject("SWCtl.SWCtl.1"))\n'+
'MM_flash = NOT IsNull(CreateObject("ShockwaveFlash.ShockwaveFlash"))\n</scr'+'ipt>');
//-->
</script>
*/


function MM_controlSound(x, _sndObj, sndFile) { //v3.0
	// onMouseOver="MM_controlSound('play','document.CS1025441064139','special/magic.mid')"
	//
	/* 소스코드에 아래 코드가 들어가야 함.
<EMBED NAME='CS1025441064139' SRC='../../../v2/lib/special/magic.mid' LOOP=false 
AUTOSTART=false MASTERSOUND HIDDEN=true WIDTH=0 HEIGHT=0></EMBED> */
	//
	//
  var i, method = "", sndObj = eval(_sndObj);
  if (sndObj != null) {
    if (navigator.appName == 'Netscape') method = "play";
    else {
      if (window.MM_WMP == null) {
        window.MM_WMP = false;
        for(i in sndObj) if (i == "ActiveMovie") {
          window.MM_WMP = true; break;
      } }
      if (window.MM_WMP) method = "play";
      else if (sndObj.FileName) method = "run";
  } }
  if (method) eval(_sndObj+"."+method+"()");
  else window.location = sndFile;
}


function MM_popupMsg(msg) { //v1.0
	// onMouseOver="MM_popupMsg('abcdefg')"
  alert(msg);
}


function MM_displayStatusMsg(msgStr) { //v1.0
	// 스테이터스 바에 메시지 띄우기
	// onLoad="MM_displayStatusMsg('ㅁㄴㅇㄹ');return document.MM_returnValue"
	//
  status=msgStr;
  document.MM_returnValue = true;
}


function MM_setTextOfLayer(objName,x,newText) { //v4.01
	// 레이어에 메시지 띄우기
	// onMouseOver="MM_setTextOfLayer('Layer1','','abcdefg')"
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}


///////////////////////////////////////////////////////////////////////////////////
// made by hsmtree below
///////////////////////////////////////////////////////////////////////////////////


// 단순 이미지 롤오버
function over(obj,type) {
	if (type) {obj.src = obj.src.replace(".gif","_over.gif");}
	else {obj.src = obj.src.replace("_over.gif",".gif");}
}


// IE 6 에서 PNG 렌더링 하기
// layout4ie.css 에서 사용합니다.
// <img src=../../../kr/common/lib/***.png class="png24" />
function setPng24(obj) { 
    obj.width=obj.height=1; 
    obj.className=obj.className.replace(/\bpng24\b/i,''); 
    obj.style.filter = 
    "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
    obj.src='';  
    return ''; 
} 


// = = = = = = = = = = = = = = = = = = = =
/* 
이 함수는 문서를 읽을 때 실행될 함수를 효율적인 방법으로 차례대로 실행합니다.
onload event( body onload, window.onload)를 중복해서 사용해야 하는 경우엔 마지막 onload만 적용되는 오류를 피해가기 위한 함수입니다.
ex)
addLoadEvent(firstFunction);
addLoadEvent(secondFunction);
*/
function addLoadEvent(func) {
	var oldonload = window.onload;
	if(typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}


// = = = = = = = = = = = = = = = = = = = =
/* 
이 함수는 인용(blockquote) 요소의 cite라는 속성을 화면에 적절히 표시해주는 함수입니다. 
또한 링크와 윗첨자모양을 나타내 줍니다.
<blockquote cite="http://www.w3.com/DOM/">~~
*/
function displayCitations() {
	if (!document.getElementsByTagName || !document.createElement || !document.createTextNode) return false;
	//모든 blockquote요소를 가져 온다.
	var quotes = document.getElementsByTagName("blockquote");
	for (var i=0; i<quotes.length; i++) {
		// cite속성이 없으면 반복문을 다시 시작.
		if (!quotes[i].getAttribute("cite")) continue;
		// cite속성을 저장
		var url = quotes[i].getAttribute("cite");
		// blockquote 내 모든 요소 node를 가져 온다.
		var quoteChildren = quotes[i].getElementsByTagName('*');
		// 만약 요소 node가 없으면 반복문을 다시 시작.
		if (quoteChildren.length < 1) continue;
		// blockquote 내에 제일 마지막 요소 노드를 가져 온다.
		var elem = quoteChildren[quoteChildren.length-1];
		// 마크업을 생성한다.
		var linkTag = document.createElement("a");
		var linkText = document.createTextNode("SOURCE: "+ url);
		linkTag.appendChild(linkText);
		linkTag.setAttribute("href",url);
		var subscript = document.createElement("sub");
		subscript.appendChild(linkTag);
		var divTag = document.createElement("div");
		divTag.setAttribute("align","right");
		divTag.appendChild(subscript);
		// 마크업을 blockquote의 마지막 요소 노드 뒤에 추가 한다.
		elem.appendChild(divTag);
	}
}
addLoadEvent(displayCitations);


///////////////////////////////////////////////////////////////////////////////////
/*
	Usage :
	displayLayers('Layer1','','show','Layer2','','hide','Layer3','','hide','Layer4,'','hide');
	첫번째인수 = 테이블이름
	두번째인수 = 공란으로 둠
	세번째인수 = 'show' or 'hide'
	이후부터 컴마로 구분하여 연속적인 값으로 보내면 됨.
	showHideLayers와는 달리 안보이는 테이블은 자리를 차지 하지 않습니다.
*/
function displayLayers() { 
  var i, visStr, obj, args = displayLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) {
    if ((obj = findObj(args[i])) != null) {
      visStr = args[i+2];
      if (obj.style) {
        obj = obj.style;
        if(visStr == 'show') visStr = '';
        else if(visStr == 'hide') visStr = 'none';
      }
      obj.display = visStr;
    }
  }
}


///////////////////////////////////////////////////////////////////////////////////
/*
	마우스오버하면 투명도가 점점 사라집니다.

	아래와 같이 사용합니다.
	<img src="/lib/spacer.gif" width="1" height="1" border="0" style="filter:alpha(opacity=40)" onmouseover="fadeIt(this,1);" onmouseout="fadeIt(this,2);">
	이미지 기본 투명도(0~100 사이의 수로 0으로 하면 안보입니다.)
*/
var startopacity = 60; 
function fadeIt(obj,direct) {
	if(window.timer) { clearInterval(timer); } 
	tobj=obj; drct=direct; 
	timer=setInterval("flowfilter(tobj,drct);",5); 
}
function flowfilter(thing,dct) {
	if(dct==1) { 
		if (thing.filters.alpha.opacity<100) {
			thing.filters.alpha.opacity+=10; 
		}
	else {
		clearInterval(timer); 
		}
	}
	if(dct==2) {
		if (thing.filters.alpha.opacity>startopacity) {
			thing.filters.alpha.opacity-=10; }
		else { clearInterval(timer); } 
	}
}


///////////////////////////////////////////////////////////////////////////////////
/*
	자바스크립트로 parent 창 닫을때 warning message 안보이게 하기
	<a href="javascript:winClose();">닫기</a> 
*/
function winClose() { 
        self.opener = self; 
        window.close(); 
} 


///////////////////////////////////////////////////////////////////////////////////
/*
	부모프레임에 아래 함수를 넣고
	자식프레임의 HTML에서 onLoad일때 함수를 호출
	onLoad="parent.Resize_Frame('frameName')"
*/
function Resize_Frame(name)
{
	try
	{       
		var oBody 	= document.frames(name).document.body;
		var oFrame 	= document.all(name);

		oFrame.style.width 
				= oBody.scrollWidth + (oBody.offsetWidth-oBody.clientWidth);
		oFrame.style.height 
				= oBody.scrollHeight + (oBody.offsetHeight-oBody.clientHeight);

		if (oFrame.style.height == "0px" || oFrame.style.width == "0px")
		{
			oFrame.style.width = "600";
			oFrame.style.height = "200px"; 
			window.status = 'iframe resizing fail.';
		}
		else
		{
			window.status = '';
		}
	}
	catch(e)	//exception의 초기값은 발생 오류 값입니다. 
	{
		window.status = 'Error: ' + e.number + '; ' + e.description;
	}
}


///////////////////////////////////////////////////////////////////////////////////
/*
	javascript로 구현한 Request

	javascript로 Request해주는 함수
	주소창의 location.href를 이용하는 것이므로  GET방식만 된다.

	var str = Request("ValueName");
*/
function Request(valuename)    //
{
    var rtnval;
    var nowAddress = unescape(location.href);
    var parameters = new Array();
    parameters = (nowAddress.slice(nowAddress.indexOf("?")+1,nowAddress.length)).split("&");
    for(var i = 0 ; i < parameters.length ; i++){
        if(parameters[i].indexOf(valuename) != -1){
            rtnval = parameters[i].split("=")[1];
            if(rtnval == undefined || rtnval == null){
                rtnval = "";
            }
            return rtnval;
        }
    }
}


///////////////////////////////////////////////////////////////////////////////////
/*
	what은 개체 이름
*/
function enforcechar(what){

    if (what.value.length>=8){
        alert("8자 이상 입력하실 수 없습니다");
        return false;
    }

}


///////////////////////////////////////////////////////////////////////////////////
/*
	단순패스워드방지함수
	onBlur나 onChange event에서 사용하면 될 듯.
*/
function ban_simplepass(strid,strpass)
{
/*
단순패스워드의 범위
1. 똑같은 숫자나 문자로 된 패스워드
2. 순차적인 일련숫자나 문자(ex:1234, dcba)
3. 아이디와 동일하거나 아이디가 들어간 패스워드
*/
	//각각의 변수값이 null이 되지 않도록!
	strid=""+strid;
	strpass=""+strpass;

	if(strpass.indexOf(strid)>-1) 
	{
		alert("아이디는 패스워드의 일부가 될 수 없습니다.");
		return false;
	}

	smplchkasc=smplchkdsc=smplchksam=true;

	for (i=0; i<strpass.length-1; i++)
	{
		if(strpass.charCodeAt(i)!=strpass.charCodeAt(i+1)) smplchksam=false;
		if(strpass.charCodeAt(i)!=strpass.charCodeAt(i+1)-1) smplchkasc=false;
		if(strpass.charCodeAt(i)!=strpass.charCodeAt(i+1)+1) smplchkdsc=false;
	}
	if(smplchksam) {alert("패스워드를 동일한 문자로만 사용하실 수 없습니다.");return false;}
	if(smplchkasc) {alert("패스워드를 순차적인 글자로 사용하실 수 없습니다.\n ex)1234");return false;}
	if(smplchkdsc) {alert("패스워드를 순차적인 글자로 사용하실 수 없습니다.\n ex)4321");return false;}

return true;
}


///////////////////////////////////////////////////////////////////////////////////
/*
	주민등록번호가 형식에 맞는지 아닌지를 확인하는 함수
	jumin1과 jumin2를 input tag이름으로 사용한다.
*/
function check_jumin(frmID){

  n=frmID.jumin1.value;
  m=frmID.jumin2.value;
  a=n+m;
  //b=document.myform.na.value;
  ju=new Array(13);
  ch=new Array(2,3,4,5,6,7,8,9,2,3,4,5);
  sum=0;

  if(n.length!=6)
  {
     alert('주민번호 입력이 잘못되었습니다.');
     frmID.jumin1.focus();
     return false;
  }
  else if(m.length!=7)
  {
     alert('주민번호 입력이 잘못되었습니다.');
     frmID.jumin2.focus();
     return false;
  }
  else
  {
	   for(i=0;i<12;i++)
	   {
	        ju[i]=a.charAt(i);
	        ju[i]=eval(ju[i]);
	        sum=sum+(ju[i]*ch[i]);

	   }
	   sum=11-(sum%11);
	   if(9<sum)
	      sum=sum%10;
	   ju[12]=a.charAt(12);
	   ju[12]=eval(ju[12]);

	   if(ju[12]==sum)
	   {

	     if(ju[6]==1 | ju[6]==3)
	     {
	       //alert("님\n(남성)"+a+"\n주민번호가 맞습니다!");
	       return true;
	     }
	     else
	     {
	       //alert("님\n(여성)"+a+"\n주민번호가 맞습니다!");
	       return true;
	     }

	   }
	   else
	   {
	     alert("주민번호가 틀렸습니다!");
	     return false;
	   }
	   frmID.jumin1.value= "";
	   frmID.jumin2.value= "";
   }
}


///////////////////////////////////////////////////////////////////////////////////
/*
ctrl + N 막기
*/
//document.onkeydown=KeyEventHandle;
//document.onkeyup=KeyEventHandle;
function KeyEventHandle() {
	if((event.ctrlKey == true && (event.keyCode == 78 || event.keyCode == 82)) || (event.keyCode >= 112 && event.keyCode <= 123)) {
		event.keyCode = 0;
		event.cancelBubble = true;
		event.returnValue = false;
	}
}


///////////////////////////////////////////////////////////////////////////////////
/*
게시판 등의 내용 보여주는 부분에서 이미지가 큰 경우 자동으로 이미지 크기를 줄여준다.
아래 함수에서 imgWidth의 값을 조정한 후, html소스에서 <img>나 <table>의 name의 값을 "img_resize"로 지정해준다.
마지막 줄의 //window.onload = zb_img_check; 부분을 해제하거나 게시판에서 이 함수를 호출해 준다.

*/
function zb_img_check(){

  var imgWidth = 600;
  var img_resize_num = document.img_resize.length;
  for(i=0;i<img_resize_num;i++){ 
    if(document.img_resize[i].width > imgWidth) {
      document.img_resize[i].width = imgWidth;
    }
  }
}
//window.onload = zb_img_check; onload event를 중복사용하면 맨 마지막 호출된 이벤트만 동작하므로 아래 함수를 호출한다.
//addLoadEvent(zb_img_check);

///////////////////////////////////////////////////////////////////////////////////
/*
간단하게 팝업만드는 방법
링크에 onClick="popup()" target="popup" 이렇게 써주면 된다.
onClick이 먼저 작동해서 별도창을 열고, 다음 링크가 작동해서 popup이라는 프레임(창)으로 링크된 페이지가 열리기 때문.
<a href="http://192.168.1.1:81/" onClick="popup()" target="popup">창열기</a>
<a href="http://192.168.1.1:81/" onClick="popup('width=400,height=300')" target="popup">창열기(옵션)</a>

*/
function popup(params){
	var params,newWins;
	newWins = window.open("","popup",params); 
	newWins.focus();
}


///////////////////////////////////////////////////////////////////////////////////
/*
옛날 방식으로 팝업 띄우기
status bar없고, 자동 팝업

*/
function startwindow(theURL,winName,features) { //v2.0
	features = features +',left='+((window.screen.width/2)-483)+',top='+((window.screen.height/2)-375)
	childwin = window.open(theURL,winName,features);
	childwin.focus();
	//(self.opener=self).close();
}


// writeObj : embed,object 기술
function writeObj(code) {
    document.write(code);
}



//----------------------------------------------
//Floating v1.1 Source By Bermann
//dobermann75@gmail.com
//----------------------------------------------
//new Floating(적용할개체 , X축여백 , Y축여백 , 미끄러지는속도:작을수록빠름..기본20 , 빠르기:작을수록부드러움..기본10);

function Floating(FloatingObj,MarginX,MarginY, position, Percentage,setTime) {
	this.FloatingObj = FloatingObj;
	this.MarginX = (MarginX) ? MarginX : 0;
	this.MarginY = (MarginY) ? MarginY : 0;
	this.Percentage = (Percentage) ? Percentage : 20;
	this.setTime = (setTime) ? setTime : 20;
	this.FloatingObj.style.position = (position) ? position : "absolute";
	this.Body = null;
	this.setTimeOut = null;
	this.cnt = 0;
	this.Run();
}

Floating.prototype.Run = function () {
	if ((document.documentElement.scrollLeft + document.documentElement.scrollTop) > (document.body.scrollLeft + document.body.scrollTop)) {
		this.Body = document.documentElement;
	} else {
		this.Body = document.body;
	}
	var This = this;
	var FloatingObjLeft = (this.FloatingObj.style.left) ? parseInt(this.FloatingObj.style.left,10) : this.FloatingObj.offsetLeft;
	var FloatingObjTop = (this.FloatingObj.style.top) ? parseInt(this.FloatingObj.style.top,10) : this.FloatingObj.offsetTop;
	var DocLeft = this.Body.scrollLeft + this.MarginX;
	var DocTop = this.Body.scrollTop + this.MarginY;
	var MoveX = Math.abs(FloatingObjLeft - DocLeft);
	MoveX = Math.ceil(MoveX / this.Percentage);
	var MoveY = Math.abs(FloatingObjTop - DocTop);
	MoveY = Math.ceil(MoveY / this.Percentage);
/*
	if (FloatingObjLeft < DocLeft) {
		this.FloatingObj.style.left = FloatingObjLeft + MoveX + "px";
	} else {
		this.FloatingObj.style.left = FloatingObjLeft - MoveX + "px";
	}
*/
	try{
		var top = 0;
		
		if (FloatingObjTop < DocTop) {
			top = FloatingObjTop + MoveY;
		} else {
			top = FloatingObjTop - MoveY;
		}
		var bodyHeight = this.Body.offsetHeight + this.Body.scrollTop;
		var max = (screen.availHeight > bodyHeight) ? screen.availHeight : bodyHeight;
		max -= 50;
		if(this.FloatingObj.getHeight()+FloatingObjTop > max){
			top = top  - (this.FloatingObj.getHeight()+FloatingObjTop - max);
		}
	}catch(ex){}
	this.FloatingObj.style.top = top + 'px';
	window.clearTimeout(this.setTimeOut);
	this.setTimeOut = window.setTimeout(function () { This.Run(); },this.setTime);
}


//----------------------------------------------

