var _F1_KEY = 112;
var _F2_KEY = 113;
var _F3_KEY = 114;
var _F4_KEY = 115;
var _F5_KEY = 116;
var _F6_KEY = 117;
var _F7_KEY = 118;
var _F8_KEY = 119;
var _F9_KEY = 120;
var _F10_KEY = 121;
var _F11_KEY = 122;
var _F12_KEY = 123;
var _BACK_SPACE_KEY = 8;
var _TAB_KEY = 9;
var _ENTER_KEY = 13;
var _ESC_KEY = 27;
var _SPACE_KEY = 32;
var _LEFT_ARROW_KEY = 37;
var _DEL_KEY = 46;
var _LAST_SUB_MENU = 'subMenu00000';
var _LAST_SUB_IMG = 'subImg00000';
// AJAX 객체
var moduleAdminInfoXMLHttp;

document.onkeydown = jf_FuncKey;

// 현재 마우스 포인터 좌표
var xPos=0;
var yPos=0; 


// ------------------------ key function ----------------------------------
function jf_FuncKey(event)
{
  if (event == null) return;

  if((event.keyCode == 16)||(event.keyCode == 17)||(event.keyCode == 18))
  {
    return;  
  }

  if(event.keyCode == _ENTER_KEY)
  {
    EnterKeyDown();
  }
    
  if(event.keyCode == _ESC_KEY)
  {
    EscKeyDown();
  }
}

function EnterKeyDown()
{
  return;
}

function EscKeyDown()
{
  return;
}

function jf_BasicOperationKey(eventKey)
{
  if(eventKey == _LEFT_ARROW_KEY || eventKey == _RIGHT_ARROW_KEY || eventKey == _DEL_KEY || eventKey == _BACK_SPACE_KEY || eventKey == _SPACE_KEY)
  { 
    return true;
  }

  return false;
}

//Image를 부르는 창의 크기에 맞추어 최대 크기를 조정하는 메소드 	  
//단, boardItemImage 만 처리 대상이다.   
function fitImage()
{
    	
    var maxWidth = 670;
    if (document.body.clientWidth < maxWidth)
    	maxWidth = document.body.clientWidth - 20;

  	var e=document.body.getElementsByTagName('IMG');  
  		
    for (i=0;i< e.length;i++){        	
    		
        	if(e[i].id.indexOf("boardItemImage")==0){        		
        		if(e[i].width>maxWidth) e[i].width = maxWidth;        		
    		}
  	}    
  	
  
}

 
  
function viewImage(ifile,ix,iy,ititle) { 
	
	var win;
	var sWidth;
	var sHeight;
	var NS = (document.layers) ? 1 : 0;
	

	
	win = window.open("","imageviewer","width="+ix+",height="+iy+",menubar=no,toolbar=no, resizable=yes, scrollbars=yes");
	
	/*
	if (NS) {
		sWidth = win.innerWidth;
		sHeight = win.innerHeight;
	} else {
		sWidth = win.document.body.clientWidth;
		sHeight = win.document.body.clientHeight;
	}
	
	if(sWidth!=ix || sHeight!=iy) {
		win.close();
		setTimeout("ViewImage('"+ifile+"',"+ix+","+iy+",'"+ititle+"')", 250);
		return;
	}
	*/
	
	if (NS) {
		win.innerWidth = document.layers[0].document.images[0].width;
		win.innerHeight = document.layers[0].document.images[0].height;
	}
		
		
	win.document.open();
	win.document.write("<html><head><title>"+ititle+"</title>");
	win.document.write("<script>");
	win.document.write("function setSize(){ ");
	win.document.write("	window.resizeTo(500, 500); ");
	win.document.write("    var width = 500 - (window.document.body.clientWidth -  window.document.images[0].width); ");
	win.document.write("    var height = 500 - (window.document.body.clientHeight -  window.document.images[0].height); ");			
    win.document.write("    window.resizeTo(width, height); ");
    win.document.write("    if(window.screen.width<=width) window.moveTo(0,0);");    	    	
	win.document.write("} ");
	win.document.write("</script>");
	win.document.write("</head><body onLoad='javascript:setSize()'>");
	win.document.write('<div style="position:absolute;width:'+ix+'px;height:'+iy+'px;left:0px;top:0px">');
	win.document.write("<img src='"+ifile+"&downloadType=inline"+"' onClick='javascript:window.close()' alt='클릭하시면 이미지창이 닫힙니다.'></div></body></html>");
	win.document.close();		
}

//------------------------ Navigation function ------------------------------------
function jf_CurWinUrl(psUrl, psParam)
{
  if(psParam == null || psParam == '')
    location.href = psUrl;
  else
    location.href = psUrl + '?' + psParam;
}

function jf_FrameUrl(pFrame, psUrl, psParam)
{  
  var target = eval(pFrame + ".location");
  if(psParam == null || psParam == '')
    target.href = psUrl;
  else
    target.href = psUrl + '?' + psParam;
    
}

function jf_PostCurWinUrlRight(pForm, psUrl)
{
  pForm.target = "rightFrame"
  pForm.action = psUrl
  pForm.submit();
}


function jf_PostCurWinUrl(pForm, psUrl)
{
  pForm.target = "_self"
  pForm.action = psUrl
  pForm.submit();
}


function jf_PostTargetWinUrl(pForm, pTarget, psUrl)
{
  pForm.target = pTarget;
  pForm.action = psUrl;
  pForm.submit();
}

eventValue=null;

function SaveMouseEvent(e)
{
  eventValue = e;
}

function jf_OpenDialogNear(psUrl, psName, piWidth, piHeight, event)
{
  if (isIE())
  {
    xPos = event.x;
    yPos = event.y;
  }
  else
  {
    xPos = event.pageX;
    yPos = event.pageY;
  }
  
  return window.open(psUrl, psName, "top="+yPos+",left="+xPos+",width="+piWidth+",height="+piHeight+",status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no");
}

function jf_OpenDialog(psUrl, psName, piWidth, piHeight)
{
  var xPos = (window.screen.width) ? (window.screen.width-piWidth)/2 : 0;
  var yPos = (window.screen.height) ? (window.screen.height-piHeight)/2 : 0;
  return window.open(psUrl, psName, "top="+yPos+",left="+xPos+",width="+piWidth+",height="+piHeight+",status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no");
}

function jf_OpenViewer(psUrl, psName, piWidth, piHeight)
{
  var xPos = (window.screen.width) ? (window.screen.width-piWidth)/2 : 0;
  var yPos = (window.screen.height) ? (window.screen.height-piHeight)/2 : 0;

  return window.open(psUrl, psName, "top="+yPos+",left="+xPos+",width="+piWidth+",height="+piHeight+",status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no");
}

function jf_OpenWindowNear(psUrl, psName, piWidth, piHeight, event)
{
  if (isIE())
  {
    xPos = event.x;
    yPos = event.y;
  }
  else
  {
    xPos = event.pageX;
    yPos = event.pageY;
  }
  
  return window.open(psUrl, psName, "top="+yPos+",left="+xPos+",width="+piWidth+",height="+piHeight+",status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes");
}

function jf_OpenWindow(psUrl, psName, piWidth, piHeight)
{
  var xPos = (window.screen.width) ? (window.screen.width-piWidth)/2 : 0;
  var yPos = (window.screen.height) ? (window.screen.height-piHeight)/2 : 0;

  return window.open(psUrl, psName, "top="+yPos+",left="+xPos+",width="+piWidth+",height="+piHeight+",status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes");
}

function jf_PostOpenWindow(pForm, psUrl, psName, piWidth, piHeight)
{
  var win = jf_OpenWindow("", psName, piWidth, piHeight)
  
  pForm.target = psName;
  pForm.action = psUrl;
  pForm.submit();
  
  return win;
}

function jf_ModalDialog(psUrl, piWidth, piHeight)
{
  var param = jf_ModalFeatures(piWidth, piHeight);

  return window.showModalDialog(psUrl, window, param);
}

function jf_ModalFeatures(xSize, ySize)
{
  return "help:no;status:no;scroll:no;dialogWidth:"+xSize+";dialogHeight:"+ySize;
}

function jf_ReloadWin() 
{
  this.location.reload();
}

//----------------------------------- Upload  -----------------------------------
function jf_ChangeAttachCount(peInput, piMaxCnt)
{
  var attachCnt = peInput.selectedIndex + 1;

  for(i=1; i<=attachCnt; i++)
  {
    div = eval("document.getElementById('attach" + i + "')");
    div.style.display = "";
  }

  for(i=attachCnt+1; i<=piMaxCnt; i++)
  {
    div = eval("document.getElementById('attach" + i + "')");
    div.style.display = "none";
    
    div.innerHTML = div.innerHTML;
  }
}
function changeDirectAttachCount(peInput, piMaxCnt)
{
  var attachCnt = peInput.selectedIndex + 1;

  for(i=1; i<=attachCnt; i++)
  {
    div = eval("document.getElementById('directAttach" + i + "')");
    div.style.display = "";
  }

  for(i=attachCnt+1; i<=piMaxCnt; i++)
  {
    div = eval("document.getElementById('directAttach" + i + "')");
    div.style.display = "none";
    
    div.innerHTML = div.innerHTML;
  }
}

//----------------------------------- Menu function -----------------------------------
/* left_menu */
function jf_menu_noimg(psName) 
{
  if (eval("document.getElementById('" + psName + "').style.display != 'none'")) 
  {
    eval("document.getElementById('" + psName + "').style.display = 'none'");
  }
  else
  {
    eval("document.getElementById('" + psName + "').style.display = 'block'");
  }
}

function jf_menu(psName, psNum) 
{
  menubObj = document.getElementById(psName);

  if (menubObj.style.display != 'none') 
  {
    jf_HideMenu(psName, psNum);
  }
  else 
  {
    jf_ShowMenu(psName, psNum);      
  }
}

function jf_ShowMenu(psName, psNum)
{
  menubObj = document.getElementById(psName);
  menuImg = document.getElementById(psNum);
  
  menubObj.style.display = '';
  menuImg.src= context + "images/common/menu/blank.gif";
}

function jf_HideMenu(psName, psNum) 
{
  menubObj = document.getElementById(psName);
  menuImg = document.getElementById(psNum);
  
  menubObj.style.display = 'none';
  menuImg.src= context + "images/common/menu/icon_menuarrow_gray.gif";
}

function jf_wk_menu(psName, psNum) 
{
  if (eval("document.getElementById('" + psName + "').style.display != 'none'")) 
  {
    jf_wk_HideMenu(psName, psNum);
  }
  else 
  {
    jf_wk_ShowMenu(psName, psNum);      
  }
}

function jf_wk_ShowMenu(psName, psNum)
{
  eval("document.getElementById('" + psName + "').style.display = 'block'");
  eval("document.getElementById('" + psNum + "').src='" + context + "/images/wiki/icon_04_01.jpg'");
}

function jf_wk_HideMenu(psName, psNum) 
{
  eval("document.getElementById('" + psName + "').style.display = 'none'");
  eval("document.getElementById('" + psNum + "').src='" + context + "/images/wiki/icon_04.gif'");
}

function jf_sub_menu(subMenu, subImg) 
{
  var lastMenuObj = eval("document.getElementById('" + _LAST_SUB_MENU + "')");
  var lastImgObj = eval("document.getElementById('" + _LAST_SUB_IMG + "')");

  if(lastMenuObj != null) 
  {  
    lastMenuObj.className='leftmenu_2level';
  }
  if(lastImgObj != null) 
  { 
    eval(_LAST_SUB_IMG + ".src= context  +'images/common/menu/icon_menudot_gray.gif'");
  }
 
  eval(subMenu).className='leftmenu_2level_texton';
  eval(subImg + ".src= context  +'images/common/menu/icon_menudot_blue.gif'");

  _LAST_SUB_MENU = subMenu;
  _LAST_SUB_IMG = subImg;
}

/**
 *  메뉴를 클릭했을때 스타일과 이미지를 변경
 * @param {Object} clickedObj -- 클릭한 메뉴(TD)
 */
function fncClickMenuLevel2(clickedObj)
{
  var activeMenuImage       = context + 'images/common/menu/icon_menudot_blue.gif';
  var activeMenuImageHeight = "5";
  var activeMenuClassName   = "leftmenu_2level_texton";
  
  var normalMenuImage       = context + 'images/common/menu/icon_menudot_gray.gif';
  var normalMenuImageHeight = "2";
  var normalMenuClassName   = "leftmenu_2level";
  
  var tdList = document.getElementById("tbl_menu").getElementsByTagName("TD");
  
  for(var i =0; i < tdList.length; i++)
  {
    if(tdList[i].className == activeMenuClassName) 
    {
      tdList[i].className = normalMenuClassName;
      
      tdList[i].firstChild.src    = normalMenuImage;
      tdList[i].firstChild.height = normalMenuImageHeight;
    }
    
  }
  
  clickedObj.firstChild.src    = activeMenuImage;
  clickedObj.firstChild.height = activeMenuImageHeight;
  clickedObj.className = activeMenuClassName;
  
}

//----------------------------------- Button function -----------------------------------

/** deprecated */
function btnOver(el) 
{
  el.style.color="#0088D4";
}
/** deprecated */
function btnOut(el)
{
  el.style.color="#2359A3";
}

function jf_BtnOver(el) 
{
  el.style.color="#0088D4";
}

function jf_BtnOut(el)
{
  el.style.color="#2359A3";
}

//----------------------------------- Table function -----------------------------------
/** deprecated */
function cellOver(el) 
{
  el.style.backgroundColor="#F7F9E7";
}
/** deprecated */
function cellOut(el)
{
  el.style.backgroundColor="#FFFFFF";
}

function jf_CellOver(el) 
{
  el.style.backgroundColor="#F7F9E7";
}

function jf_CellOut(el)
{
  el.style.backgroundColor="#FFFFFF";
}



// ----------------------------------- Common Module function -----------------------------------
// open popup-window to select groups
// psContext : context
// groupTypeIds : group type id list to select (in case empty value, all group type) (delimiter : ,)
// isMulti : (true/false)
// isFullName : (true/false)
function jf_OpenGroupControl(psContext, groupTypeIds, isMulti, isFullName)
{
  var width;
  var height;
  
  if(isMulti)
  {
    width = 680;
    height = 520;
  }
  else
  {
    width = 340;
    height = 520;    
  }
  
  jf_OpenDialog(psContext + 'common/GroupControlMain.do?groupTypeIds=' + groupTypeIds + '&isMulti=' + isMulti + '&isFullName=' + isFullName, 'GroupCtrl', width, height);
} 

function jf_OpenOrgGroupControl(psContext, isMulti, isFullName)
{
  jf_OpenGroupControl(psContext, '0001', isMulti, isFullName)
} 

function jf_OpenWSGroupControl(psContext, isMulti, isFullName)
{
  jf_OpenGroupControl(psContext, '0002', isMulti, isFullName)
} 

// clear opener's group value : overide method
function clearGroupValue()
{
}

// get opener's group value list (delimiter : ,)  : overide method
function beforeGroupValue()
{
  return '';
}

// set opener's group value : overide method
// psValue : group id
// psText : group name
function afterGroupValue(psValue, psText)
{
}

// open popup-window to select uses
// psContext : context
// groupTypeIds : group type id list to select (in case empty value, all group type) (delimiter : ,)
// isMulti : (true/false)
// isFullName : (true/false)
function jf_OpenUserControl(psContext, groupTypeIds, isMulti, isFullName)
{
  var width;
  var height;

  if(isMulti)
  {
    width = 680;
    height = 520;
  }
  else
  {
    width = 460;
    height = 520;    
  }

  jf_OpenDialog(psContext + 'common/UserControlMain.do?groupTypeIds=' + groupTypeIds + '&isMulti=' + isMulti + '&isFullName=' + isFullName, 'UserCtrl', width, height);
} 

function jf_OpenUserControlForMail(psContext, groupTypeIds, isMulti, isFullName, task)
{
  var width;
  var height;
  if(isMulti)
  {
    width = 680;
    height = 520;
  }
  else
  {
    width = 460;
    height = 520;    
  }
  jf_OpenDialog(psContext + 'common/UserControlMain.do?groupTypeIds=' + groupTypeIds + '&isMulti=' + isMulti + '&isFullName=' + isFullName+'&task='+task, 'UserCtrl', width, height);
} 


function jf_OpenOrgUserControl(psContext, isMulti, isFullName)
{
  jf_OpenUserControl(psContext, '0001', isMulti, isFullName)
} 

function jf_OpenWSUserControl(psContext, isMulti, isFullName)
{
  jf_OpenUserControl(psContext, '0002', isMulti, isFullName)
} 

function jf_OpenWSUserControlForMail(psContext, isMulti, isFullName, task)
{
  jf_OpenUserControlForMail(psContext, '0002', isMulti, isFullName, task)
} 

function jf_OpenUserControlForSMS(psContext, isMulti, isFullName, task)
{
  jf_OpenUserControlForMail(psContext, '0001', isMulti, isFullName, task)
}

// clear opener's group value (called repeartedly): overide method
function clearUserValue()
{
}

// get opener's group value list (delimiter : ,)  : overide method
function beforeUserValue()
{
  return '';  
}

// set opener's group value (called repeat : overide method
// psValue : user id
// psText : user name
function afterUserValue(psValue, psText)
{
}


// open popup-window to select uses
// psContext : context
// roleTypeIds : role type id list to select (in case empty value, all role type) (delimiter : ,)
// isMulti : (true/false)
// isFullName : (true/false)
function jf_OpenRoleControl(psContext, roleTypeIds, isMulti, isFullName)
{
  var width;
  var height;

  if(isMulti)
  {
    width = 680;
    height = 520;
  }
  else
  {
    width = 340;
    height = 520;    
  }

  
  jf_OpenDialog(psContext + 'common/RoleControlMain.do?roleTypeIds=' + roleTypeIds + '&isMulti=' + isMulti + '&isFullName=' + isFullName, 'RoleCtrl', width, height);
} 

function jf_OpenAdminRoleControl(psContext, isMulti, isFullName)
{
  jf_OpenRoleControl(psContext, '0001', isMulti, isFullName)
} 

function jf_OpenWSRoleControl(psContext, isMulti, isFullName)
{
  jf_OpenRoleControl(psContext, '0002', isMulti, isFullName)
} 

// clear opener's group value (called repeartedly): overide method
function clearRoleValue()
{
}

// get opener's group value list (delimiter : ,)  : overide method
function beforeRoleValue()
{
  return '';  
}

// set opener's group value (called repeat : overide method
// psValue : user id
// psText : user name
function afterRoleValue(psValue, psText)
{
}

function jf_Search(psContext, searchType, searchString, isMulti, isFullName)
{ 
  var WebObject = "<iframe id='FrameObject' name='HiddenFrame' src='' frameborder='0' width='0' height='0'></iframe>";
  if(document.getElementById('FrameObject') == null)
  {
	if(typeof HTMLElement!="undefined" && !HTMLElement.prototype.insertAdjacentElement){
	 HTMLElement.prototype.insertAdjacentElement = function(where,WebObject){
      	switch (where){
		   case 'beforeBegin':
		   this.parentNode.insertBefore(WebObject,this);
		   break;
		   case 'afterBegin':
		   this.insertBefore(WebObject,this.firstChild);
		   break;
		   case 'beforeEnd':
		   this.appendChild(WebObject);
		   break;
		   case 'afterEnd':
		   if (this.nextSibling) this.parentNode.insertBefore(WebObject,this.nextSibling);
		   else this.parentNode.appendChild(WebObject);
		   break;
		  }
	 }
	 HTMLElement.prototype.insertAdjacentHTML = function(where,htmlStr) {
	  var r = this.ownerDocument.createRange();
	  r.setStartBefore(this);
	  var parsedHTML = r.createContextualFragment(htmlStr);
	  this.insertAdjacentElement(where,parsedHTML);
	 }
	 HTMLElement.prototype.insertAdjacentText = function(where,txtStr){
	  var parsedText = document.createTextNode(txtStr);
	  this.insertAdjacentElement(where,parsedText);
	 }
	}
    document.body.insertAdjacentHTML('beforeEnd', WebObject);
  }
  jf_FrameUrl('HiddenFrame', psContext + 'common/Search.do', 'searchType=' + searchType + '&searchString='  + encodeURIComponent(searchString) + '&isMulti=' + isMulti + '&isFullName=' + isFullName);
}

function afterSearchValue(psValue, psText)
{
}

//===============  사용자 선택 팝업관련 추가함수 (임창진)  ==========================
function getOffsetLeft(anElem)  {
    if(anElem == null ) return 0;
    return anElem.offsetLeft + getOffsetLeft(anElem.offsetParent);
}

function getOffsetTop(anElem)  {
    if(anElem == null ) return 0;
    return anElem.offsetTop + getOffsetTop(anElem.offsetParent) ;
}



/**
 * 주의 !!!!!!!!! handler function 을 return 
 */
function makeAfterUserSearchHandler( userDefinedHandler,canHandleError )  {
    //alert('makeAfterUserSearchHandler');
    return function(req, id)    {
        if(req.readyState == 4 && req.status == 200)     {            
            var the_object              
            try {
                the_object = eval("(" + req.responseText + ")");
            }catch(e)    {
                alert('로그인 하시기 바랍니다.');
                return;
            }
            
            if(canHandleError != true)  {   //에러처리 위임시 
                if(processFail(the_object,'조회중 에러발생!')) return;
            }else { //자체적으로 에러처리할때 
                if(the_object.result == 'FAIL' )  {    //에러가 있을경우만 호출 
                    userDefinedHandler(the_object.returnValue , rtnObj.result );
                }
            }
            
            //팝업이 필요한 경우 
            if(the_object.popupNeeded == 'true')    {
                var myIframe = document.getElementById('list1');
                
                //var myIframe = document.createObject("<iframe id=list1 name=list1 src='<c:url value="/coll/approval/list.jsp"/>' width=600 height=354 frameborder=0 STYLE='position:absolute;top:140;left:138;z-index:0'></iframe>");
                //alert('pop need');
                myIframe.contentWindow.listWin = document.getElementById('list1');
                myIframe.contentWindow.locale = "ko";                                    
                myIframe.contentWindow.showList(the_object.returnValue , userDefinedHandler);                                                    
                myIframe.style.display = '';
            }else   {
                if(the_object.returnValue.length == 0)  {
                    alert('일치하는 검색결과가 없습니다.');
                }
                document.getElementById('list1').style.display='none';
                userDefinedHandler(the_object.returnValue ,'SUCCESS');  
            }
        }    
    }
}


function processFail(rtnObj,msg)   {
    try {
        if(rtnObj.result == 'SUCCESS') return false;
    }catch(e)   {
        alert(e);
    }
    
    alert(msg);
    return true;
}

/*
function jf_ModuleAdminInfo(psContext, moduleName)
{
  var url = psContext + 'common/ModuleAdminInfoView.do';
  var params= 'moduleName='+ moduleName ;
  new ajax.Request("1", 'POST', url, params, addResult);
}
*/

function jf_ModuleAdminInfo(psContext, moduleName)
{ 
  var popupUrl = psContext + '/common/ModuleAdminInfoView.do';
  popupUrl = popupUrl + '?moduleName='+ moduleName ;

  createModuleAdminInfoXMLHttpRequest();
  moduleAdminInfoXMLHttp.onreadystatechange = moduleAdminInfoReqChange;
  moduleAdminInfoXMLHttp.open("GET", popupUrl, true);
  moduleAdminInfoXMLHttp.send();
  document.getElementById("moduleAdminInfoPopup").style.visibility = "visible";      
}

function createModuleAdminInfoXMLHttpRequest() {
    if (window.ActiveXObject) {
        moduleAdminInfoXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    else if (window.XMLHttpRequest) {
        moduleAdminInfoXMLHttp = new XMLHttpRequest();
    }
}

function moduleAdminInfoReqChange() 
{
    if(moduleAdminInfoXMLHttp.readyState == 4) 
    {
        if(moduleAdminInfoXMLHttp.status == 200) 
        {
            document.getElementById("moduleAdminInfoPopup").innerHTML = moduleAdminInfoXMLHttp.responseText;
            document.getElementById("moduleAdminInfoPopup").style.top = getOffsetTop(document.getElementById("moduleAdminInfo")) + 20;
        }
    }
}  
 

function addResult(req)
{
 
  if(req.readyState==4)
  {
    if(req.status == 200)
    {
      document.getElementById("moduleAdminInfoPopup").style.visibility = "";   
      document.getElementById("moduleAdminInfoPopup").innerHTML = req.responseText;
      document.getElementById("moduleAdminInfoPopup").style.top = getOffsetTop(document.getElementById("moduleAdminInfo")) + 20;
     }
  }
}


function closeModuleAdminPopup()
{
    document.getElementById("moduleAdminInfoPopup").style.visibility = "hidden";             
}
function resizeLeftFrameToggle()
{
  if(document.getElementById("widthResize").width == 180)
    resizeLeftFrame("WIDE")
  else if(document.getElementById("widthResize").width > 180)
    resizeLeftFrame("BACK")
}

function resizeLeftFrame(option)
{
  if(option=='WIDE')
  {
    var width = document.body.scrollWidth;
    if(width > 180)
    {  
      parent.mainFrame.cols= "" + width + ",*%";
      document.getElementById("widthResize").width = width;
      document.getElementById("wideImg").style.display="none";
      document.getElementById("backImg").style.display="";
    }
  }
  else if(option=='BACK')
  {
    parent.mainFrame.cols= "" + 180 + ",*%";
    document.getElementById("widthResize").width = "180";
    document.getElementById("wideImg").style.display="";
    document.getElementById("backImg").style.display="none";
  }
}

function changeOnImg(loc, obj)
{
  obj.src = loc+ obj.id + "_on.gif";
}

function restoreImg(loc, obj)
{
  obj.src = loc+ obj.id + ".gif";
}

function getElementsByName(sName)
{
  if (arguments.length<2)
    return getElementsBy(arguments[0], "name", "this");
  else
    return getElementsBy(arguments[0], "name", arguments[1]);
}
 
function getElementsById()
{
  if (arguments.length<2)
    return getElementsBy(arguments[0], "id", "this");
  else
    return getElementsBy(arguments[0], "id", arguments[1]);
}

function changeOnMouseOver(imgObj)
{
      var img_src = imgObj.src;
      
      var i = img_src.lastIndexOf(".");
      
      var new_src = img_src.substring(0,i)+ "_on.gif";
      
      event.srcElement.src = new_src;
}

function changeOnMouseOut(imgObj)
{
      var img_src = imgObj.src;
    var new_src = img_src;
    var i = img_src.lastIndexOf("_on.gif");
      
      if(i>=0)
        new_src = img_src.substring(0,i)+ ".gif";
      
      event.srcElement.src = new_src;
}


function changeAsNewImage(imgObj, src){
  imgObj.src = src;
}

// 브라우저 호환을 위한 element 조회 함수
// name : 조회할 이름 또는 ID명
// type : 조회할 대상 id : element ID, name : element 명
// window : window 이름
function getElementsBy(name, type, window)
 {
  var outArray = new Array();
  if(typeof(name)!='string' || !name)
  {
    return outArray;
  };
  
  var doc = null;
  
  if (window=="this")
    doc = document;
  else
    doc = eval(window + ".document");
    
  if(doc.evaluate)
  {
    var xpathString = "//*[@" + type + "='" + name.toString() + "']"
    var xpathResult = doc.evaluate(xpathString, doc, null, 0, null);
    while ((outArray[outArray.length] = xpathResult.iterateNext())) { }
    outArray.pop();
  }
  else if(doc.all)
  {
    if (doc.all[name] != null)
    {
	    if (doc.all[name].length>0)
	    {
	      for(var i=0,j=doc.all[name].length;i<j;i+=1){
	        outArray[i] =  doc.all[name][i];}
	    }
	    else
	    {
	      outArray.push(doc.all[name]);
	    }
	 }
  }
  else if(doc.getElementsByTagName)
  {
    var aEl = doc.getElementsByTagName( '*' ); 
    for(var i=0,j=aEl.length;i<j;i+=1){
    
      if(aEl[i].id == name )
      {
        outArray.push(aEl[i]);
      };
    };  
    
  };
  
  return outArray;
 }
 
 function isIE()
 {
  if (navigator.appName == "Microsoft Internet Explorer")
    return true;
   else
    return false;
 }
 
 function editorBodySet_NBSP_BR(editorDom, content){
	var editorBodyHTML;

	content = content.replace(/&amp;nbsp;/gi, "<!--user##nbsptext##tmpstring-->");
	content = content.replace(/&lt;br&gt;/gi, "<!--user##brtext##tmpstring-->");

	editorDom.body.innerHTML = content;

	insertNBSP_BR(editorDom.body);

	editorBodyHTML = editorDom.body.innerHTML;
	editorBodyHTML = editorBodyHTML.replace(/&amp;nbsp;/gi, "&nbsp;");
	editorBodyHTML = editorBodyHTML.replace(/&lt;br&gt;/gi, "<br>");
	editorBodyHTML = editorBodyHTML.replace(/<!--user##nbsptext##tmpstring-->/gi, "&amp;nbsp;");
	editorBodyHTML = editorBodyHTML.replace(/<!--user##brtext##tmpstring-->/gi, "&lt;br&gt;");
	editorDom.body.innerHTML = editorBodyHTML;

	var preTag = editorDom.body.all.tags("PRE");
	for(var i = preTag.length - 1; i >=0 ; i--){
		if(preTag[i] != null && preTag[i].name != null && (preTag[i].name == "tmpBodyPRE" || preTag[i].name == "tmpSignPRE")){						
			preTag[i].outerHTML = preTag[i].innerHTML + "<BR>";
		}
	}
}

function insertNBSP_BR(obj){
	try{
		var nodeText;
		for(var i = 0; i < obj.childNodes.length; i++){
			if(obj.childNodes[i].nodeType == 3){	// text node
				nodeText = obj.childNodes[i].nodeValue;				
				nodeText = nodeText.replace(/ /g, "&nbsp;");
				nodeText = nodeText.replace(/\t/g, "&nbsp;&nbsp;&nbsp;&nbsp;");
				nodeText = nodeText.replace(/(?:\r\n|\r|\n)/g, "<br>\r\n");
				
				obj.childNodes[i].nodeValue = nodeText;
			}else{
				if(obj.childNodes[i].nodeName != null && obj.childNodes[i].nodeName.toUpperCase() == "P"){
					if(obj.childNodes[i].style.marginTop == null || obj.childNodes[i].style.marginTop == ""){
						obj.childNodes[i].style.marginTop = "auto";
					}
				}
				insertNBSP_BR(obj.childNodes[i]);
			}
		}
	}catch(e){}
}

/**
  * @type : function
  * @desc : 워크스페이스 메시지 출력
  */
 var GLOBAL_MESSAGE_KEY = 'ikeps.workspace.message';
  
 function jf_ShowMessage(message) {
   if(jf_GetCookie(GLOBAL_MESSAGE_KEY) == 'true') {
     if (!jf_IsEmpty(message)) {
       alert(message);
     }
     jf_SetCookie(GLOBAL_MESSAGE_KEY, 'false', 0);
   }
 }
 
/** SMS 발송 화면 띄우기 시작 **/
function openSMSWin(hp){	
    var send = hp==undefined || hp==""?"":"?receiver=" + hp;
		jf_OpenWindow('/portal/product/sms/SMSSendForm.do' + send,'sendSMS', 500, 490);
}
/** SMS 발송 화면 띄우기 끝 **/

/** 웹보안 Filter = Start  (2010.05.11 신동진D) */
function checkSpecialChar(strText, msg)
{
//	var specialChar = "><\'\"@#$%*+&-^;!=_?";
//	var specialChar = "<>\'\"$%&;=?";
//	var specialChar = "<>\'";	
	var specialChar = "";

	var flag = true;

	var txt = strText;
     
	for (i=0; i < txt.length; i++)
	{
		subString = txt.charAt(i);
	    if (specialChar.indexOf(subString) != -1)
	    {
			alert(msg);
			flag = false;
	     	break;
		}
   }
   
   return flag;
}
/** 웹보안 Filter = End */


/** 웹보안 Filter = Start  (2010.05.11 신동진D) */
function checkSpecialChar2(strText, msg)
{
//	var specialChar = "><\'\"@#$%*+&-^;!=_?";
//	var specialChar = "<>\'\"$%&;=?";
	var specialChar = "<>\'\"~`-_=+\|{}[]:;<>?/.,&";	
//	var specialChar = "";

	var flag = true;

	var txt = strText;
     
	for (i=0; i < txt.length; i++)
	{
		subString = txt.charAt(i);
	    if (specialChar.indexOf(subString) != -1)
	    {
			alert(msg);
			flag = false;
	     	break;
		}
   }
   
   return flag;
}
/** 웹보안 Filter = End */



/** 로그인 체크  Start */
function loginChkKnt(userStatus, parentUrl, rightUrl, menuId, loginMessage)
{
  var objForm = document.mainForm;   
	if(userStatus != 'A'){
    if(confirm(loginMessage))
    {
	     var targetUrl = '/sso/CreateRequest.jsp'; 
	     var url1 = '/portal/PortalView.do?urlType=Y&menuId='+menuId;
	     var url2 = '&pageUrl='+encodeURIComponent(parentUrl);	
	     var url3 = '&pageUrlSub='+encodeURIComponent(rightUrl);  
	     var param = 'RelayState=' + encodeURIComponent(url1 + url2 + url3);

	     jf_FrameUrl('top', targetUrl, param);
    }	
    return false;
	}
	return true;	   
}	

function loginChkExpKnt(userStatus, parentUrl, rightUrl, menuId, itemType, loginMessage)
{
  var objForm = document.mainForm;   
	if(userStatus != 'A'){
    if(confirm(loginMessage))
    {
	     var targetUrl = '/sso/CreateRequest.jsp'; 
	     var url1 = '/portal/PortalView.do?urlType=Y&menuId='+menuId;
	     var url2 = '&pageUrl='+encodeURIComponent(parentUrl);	
	     var url3 = '&pageUrlSub='+encodeURIComponent(rightUrl);  
	     var param = 'RelayState=' + encodeURIComponent(url1 + url2 + url3+'?itemType='+itemType);

	     jf_FrameUrl('top', targetUrl, param);
    }	
    return false;
	}
	return true;	  
}

/** 로그인 체크  Start */
function loginChk(userStatus, parentUrl, rightUrl, menuId, loginMessage)
{
  var objForm = document.mainForm;   
	if(userStatus != 'A'){
    if(confirm(loginMessage))
    {
	     var targetUrl = '/LoginForm.do'; 
	     var param = 'RedirectTo='+parentUrl+'&amp;RedirectToSub='+rightUrl+'&amp;menuId='+menuId;
	     jf_FrameUrl('top', targetUrl, param);
    }	
    return false;
	}
	return true;	  
}	

function loginChkExp(userStatus, parentUrl, rightUrl, menuId, itemType, loginMessage)
{
  var objForm = document.mainForm;   
  
	if(userStatus != 'A'){
    if(confirm(loginMessage))
    {
      var targetUrl = '/LoginForm.do'; 
      var param = 'RedirectTo='+parentUrl+'&amp;RedirectToSub='+rightUrl+'&amp;menuId='+menuId+'&amp;itemType='+itemType;
      jf_FrameUrl('top', targetUrl, param);
    }	
    return false;
	}
	return true;	  
}

/** 로그인 체크  End */ 

/** Navi 경로  Start */
function goList(target, url, pageUrlSub)
{
  var obj = document.mainForm;
  obj.target = target;
  obj.action = url + encodeURIComponent(pageUrlSub);
  obj.submit();
}
/** Navi 경로  End */ 

function sitemap_click() {
	var sitemap_flag = top.portal_main.document.getElementById('sitemap').style.display;

	if(sitemap_flag == "block")
	  top.portal_main.document.getElementById('sitemap').style.display = 'none';
	else
	  top.portal_main.document.getElementById('sitemap').style.display = 'block';
}

function sitemap_close() {
	//var sitemap_flag = top.portal_main.document.getElementById('sitemap').style.display;

	//if(sitemap_flag == "block")
	//  top.portal_main.document.getElementById('sitemap').style.display = 'none';
}


