/**
 * cms페이지 로그아웃
 * @return void
 */
function logout(){
  document.location.href = "../cms/logout.jsp";
}



/**
 * depth1메뉴 포커스변경시 이미지교체
 * @param obj
 * @return
 */
function changeTopMenu( position ){
  var topMenuImages = document.getElementById('topmenulist').getElementsByTagName("img");
  for( var i = 0; i < topMenuImages.length; i++ ){
      topMenuImages[i].src = ( i == position )?topMenuImages[i].src.replace('_off', '_on')
                                      :topMenuImages[i].src.replace('_on', '_off');
  }
}



/**
 * depth2메뉴에 마우스오버시 스타일변경
 * @param position
 * @return
 */
function changeSubmenu( position ){
  var subMenuLists = document.getElementById('submenulist').getElementsByTagName("li");
  for( var i = 0; i < subMenuLists.length; i++ ){
    subMenuLists[i].className = ( i == position )?'menuOn':'menuOff';
  }
}



/**
 * 관리자메뉴수정(editAdminMenu.jsp)페이지의 하위링크 추가
 * @param liId
 * @return
 */
function addSubMenu(){
  var root = document.getElementById('subitemlist');
  var items = root.getElementsByTagName('li');
  
  var maxrow = 0;
  for( var i = 0; i < items.length; i++ ){
    maxrow = ( maxrow < ( (items[i].getAttribute('rowid') == null)?0:items[i].getAttribute('rowid') )
               ?    items[i].getAttribute('rowid') : maxrow );
  }
  if( maxrow == 0 && items.length == 1 ){
    root.removeChild(items[0]);
  }else{
    maxrow += 1;
  }
  var li = document.createElement('li');
  li.setAttribute('rowid', maxrow);
  var tempArray = new Array();
  tempArray.push('<label style="cursor:move;">메뉴명: <input type="text" name="menuname" class="txt" /></label>\n');
  tempArray.push('<label>링크: <input type="text" name="menulink" class="txt" size="50" /></label>\n');
  tempArray.push('<a href="#" onclick="deleteSubMenu(\''+maxrow+'\');return false;" class="btnType2 btnType2Style"><span class="btnType2SpanStyle">삭제</span></a>');
  tempArray.push(' <a href=\"#\" onclick="moveSubMenu(this, \'up\'); return false;" class="btnType2 btnType2Style"><span class="btnType2SpanStyle">위로</span></a>');
  tempArray.push(' <a href=\"#\" onclick="moveSubMenu(this, \'down\'); return false;" class="btnType2 btnType2Style"><span class="btnType2SpanStyle">아래로</span></a>');

  li.innerHTML = tempArray.join('');
  root.appendChild(li);

}



/**
 * 관리자메뉴수정(editAdminMenu.jsp)페이지의 하위링크 삭제
 * @param liId
 * @return
 */
function deleteSubMenu( liId ){
  if( confirm('선택하신 하위메뉴를 삭제하시겠습니까?') ){
    var root = document.getElementById('subitemlist');
    var items = root.getElementsByTagName('li');
    for( var i = 0; i < items.length; i++ ){
      if( items[i].getAttribute('rowid') == liId ){
        root.removeChild(items[i]);
      }
    }
  }
}




/**
 * editAdminMenu.jsp 하위메뉴의 순서변경함수
 * @param obj anchor태그개체
 * @param direction 방향('up' or '아무거나')
 * @return
 */
function moveSubMenu( obj, direction ){
  var parentLi = obj.parentNode;
  var root = parentLi.parentNode;
  var liList = root.getElementsByTagName('li');
  var prevLinumber = 0;
  var replacedNode;
  
  for( var i = 0; i < liList.length; i++ ){
    
    if( ( parentLi == liList[i] ) ){
      
      if( direction == 'up' ){
        root.insertBefore( parentLi, liList[prevLinumber] );
      }else if( i < (liList.length - 1) ){
        replacedNode = root.replaceChild( parentLi, liList[i + 1] );
        root.insertBefore( replacedNode, parentLi );
        i++;
      }
      
    }
    
    prevLinumber = i;
    
  }
  
}



/**
 * 달력 보여주는 함수
 * @param target
 * @param frame
 * @param e
 * @return
 */
function showCalendar(target, frame, e){
  var event = window.event || e;
  var x = event.pageX || event.clientX + document.body.scrollLeft;
  var y = event.pageY || event.clientY + document.body.scrollTop;
  document.getElementById(frame).style.left = x + 'px';
  document.getElementById(frame).style.top = y + 'px';
  document.getElementById(frame).src = "../calendar/calendarFrame.jsp?targetId="+target+"&frameId="+frame;
  document.getElementById(frame).style.display = "inline";
}




/**
 * <script>fncCalendarImg('inputid');</script>
 * 달력 이미지보여주는 함수
 * @param e
 * @return
 */
function fncCalendarImg(type){
  $("#"+type).datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true });
  //document.write("<img src=\"../../files/board/images/board/icon_calendar.gif\" align=\"absmiddle\" onclick=\"showCalendar2('"+type+"');\" style=\"cursor:pointer;margin-right:5px;\"><div id='"+type+"_cal' style='display:none;'></div>");
  
}

/**
 * 게시판관리분류입력
 * @author 김지은
 * @param 분류텍스트객체
 * @param 분류select객체
 * @param text
 * @return 
 */
function addItem(obj1, obj2, text) {
  if( obj1.value.replace(/\s/g, '')=="" ) {
    alert("입력할 "+text+"를 입력하세요");
    obj1.focus();
    return;
  }
  
  var sOption = document.createElement("OPTION");
/*
  if ( objectid != "" ) {
    $.post("itemProcess.jsp",        //ajax 로 페이지 부르기 
          { 'itemFieldName':obj1.value, 'mode':"insertItemProcess", 'groupID':groupid, 'objectID':objectid },  // 선택된 것 Array로 넘기기
          function(data) {            // Callback 함수
            aData = data.split("|");
            len = aData.length ;
            for (i=0;i<len;i++) {
              if ( i == 0 ) {
                sOption.value=aData[0];
              } else if ( i == 1 ) {
                alert(aData[1]);
              }
            }
          }, 
          "text");
  } else {
    sOption.value=" ";
  }
  */
  sOption.value="";
  sOption.text=obj1.value;
  obj2.options.add(sOption);
  obj1.value = "";
}


/**
 * 게시판관리분류삭제
 * @author 김지은
 * @param 분류select객체
 * @param text
 * @return
 */
function deleteItem(obj2, text) {
  if( obj2.selectedIndex == -1 ) {
    alert("삭제할  "+text+"를 선택하세요");
    obj2.focus();
    return;
  }
  $.post("itemProcess.jsp",        //ajax 로 페이지 부르기 
          { 'itemID':obj2.options[obj2.selectedIndex].value, 'mode':"checkItemProcess" },  // 선택된 것 Array로 넘기기
          function(data) {            // Callback 함수
            aData = data.split("|");
            len = aData.length ;
            for (i=0;i<len;i++) {
              if ( i == 0 ) {
                //obj2.remove(obj2.selectedIndex);
              } else if ( i == 1 ) {
                if ( confirm(aData[i]) ) {
                  obj2.remove(obj2.selectedIndex);
                }
              }
            }
          }, 
          "text");
  /*
  if ( objectid != "" ) {
    $.post("itemProcess.jsp",        //ajax 로 페이지 부르기 
          { 'itemID':obj2.options[obj2.selectedIndex].value, 'mode':"deleteItemProcess", 'groupID':groupid, 'objectID':objectid },  // 선택된 것 Array로 넘기기
          function(data) {            // Callback 함수
            aData = data.split("|");
            len = aData.length ;
            for (i=0;i<len;i++) {
              if ( i == 0 ) {
                obj2.remove(obj2.selectedIndex);
              } else if ( i == 1 ) {
                alert(aData[1]);
              }
            }
          }, 
          "text");
  } else {
    obj2.remove(obj2.selectedIndex);
  }
  */
  //obj2.remove(obj2.selectedIndex);
}

function editItemDisplay(obj1, obj2) {
  obj2.value = obj1.options[obj1.selectedIndex].text;
  /*
  obj3.value = obj1.options[obj1.selectedIndex].value;
  */
}

function editItem(itemfieldname, obj){
/*
        $.post("itemProcess.jsp",        //ajax 로 페이지 부르기 
          { 'itemFieldName':itemfieldname, 'itemID':itemid, 'mode':"updateItemProcess", 'groupID':groupid, 'objectID':objectid },  // 선택된 것 Array로 넘기기
          function(data) {            // Callback 함수
            aData = data.split("|");
            len = aData.length ;
            for (i=0;i<len;i++) {
              if ( i == 0 ) {
                if ( obj.options[obj.selectedIndex].value == itemid ) {
*/
                  obj.options[obj.selectedIndex].text = itemfieldname;
/*
                }
              } else if ( i == 1 ) {
                alert(aData[1]);
              }
            }
          }, 
          "text");
*/
}
/**
 * 게시판관리분류   위로
 * @author 김지은
 * @param 분류select객체
 * @return
 */
function upItem(obj2) {
  var nSelectedIndex = obj2.selectedIndex;
  if ( nSelectedIndex < 0 ) {
    alert("선택한 값이 없습니다.");
    return;
  }
  if ( nSelectedIndex == 0 ) {
    alert("처음입니다.");
    return;
  }

  var sText = obj2.options[nSelectedIndex].text;
  var sValue = obj2.options[nSelectedIndex].value;
  obj2.options[nSelectedIndex].text = obj2.options[nSelectedIndex-1].text;
  obj2.options[nSelectedIndex].value = obj2.options[nSelectedIndex-1].value;
  obj2.options[nSelectedIndex-1].text = sText;
  obj2.options[nSelectedIndex-1].value = sValue;
}



/**
 * 게시판관리분류아래로
 * @author 김지은
 * @param 분류select객체
 * @return
 */
function downItem(obj2) {
  var nSelectedIndex = obj2.selectedIndex;
  if ( nSelectedIndex < 0 ) {
    alert("선택한 값이 없습니다.");
    return;
  }
  if ( nSelectedIndex == obj2.length -1 ) {
    alert("마지막입니다.");
    return;
  }

  var sText = obj2.options[nSelectedIndex].text;
  var sValue = obj2.options[nSelectedIndex].value;
  obj2.options[nSelectedIndex].text = obj2.options[nSelectedIndex+1].text;
  obj2.options[nSelectedIndex].value = obj2.options[nSelectedIndex+1].value;
  obj2.options[nSelectedIndex+1].text = sText;
  obj2.options[nSelectedIndex+1].value = sValue;
}

/**
 * 분류select객체의 text를 아이템필드로 삽입
 * @author 조지은
 * @param 분류select객체
 * @param 아이템필트네임객체
 * @return
 */
function checkItemFieldName(sSelectItem, sItemFieldName){
  if ( sSelectItem && sItemFieldName ) {
    var sTxt = "";
    var nOption = sSelectItem.length;
    for( i = 0; i < nOption; i++ ) {
     sTxt += sSelectItem.options[i].value;
     sTxt += ":";
     sTxt += sSelectItem.options[i].text;
      if( i < nOption - 1 ) {
        sTxt = sTxt + "|";
      }
    }
    sItemFieldName.value = sTxt;
  }
}

/**
* 첨부파일 확장자 검사
* @author 조지은
* @param 첨부파일 허용종류
* @param 파일 객체
* @return
*/ 
function checkFile(existExt){
  existExtArray = existExt.split("|");
  var inputs = document.getElementsByTagName("input");
  var file = new Array();
  var idx =0;
        
  for ( var i=0; i<inputs.length;i++){
    if ( inputs[i].type == "file" && inputs[i].value != "" ) {
      file[idx] = inputs[i];
      idx++;
    }
  }
  
  if ( file.length > 0 ) {
    for ( var i=0; i<file.length;i++){
      Temp_file1_name = file[i].value;
      if (Temp_file1_name != "") {
        bi = false;
        Temp_strExt1_num = Temp_file1_name.slice(Temp_file1_name.lastIndexOf(".")).toLowerCase();
        for (var j=0; j < existExtArray.length; j++){
          if (Temp_strExt1_num == existExtArray[j]){
            bi = true;
          }
          if ( ( j == existExtArray.length - 1 ) && !bi ) {
            if ( !bi ) {
              alert(Temp_strExt1_num+"는 첨부할 수 없는 확장자입니다.");
              return false;
            } else {
              return true;
            }
          }
        }
      } else {
        return true;
      }
    }
    if ( !bi ) {
      alert(Temp_strExt1_num+"는 첨부할 수 없는 확장자입니다.");
      return false;
    } else {
      return true;
    }
  } else {
    return true;
  } 
}

/**
* 글쓰기제한단어 검사
* @author 조지은
* @param 글쓰기제한단어
* @param 인풋
* @return
*/
function checkRestrictWord(restrictWord, input){
  Temp_name = input.value;
  restrictWordArray = restrictWord.split(",");
  if ( restrictWord != "" && Temp_name != "" ) {
    ci = false;
    for(i=0;i<restrictWordArray.length;i++){
      var c = new RegExp(restrictWordArray[i].replace(/(^\s*)|(\s*$)/g, ""));
      if ( c.test(Temp_name) ) {
        ci = false;
        break;
      } else {
        ci = true;
      }
    }
    if ( !ci ) {
      alert("금지어를 포함하고 있습니다. 다시 작성해주세요.");
      return false;
    } else {
      return true;
    }
  } else {
    return true;
  }
}


/**
 * open popup, window open을 이용, 인자전달 없음
 *
 * @param       sURL    url
 * @param       sWidth  window width(optional)
 * @param       sHeight window height(optional)
 * @return  window  object
 * @since       1.0
 */
function openPopup (sURL) {
    var sWidth, sHeight;
    var sFeatures;
    var oWindow;
    var SP2 = false;
    var POPUP_WIDTH     = 400;
    var POPUP_HEIGHT    = 300;
    var B_MAIN_PAGE     = true;

    sHeight = POPUP_HEIGHT;
    sWidth  = POPUP_WIDTH;
    sTitle = "PopupWindow";

    try {
      SP2 = (window.navigator.userAgent.indexOf("SV1") != -1);
      if (arguments[1] != null && arguments[1] != "") sWidth = arguments[1] ;
      if (arguments[2] != null && arguments[2] != "") sHeight = arguments[2] ;
      if (arguments[3] != null && arguments[3] != "") sTitle = arguments[3] ;
      if (SP2)     {   // XP SP2 브라우저임..
        sHeight = Number(sHeight)+10;
      }else{  //그외 브라우저
      }
    } catch(e) {}
    
    if(sURL.indexOf("printPopup.jsp") > 0) {
      sWidth = 760;
    }
    sFeatures =  "width=" + sWidth + ",height=" + sHeight ;
    sFeatures += ",left=0,top=0" ;
    if(sURL.indexOf("printPopup.jsp") > 0) {
      sFeatures += ",directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=no,toolbar=no";
    } else {
      sFeatures += ",directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no";
    }
    
    if(sURL!=null && sURL.length > 0) {
      if(sURL.indexOf("?") > 0) {
        sURL += "&thref="+encodeURI(location.href);
      } else {
        sURL += "?thref="+encodeURI(location.href);
      }
    }
    oWindow = window.open(sURL, sTitle, sFeatures);
    oWindow.focus();

    // move to screen center
    //oWindow.moveTo( (window.screen.availWidth - sWidth) / 2, (window.screen.availHeight - sHeight) / 2);

    return oWindow;
}

/**
 * open popup, window open을 이용, 인자전달 없음
 *
 * @param       sURL    url
 * @param       sWidth  window width(optional)
 * @param       sHeight window height(optional)
 * @return  window  object
 * @since       1.0
 */
function openPopupScroll (sURL) {
  var sWidth, sHeight;
  var sFeatures;
  var oWindow;
  var SP2 = false;
  var POPUP_WIDTH     = 400;
  var POPUP_HEIGHT    = 300;
  var B_MAIN_PAGE     = true;
  
  sHeight = POPUP_HEIGHT;
  sWidth  = POPUP_WIDTH;
  sTitle = "PopupWindow";
  
  try {
    SP2 = (window.navigator.userAgent.indexOf("SV1") != -1);
    if (arguments[1] != null && arguments[1] != "") sWidth = arguments[1] ;
    if (arguments[2] != null && arguments[2] != "") sHeight = arguments[2] ;
    if (arguments[3] != null && arguments[3] != "") sTitle = arguments[3] ;
    if (SP2)     {   // XP SP2 브라우저임..
      sHeight = Number(sHeight)+10;
    }else{  //그외 브라우저
    }
  } catch(e) {}
  
  if(sURL.indexOf("printPopup.jsp") > 0) sWidth = 680;

  sFeatures =  "width=" + sWidth + ",height=" + sHeight ;
  sFeatures += ",left=0,top=0" ;
  sFeatures += ",directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=no,toolbar=no";
  
  if(sURL!=null && sURL.length > 0 && sURL.indexOf("printPopup.jsp") > 0) {
    if(sURL.indexOf("?") > 0) {
      sURL += "&thref="+encodeURI(location.href);
    } else {
      sURL += "?thref="+encodeURI(location.href);
    }
  }
  oWindow = window.open(sURL, sTitle, sFeatures);
  oWindow.focus();
  
  // move to screen center
  //oWindow.moveTo( (window.screen.availWidth - sWidth) / 2, (window.screen.availHeight - sHeight) / 2);
  
  return oWindow;
}

/**
* textarea 바이트체크
* @author 인터넷
* @param obj(textarea), iSize(byte), sId(textarea id)
* @return
*/
function char_length(obj, iSize, sId) {
  var tmpStr;
  var temp=0;
  var onechar;
  var tcount;
  tcount = 0;
  aquery = obj.value;
  tmpStr = new String(aquery);
  temp = tmpStr.length;
  
  for (k=0;k<temp;k++)
  {
    onechar = tmpStr.charAt(k);
    if (escape(onechar) =='%0D') { } else if (escape(onechar).length > 4) { tcount += 2; } else { tcount++; }
  }
  
  document.getElementById(sId).innerHTML = tcount;
  
  if(tcount>iSize) {
    reserve = tcount-iSize;
    alert(iSize+"바이트 이상 입력할 수 없습니다.");
    cutText(obj, iSize, sId);
    return;
  }
}

/**
* textarea 바이트수  보여주기
* @author 인터넷
* @param obj(textarea), iSize(byte), sId(textarea id)
* @return
*/
function cutText(obj, iSize, sId){
  var tmpStr;
  var temp=0;
  var onechar;
  var tcount;
  tcount = 0;
  aquery = obj.value;
  tmpStr = new String(aquery);
  temp = tmpStr.length;
  
  for(k=0;k<temp;k++)
  {
    onechar = tmpStr.charAt(k);
    
    if(escape(onechar).length > 4) {
      tcount += 2;
    } else {
      // 엔터값이 들어왔을때 값(\r\n)이 두번실행되는데 첫번째 값(\n)이 들어왔을때 tcount를 증가시키지 않는다.
      if(escape(onechar)=='%0A') {
      } else {
        tcount++;
      }
    }
  
    if(tcount>iSize) {
      tmpStr = tmpStr.substring(0,k);
      break;
    }
  }
  obj.value = tmpStr;
  char_length(obj, iSize, sId);
}

/*
 * 팝업 자동 리사이징
 *  - 윈도 환경에 따라 사이즈가 다를 수 있습니다.
 *  - 팝업페이지의 스크립트 최하단에서 실행하십시오.
 *
 * (ex.) window.onload = function(){popupAutoResize();}
*/
/*
function popupAutoResize() {
  //window.resizeTo(arguments[0], 50);
  if ( navigator.userAgent.indexOf("Linux") < 0 ) {
    var thisX = parseInt(document.documentElement.scrollWidth);
    var thisY = parseInt(document.documentElement.scrollHeight);
    var maxThisX = screen.width - 50;
    var maxThisY = screen.height - 50;
    var marginY = 0;
    var SP2 = (navigator.appVersion.indexOf("MSIE 7.0") != -1);
   
    //alert(thisX + "===" + thisY);
    //alert("임시 브라우저 확인 : " + navigator.userAgent);
    // 브라우저별 높이 조절. (표준 창 하에서 조절해 주십시오.)
    if(navigator.userAgent.indexOf("MSIE 7") > 0) marginY = 52;  
    else if (navigator.userAgent.indexOf("MSIE 6") > 0) marginY = 29;  
    else if (navigator.userAgent.indexOf("MSIE 8") > 0) marginY = 80;   
    else if(navigator.userAgent.indexOf("Firefox") > 0) marginY = 82;   
    else if(navigator.userAgent.indexOf("Opera") > 0) marginY = 30;   
    else if(navigator.userAgent.indexOf("Netscape") > 0) marginY = -2;  
    //window.resizeTo(arguments[0], thisY);
        
    if (SP2)     {   // XP SP2 브라우저임..
      marginY = Number(marginY)-23;
    }else{  //그외 브라우저
    }
    if (thisX > maxThisX) {
        window.document.body.scroll = "yes";
        thisX = maxThisX;
    }
    if (thisY > maxThisY - marginY) {
        window.document.body.scroll = "yes";
        thisX += 19;
        thisY = maxThisY - marginY;
    }
  //alert("thisY : " + thisY);   
    if (arguments[0] != null && arguments[0] != "") {
  //alert("arguments[0] : " + arguments[0]);
  //alert(thisY+marginY);    
      window.resizeTo(arguments[0], thisY+marginY);
    } else {
      window.resizeTo(thisX+8, thisY+marginY);
    }
    //window.resizeBy(0, 0);
    // 센터 정렬
    // var windowX = (screen.width - (thisX+10))/2;
    // var windowY = (screen.height - (thisY+marginY))/2 - 20;
    // window.moveTo(windowX,windowY);
  }
}
*/  

//리사이즈 문제있으면 원래함수로 복구하세요
function popupAutoResize() {
  if ( navigator.userAgent.indexOf("Linux") < 0 ) {
    var thisX = parseInt(document.documentElement.scrollWidth);
    var thisY = parseInt(document.documentElement.scrollHeight);
    var maxThisX = screen.width - 50;
    var maxThisY = screen.height - 50;
    var marginY = 0;
    //var SP2 = (navigator.appVersion.indexOf("MSIE 7.0") != -1);   
    //WindowsXP SP2
    if(navigator.userAgent.indexOf("MSIE 8") > 0) {
      marginY = 78;
    } else if(navigator.userAgent.indexOf("MSIE 7") > 0) {
      marginY = 78;                       
    } else if (navigator.userAgent.indexOf("MSIE 6") > 0) {
      marginY = 58;         
    } else if (navigator.userAgent.indexOf("Firefox") > 0) {
      marginY = 84;         
    } else if (navigator.userAgent.indexOf("Chrome") > 0) {
      marginY = 0;            
      thisX -= 8;     
    } else {
      marginY = 50;
    } 
    /*
    if (SP2) { 
      marginY = Number(marginY) - 23;
    }else{    
    }
    */
    //WindowsVISTA, Windows7
    if(navigator.userAgent.indexOf("Windows NT 6") > 0) { 
      if (navigator.userAgent.indexOf("MSIE") > 0) {
        marginY += 0;    
      } else if (navigator.userAgent.indexOf("Firefox") > 0) {
        marginY += -1;      
        thisX += 8;                
      } else if (navigator.userAgent.indexOf("Chrome") > 0) {
        marginY += 3;
      }   
    }
    //Windows2000
    if(navigator.userAgent.indexOf("Windows NT 5.0") > 0) {
      if (navigator.userAgent.indexOf("MSIE") > 0) {
        marginY -= 41;         
      } else if (navigator.userAgent.indexOf("Firefox") > 0) {
        marginY -= 3;      
      } 
    }
    if (thisX > maxThisX) {
        window.document.body.scroll = "yes";
        thisX = maxThisX;
    }
    if (thisY > maxThisY - marginY) {
        window.document.body.scroll = "yes";
        thisX += 19;
        thisY = maxThisY - marginY;
    }
    if (arguments[0] != null && arguments[0] != "") {
      window.resizeTo(arguments[0], thisY+marginY);
    } else {
      window.resizeTo(thisX+8, thisY+marginY);
    }  
  }
}

/**
 * 글자수check
 * @param obj
 * @param max
 * @param checkMaxID
 * @return
 */
function displayStateData (targetID, displayState) {
  var targetArray = targetID.split('|');
  for( var i = 0; ( i < targetArray.length ) && targetArray[i] != '' ; i++ ){
    document.getElementById(targetArray[i]).style.display = displayState;
  }
}

/**
 * cookie
 * @param targetID
 * @return
 */
function setCookie(name,value,expiredays) {
  var todayDate = new Date();
  todayDate.setDate(todayDate.getDate() + expiredays);
  document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
  
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 "";
}

 /**
  * 쿠키 삭제
  * @param cookieName 삭제할 쿠키명
  */
function deleteCookie( cookieName )
{
  var expireDate = new Date();
  
  //어제 날짜를 쿠키 소멸 날짜로 설정한다.
  expireDate.setDate( expireDate.getDate() - 1 );
  document.cookie = cookieName + "= " + "; expires=" + expireDate.toGMTString() + "; path=/";
}
/**
 * 글자수check
 * @param obj
 * @param max
 * @param checkMaxID
 * @return
 */
function checkMax(obj, max, checkMaxID){
  var sTxt = obj.value;
  if( sTxt.length > max ) {
    alert(max+'자 이내로 입력해 주십시오.');
    obj.value = obj.value.substring(0, max );
    return false;
  }
  var sCheckMaxID = document.getElementById(checkMaxID);
  sCheckMaxID.innerHTML = sTxt.length;
  return true;
}

/**
 * 트리밍
 * @param str
 * @return
 */
function trim(str){
  //alert(str);
  str = str.replace(/^\s*/,'').replace(/\s*$/, '');
  return str;
}

/**
 * 첨부파일 다운로드
 * @param str
 * @return
 */
function fncDownload( arg1, arg2, arg3 ) { 
	if(arg3 == undefined)
		  arg3 = arg2;
  if ( !document.getElementById("fileDownloadForm") ) {
    fncCreateDownloadForm();
  }
  
  if ( document.getElementsByName("hFrame").length == 0 ) {
    fncCreateHiddenFrame();
  }
  
  document.getElementById("fileDownloadForm").action = "../../filter/FileDownload";
  document.getElementById("fileDownloadForm").dirName.value = arg1;
  document.getElementById("fileDownloadForm").fileName.value = arg2;
  document.getElementById("fileDownloadForm").orgName.value = arg3;
  document.getElementById("fileDownloadForm").target = "hFrame";
  document.getElementById("fileDownloadForm").submit();
}

/**
 * 다운로드 폼이 없을 경우 생성
 * @param str
 * @return
 */
function fncCreateDownloadForm() {
  var addHtml = "<form id=\"fileDownloadForm\" name=\"fileDownloadForm\" action=\"\" method=\"post\"><input id=\"dirName\" type=\"hidden\" name=\"dirName\"/> <input id=\"fileName\" type=\"hidden\" name=\"fileName\"/> <input id=\"orgName\" type=\"hidden\" name=\"orgName\"/></form>";
  $(addHtml).appendTo("body");  
}

/**
 * HiddenFrame이 없을 경우 생성
 * @return
 */
function fncCreateHiddenFrame() {
  var addHiddenFrame = "<iframe name=\"hFrame\" src=\"\" frameborder=\"0\" width=\"0\" scrolling=\"no\" height=\"0\"></iframe>";
  $(addHiddenFrame).appendTo("body");  
}


function fncCreateDiv(id) {
  var addHiddenFrame = "<div id=\"popLayerContent"+id+"\""
+"style=\"position: absolute; top: 0px; left: 0px; z-index: 1000;\" >"
+"<iframe title=\"이벤트 알림\" name=\"popLay"+id+"\" id=\"popLay"+id+"\" src=\"#\" width=\"0px\""
+"height=\"0px\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\""
+"frameborder=\"0\"></iframe></div>";
  $(addHiddenFrame).appendTo("body");
  return true;
}
/**
 * add combobox list
 *
 * @param   oCombo      combo object
 * @param   sValue      combo data string
 * @param   sText       combo text string
 * @since   1.0
 */
function addCombo (oCombo, sValue, sText) {
    if (sValue == null || sValue == "") return;

    var optionElem = document.createElement("OPTION");
    optionElem.setAttribute("value", sValue);
    optionElem.appendChild(document.createTextNode(sText));

    eval(oCombo).appendChild(optionElem);
}

/**
 * remove combobox list
 *
 * @param   oCombo          combo object
 * @since   1.0
 */
function removeCombo (oCombo, idx) {
  var cntOption = eval(oCombo).getElementsByTagName("option");

  if ( idx < 0 || idx > (cntOption.length - 1 ) ) {
    return;
  }

  aCompare = (oCombo.options[idx].value).split(":");
  len = aCompare.length;
  for (i=0;i<len;i++){
    if ( i == 0 ) {
      if ( aCompare[i] == "U" ) {
        var DEL_FILE_LIST = document.createElement("input");
        DEL_FILE_LIST.type = "hidden"
        DEL_FILE_LIST.name = "DEL_FILE_LIST";
        DEL_FILE_LIST.setAttribute("name", "DEL_FILE_LIST");
        DEL_FILE_LIST.value = (oCombo.options[idx].value).replace("U:", "");
        document.forms['writeForm'].appendChild(DEL_FILE_LIST);
      } 
      oCombo.removeChild(cntOption[idx]);    
    }
  }
}

/**
 * remove combobox list
 *
 * @param   oCombo          combo object
 * @since   1.0
 */
function removeImageCombo (oCombo, idx) {
  var cntOption = eval(oCombo).getElementsByTagName("option");

  if ( idx < 0 || idx > (cntOption.length - 1 ) ) {
    return;
  }

  aCompare = (oCombo.options[idx].value).split(":");
  len = aCompare.length;
  for (i=0;i<len;i++){
    if ( i == 0 ) {
      if ( aCompare[i] == "U" ) {
        var DEL_IMAGE_LIST = document.createElement("input");
        DEL_IMAGE_LIST.type = "hidden"
        DEL_IMAGE_LIST.name = "DEL_IMAGE_LIST";
        DEL_IMAGE_LIST.setAttribute("name", "DEL_IMAGE_LIST");
        DEL_IMAGE_LIST.value = (oCombo.options[idx].value).replace("U:", "");
        document.writeForm.appendChild(DEL_IMAGE_LIST);
      } 
      oCombo.removeChild(cntOption[idx]);    
    }
  }
}
/**
 * remove combobox list
 *
 * @param   oCombo          combo object
 * @since   1.0
 */
function removePosterCombo (oCombo, idx) {
  var cntOption = eval(oCombo).getElementsByTagName("option");

  if ( idx < 0 || idx > (cntOption.length - 1 ) ) {
    return;
  }

  aCompare = (oCombo.options[idx].value).split(":");
  len = aCompare.length;
  for (i=0;i<len;i++){
    if ( i == 0 ) {
      if ( aCompare[i] == "U" ) {
        var DEL_POSTER_LIST = document.createElement("input");
        DEL_POSTER_LIST.type = "hidden"
        DEL_POSTER_LIST.name = "DEL_POSTER_LIST";
        DEL_POSTER_LIST.setAttribute("name", "DEL_POSTER_LIST");
        DEL_POSTER_LIST.value = (oCombo.options[idx].value).replace("U:", "");
        document.writeForm.appendChild(DEL_POSTER_LIST);
      } 
      oCombo.removeChild(cntOption[idx]);    
    }
  }
}
/**
 * remove combobox list
 *
 * @param   oCombo          combo object
 * @since   1.0
 */
function removeMainimageCombo (oCombo, idx) {
  var cntOption = eval(oCombo).getElementsByTagName("option");

  if ( idx < 0 || idx > (cntOption.length - 1 ) ) {
    return;
  }

  aCompare = (oCombo.options[idx].value).split(":");
  len = aCompare.length;
  for (i=0;i<len;i++){
    if ( i == 0 ) {
      if ( aCompare[i] == "U" ) {
        var DEL_MAINIMAGE_LIST = document.createElement("input");
        DEL_MAINIMAGE_LIST.type = "hidden"
        DEL_MAINIMAGE_LIST.name = "DEL_MAINIMAGE_LIST";
        DEL_MAINIMAGE_LIST.setAttribute("name", "DEL_MAINIMAGE_LIST");
        DEL_MAINIMAGE_LIST.value = (oCombo.options[idx].value).replace("U:", "");
        document.writeForm.appendChild(DEL_MAINIMAGE_LIST);
      } 
      oCombo.removeChild(cntOption[idx]);    
    }
  }
}

/**
 * file 삭제
 * @param path
 * @return
 */
function fileDelSubmit (path) {
  var frm = document.forms['writeForm'];
  if(frm.file_list.length == 0){
    alert('삭제할 파일이 없습니다.');
    return;
  }

  if(frm.file_list.selectedIndex == -1){
    alert('삭제할 파일을 선택해 주십시오.');
    return;
  }
  var fileID   = frm.file_list.options[frm.file_list.options.selectedIndex].value;
  var fileName = frm.file_list.options[frm.file_list.options.selectedIndex].innerHTML;

  hFrame.location.href = "../../inc/fileUploading.jsp?path="+path+"&fileID="+ encodeURI(fileID) + "&fileName="+ encodeURI(fileName);
}

/**
 * image 삭제
 * @param path
 * @return
 */
function imageDelSubmit (path) {
  var frm = document.writeForm;
  if(frm.image_list.length == 0){
    alert('삭제할 파일이 없습니다.');
    return;
  }

  if(frm.image_list.selectedIndex == -1){
    alert('삭제할 파일을 선택해 주십시오.');
    return;
  }
  var fileID   = frm.image_list.options[frm.image_list.options.selectedIndex].value;
  var fileName = frm.image_list.options[frm.image_list.options.selectedIndex].innerHTML;
  hFrame.location.href = "../../inc/imageUploading.jsp?path="+path+"&fileID="+ encodeURI(fileID) + "&fileName="+ encodeURI(fileName);
}
/**
 * poster 삭제
 * @param path
 * @return
 */
function posterDelSubmit (path) {
  var frm = document.writeForm;
  if(frm.poster_list.length == 0){
    alert('삭제할 파일이 없습니다.');
    return;
  }

  if(frm.poster_list.selectedIndex == -1){
    alert('삭제할 파일을 선택해 주십시오.');
    return;
  }
  var fileID   = frm.poster_list.options[frm.poster_list.options.selectedIndex].value;
  var fileName = frm.poster_list.options[frm.poster_list.options.selectedIndex].innerHTML;
  hFrame.location.href = "../../inc/posterUploading.jsp?path="+path+"&fileID="+ encodeURI(fileID) + "&fileName="+ encodeURI(fileName);
}
/**
 * mainimage 삭제
 * @param path
 * @return
 */
function mainimageDelSubmit (path) {
  var frm = document.writeForm;
  if(frm.mainimage_list.length == 0){
    alert('삭제할 파일이 없습니다.');
    return;
  }

  if(frm.mainimage_list.selectedIndex == -1){
    alert('삭제할 파일을 선택해 주십시오.');
    return;
  }
  var fileID   = frm.mainimage_list.options[frm.mainimage_list.options.selectedIndex].value;
  var fileName = frm.mainimage_list.options[frm.mainimage_list.options.selectedIndex].innerHTML;
  hFrame.location.href = "../../inc/mainimageUploading.jsp?path="+path+"&fileID="+ encodeURI(fileID) + "&fileName="+ encodeURI(fileName);
}

/**
 * file 첨부 후 
 * @param fileID
 * @param fileName
 * @return
 */
function afterFileSave(fileID, fileName){
  var frm = document.forms['writeForm'];
  addCombo(frm.file_list, fileID, fileName);
}

/**
 * file 삭제 후 
 * @param file_list
 * @param idx
 * @return
 */
function afterFileDelete(file_list, idx){
  if ( file_list == null || file_list == "" ) {
    file_list = document.forms['writeForm'].file_list;
  }
  if ( idx == null || idx == "" ) {
    idx = file_list.options.selectedIndex;
  }
  removeCombo(file_list, idx);
}
 
/**
 * image 첨부 후 
 * @param fileID
 * @param fileName
 * @return
 */
function afterImageSave(fileID, fileName){
  var frm = document.writeForm;
  addCombo(frm.image_list, fileID, fileName);
}

/**
 * image 삭제 후 
 * @param image_list
 * @param idx
 * @return
 */
function afterImageDelete(image_list, idx){
  if ( image_list == null || image_list == "" ) {
    image_list = document.writeForm.image_list;
  }
  if ( idx == null || idx == "" ) {
    idx = image_list.options.selectedIndex;
  }
  removeImageCombo(image_list, idx);
}
/**
 * poster 첨부 후 
 * @param fileID
 * @param fileName
 * @return
 */
function afterPosterSave(fileID, fileName){
  var frm = document.writeForm;
  addCombo(frm.poster_list, fileID, fileName);
}
/**
 * mainimage 첨부 후 
 * @param fileID
 * @param fileName
 * @return
 */
function afterMainimageSave(fileID, fileName){
  var frm = document.writeForm;
  addCombo(frm.mainimage_list, fileID, fileName);
}
/**
 * poster 삭제 후 
 * @param poster_list
 * @param idx
 * @return
 */
function afterPosterDelete(poster_list, idx){
  if ( poster_list == null || poster_list == "" ) {
    poster_list = document.writeForm.poster_list;
  }
  if ( idx == null || idx == "" ) {
    idx = poster_list.options.selectedIndex;
  }
  removePosterCombo(poster_list, idx);
}
/**
 * mainimage 삭제 후 
 * @param mainimage_list
 * @param idx
 * @return
 */
function afterMainimageDelete(mainimage_list, idx){
  if ( mainimage_list == null || mainimage_list == "" ) {
    mainimage_list = document.writeForm.mainimage_list;
  }
  if ( idx == null || idx == "" ) {
    idx = mainimage_list.options.selectedIndex;
  }
  removeMainimageCombo(mainimage_list, idx);
}
/**
 * 폼 전송 전에 file list 생성  
 * 형식은 (모드):VALUE:TEXT|의 반복
 * @param obj(form)
 * @param input(select)
 * @return
 */
function fileListEdit(obj, input){
  var FILE_LIST = document.createElement("input");
  FILE_LIST.type = "hidden"
  FILE_LIST.id = "FILE_LIST";
  FILE_LIST.name = "FILE_LIST";
  FILE_LIST.setAttribute("name", "FILE_LIST");
  FILE_LIST.value = "";
  obj.appendChild(FILE_LIST);
  
  var file_list = input;
  var fOption = file_list.getElementsByTagName("option");
  FILE_LIST.value = "";
  for(var i=0;i<fOption.length;i++){
    FILE_LIST.value = FILE_LIST.value + fOption[i].value+":"+fOption[i].innerHTML;
    FILE_LIST.value = FILE_LIST.value + "|";
  }
  return true;
}

 
/**
 * 폼 전송 전에 image list 생성  
 * 형식은 (모드):VALUE:TEXT|의 반복
 * @param obj(form)
 * @param input(select)
 * @return
 */
function imageListEdit(obj, input){
  var IMAGE_LIST = document.createElement("input");
  IMAGE_LIST.type = "hidden"
  IMAGE_LIST.id = "IMAGE_LIST";
  IMAGE_LIST.name = "IMAGE_LIST";
  IMAGE_LIST.setAttribute("name", "IMAGE_LIST");
  IMAGE_LIST.value = "";
  obj.appendChild(IMAGE_LIST);
  
  var image_list = input;
  var fOption = image_list.getElementsByTagName("option");
  IMAGE_LIST.value = "";
  for(var i=0;i<fOption.length;i++){
    IMAGE_LIST.value = IMAGE_LIST.value + fOption[i].value+":"+fOption[i].innerHTML;
    IMAGE_LIST.value = IMAGE_LIST.value + "|";
  }
  return true;
}

/**
 * 폼 전송 전에 poster list 생성  
 * 형식은 (모드):VALUE:TEXT|의 반복
 * @param obj(form)
 * @param input(select)
 * @return
 */
function posterListEdit(obj, input){
  var POSTER_LIST = document.createElement("input");
  POSTER_LIST.type = "hidden"
  POSTER_LIST.id = "POSTER_LIST";
  POSTER_LIST.name = "POSTER_LIST";
  POSTER_LIST.setAttribute("name", "POSTER_LIST");
  POSTER_LIST.value = "";
  obj.appendChild(POSTER_LIST);
  
  var poster_list = input;
  var fOption = poster_list.getElementsByTagName("option");
  POSTER_LIST.value = "";
  for(var i=0;i<fOption.length;i++){
    POSTER_LIST.value = POSTER_LIST.value + fOption[i].value+":"+fOption[i].innerHTML;
    POSTER_LIST.value = POSTER_LIST.value + "|";
  }
  return true;
}
/**
 * 폼 전송 전에 mainimage list 생성  
 * 형식은 (모드):VALUE:TEXT|의 반복
 * @param obj(form)
 * @param input(select)
 * @return
 */
function mainimageListEdit(obj, input){
  var MAINIMAGE_LIST = document.createElement("input");
  MAINIMAGE_LIST.type = "hidden"
  MAINIMAGE_LIST.id = "MAINIMAGE_LIST";
  MAINIMAGE_LIST.name = "MAINIMAGE_LIST";
  MAINIMAGE_LIST.setAttribute("name", "MAINIMAGE_LIST");
  MAINIMAGE_LIST.value = "";
  obj.appendChild(MAINIMAGE_LIST);
  
  var mainimage_list = input;
  var fOption = mainimage_list.getElementsByTagName("option");
  MAINIMAGE_LIST.value = "";
  for(var i=0;i<fOption.length;i++){
    MAINIMAGE_LIST.value = MAINIMAGE_LIST.value + fOption[i].value+":"+fOption[i].innerHTML;
    MAINIMAGE_LIST.value = MAINIMAGE_LIST.value + "|";
  }
  return true;
}

 /**
 *  Ajax 이용한 로그인 구현
 *
 *
 *
 */
 function loginCheckAjax() {   
   var sMenuID = "";
   if ( $("#mySiteID").val() ) {
     sMenuID = $("#mySiteID").val(); 
   }
   $.post("../../main/loginCheckAjax.jsp", { menuID : sMenuID },
        function(msg) {
          if ( jQuery.trim(msg) == "login" ) {
            $(".loginStatus").css("display","inline");
            $(".logoutStatus").css("display","none");
            $(".loginBlock").css("display","block");
            $(".logoutBlock").css("display","none");
            $("#logout").css("display","inline");
            $("#login").css("display","none");
          } else if ( jQuery.trim(msg) == "logout" ) {            
            $(".logoutStatus").css("display","inline");
            $(".loginStatus").css("display","none");
            $(".logoutBlock").css("display","block");
            $(".loginSBlock").css("display","none");
            $(".loginBlock").css("display","none");
            $("#login").css("display","inline");
            $("#logout").css("display","none");
            $(".moologinStatus").css("display","none");
          } else if ( jQuery.trim(msg) == "mooMember" ) {  /* webzine moo */          
            $(".loginStatus").css("display","inline");
              $(".logoutStatus").css("display","none");
              $(".loginBlock").css("display","block");
              $(".logoutBlock").css("display","none");
              $("#logout").css("display","inline");
              $("#login").css("display","none");
              $(".moologinStatus").css("display","inline");
          }
        });
 } 
 $(document).ready(loginCheckAjax);

 
 
 /**
  *  Ajax 이용한 로그인 구현
  *
  *
  *
  */
 function artMemberLoginCheckAjax() {
   $.post("../../program/artMember/artMemberLoginCheckAjax.jsp",function(data){
     if ( jQuery.trim(data) == "login" ) {
       $(".loginStatus").css("display","inline");
       $(".logoutStatus").css("display","none");
     } else if ( jQuery.trim(data) == "logout" ) {            
       $(".logoutStatus").css("display","inline");
       $(".loginStatus").css("display","none");       
     }
   });      
 }
 
 /**
  * 
  */
 function fncLoginCheckMypage(id) {   
   if ( id == '' ) {
     if(confirm("로그인 후 사용하실 수 있습니다.\n로그인 화면으로 이동하시겠습니까?")){
         //var link = location.href; 
         var link = "/program/mypage/mypage.jsp?menuID=102003";
         link = link.replace(/&/gi, "$");          
         link = link.replace(/\?/gi, "@");          
                   
         location.replace("../../program/publicMember/memberLogin.jsp?menuID=102002&thref="+link);
     }   
     return ;
   }else{
     location.replace("../../program/mypage/mypage.jsp?menuID=102003");
   }
 } 
 
 function fncLoginCheck() {
   if(confirm("로그인 후 사용하실 수 있습니다.\n로그인 화면으로 이동하시겠습니까?")){
     var link = location.href;
     
     link = link.replace(/&/gi, "$");          
     link = link.replace(/\?/gi, "@");          
               
     location.replace("../../program/publicMember/memberLogin.jsp?menuID=102002&thref="+link);
   }   
 }
 
 function fncLogin() {
   var link = location.href;
   
   link = link.replace(/&/gi, "$");          
   link = link.replace(/\?/gi, "@");          
             
   location.replace("https://sec.incheon.go.kr/icweb/program/publicMember/memberLogin.jsp?menuID=102002&thref="+link);
 }
 
 function fncLogout(){
   var link = location.href;
   
   link = link.replace(/&/gi, "$");          
   link = link.replace(/\?/gi, "@");          
             
   location.replace("../../program/publicMember/memberLogout.jsp?menuID=102002&thref="+link); 
 }

 function fncLoginArt() {
   var link = location.href;
   
   link = link.replace(/&/gi, "$");          
   link = link.replace(/\?/gi, "@");          
             
   location.replace("../../program/artMember/artMemberLogin.jsp?menuID=026007001&thref="+link);
 }
 
 function fncLogoutArt(){
   var link = location.href;
   
   link = link.replace(/&/gi, "$");          
   link = link.replace(/\?/gi, "@");          
   location.replace("../../program/artMember/artMemberLogout.jsp?menuID=026007001"); 
 }
 
 
 

  /**
   * 이미지리사이즈
   * @param 
   * @return
   */
   function imageResize(width, height){
     if (document.getElementById('imageResize') != null) {  
       var images = document.getElementById('imageResize').getElementsByTagName('IMG');
       for ( var i = 0; i < images.length; i++) {
         images[i].style.display = "";
         if(images[i].height > 70 || images[i].width > 70){          
           if (images[i].height > images[i].width) {
             images[i].height = height;
           } else {
             images[i].width = width;
           }     
         }              
       }           
     }
     setTimeout("imageResizeRe("+width+","+height+")",100);
   }  
   
   function imageResizeRe(width, height){
     var images = document.getElementById('imageResize').getElementsByTagName('IMG');
     for (var i = 0; i < images.length; i++) {
       if(images[i].height > height){
         images[i].height = height;
       } else if(images[i].width > width){
         images[i].width = width;
       }              
     }
   }
   

  /**
   * 에디터에서 호스트 삭제
   * @author: 서경대
   * @param: 
   * @return
   */
  function replaceHost(content, sUserURL) {  
    var reg = new RegExp("\\/","g");  
    sUserURL = sUserURL.replace(reg, "\\/");
    
    reg = new RegExp(sUserURL,"g");  
    content = content.replace(reg,"../../");
    // img, br 종료 처리
    reg = new RegExp("(<[img|br][^>]{0,}[^/])>","ig");  
    content = content.replace(reg,"$1/>");
    // TAB toLowerCase 처리
    reg = new RegExp("(<[A-Z/]{0,}[> ])","g");  
    content = content.replace(reg, function($1){return $1.toLowerCase();});
    // class \" 처리
    reg = new RegExp("( [a-zA-Z]{1,}=)([a-zA-Z0-9-_]{1,})","gi");  
    content = content.replace(reg, "$1\"$2\"");
    
    // ID관련 변경
    content = content.replace("menuid","menuID");
    content = content.replace("boardtypeid","boardTypeID");
    
    return content;
  }

  /**
   * 우편번호검색 팝업 
   * @author: 조지은
   * @param: zipcodeobj
   * @param: addr1obj
   * @param: addr2obj
   * @return
   */
  function zipcodeSearch(zipcodeobj, addr1obj, addr2obj){
    var sUrl = "../../inc/zipcode/findZipcode.jsp?zipcodeobj="+zipcodeobj+"&addr1obj="+addr1obj+"&addr2obj="+addr2obj;
    openPopup(encodeURI(sUrl), 540, 520, "zipcode");
  }
  
  
  /**
   * 우편번호검색 팝업 
   * @author: 김준철
   * @param: zipcodeobj
   * @param: addr1obj
   * @param: addr2obj
   * @return
   */
  function zipcodeSearch2(zipcodeobj1, zipcodeobj2, addr1obj, addr2obj){
    var sUrl = "../../inc/zipcode/findZipcode.jsp?zipcodeobj1="+zipcodeobj1+"&zipcodeobj2="+zipcodeobj2+"&addr1obj="+addr1obj+"&addr2obj="+addr2obj;
    openPopup(encodeURI(sUrl), 540, 520, "zipcode");
  }
  
  /**
   * 우편번호세팅 
   * @author: 조지은
   * @param: zipcode
   * @param: addr
   * @param: edps
   * @param: zipcodeobj
   * @param: addr1obj
   * @param: addr2obj
   * @return
   */
  function setZipInfo(zipcode, addr, edps, zipcodeobj, addr1obj, addr2obj){
    if ( document.getElementById(zipcodeobj) ) {
      document.getElementById(zipcodeobj).value = zipcode;
    }
    if ( document.getElementById(addr1obj) ) {
      document.getElementById(addr1obj).value = addr;
    }
    if ( document.getElementById(addr2obj) ) {
      document.getElementById(addr2obj).value = "";
      //document.getElementById(addr2obj).value = edps;
      document.getElementById(addr2obj).focus();
    }
  }
  
  
  
  /**
   * 우편번호세팅 
   * @author: 조지은
   * @param: zipcode
   * @param: addr
   * @param: edps
   * @param: zipcodeobj
   * @param: addr1obj
   * @param: addr2obj
   * @return
   */
  function setZipInfo2(zipcode, addr, edps, zipcodeobj1, zipcodeobj2, addr1obj, addr2obj){
    if ( document.getElementById(zipcodeobj1) ) {
      document.getElementById(zipcodeobj1).value = zipcode.substring(0,3);
    }
    if ( document.getElementById(zipcodeobj2) ) {
        document.getElementById(zipcodeobj2).value = zipcode.substring(4,7);
      }
    if ( document.getElementById(addr1obj) ) {
      document.getElementById(addr1obj).value = addr;
    }
    if ( document.getElementById(addr2obj) ) {
      document.getElementById(addr2obj).value = "";
      //document.getElementById(addr2obj).value = edps;
      document.getElementById(addr2obj).focus();
    }
  }
  
  /**
   * 신고하기 alert창
   * @return
   */
  function declarationCheck (sCreatedBy, sGroupID, sObjectID, sArticleID) {
    //로그인 한 사람만 신고 가능
    if ( sCreatedBy == "" ) {
    loginCheck();
    } else {
     //신고 접수창 오픈 
     var sLink = "groupID="+sGroupID+"&objectID="+sObjectID+"&articleID="+sArticleID+"&createdBy="+sCreatedBy;    
     window.open('../declaration/declarationPopUp.jsp?'+sLink, 'declarationPopUp', 'width=500px, height=600px,toolbar=no,menubar=no,location=no,scrollbars=no,status=no');
    }
  }
  function showAlert () {
    alert("신고는 한번만 가능합니다.");
  }
  
  /**
   * 라디오버튼의 선택된값   RETURN
   * @param targetID
   * @return 선택된radio object값
   */
  function getCheckedValue( targetID ){
    var radioObject = document.getElementsByName(targetID);
    var checkedValud = '-1';
    for( var i = 0; i < radioObject.length; i++ ){
      if( radioObject[i].checked == true ){
        checkedValud = radioObject[i].value;
      }
    }
    return checkedValud;
  }

  /**
   * tag
   * @param groupid
   * @param objectid
   * @param articleid
   * @param menuid
   * @param type
   * @param mode
   * @return
   */
  function fncTagPopup(groupid, objectid, articleid, menuid, type, mode) {
    var sUrl = "../../inc/tagPopup.jsp?groupID="+groupid+"&objectID="+objectid+"&articldID="+articleid+"&menuID="+menuid+"&type="+type+"&mode="+mode;
    PopUp(encodeURI(sUrl), "tag", 560, 200);
  }

  function getH() {

    var h=0;

    if (navigator.userAgent.indexOf("SV1") > 0){  h=14; }
    else if(navigator.userAgent.indexOf("NT 5.0") > 0){  h=14; }
    else if(navigator.userAgent.indexOf("MSIE 7")>0) { h=45; }
    else if(navigator.userAgent.indexOf("Gecko")>0 && navigator.userAgent.indexOf("Firefox") <= 0 && navigator.userAgent.indexOf("Netscape") <= 0 ){ h=22; }
    else if(navigator.userAgent.indexOf("Firefox") >0 ){  h=18; } 
    else if(navigator.userAgent.indexOf("Netscape") >0 ){ h=-2; }
    else { h=0;} 
   
    return parseInt(h);
  }
  function PopUp(url, winName, xx, yy) {
    window.open(url,winName,'width='+ xx +',height='+ (yy+getH()) +',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
  } 

function phoneCheck(phone, phone1, phone2, phone3){
  if(phone1 != "" && phone2 != "" && phone3 != ""){
    phone.value = phone1 + "-" + phone2 + "-" + phone3;
  }
}

/**
 * display변경
 * @param targetID
 * @return
 */

function displayData (targetID) {
  var obj = document.getElementById(targetID);
  if ( obj.style.display == "none" ){
  obj.style.display = "";
  } else {
  obj.style.display = "none";
  }
}

// objname이 있는 checkbox들의 체크된 값들을 값|값|... 의 형태로 만들어 resultobjid를 가진 객체의 값으로 만든다
function fncCheckValue(objname, resultobjid){
  var obj = document.getElementsByName(objname);
  document.getElementById(resultobjid).value = "";
  for ( i = 0; i < obj.length; i++ ) {
    if ( obj[i].checked ) {
      document.getElementById(resultobjid).value += obj[i].value;
      if ( i < obj.length -1 ) {
        if ( document.getElementById(resultobjid).value != "" ) {
          document.getElementById(resultobjid).value += "|";
        }
      }
    }
  }
}  

// selectobjid가 있는 select의 text들을 text|text|...의 형태로 만들어 resultobjid를 가진 객체의 값으로 만든다.
function fncSelectValue(selectobjid,resultobjid){
  var selectobj = document.getElementById(selectobjid);
  var fOption = selectobj.getElementsByTagName("option");
  var resultobj = document.getElementById(resultobjid);
  resultobj.value = "";
  for ( var i = 0; i < fOption.length; i++ ) {
    resultobj.value = resultobj.value + fOption[i].innerHTML;
    if ( i < fOption.length-1 ) {
      if ( resultobj.value != "" ) {
        resultobj.value = resultobj.value + "|";
      }
    }
  }
}

// 텍스트 합성 resultobjid.value = objid1.value + op + objid2.value
function fncAddText(resultobjid, objid1, objid2) {
  var op = ":";
  if ( arguments[3] != null && arguments[3] != "" ) {
    op = arguments[3];
  }
  if ( document.getElementById(objid1).value != "" && document.getElementById(objid2).value != "" ) {
    document.getElementById(resultobjid).value = document.getElementById(objid1).value + op + document.getElementById(objid2).value; 
  } else {
    document.getElementById(resultobjid).value = "";
  }
}

// obj1 onchange시 obj2에 obj1.selectedIndex의 value
function fncEmailSet(obj1, obj2){
  if ( obj1.selectedIndex > -1 ) {
    obj2.value = obj1.options[obj1.selectedIndex].value;
  }
}
/* djemals/reservation/setLLecture_editLecture.jsp */
/* djemals/reservation/setLLecture_editApplicant.jsp */
/* djemals/reservation/seditReserveGroup.jsp */
//동적 SELECTBOX 구현을 위한 사용자 함수  
(function($) {    //SELECT OPTION 삭제
    $.fn.emptySelect = function() {       
        return this.each(function(){         
            if (this.tagName=='SELECT'){ 
              this.options.length = 0;  
            }
        });    
    }     //SELECT OPTION 등록
    $.fn.loadSelect = function(optionsDataArray,defaultValue) {       
        return this.emptySelect().each(function(){         
          if (this.tagName=='SELECT') {             
            var selectElement = this;             
            if(optionsDataArray.length > 0 && defaultValue != null && defaultValue != ""){
              selectElement.add(new Option(defaultValue,""));  
            }
            $.each(optionsDataArray,function(idx, optionData){                 
                var option = new Option(optionData.key, optionData.value);                 
                if ($.browser.msie) {                     
                  selectElement.add(option);                 
                } else {                     
                  selectElement.add(option,null);                 
                }             
            });         
          }      
        });    
    }
    $.fn.loadForm = function(formDataArray){
      alert("checkloadForm");
    }  
})(jQuery);

/**
 * 스크랩 팝업창
 * @param obj
 * @return
 */

function scrapPopUp(obj) {
  $.post("../../main/loginCheckAjax.jsp", function(msg) {
    if ( jQuery.trim(msg) == "login" ) {
      var thref = location.href;
      thref = thref.replace(/\?/g,"@");
        thref = thref.replace(/\&/g,"$");
        if ( thref.search("thref=") == -1 ) {
          window.open('../../inc/scrapPopUp.jsp?menuID='+obj+'&scrapLink='+thref, 'scrap', 'width=500px,height=300px,toolbar=no,menubar=no,location=no,scrollbars=no,status=no');
        }
    } else if ( jQuery.trim(msg) == "logout" ) {
      alert("로그인이 필요한 페이지입니다.");
    }
  }); 
  return false;
}

/**
 * 스크랩 로그인체크 comfirm
 * @param id
 * @return
 */
function fncLoginCheckScrap(id) {   
   if ( id == '' ) {
     if(confirm("로그인 후 사용하실 수 있습니다.\n로그인 화면으로 이동하시겠습니까?")){
         var link = location.href;
         
         link = link.replace(/&/gi, "$");          
         link = link.replace(/\?/gi, "@");          
                   
         location.replace("../../program/publicMember/memberLogin.jsp?menuID=102002&thref="+link);
     }   
     return ;
   }else{
   animatedcollapse.toggle('toolbarTop');
   }
 }

function faqPopUp(sMenuCategory) {
  window.open('../../inc/faqPopUp.jsp?menuCategory='+sMenuCategory+"&boardTypeID=762", 'faq', 'width=1000px,height=700px,toolbar=no,menubar=no,location=no,scrollbars=yes,status=no');
}

function openURL(url) {
  if(url == ''){
    alert('링크 주소가 올바르지 않습니다.');
    return false;
  }
  window.open(url,name,'width=1000px,height=700px,toolbar=yes,menubar=yes,location=yes,scrollbars=yes,status=yes');
}

/**
 * 대표사이트 해당메뉴 전체 보기
 * @param sMenuID
 * @return
 */
function subMenuListPopUp(sMenuID) {
  window.open('../../main/inc/listSubMenu.jsp?menuID='+sMenuID, '메뉴한눈에보기', 'width=900px,height=700px,toolbar=no,menubar=no,location=no,scrollbars=yes,status=no');
}

/**
 * 대표사이트 사이트맵
 * @param ulID
 * @return
 */
function viewSubMenu(ulID){
  if($("#"+ulID).hasClass("displayNone")){
    $("#"+ulID).removeClass("displayNone");
  } else {
    $("#"+ulID).addClass("displayNone");
  }
}

/**
 * 대표사이트 사이트맵
 * @param selectMenu, selectDepth
 * @return
 */
function selectSiteMap(selectMenu,selectDepth){
    for( var j = 1; j < 7; j++) {
      if(j > selectDepth) {
        $("."+selectMenu+"_"+j).addClass("displayNone");
      } else {
        $("."+selectMenu+"_"+j).removeClass("displayNone");
      }
    }
    changeListSubMenu(Number(selectDepth) - 2);    
}

/**
 * 대표사이트 사이트맵
 * @param selectMenu, selectDepth
 * @return
 */
function selectSiteMapReset(){
  for ( var i=1; i < 6; i++ ) {
    for( var j = 1; j < 7; j++) {      
        $("."+i+"_"+j).addClass("displayNone");
    }
  }  
}



function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() {//v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function copyUrl(id) {
  var curl = $("#"+id).attr("href");   
  window.clipboardData.setData('Text', curl);   
  alert ("주소가 복사 되었습니다."); 
}

function copyThisPageUrl() {
  if ($.browser.msie) {
    var curl = location.href;  
    window.clipboardData.setData('Text', curl);   
    alert ("주소가 복사 되었습니다.");
  } else {
    alert("주소복사기능을 지원하지 않는 브라우저입니다.");
  }
  return false;
}

$(document).ready( function() {


  // 2010년 8월 3일 추가 시작
  // 레이어 툴팁 스크립트 추가(최군철)
    for ( var t = 0; t < 1; t ++ ) {
      var tipTool_show = document.getElementById("tipTool_show"+t);
      if ( tipTool_show ) {
        tipTool_show.tipid = t;
        tipTool_show.onclick = function () {
          showHide('tipTool'+this.tipid, '', 'show'); return false;
        };
        tipTool_show.style.cursor = "pointer";
      }
    }
    
    // 레이어 툴팁 닫기 스크립트 추가(최군철)
    for ( var t = 0; t < 1; t ++ ) {
      var tipTool_close = document.getElementById("tipTool_close"+t);
      if ( tipTool_close ) {
        tipTool_close.tipid = t;
        tipTool_close.onclick = function () {
          showHide('tipTool'+this.tipid, '', 'hide'); return false;
        };
        tipTool_close.style.cursor = "pointer";
      }
    }       
    
 // TopMenu 마이스크랩
 var top_scrap = document.getElementById("top_scrap");
 if ( top_scrap ) {
   top_scrap.style.cursor = "pointer";

	 $.post("../../main/loginCheckAjax.jsp",function(data){
	   if ( jQuery.trim(data) == "login" ) {

		   top_scrap.onclick = function () {
			   animatedcollapse.toggle('toolbarTop'); 
			   return false;	
					
		   }		   
	     
	   } else if ( jQuery.trim(data) == "logout" ) {            
		   top_scrap.onclick = function () {
			   fncLoginCheck();
			   return false;	
					
		   }		     
	   }
	 });
   
   top_scrap.onclick = function () {

   }
 }

 // 헤더툴바 닫기 스크립트 추가(최군철)
 var toolbarTop_close = document.getElementById("toolbarTop_close");
 if ( toolbarTop_close ) {
   toolbarTop_close.onclick = function () {
     animatedcollapse.toggle('toolbarTop');
   }
 }

 // 푸터툴바 닫기 스크립트 추가(최군철)
 for ( var t = 1; t <= 6; t ++ ) {
   var toolbarBot_close = document.getElementById("toolbarBot_close" + t);
   if ( toolbarBot_close ) {
     toolbarBot_close.tipid = t;
     toolbarBot_close.onclick = function () {
       animatedcollapse.toggle('toolbarBot'+this.tipid);
     }
     toolbarBot_close.style.cursor = "pointer";
   }
 }


 // 인쇄, 클립보드, 폰트사이즈 조절버튼 불러오기 (박성규)
	topPrintBtnView();
	topClipboardBtnView();  
	topFontSizeBtnView();

// 2010년 8월 3일 추가 끝

  if(document.getElementById("rsslist")){    
    $("#rsslist").appendTo("body");  
    $("#rsslist").css("position","absolute");     
    $(".sl_td > A :odd").bind("click", xypos);
    $(document).click(function(e){      
      if($("#rsslist").css("visibility")=="visible" && !$(e.target).hasClass("rsslist") && $(e.target).attr("id")!='rsslist'){
        layer_hidden();
      }else{        
      }
    });
  }
  $("#zoomIn").bind("click", zoomIn);
  $("#zoomOut").bind("click", zoomOut);
  $("#zoomZero").bind("click", zoomZero);
  $("#zoomZero").css("cursor", "pointer");
});
var fSize = 12;
function zoomIn() {
  if( fSize < 25){
    fSize++;
    $("#zoomZone").css("font-size", fSize+"px");
    return false;    
  }else {
    alert("더이상 커질 수 없습니다.");
  }
}

function zoomZero() { 
  fSize = 12;
  $("#zoomZone").css("font-size", fSize+"px");
  return false;
}

function zoomOut() {
  if( fSize > 12){    
    fSize--;
    $("#zoomZone").css("font-size",fSize+"px");
    return false;
  } else {
    alert("더이상 줄일수 없습니다.");
    return false;
  }
}

function fncPrintPopup() {
  alert($(this).attr("href"));
  return false;
}

function xypos(e){
  
  var dd = document.documentElement; //최신버전의 브라우저들
  var db = document.body;//구 버전의 브라우저들

  var scrollLeft=0;scrollTop=0;

  if(dd){
      scrollLeft+=dd.scrollLeft;
      scrollTop+=dd.scrollTop;
  }

  else if(db){
      scrollLeft+=db.scrollLeft;
      scrollTop+=db.scrollTop;
  }

  var mouseX = e.clientX;

  var mouseY = e.clientY;

  if(dd){
      mouseX+=dd.scrollLeft;
      mouseY+=dd.scrollTop;
  }else if(db){
      mouseX+=db.scrollLeft;
      mouseY+=db.scrollTop;
  }
  
  var left = 0;
  var top = 0;
  
  left = mouseX - 10;
  top  = mouseY - 10; 
    
  $("#rsslist").css({"left":left+"px"});
  $("#rsslist").css({"top":top+"px"});
  
  var temp = $(e.target).attr("id");
  var urlID = $("#board"+temp).attr("href");

  $("#rsslist>ul>li>A").eq(0).attr("href",urlID);    
  $("#rsslist>ul>li>A").eq(1).attr("href","http://blog.daum.net/_blog/rss/ManagerChannelInsertForm.do?channelUrl="+urlID+"&channelCheck=true&event=t");    
  $("#rsslist>ul>li>A").eq(2).attr("href","http://www.hanrss.com/add_sub.qst?url="+urlID);
  $("#rsslist>ul>li>A").eq(3).attr("href","http://fusion.google.com/add?feedurl="+urlID);
  //$("#rsslist>ul>li>A").eq(4).attr("href","http://blog.daum.net/_blog/rss/ManagerChannellnesrtForm.do?channelCheck=true&event=t&channelUrl=board"+urlID);
  $("#rsslist>ul>li>A").eq(4).attr("href","http://wzd.com/subscribe?"+urlID);
  $("#rsslist>ul>li>A").eq(5).attr("href","http://www.bloglines.com/sub/"+urlID);
    
  MM_showHideLayers('rsslist',' ','show');
  return false;
}

function layer_hidden() {
  MM_showHideLayers('rsslist',' ','hidden');  
}


function onlyNumber(e){
  evt = e || window.event;
  var keyCode = (window.netscape) ? evt.which : evt.keyCode;
  if(  
  (keyCode >= 48 && keyCode <=57) ||  // 중간 숫자키
  (keyCode >= 37 && keyCode <=40) || // 중간화살표 
  keyCode == 9 || keyCode == 8 || keyCode == 46 || keyCode == 0 || // 탭, 백스페이스, DELETE, 탭 
  keyCode == 109 || keyCode == 189 || keyCode == 45 // 오른쪽 -, 중간 -
  ){    
  }else{
      if (window.netscape){
        evt.preventDefault();
      } else{
        evt.returnValue=false;
      } 
  }
}

function resize_frame(obj){   
  var obj_document = obj.contentWindow.document;
  if( navigator.appVersion.indexOf("MSIE 6") > -1 ||  navigator.appVersion.indexOf("MSIE 7") > -1){
    obj.style.height = obj_document.body.scrollHeight;
  } else {
    obj.style.height = Number(obj_document.documentElement.scrollHeight) + Number(400) + 'px';
  }
}

function my_album(objID){    
  
  if ($(objID+":animated").size()) return false;
  var width = $(objID).attr("width");
  var pos = (parseInt($(objID).attr("top"))+1);    
  var px = pos * width;      
  $(objID).attr("top", pos);
  $(objID).animate({ 
    left: ((px * -1) + "px")
  }, 1500, $(objID).attr("motion"), 
    function() {
      var pos = parseInt($(objID).attr("top"));
      var total = parseInt($(objID).attr("total"));
      
      if (pos>=total) {
        $(objID).attr("top", 0);
        $(objID).css("left", "0px");
      }
    }
  );
}

function my_albumBack(objID){    
  
  if ($(objID+":animated").size()) return false;
  var width = $(objID).attr("width");
  var pos = (parseInt($(objID).attr("top"))-1);    
  var px = pos * width;      
  $(objID).attr("top", pos);
  $(objID).animate({ 
    left: ((px * -1) + "px")
  }, 1500, $(objID).attr("motion"), 
    function() {
      var pos = parseInt($(objID).attr("top"));
      var total = parseInt($(objID).attr("total"));
      
      if (pos>=total) {
        $(objID).attr("top", 0);
        $(objID).css("left", "0px");
      }
    }
  );
}

function nextBanner(mode){    
  clearInterval($("#banner").attr("timer"));
  if ( mode == "right" ) {      
      my_album("#banner");      
  } else if ( mode == "left" ) {      
    if( parseInt($("#banner").attr("top")) == 0 ) {
      alert('더 이상 앞으로 갈 수 없습니다.');
    } else {
      my_albumBack("#banner");
    }
  }
  $("#banner").attr("timer", setInterval("my_album('#banner')", 3000));
}

function getTodayWeather() {
  $.ajax({url: "../../program/weather/today.jsp", dataType:"text", success: function(data) {
        var wPop = trim(data.split("|")[0]);
        var wT3h = trim(data.split("|")[1]);
        var wSky = trim(data.split("|")[2]);
        var wSkyImg = trim(data.split("|")[3]);
        var wWindDirection = trim(data.split("|")[4]);
        var wWind = trim(data.split("|")[5]);
        
        var d = new Date();
        var week = new Array('일', '월', '화', '수', '목', '금', '토');
        $("#weatherDate").html("<strong>"+ ( d.getMonth()+1 ) +"." + d.getDate() + "(" + week[d.getDay()] + ")</strong>");
        $("#weatherPop").html(wPop);
        $("#weatherT3h").html(wT3h);
        $("#weatherSky").html(wSky);
        $("#weatherSkyImg").html(wSkyImg);
        $("#weatherWindDirection").html(wWindDirection);
        $("#weatherWind").html(wWind);
     } }); 
}

function fncTelephoneSearch(){
  if( trim($("#searchText").val()) == '' ) {
    alert("검색어를 입력해 주세요.");
    return false;
  }
  document.getElementById("searchForm").action = "../../program/searchTelephone/listTelephone.jsp?menuID=001005005002001";
  document.getElementById("searchForm").submit();
  /*
  $.post("../../program/telephoneSearch/listTelephoneInformation.jsp",
         {"searchType" : $(".search_list>input:checked").val(), "searchText" : $("#searchText").val()},
         function(data){
           data = trim(data);
           $("#content1").html(data);
         }
  );
  */
}

/* Click SOS 이메일 선택시 */
function fncSelectEmail(selectObj){
  var dirSelectObj = document.getElementById("email3");
  var emailObj2 = document.getElementById("email2");
  var dirSelectText = document.getElementById("dirselectText");
  if(selectObj.value != "dirselect"){
    dirSelectObj.value = selectObj.value;
  } else {
    dirSelectObj.value = '';
    emailObj2.style.display = "none";    
    dirSelectObj.style.display = "inline";    
    dirSelectText.style.display = "inline";    
  }
}

function fncCancelDirselect(){
  var dirselectObj = document.getElementById("email3");
  var emailObj2 = document.getElementById("email2");
  var dirSelectText = document.getElementById("dirselectText");
  dirselectObj.style.display = "none";    
  dirSelectText.style.display = "none";    
  emailObj2.style.display = "inline";
  emailObj2.value = "";
  dirselectObj.value="";
}

  /* 셀렉트박스 IE6 버그 해결을 위한 DIV*/
  function showHideDivSelect(divID,blank,type){
    showHide(divID,blank,type);
    if ( type == "show" ) {
      hideSelect(divID);
    }else if ( "hide" ) {
      showSelect(divID);
    }
  }  
  
  /* Click SOS 입력*/
  function fncInsertClickSOS(){
  var sMobile  = "";
  var sEmail   = "";
  var sContent = "";
  var sTemp = "입력하신 정보를 확인하세요.     \n\n변경을 원하시면 취소를 선택하세요.";
  
  sMobile = trim($("#mobile1").val() + "-" + $("#mobile2").val() + "-" + $("#mobile3").val()); 
  sEmail  = trim($("#email1").val() + "@" + $("#email3").val());
  sContent = trim($("#sosContent").val());
  
  if ( sContent == "" ) {
    alert("찾으시는 정보나 서비스를 입력해 주세요.");
    return false;    
  }

  if ( sEmail == "@" && sMobile == "--" ) {
    alert("전화번호와 이메일주소 중 한가지는\n반드시 입력하셔야 합니다.");
    return false;
  }

  if ( sEmail == "@" ) {
    sEmail = "입력안함"
  }

  if ( sMobile == "--" ) {
    sMobile = "입력안함"
  }
  
  sTemp += "     \n\n전화번호 : " + sMobile;
  sTemp += "     \n\n이메일 주소 : " + sEmail + "     ";
  
  if(confirm(sTemp)){    
    $.post("../../program/clickSOS/clickSOS.jsp",
        {"mobile" : sMobile, "email": sEmail, "content" : sContent},
        function(data){
          data = trim(data);
          //if ( Number(data) > 0 ) {
            alert("클릭!SOS신청을 접수하였습니다.\n감사합니다.");
            document.getElementById("clickSOSForm").reset();
            $("#textSize").text("0");
            $("#clickSOS").css("display","none");
          //}else{            
          //  alert("클릭!SOS신청을 접수에 실패하였습니다 .\n다시 한번 시도해 주세요.");            
          //}
          
    });  
  }
}

  
  
  
  
  /* Click SOS 입력
   * 2010년 05월 11일 박성규 
   * 리턴값 true, false 받을 수 있게 수정
   **/
 function fncInsertClickSOS2(){
  var sMobile  = "";
  var sEmail   = "";
  var sContent = "";
  var sTemp = "입력하신 정보를 확인하세요.\n\n변경을 원하시면 취소를 선택하세요.";
  
  sMobile = trim($("#mobile1").val() + "-" + $("#mobile2").val() + "-" + $("#mobile3").val()); 
  sEmail  = trim($("#email1").val() + "@" + $("#email3").val());
  sContent = trim($("#sosContent").val());
  
  if ( sContent == "" ) {
    alert("찾으시는 정보나 서비스를 입력해 주세요.");
    return false;    
  }
  if ( sEmail == "@" && sMobile == "--" ) {
    alert("전화번호와 E-Mail주소 중 한가지는\n반드시 입력하셔야 합니다.");
    return false;
  }
  if ( sEmail == "@" ) {
    sEmail = "입력안함"
  }

  if ( sMobile == "--" ) {
    sMobile = "입력안함"
  }
  
  sTemp += "     \n\n전화번호 : " + sMobile;
  sTemp += "     \n\n이메일 주소 : " + sEmail + "     ";
  
  //if(confirm(sTemp)){    
    //$.post("../../program/clickSOS/clickSOS.jsp",
        //{"mobile" : sMobile, "email": sEmail, "content" : sContent},
        //function(data){
          //data = trim(data);
          //if ( Number(data) > 0 ) {
            alert("클릭!SOS신청을 접수하였습니다.\n감사합니다.");
            document.getElementById("clickSOSForm").reset();
            $("#textSize").text("0");
            $("#clickSOS").css("display","none");
          //}else{            
            //alert("클릭!SOS신청을 접수에 실패하였습니다 .\n다시 한번 시도해 주세요.");            
          //}
          
    //});
  //}
}
  
  
//팝업 설정
function pcenter_s_yes(theURL, name,  width, height ){
  var x = (screen.width) ? (screen.width-width)/2 : 0;
  var y = (screen.height) ? (screen.height-height)/2 : 0;  
  var pop = window.open(theURL,name,"toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+width+",height="+height+",left="+x+",top="+y);
  //pop.focus;
}

function showCoreMenu(menuCoreUrl) {
  $("#menuCore").load(menuCoreUrl);
  showHide('menuCore', '', 'show');
  hideSelect("#menuCore");
}

/*IE6에서 셀렉트 박스가 DIV위로 올라가는 문제해결을 위한 설정(나타내기)
 * 작성자 : 서경대
 * 작성일 : 2009.09.24
 * */
function showSelect(objID){
  $("select").css("visibility","visible");
}

/*IE6에서 셀렉트 박스가 DIV위로 올라가는 문제해결을 위한 설정(숨기기)
 * 작성자 : 서경대
 * 작성일 : 2009.09.24
 * */
function hideSelect(objID){
  $("select").css("visibility","hidden");
  $("#" + objID + " select").css("visibility","visible");  
}  
//Http:// 제거
function replaceHttp(str){ 
  str = str.replace(/http:\/\//gi, "");
  return str;
}
function makeSelectGIS(addressID, codeID, selectVal) {  
  $("#addrSelect").append( $("<select>").attr("id", "sidoListG") )
          .append( $("<select>").attr("id", "guListG") )
          .append( $("<select>").attr("id", "dongListG") )
          .append( $("<input>").attr("type", "hidden").attr("id", addressID) )          
          .append( $("<input>").attr("type", "text").attr("id", "addressID2").addClass("txt txtSize1") )
          .append(" 번지")
          .append( $("<input>").attr("type", "hidden").attr("id", codeID));
  requestLevel1(selectVal);
  $("#sidoListG").bind("change", function() { requestLevel2(); } );
  $("#guListG").bind("change", function() { requestLevel3(); } );
  $("#dongListG").bind("change", function() { insertAddressCode(); } );
  $("#addressID2").bind("change", function() { insertAddressCode(); } );
}
function requestLevel1(selectVal) {
  var defaultValue = "28";
  if ( selectVal ) {
    defaultValue = selectVal.substring(0, 2);
  }
  
  $("#sidoListG").ajaxAddOption("../../program/weather/top.json.txt", {}, false, function() { $("#sidoListG").selectOptions(defaultValue, true); requestLevel2(selectVal); } );   
}

function requestLevel2(selectVal) {
  var defaultValue = "28200";
  if ( selectVal ) {
    defaultValue = selectVal.substring(0, 5);
  }
  
  $("#guListG").removeOption(/./);
  $("#guListG").ajaxAddOption("../../program/weather/json/"+$("#sidoListG").selectedValues(), {}, false, function() { $("#guListG").selectOptions(defaultValue, true); requestLevel3(selectVal); } );   
}
function requestLevel3(selectVal) {
  var defaultValue = "2820051000";
  if ( selectVal ) {
    defaultValue = selectVal.substring(6, 16);
  }
  $("#dongListG").removeOption(/./);
  $.getJSON("../../program/weather/json2/"+$("#guListG").selectedValues(), function(data) {
    $.each(data, function(i, item){       
        $("#dongListG").addOption(item.code, item.value);           
          }); 
    
    $("#dongListG").selectOptions(defaultValue, true);    
    insertAddressCode(selectVal);
  } );
}
function insertAddressCode(selectVal) {
  if ( selectVal ) {
    $("#addressID2").val(selectVal.split("&")[2]);
  }
  $("#addrSelect>input:first").val( $("#sidoListG").selectedTexts() + " " + $("#guListG").selectedTexts() + " " + $("#dongListG").selectedTexts() + " " + $("#addressID2").val());  
  $("#addrSelect>input:last").val( $("#guListG").selectedValues() + "&" + $("#dongListG").selectedValues() + "&" + $("#addressID2").val());
}

function checkSearch(searchID){
  if ( $("#search"+searchID).val() == '' ) {
    alert("검색어를 입력해 주세요.");
    document.getElementById("search" + searchID).focus();
    return false;
  } else {
    document.getElementById("searchForm" + searchID).submit();
  }
}


//max가 20자리면 20자 이상 글자를 잘라냈을경우 뒤에 ...까지
//총 23자기 나온다.
function getStrCuts(str, max){
  ns = str.substr(0, max);
  if (ns.length != str.length) {
    ns = ns + "...";
  }
  return ns;
} 


// 웹로그를 위한 쿠키 생성 시작
function Nethru_getCookieVal(offset)
{
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function Nethru_SetCookie(name, value){
   var argv = Nethru_SetCookie.arguments;
   var argc = Nethru_SetCookie.arguments.length;
   var expires = (2 < argc) ? argv[2] : null;
   var path = (3 < argc) ? argv[3] : null;
   var domain = (4 < argc) ? argv[4] : null;
   var secure = (5 < argc) ? argv[5] : false;

  // alert("DOMAIN = " + domain);
   document.cookie = name + "=" + escape (value) +
        ((expires == null) ? "" : ("; expires="+expires.toGMTString())) +
     ((path == null) ? "" : ("; path=" + path)) +
     ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");

//  alert(document.cookie);
}

function Nethru_GetCookie(name){
   var arg = name + "=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i = 0;
   while (i < clen)
      {
      var j = i + alen;
      if (document.cookie.substring(i, j) == arg)
         return Nethru_getCookieVal (j);
      i = document.cookie.indexOf(" ", i) + 1;
      if (i == 0)
         break;
      }
  return null;
}

function Nethru_makePersistentCookie(name,length,path,domain)
{
    var today = new Date();
    var expiredDate = new Date(2100,1,1);
    var cookie;
  var value;

    cookie = Nethru_GetCookie(name);
    if ( cookie ) {
//    alert(cookie);
        return 1;
  }

  var values = new Array();
  for ( i=0; i < length ; i++ ) {
    values[i] = "" + Math.random();
  }

  value = today.getTime();

  // use first decimal
  for ( i=0; i < length ; i++ ) {
    value += values[i].charAt(2);
  }

    Nethru_SetCookie(name,value,expiredDate,path,domain);
}

function Nethru_getDomain() {
  var _host   = document.domain;
  var so      = _host.split('.');
  var dm    = so[so.length-2] + '.' + so[so.length-1];
  return (so[so.length-1].length == 2) ? so[so.length-3] + '.' + dm : dm;
}

var Nethru_domain  = Nethru_getDomain();

Nethru_makePersistentCookie("PCID",10,"/",Nethru_domain);
//웹로그를 위한 쿠키 생성 끝



function chgDiaryYear(arg){
  var sYear = arg;
  var sMonth = document.getElementById("searchDiaryMonth").value;
/*  
  var objForm = document.getElementById("frmDiary");
  objForm.method = "post";
  objForm.action = "detail.jsp";  
  objForm.diaryYear.value = sYear;
  objForm.diaryMonth.value = sMonth;
  objForm.menuID.value = "066002001";
  objForm.boardTypeID.value = "2052";
  objForm.submit();
*/
  document.location.href = "detail.jsp?menuID=066002001&boardTypeID=2052&diaryYear=" + sYear + "&diaryMonth=" + sMonth;
}

function chgDiaryMonth(arg){
  var sYear = document.getElementById("searchDiaryYear").value;
  var sMonth = arg;
/*  
  var objForm = document.getElementById("frmDiary");
  objForm.method = "post";
  objForm.action = "detail.jsp";
  objForm.diaryYear.value = sYear;
  objForm.diaryMonth.value = sMonth;
  objForm.menuID.value = "066002001";
  objForm.boardTypeID.value = "2052";
  objForm.submit();  
*/
  document.location.href = "detail.jsp?menuID=066002001&boardTypeID=2052&diaryYear=" + sYear + "&diaryMonth=" + sMonth;
}

 

function showHide() {//v6.0
  var i,p,v,obj,args=showHide.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
  if (obj.style) { obj=obj.style; v=(v=='show')?'':(v=='hide')?'none':v; }
    obj.display=v; }
}

function close_fun (){
  document.getElementById("agiBox").style.display ="none";
}


function topPrintBtnView(){
		if(document.getElementById('topPrintBtn')){
		  var p_topPrintBtn = document.getElementById('topPrintBtn');
 
		  if ( p_topPrintBtn ) {

			var aTag = document.createElement('A'); 
			aTag.href="../../main/inc/printPopup.jsp";
			aTag.setAttribute('target','_blank');
			
			aTag.onclick = function(){
		      openPopup(this.href, '500', '600');
		      return false;
		    };	

		    aTag.setAttribute('title','새창으로 프린트 하기');

		    
		    var but = document.createElement('img');
		    
		    but.setAttribute('src','../../files/web1/images/common/btn_browsctrl_03.gif');
		    but.setAttribute('alt','프린트');



		    var oTextNode1 = document.createTextNode('프린트');

		    
		    aTag.appendChild(but);
		    aTag.appendChild(oTextNode1);
		    
		    p_topPrintBtn.appendChild(aTag);

		  }
		  
		}

	}


	function topClipboardBtnView(){
		if(document.getElementById('topClipboardBtn')){
		  var p_topClipboardBtn = document.getElementById('topClipboardBtn');
 
		  if ( p_topClipboardBtn ) {

			var aTag = document.createElement('A'); 
			aTag.href="#copy";
		  
			aTag.onclick = function(){
		    	return copyThisPageUrl();
		    };	

		    aTag.setAttribute('title','현제페이지 주소 복사하기');

		    
		    var but = document.createElement('img');
		    
		    but.setAttribute('src','../../files/web1/images/common/btn_browsctrl_04.gif');
		    but.setAttribute('alt','주소복사');

		    var oTextNode1 = document.createTextNode('주소복사');
		    
		    aTag.appendChild(but);
		    aTag.appendChild(oTextNode1);
		    
		    p_topClipboardBtn.appendChild(aTag);

		  }
		  
		}

	}

	function topFontSizeBtnView(){
		if(document.getElementById('topFontSizeBtn')){
		  var p_topFontSizeBtn = document.getElementById('topFontSizeBtn');
 
		  if ( p_topFontSizeBtn ) {

			var aTag1 = document.createElement('A'); 
			aTag1.href="#zoom_Out";
			aTag1.setAttribute('id','zoomOut');
			aTag1.setAttribute('title','글자  작게하기');

			 
		    
		    var but1 = document.createElement('img');
		    
		    but1.setAttribute('src','../../files/web1/images/common/btn_browsctrl_05.gif');
		    but1.setAttribute('alt','zoomout');

		    aTag1.appendChild(but1);
		    
		    var aTag2 = document.createElement('A'); 
			aTag2.href="#zoom_Zero";
			aTag2.setAttribute('id','zoomZero');
			aTag2.setAttribute('title','글자크기 원래대로');

			var oTextNode2 = document.createTextNode('글자크기');
			 
		    
		    aTag2.appendChild(oTextNode2);



		    var aTag3 = document.createElement('A'); 
			aTag3.href="#zoom_In";
			aTag3.setAttribute('id','zoomIn');
			aTag3.setAttribute('title','글자 크게하기');

			 
		    
		    var but3 = document.createElement('img');
		    
		    but3.setAttribute('src','../../files/web1/images/common/btn_browsctrl_06.gif');
		    but3.setAttribute('alt','zoom_in');

		    aTag3.appendChild(but3);

		    
		    p_topFontSizeBtn.appendChild(aTag1);
		    p_topFontSizeBtn.appendChild(aTag2);
		    p_topFontSizeBtn.appendChild(aTag3);
		  }
		  
		}

	}

	/**
	 * HOME> 생활과 복지> 도시주택정보> 부동산정보> 부동산계약상식>중개수수료 자동계산에서만 사용하는 스크립트
	 * @param 
	 * @return
	 */	
	//*************************************************************************************************
	// 사용자 정의 관련 스크립트 START
	//*************************************************************************************************

	//-------------------------------변수선언

	// priceDiv() START ========================
	function priceDiv(sep){
      divLayer1 = "IO_div1.1";
	  divLayer2 = "IO_div1.2";
	  divLayer3 = "IO_div1.3";

	  targetLayer1 = document.getElementById(divLayer1);
	  targetLayer2 = document.getElementById(divLayer2);
	  targetLayer3 = document.getElementById(divLayer3);

	  if(sep == "1"){
	    targetLayer1.style.display = "";
	    targetLayer2.style.display = "none";
	    targetLayer3.style.display = "none";
	  }else if(sep == "2"){
	    targetLayer1.style.display = "none";
	    targetLayer2.style.display = "";
	    targetLayer3.style.display = "none";
	  }
	  else if(sep == "3"){
	    targetLayer1.style.display = "none";
	    targetLayer2.style.display = "none";
	    targetLayer3.style.display = "";
	  }
	  document.getElementById("I_gubun").value = sep;
	  
	  //이전값 제거
	  document.getElementById("inPrice1_1").value = "";
	  document.getElementById("inPrice1_2").value = "";
	  document.getElementById("inDepositPrice1_3").value = "";
	  document.getElementById("inMonthPrice1_3").value = "";
	  
	  document.getElementById("outSusu1_1").value = "";
	  document.getElementById("outSusu1_2").value = "";
	  document.getElementById("outSusu1_3").value = "";
	}

	// priceDiv2() START ========================
	function priceDiv2(sep){
	  divLayer1 = "IO_div2.1";
	  divLayer2 = "IO_div2.2";

	  targetLayer1 = document.all(divLayer1);
	  targetLayer2 = document.all(divLayer2);

	  if(sep == "1"){
	    targetLayer1.style.display = "";
	    targetLayer2.style.display = "none";
	  }else if(sep == "2"){
	    targetLayer1.style.display = "none";
	    targetLayer2.style.display = "";
	  }
	  document.getElementById("I2_gubun").value = sep;
	  
	  //이전값 제거
	  document.getElementById("inPrice2_1").value = "";
	  document.getElementById("inDepositPrice2_2").value = "";
	  document.getElementById("inMonthPrice2_2").value = "";
	  
	  document.getElementById("outSusu2_1").value = "";
	  document.getElementById("outSusu2_2").value = "";
	}

	// calcPrice1() START ========================
	function calcPrice1(){
	  var gubun;        //.String_구분
	  var checkStatus;    //.String_입력값 체크 상태
	
	  var price1;       //.Float[매매/교환]_매매 거래가액
	  var price2;       //.Float[부동산 전세]_전세보증금
	  
	  var depositPrice;   //.Float[부동산 월세]_보증금
	  var monthPrice;      //.Float[부동산 월세]_월세
	  
	  var susu1;        //.Float[매매/교환]_수수료
	  var susu2;        //.Float[부동산 전세]_수수료
	  var susu3;        //.Float[부동산 월세]_수수료
	  
	  var temp1_susu3;    //.Float[부동산 월세]_거래금액_초안
	  var temp2_susu3;    //.Float[부동산 월세]_거래금액 확정
	  
	  var gubun2;
	  
	  var price2_1;
	  var depositPrice2;
	  var monthPrice2;
	  
	  var susu4;
	  var susu5;
	  
	  var temp1_susu5;
	  var temp2_susu5;
		
	  //-------------------------------변수선언
	  gubun = document.getElementById("I_gubun").value;

	  price1 = parseFloat(document.getElementById("inPrice1_1").value);
	  price2 = parseFloat(document.getElementById("inPrice1_2").value);
	  depositPrice = parseFloat(document.getElementById("inDepositPrice1_3").value);
	  monthPrice = parseFloat(document.getElementById("inMonthPrice1_3").value);

	  switch(gubun) {
	    //매매/교환 수수료 계산
	    case "1":
	      if(isNaN(price1)){
	      alert('거래 금액을 입력해 주세요');
	        break;
	      }
	      if (price1 < 5000) {
	        susu1 = price1 * 0.006;
	        if (susu1 > 25) {
	          susu1 = 25;
	        }
	      }
	      else if (price1 >= 5000 && price1 < 20000) {
	        susu1 = price1 * 0.005;
	        if (susu1 > 80) {
	          susu1 = 80;
	        }
	      }
	      else if (price1 >= 20000 && price1 < 60000) {
	        susu1 = price1 * 0.004;
	      }
	      else if (price1 >= 60000) {
	        susu1 = price1 * 0.009;
	      }
	      //susu1 = commaStr(susu1);
	      susu1 = parseInt(Math.round(susu1));
	      document.getElementById("outSusu1_1").value = susu1;
	    break;
	    
	    //부동산 전세 수수료 계산
	    case "2":
	      if(isNaN(price2)){
	        alert('전세보증금을 입력해 주세요');
	        break;  
	      }
	      if (price2 < 5000) {
	        susu2 = price2 * 0.005;
	        if (susu2 > 20) {
	          susu2 = 20;
	        }
	      }
	      else if (price2 >= 5000 && price2 < 10000) {
	        susu2 = price2 * 0.004;
	        if (susu2 > 30) {
	          susu2 = 30;
	        }
	      }
	      else if (price2 >= 10000 && price2 < 30000) {
	        susu2 = price2 * 0.003;
	      }
	      else if (price2 >= 30000) {
	        susu2 = price2 * 0.008;
	      }
	      //susu2 = commaStr(susu2);
	      susu2 = parseInt(Math.round(susu2));
	      document.getElementById("outSusu1_2").value = susu2;
	    break;
	    
	    //부동산 월세 수수료 계산
	    case "3":
	      if(isNaN(depositPrice)){
	        alert('보증금을 입력해 주세요');
	        break;
	      }else if(isNaN(monthPrice)){
	        alert('월세를 입력해 주세요');
	        break;
	      }
	      
	      //거래금액 선계산
	      temp1_susu3 = depositPrice + (monthPrice * 100);
	      if (temp1_susu3 < 5000) {
	        temp1_susu3 = 0;
	        temp2_susu3 = depositPrice + (monthPrice * 70);
	      }
	      else {
	        temp2_susu3 = depositPrice + (monthPrice * 100);
	      }
	      
	      //거래금액에 요율상한 적용
	      if (temp2_susu3 < 5000) {
	        susu3 = temp2_susu3 * 0.005;
	      }
	      else if (temp2_susu3 >= 5000 && temp2_susu3 < 10000) {
	        susu3 = temp2_susu3 * 0.004;
	      }
	      else if (temp2_susu3 >= 10000 && temp2_susu3 < 30000) {
	        susu3 = temp2_susu3 * 0.003;
	      }
	      else if (temp2_susu3 >= 30000) {
	        susu3 = temp2_susu3 * 0.008;
	      }
	      //susu3 = commaStr(susu3);
	      susu3 = parseInt(Math.round(susu3));
	      document.getElementById("outSusu1_3").value = susu3;
	    break;
	  }
	}

	// calcPrice2() START ========================
	function calcPrice2(){
	  var gubun;        //.String_구분
	  var checkStatus;    //.String_입력값 체크 상태
	
	  var price1;       //.Float[매매/교환]_매매 거래가액
	  var price2;       //.Float[부동산 전세]_전세보증금
	  
	  var depositPrice;   //.Float[부동산 월세]_보증금
	  var monthPrice;      //.Float[부동산 월세]_월세
	  
	  var susu1;        //.Float[매매/교환]_수수료
	  var susu2;        //.Float[부동산 전세]_수수료
	  var susu3;        //.Float[부동산 월세]_수수료
	  
	  var temp1_susu3;    //.Float[부동산 월세]_거래금액_초안
	  var temp2_susu3;    //.Float[부동산 월세]_거래금액 확정
	  
	  var gubun2;
	  
	  var price2_1;
	  var depositPrice2;
	  var monthPrice2;
	  
	  var susu4;
	  var susu5;
	  
	  var temp1_susu5;
	  var temp2_susu5;
		
	  //-------------------------------변수선언
	  gubun2 = document.getElementById("I2_gubun").value;

	  price2_1 = parseFloat(document.getElementById("inPrice2_1").value);
	  depositPrice2 = parseFloat(document.getElementById("inDepositPrice2_2").value);
	  monthPrice2 = parseFloat(document.getElementById("inMonthPrice2_2").value);

	  switch(gubun2) {
	    //매매/교환 수수료 계산
	    case "1":
	      if(isNaN(price2_1)){
	        alert('거래금액을 입력해 주세요');
	        break;
	      }
	      susu4 = price2_1 * 0.009;
	      //susu4 = commaStr(susu4);
	      susu4 = parseInt(Math.round(susu4));
	      document.getElementById("outSusu2_1").value = susu4;
	    break;
	    
	    //임대차 수수료 계산
	    case "2":
	      if(isNaN(depositPrice2)){
	        alert('보증금을 입력해 주세요');
	        break;
	      }else if(isNaN(monthPrice2)){
	        alert('월세를 입력해 주세요');
	        break;
	      }
	      //거래금액 선계산
	      temp1_susu5 = depositPrice2 + (monthPrice2 * 100);
	      if (temp1_susu5 < 5000) {
	        temp1_susu5 = 0;
	        temp2_susu5 = depositPrice2 + (monthPrice2 * 70);
	      }
	      else {
	        temp2_susu5 = depositPrice2 + (monthPrice2 * 100);
	      }
	      //거래금액에 요율상한 적용
	      susu5 = temp2_susu5 * 0.009;
	      //susu5 = commaStr(susu5);
	      susu5 = parseInt(Math.round(susu5));
	      document.getElementById("outSusu2_2").value = susu5;
	    break;
	  }
	}


	//금액 입력시 숫자만 허용 ========================
	function handlerNum( obj ) {

	  //숫자만 입력 받게끔 하는 함수.
	  e = window.event; //윈도우의 event를 잡는것입니다.

	  //입력 허용 키
	  if( ( e.keyCode >=  48 && e.keyCode <=  57 ) ||   //숫자열 0 ~ 9 : 48 ~ 57
	  ( e.keyCode >=  96 && e.keyCode <= 105 ) ||   //키패드 0 ~ 9 : 96 ~ 105
	  e.keyCode ==   8 ||    //BackSpace
	  e.keyCode ==  46 ||    //Delete
	  //e.keyCode == 110 ||    //소수점(.) : 문자키배열
	  //e.keyCode == 190 ||    //소수점(.) : 키패드
	  e.keyCode ==  37 ||    //좌 화살표
	  e.keyCode ==  39 ||    //우 화살표
	  e.keyCode ==  35 ||    //End 키
	  e.keyCode ==  36 ||    //Home 키
	  e.keyCode ==   9       //Tab 키
	  ) {
	  
	    if(e.keyCode == 48 || e.keyCode == 96) { //0을 눌렀을경우
	      if ( obj.value == "" || obj.value == '0' ) { //아무것도 없거나 현재 값이 0일 경우에서 0을 눌렀을경우
	        e.returnvalue=false; //-->입력되지않는다.
	      } else { //다른숫자뒤에오는 0은
	        return; //-->입력시킨다.
	      }
	    } else { //0이 아닌숫자
	      return; //-->입력시킨다.
	    }
	  } else {//숫자가 아니면 넣을수 없다.
	    alert('숫자만 입력가능합니다');
	    e.returnvalue=false;
	  }
	}
	//*************************************************************************************************
	// 사용자 정의 관련 스크립트 END
	//*************************************************************************************************



// 2010년 11월 12일 박성규 추가
// 사용 페이지 http://www.incheon.go.kr/icweb/html/web1/001003001005002003.html

	function emulAcceptCharset(form) {
    if (form.canHaveHTML) { // detect IE
        document.charset = form.acceptCharset;
    }
    return true;
}

	// 이벤트 핸들러
	$(function(){
 		$('#gucd').bind('change',function(event){
			change_section();
 		});
    });

 		
    function change_section() {
		
		var num = $('#gucd').val();
		var j = 0;
		var optionArray = new Array();

		if (num == '28110') {
			optionArray[j++] = new Option('전체','');                
			optionArray[j++] = new Option('연안동', '2811052000');   
			optionArray[j++] = new Option('신포동', '2811053000');   
			optionArray[j++] = new Option('신흥동', '2811054000');   
			optionArray[j++] = new Option('도원동', '2811056000');   
			optionArray[j++] = new Option('율목동', '2811057000');   
			optionArray[j++] = new Option('동인천동', '2811058500'); 
			optionArray[j++] = new Option('북성동', '2811060000');   
			optionArray[j++] = new Option('송월동', '2811061000');   
			optionArray[j++] = new Option('영종동', '2811062000');   
			optionArray[j++] = new Option('용유동', '2811063000');   

			for(var i = 0 ; i < optionArray.length ; i++){
				document.getElementById('dcd').options[i] = optionArray[i]; 
			}
		}else if (num == '28140') {
			optionArray[j++] = new Option('전체','');                    
			optionArray[j++] = new Option('만석동', '2814051000');       
			optionArray[j++] = new Option('화수1,화평동', '2814052500'); 
			optionArray[j++] = new Option('화수2동', '2814053000');      
			optionArray[j++] = new Option('송현1,2동', '2814055500');    
			optionArray[j++] = new Option('송현3동', '2814057000');      
			optionArray[j++] = new Option('송림1동', '2814058000');      
			optionArray[j++] = new Option('송림2동', '2814059000');      
			optionArray[j++] = new Option('송림3,5동', '2814060500');    
			optionArray[j++] = new Option('송림4동', '2814061000');      
			optionArray[j++] = new Option('송림6동', '2814063000');      
			optionArray[j++] = new Option('금창동', '2814064000');       

			for(var i = 0 ; i < optionArray.length ; i++){
				document.getElementById('dcd').options[i] = optionArray[i];
			}
		}else if (num == '28170') {
			optionArray[j++] = new Option('전체','');              
			optionArray[j++] = new Option('숭의1동', '2817051000');
			optionArray[j++] = new Option('숭의2동', '2817052000');
			optionArray[j++] = new Option('숭의3동', '2817053000');
			optionArray[j++] = new Option('숭의4동', '2817054000');
			optionArray[j++] = new Option('용현1동', '2817055000');
			optionArray[j++] = new Option('용현2동', '2817056000');
			optionArray[j++] = new Option('용현3동', '2817057000');
			optionArray[j++] = new Option('용현4동', '2817058000');
			optionArray[j++] = new Option('용현5동', '2817059000');
			optionArray[j++] = new Option('학익1동', '2817060000');
			optionArray[j++] = new Option('학익2동', '2817061000');
			optionArray[j++] = new Option('도화1동', '2817063000');
			optionArray[j++] = new Option('도화2동', '2817064000');
			optionArray[j++] = new Option('도화3동', '2817065000');
			optionArray[j++] = new Option('주안1동', '2817066000');
			optionArray[j++] = new Option('주안2동', '2817067000');
			optionArray[j++] = new Option('주안3동', '2817068000');
			optionArray[j++] = new Option('주안4동', '2817069000');
			optionArray[j++] = new Option('주안5동', '2817070000');
			optionArray[j++] = new Option('주안6동', '2817071000');
			optionArray[j++] = new Option('주안7동', '2817072000');
			optionArray[j++] = new Option('주안8동', '2817073000');
			optionArray[j++] = new Option('관교동', '2817073500'); 
			optionArray[j++] = new Option('문학동', '2817074000'); 

			for(var i = 0 ; i < optionArray.length ; i++){
				document.getElementById('dcd').options[i] = optionArray[i]; 
			}
		}else if (num == '28185') {
			optionArray[j++] = new Option('전체','');                           
			optionArray[j++] = new Option('옥련1동', '2818563000');             
			optionArray[j++] = new Option('옥련2동', '2818564000');             
			optionArray[j++] = new Option('선학동', '2818575000');              
			optionArray[j++] = new Option('연수1동', '2818576100');             
			optionArray[j++] = new Option('연수2동', '2818576200');             
			optionArray[j++] = new Option('연수3동', '2818576300');             
			optionArray[j++] = new Option('청학동', '2818576600');              
			optionArray[j++] = new Option('동춘1동', '2818578000');             
			optionArray[j++] = new Option('동춘2동', '2818579000');             
			optionArray[j++] = new Option('청량동', '2818580000');              

			for(var i = 0 ; i < optionArray.length ; i++){
				document.getElementById('dcd').options[i] = optionArray[i]; 
			}
		}else if (num == '28200') {
			optionArray[j++] = new Option('전체','');                       
			optionArray[j++] = new Option('구월1동', '2820051000');    	
			optionArray[j++] = new Option('구월2동', '2820052000');    	
			optionArray[j++] = new Option('구월3동', '2820052100');    	
			optionArray[j++] = new Option('구월4동', '2820052200');    	
			optionArray[j++] = new Option('간석1동', '2820053000');    	
			optionArray[j++] = new Option('간석2동', '2820054000');    	
			optionArray[j++] = new Option('간석3동', '2820055000');    	
			optionArray[j++] = new Option('간석4동', '2820055100');    	
			optionArray[j++] = new Option('만수1동', '2820056000');    	
			optionArray[j++] = new Option('만수2동', '2820057000');   	
			optionArray[j++] = new Option('만수3동', '2820058000');   	
			optionArray[j++] = new Option('만수4동', '2820058100');   	
			optionArray[j++] = new Option('만수5동', '2820058200');   	
			optionArray[j++] = new Option('만수6동', '2820058300');   	
			optionArray[j++] = new Option('장수서창동', '2820065000');	
			optionArray[j++] = new Option('남촌도림동', '2820066000');	
			optionArray[j++] = new Option('논현고잔동', '2820067000');	

			for(var i = 0 ; i < optionArray.length ; i++){
				document.getElementById('dcd').options[i] = optionArray[i]; 
			}
		}else if (num == '28237') {
			optionArray[j++] = new Option('전체','');
			optionArray[j++] = new Option('부평1동', '2823751000');     
			optionArray[j++] = new Option('부평2동', '2823752000');     
			optionArray[j++] = new Option('부평3동', '2823753000');     
			optionArray[j++] = new Option('부평4동', '2823754000');     
			optionArray[j++] = new Option('부평5동', '2823755000');     
			optionArray[j++] = new Option('부평6동', '2823756000');     
			optionArray[j++] = new Option('산곡1동', '2823757000');     
			optionArray[j++] = new Option('산곡2동', '2823758000');     
			optionArray[j++] = new Option('산곡3동', '2823758100');     
			optionArray[j++] = new Option('산곡4동', '2823758200');     
			optionArray[j++] = new Option('청천1동', '2823759100');     
			optionArray[j++] = new Option('청천2동', '2823759200');     
			optionArray[j++] = new Option('갈산1동', '2823764100');     
			optionArray[j++] = new Option('갈산2동', '2823764200');     
			optionArray[j++] = new Option('삼산동', '2823764500');      
			optionArray[j++] = new Option('부개1동', '2823765000');     
			optionArray[j++] = new Option('부개2동', '2823766000');     
			optionArray[j++] = new Option('부개3동', '2823766100');     
			optionArray[j++] = new Option('일신동', '2823767000');      
			optionArray[j++] = new Option('십정1동', '2823768000');     
			optionArray[j++] = new Option('십정2동', '2823769000');     
   
			for(var i = 0 ; i < optionArray.length ; i++){
				document.getElementById('dcd').options[i] = optionArray[i]; 
			}
		}else if (num == '28245') {
			optionArray[j++] = new Option('전체','');
			optionArray[j++] = new Option('효성1동', '2824560100');          
			optionArray[j++] = new Option('효성2동', '2824560200');   	
			optionArray[j++] = new Option('계산1동', '2824561100');   	
			optionArray[j++] = new Option('계산2동', '2824561200');   	
			optionArray[j++] = new Option('계산3동', '2824561300');   	
			optionArray[j++] = new Option('계산4동', '2824561400');   	
			optionArray[j++] = new Option('작전1동', '2824562100');   	
			optionArray[j++] = new Option('작전2동', '2824562200');   	
			optionArray[j++] = new Option('작전서운동', '2824564000');	
			optionArray[j++] = new Option('계양1동', '2824571000');   	
			optionArray[j++] = new Option('계양2동', '2824572000');   	
					       		                                
			for(var i = 0 ; i < optionArray.length ; i++){
				document.getElementById('dcd').options[i] = optionArray[i]; 
			}
		}else if (num == '28260') {
			optionArray[j++] = new Option('전체','');
			optionArray[j++] = new Option('검암경서동', '2826051500');      
			optionArray[j++] = new Option('연희동', '2826053000');    	
			optionArray[j++] = new Option('가정1동', '2826054200');   	
			optionArray[j++] = new Option('가정2동', '2826054300');   	
			optionArray[j++] = new Option('가정3동', '2826054400');   	
			optionArray[j++] = new Option('석남1동', '2826055000');   	
			optionArray[j++] = new Option('석남2동', '2826056000');   	
			optionArray[j++] = new Option('석남3동', '2826056100');   	
			optionArray[j++] = new Option('신현원창동', '2826057500');	
			optionArray[j++] = new Option('가좌1동', '2826058000');   	
			optionArray[j++] = new Option('가좌2동', '2826059000');   	
			optionArray[j++] = new Option('가좌3동', '2826060000');   	
			optionArray[j++] = new Option('가좌4동', '2826061000');   	
			optionArray[j++] = new Option('검단1동', '2826063000');   	
			optionArray[j++] = new Option('검단2동', '2826064000');   	

			for(var i = 0 ; i < optionArray.length ; i++){
				document.getElementById('dcd').options[i] = optionArray[i]; 
			}
		}else if (num == '28710') {
			optionArray[j++] = new Option('전체','');
			optionArray[j++] = new Option('강화읍', '2871025000');  
			optionArray[j++] = new Option('선원면', '2871031000');	
			optionArray[j++] = new Option('불은면', '2871032000');	
			optionArray[j++] = new Option('길상면', '2871033000');	
			optionArray[j++] = new Option('화도면', '2871034000');	
			optionArray[j++] = new Option('양도면', '2871035000');	
			optionArray[j++] = new Option('내가면', '2871036000');	
			optionArray[j++] = new Option('하점면', '2871037000');	
			optionArray[j++] = new Option('양사면', '2871038000');	
			optionArray[j++] = new Option('송해면', '2871039000');	
			optionArray[j++] = new Option('교동면', '2871040000');	
			optionArray[j++] = new Option('삼산면', '2871041000');	
			optionArray[j++] = new Option('서도면', '2871042000');	

			for(var i = 0 ; i < optionArray.length ; i++){
				document.getElementById('dcd').options[i] = optionArray[i]; 
			}
		}else if (num == '28720') {
			optionArray[j++] = new Option('전체','');
			optionArray[j++] = new Option('북도면', '2872031000'); 
			optionArray[j++] = new Option('덕적면', '2872035000'); 
			optionArray[j++] = new Option('영흥면', '2872036000'); 
			optionArray[j++] = new Option('자월면', '2872037000'); 

			for(var i = 0 ; i < optionArray.length ; i++){
				document.getElementById('dcd').options[i] = optionArray[i]; 
			}
		}else{
			optionArray[j++] = new Option('전체','');

			for(var i = 0 ; i < optionArray.length ; i++){
				document.getElementById('dcd').options[i] = optionArray[i]; 
			}
		}
	}

// 사용 페이지 http://www.incheon.go.kr/icweb/html/web1/001003001005002003.html  스크립트 끝
// 웹접근성 관련 left 메뉴 신규 2011 05 27
function makeLeftMenuAction(){
	var left_menu = $(">ul","#left_menu");
	/*
	$("li", left_menu).each(function(){
		var child = $(">ul",this); 
		if(child.length == 0) return;

		$(">a", this).click(function(){
			if(child.css("display") == "none") child.show();
			else child.hide();
			
			return false;
		});
	}); 
	 * */
	

	$(".current", left_menu).each(function(){
		$(">ul",$(this).parent()).show();
	});
}

$(document).ready(function(){
	makeLeftMenuAction();
});


//아래로 버튼
function gofooter() {
	scrollTo(document.body.scrollWidth,document.body.scrollHeight);
}
