$(document).ready(function(){
  /* history page */
  var todayDate = new Date();
  todayDate.setTime(todayDate.getTime() + 1000 * 24 * 60 * 60);
  
  var menuID = getMenuID();
  if ( getCookie('history') != "" && getCookie('history') != null ) { // 쿠키값이 있으면
    sValues = getCookie('history');
    if ( sValues != null && sValues.indexOf(document.location.href) == -1 ) {
      var coc = sValues.split("|");
      if ( coc.length > 9 ) {
    	  sValues = sValues.substring(sValues.indexOf("|")+1, sValues.length);
      }
      var isContain = false;
      for ( var i = 0; i < coc.length; i++ ) {
        if ( coc[i] == menuID) {
          isContain = true;
        }
      }
      if ( !isContain ) {
        //document.cookie = "history="+escape(sValues+"|"+(document.title)+"*"+(document.location.href)) +"; path=/;expires=" + todayDate.toGMTString()+";";
        document.cookie = "history="+(sValues+"|"+menuID) +"; path=/;expires=" + todayDate.toGMTString()+";";
      }
    }
  } else {
    document.cookie = "history="+(menuID) +"; path=/;expires=" + todayDate.toGMTString()+";";
  } 
  /* history page */
  animatedcollapse.addDiv("toolbarTop", "fade=0, speed=200, group=pets, hide=1");
  animatedcollapse.addDiv("toolbarBot1", "fade=0, speed=200, group=pets, hide=1"); // 통합뉴스센터
  animatedcollapse.addDiv("toolbarBot2", "fade=0, speed=200, group=pets, hide=1"); // 시민참여공간
  animatedcollapse.addDiv("toolbarBot3", "fade=0, speed=200, group=pets, hide=1"); // 공공서비스예약
  animatedcollapse.addDiv("toolbarBot4", "fade=0, speed=200, group=pets, hide=1"); // 다운로드
  animatedcollapse.addDiv("toolbarBot5", "fade=0, speed=200, group=pets, hide=1"); // 패밀리사이트
  animatedcollapse.addDiv("toolbarBot6", "fade=0, speed=200, group=pets, hide=1"); // 열어본페이지
  animatedcollapse.ontoggle=function($, divobj, state){    	  
    if ( divobj && state == "block" ) {
    	if ( divobj.id.indexOf("Bot") > 0 ) {
	    	var divObjid = divobj.id.substring(10, 11);
	    	$("#toolbarBot"+divObjid+" .conBody").load("../../inc/toolbar/toolbar"+divObjid+".jsp");	    	    	
    	} else if ( divobj.id.indexOf("Top") > 0 ) {
    		$("#toolbarTop .conBody").load("../../inc/toolbar/toolbar0.jsp");
    	}
    }    
  }
  animatedcollapse.init();
  
  // 패밀리사이트 리스트 출력
  /* 2010년 4월 28일 박성규
   * 웹접근성 자바스크립트 미사용해도 정상기능 구현을 위해 mainSkin>mainSkin#>subLeftBack.jsp 파일에 include 시켜줌
  if ( document.getElementById("familySiteList1") ) {
    $.post("../../inc/familySiteList1.html",function (data) {      
      $("#familySiteList1").html(data);
      $("#btnFamilySiteList1").css("cursor","pointer");
      $("#btnFamilySiteList1").bind("click", function() {
        window.open(document.getElementById('familySiteList1').value);
      } );
    });
  }
  
  if ( document.getElementById("familySiteList2") ) {
    $.post("../../inc/familySiteList2.html",function (data) {      
      $("#familySiteList2").html(data);
      $("#btnFamilySiteList2").css("cursor","pointer");
      $("#btnFamilySiteList2").bind("click", function() {
        window.open(document.getElementById('familySiteList2').value);
      } );
    });
  }
  */
  
  
  // 대표사이트 인천과의 만남> 시청아내> 전화번호 안내 leftMenu와 중복
  if ( document.getElementById("siteList1") ) {
    $.post("../../inc/familySiteList1.html",function (data) {      
      $("#siteList1").html(data);
      $("#btnSiteList1").css("cursor","pointer");
      $("#btnSiteList1").bind("click", function() {
        window.open($("#siteList1").val());
      } );
    });
  }
  
  // 인천시 소방기관 사이트 링크
  if ( document.getElementById("btnFireStationSiteList1") ) {
      $("#btnFireStationSiteList1").css("cursor","pointer");
      $("#btnFireStationSiteList1").bind("click", function() {
        window.open(document.getElementById('fireStationSiteList1').value);
      } );
  }

  // 인천시행정기관 사이트 링크
  if ( document.getElementById("btnFireStationSiteList2") ) {
    $("#btnFireStationSiteList2").css("cursor","pointer");
    $("#btnFireStationSiteList2").bind("click", function() {
      window.open(document.getElementById('fireStationSiteList2').value);
    } );
  }
  
  // 농업관련 사이트 링크
  if ( document.getElementById("btnFarmingSiteList1") ) {
      $("#btnFarmingSiteList1").css("cursor","pointer");
      $("#btnFarmingSiteList1").bind("click", function() {
        window.open(document.getElementById('farmingSiteList1').value);
      } );
  }
  
  // 도매시장 사이트 링크
  if ( document.getElementById("btnFarmingSiteList2") ) {
      $("#btnFarmingSiteList2").css("cursor","pointer");
      $("#btnFarmingSiteList2").bind("click", function() {
        window.open(document.getElementById('farmingSiteList2').value);
      } );
  }

  //고시사이트(자주찾는 시험기관) 링크
  if ( document.getElementById("btnGosiSiteList1") ) {
    $("#btnGosiSiteList1").css("cursor","pointer");
    $("#btnGosiSiteList1").bind("click", function() {
      window.open(document.getElementById('gosiSiteList1').value);
    } );
  }
  //고시사이트(시.도 관련사이트) 링크
  if ( document.getElementById("btnGosiSiteList2") ) {
    $("#btnGosiSiteList2").css("cursor","pointer");
    $("#btnGosiSiteList2").bind("click", function() {
      window.open(document.getElementById('gosiSiteList2').value);
    } );
  }
  //고시사이트(군 · 구 관련사이트) 링크
  if ( document.getElementById("btnGosiSiteList3") ) {
    $("#btnGosiSiteList3").css("cursor","pointer");
    $("#btnGosiSiteList3").bind("click", function() {
      window.open(document.getElementById('gosiSiteList3').value);
    } );
  }
  //고시사이트(공사 · 공단 관련사이트) 링크
  if ( document.getElementById("btnGosiSiteList4") ) {
    $("#btnGosiSiteList4").css("cursor","pointer");
    $("#btnGosiSiteList4").bind("click", function() {
      window.open(document.getElementById('gosiSiteList4').value);
    } );
  }

  //대표사이트>생활과 복지>복지서비스>여성·가족>임신·출산 및 양육지원>군·구별 지원 링크
  if ( document.getElementById("btnSupportList1") ) {
    $("#btnSupportList1").css("cursor","pointer");
    $("#btnSupportList1").bind("click", function() {
      location.href=document.getElementById('supportList1').value; return false;
    } );
  }

  //대표사이트>생활과 복지>복지서비스>여성·가족>임신·출산 및 양육지원>인천광역시 지원 링크
  if ( document.getElementById("btnSupportList2") ) {
    $("#btnSupportList2").css("cursor","pointer");
    $("#btnSupportList2").bind("click", function() {
      location.href=document.getElementById('supportList2').value; return false;
    } );
  }
  
  //통합로그인센터 인천광역시 통합ID 사용 가능사이트
  if ( document.getElementById("btnIncheonSiteList") ) {
    $("#btnIncheonSiteList").css("cursor","pointer");
    $("#btnIncheonSiteList").bind("click", function() {
      window.open(document.getElementById('incheonSiteList').value);
    } );
  }

  //대표사이트>교통과관광>인천교통정책>대중교통정책>지하철 건설계획
  if ( document.getElementById("btnSubwaySiteList") ) {
    $("#btnSubwaySiteList").css("cursor","pointer");
    $("#btnSubwaySiteList").bind("click", function() {
      location.href=document.getElementById('subwaySiteList').value; return false;
    } );
  }
  
  
  if ( document.getElementById("btnFamilySiteList") ) {
	  $("#btnFamilySiteList").css("cursor","pointer");
	  $("#btnFamilySiteList").bind("click", function() {
	    window.open(document.getElementById('familySiteList').value);
	  } );
  }
  
  // 모든 달력 선택에 datepicker 추가
  $(".calendar").datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true, showMonthAfterYear: false, dayNamesMin: ['일', '월', '화', '수', '목', '금', '토'], monthNamesShort: ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'] });  
});

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

function getMenuID() {
  if ( gup("menuID") != "" ) {
    return gup("menuID");
  } else {
    var sHref = window.location.href;    
    if ( sHref.indexOf("html") > -1 ) {
      return sHref.substring(sHref.lastIndexOf("/")+1, sHref.lastIndexOf(".html"));
    }
    return "";
  }
}

function viewFootToolbar(sKey) {
	animatedcollapse.toggle('toolbarBot'+sKey);	
}

/*하단툴바 패밀리사이트내 탭체인지
 * 작성자 : 서경대
 * 작성일 : 2009.08.05
 * */
function toolTabChange(item,num) {
 var str="";
 for(i=1; i<=num; i++){
  if(i<10) str = "toolTab_"+i;
  else str = "toolTab_"+i;
  document.getElementById(str).style.display = "none";
 }
 document.getElementById(item).style.display = "";
 
 /* 초기 분류 코드 설정 */
 if( item == "toolTab_1" ) { 
   codeValue = "FAMILYSITE_FORMATION";
   selectNext(1, 1, codeValue,"","","","","");
 }else if( item == "toolTab_2" ) {
   codeValue = "FAMILYSITE_DEPARTMENT";
   selectNext(2, 1, codeValue,"","","","","");   
 }else if( item == "toolTab_3" ) {   
   codeValue = "FAMILYSITE_ALPHABET";   
   selectNext(3, 1, codeValue,"","","","","");
 } 
}

/*선택된 메뉴 하위 메뉴 검색
 * 작성자 : 서경대
 * 작성일 : 2009.08.05
 * */
function selectNext(item, level, codeValue, firstFormation, secondFormation, firstDepartment, secondDepartment, firstAlphabet){  
  var nextSelectBox = "toolTab_" + item + "_" + level;  
  var oContain = document.getElementById("toolTab_" + item).getElementsByTagName("UL");
  
  /* 해당 TAB 하위 UL 초기화*/
  for ( var i = level; i < oContain.length; i++ ) {
    oContain[i].innerHTML = "";    
  }
  
  $("#totalCount" + item).html("사이트목록 (총 0개)");

  /* 코드 검색일 경우 */
  if ( (level == 1 || level == 2) && !(item == 3 && level == 2 ) ) {
    /* 1차 분류 */
    if ( level == 1 ) {
      $("#toolTab_1_3").html("<img style=\"margin:80px 0 0 120px\" src=\"../../files/tn/images/toolbar/img_one.gif\" alt=\"1차분류를 선택하세요\"/>");
      $("#toolTab_2_3").html("<img style=\"margin:80px 0 0 120px\" src=\"../../files/tn/images/toolbar/img_one.gif\" alt=\"1차분류를 선택하세요\"/>");
      if ( item == 1 ) {
        firstFormation = codeValue;
      } else if ( item == 2 ) {
        firstDepartment = codeValue;
      } else if ( item == 3 ) {
        firstAlphabet = codeValue;
      }
    /* 2차 분류 */
    }else if ( level == 2 ) {
      if ( item == 1 ) {      
        secondFormation = codeValue;
      } else if ( item == 2 ) {
        secondDepartment = codeValue;
      } else if ( item == 3 ) {
      }
    }
    /* 해당 분류의 다음 코드 값 검색 */
    $.post("../../inc/toolbar/toolbar5_Process.jsp",
        { "code" : codeValue, "mode" : "code"},
        function(data) {
          
          var oUL= null;
          data = data.replace(/(\s*$)/, "").replace(/(^\s*)/, "");
          oUL = document.getElementById(nextSelectBox);            
          oUL.innerHTML = "";
          
          if ( data && data.length > 0) {            
            var aData = data.split("|");
            var nLen = aData.length;            
            
            for ( i = 0; i < nLen; i++ ) {
              var oLi = null;
              var aSiteValue = aData[i].split("");
              var sCode = aSiteValue[0].replace(/(\s*$)/, "").replace(/(^\s*)/, "");              
              var sText = aSiteValue[1].replace(/(\s*$)/, "").replace(/(^\s*)/, "");              
              oLi = oUL.appendChild(document.createElement("li"));
              
              if ( item == 2 && level == 1 ) {
                sText = sText.replace("(","<br /><span>[");
                sText = sText.replace(")","]</span>");
              }
              
              if ( item == 3 ) {
                var img = (Number(i)+1);
                if ( Number(i)+1 > 9 ) {
                  img = "0"+img;
                } else {
                  img = "00"+img;
                }                
                oLi.innerHTML = "<a href=\"#\" onclick=\"selectNext('"+item +"','"+(Number(level)+1)+"','"+sCode+"','"+firstFormation+"','"+secondFormation+"','"+firstDepartment+"','"+secondDepartment+"','"+firstAlphabet+"'); return false;\"><img id=\"indexImg"+i+"\" src=\"../../files/tn/images/toolbar/btn_index_" + img + "_off.gif\" onfocus=\"changeImg('indexImg"+i+"',"+(i+1)+");\" alt=\""+sText+"\" /></a>";                           
              }else {
                oLi.innerHTML = "<a href=\"#\" onclick=\"selectNext('"+item +"','"+(Number(level)+1)+"','"+sCode+"','"+firstFormation+"','"+secondFormation+"','"+firstDepartment+"','"+secondDepartment+"','"+firstAlphabet+"'); return false;\">"+sText+"</a>";                           
              }            
            }
            if ( (item == 1 && level == 2) || (item == 2 && level == 2) ) {
              /* 해당 코드별 사이트 검색 */
              $.post("../../inc/toolbar/toolbar5_Process.jsp",
                  { "type" : item, "mode" : "familySiteAll", "firstFormation" : firstFormation, "secondFormation" : secondFormation, "firstDepartment" : firstDepartment, "secondDepartment" : secondDepartment, "firstAlphabet" : firstAlphabet },
                  function(data) {          
                    
                    var oUL= null;
                    data = data.replace(/(\s*$)/, "").replace(/(^\s*)/, "");
                    oUL = document.getElementById("toolTab_"+item+"_3");            
                    oUL.innerHTML = "";
                    
                    if ( data && data.length > 0) {            
                      var aData = data.split("|");
                      var nLen = aData.length;           
                      var totalCount = nLen;
                          
                      
                      for ( i = 0; i < nLen; i++ ) {
                        var oLi = null;
                        var aSiteValue = aData[i].split("");
                        var sName = aSiteValue[0].replace(/(\s*$)/, "").replace(/(^\s*)/, "");              
                        var sURL = aSiteValue[1].replace(/(\s*$)/, "").replace(/(^\s*)/, "");
                        var sTarget = "";
                        if(sName.length > 0){
                          oLi = oUL.appendChild(document.createElement("li"));
                          oLi.innerHTML = "<a href=\"" + sURL + "\" target=\"_new\">" + sName + "</a>";           
                        }else{
                          totalCount--;
                        }
                      }
                      $("#totalCount" + item).html( "사이트목록 (총 " + totalCount + "개)");
                    }else{
                      oLi = oUL.appendChild(document.createElement("li"));
                      oLi.innerHTML = "검색된 항목이 없습니다.";
                    }
                  }
                  ,"text");
              
            }
          }else{             
            oLi = oUL.appendChild(document.createElement("li"));
            oLi.innerHTML = "검색된 항목이 없습니다.";
          }
        }
        ,"text");
    
  /* 사이트 검색일 경우*/
  }else if ( level == 3 || ( item == 3 && level == 2 )) {
    /* 해당 코드별 사이트 검색 */
    $.post("../../inc/toolbar/toolbar5_Process.jsp",
        { "type" : item,"code" : codeValue, "mode" : "familySite", "firstFormation" : firstFormation, "secondFormation" : secondFormation, "firstDepartment" : firstDepartment, "secondDepartment" : secondDepartment, "firstAlphabet" : firstAlphabet },
        function(data) {
          
          var oUL= null;
          data = data.replace(/(\s*$)/, "").replace(/(^\s*)/, "");          
          oUL = document.getElementById(nextSelectBox);            
          oUL.innerHTML = "";          
          if ( data && data.length > 0) {            
            var aData = data.split("|");
            var nLen = aData.length;
            var totalCount = nLen;
            
            for ( i = 0; i < nLen; i++ ) {
              var oLi = null;
              var aSiteValue = aData[i].split("");
              var sName = aSiteValue[0].replace(/(\s*$)/, "").replace(/(^\s*)/, "");              
              var sURL = aSiteValue[1].replace(/(\s*$)/, "").replace(/(^\s*)/, "");
              var sTarget = "";
              if(sName.length > 0){                
                oLi = oUL.appendChild(document.createElement("li"));
                oLi.innerHTML = "<a href=\"" + sURL + "\" target=\"_new\">" + sName + "</a>";           
              } else{
                totalCount--;
              }             
            }  
            $("#totalCount" + item).html( "사이트목록 (총 " + totalCount + "개)");
          }else{
            oLi = oUL.appendChild(document.createElement("li"));
            oLi.innerHTML = "검색된 항목이 없습니다.";
          }
        }
        ,"text");    
  }  
}



/*패밀리사이트 시민참여공간
 * 작성자 : 서경대
 * 작성일 : 2009.08.10
 * */
function fncFamilyBoardList(mode){
  
    /* 해당 분류의 다음 코드 값 검색 */
    $.post("../../inc/toolbar/toolbar2_Process.jsp",
        { "mode" : mode},
        function(data) {
          document.getElementById("familySiteBoardList").innerHTML = data;
          if ( mode == "site" ) {
            document.getElementById("alphabetOrder").className = "";                        
            document.getElementById("siteOrder").className = "c1";            
          } else if ( mode == "alphabet" ) {
            document.getElementById("siteOrder").className = "";            
            document.getElementById("alphabetOrder").className = "c1";                        
          }
        }
        ,"text");    
}  



/*패밀리사이트 참여가능 내역
 * 작성자 : 서경대
 * 작성일 : 2009.08.27
 * */
function fncEachList(mode){
  $(".eachList1").attr("src","../../files/tn/images/toolbar/tab_002001_off.gif");
  $(".eachList2").attr("src","../../files/tn/images/toolbar/tab_002002_off.gif");
  $(".eachList3").attr("src","../../files/tn/images/toolbar/tab_002003_off.gif");
  $(".eachList4").attr("src","../../files/tn/images/toolbar/tab_002004_off.gif");
  $(".eachList5").attr("src","../../files/tn/images/toolbar/tab_002005_off.gif");
  if (mode == 'all' ) {
    $(".eachList1").attr("src","../../files/tn/images/toolbar/tab_002001_on.gif");
  } else if (mode == 'event' ) {
    $(".eachList2").attr("src","../../files/tn/images/toolbar/tab_002002_on.gif");
  } else if (mode == 'survey' ) {
    $(".eachList3").attr("src","../../files/tn/images/toolbar/tab_002003_on.gif");
  } else if (mode == 'B10' ) {
    $(".eachList4").attr("src","../../files/tn/images/toolbar/tab_002004_on.gif");
  } else if (mode == 'B11' ) {
    $(".eachList5").attr("src","../../files/tn/images/toolbar/tab_002005_on.gif");
  }
  $.post("../../inc/toolbar/toolbar2_getList.jsp",
      { "mode" : mode},
      function(data) {
        $("#getEachList").html("");
        $("#getEachList").html(data);
      }
      ,"text");    
}  

/*통합예약서비스 리스트
 * 작성자 : 서경대
 * 작성일 : 2009.08.28
 * */
function fncReserveList(mode){
  if ( mode == 'I' ) {
    $("#listTab1").css("display","none");
    $("#listTab2").css("display","");
  }else{
    $("#listTab1").css("display","");
    $("#listTab2").css("display","none");
  }
  $(".reserveList1").attr("src","../../files/tn/images/toolbar/btn_003001_off.gif");
  $(".reserveList2").attr("src","../../files/tn/images/toolbar/btn_003002_off.gif");
  $(".reserveList3").attr("src","../../files/tn/images/toolbar/btn_003003_off.gif");
  $(".reserveList4").attr("src","../../files/tn/images/toolbar/btn_003004_off.gif");
  $(".reserveList5").attr("src","../../files/tn/images/toolbar/btn_003005_off.gif");
  
  var changeTitle = "";
  
  if (mode == 'L' ) {
    changeTitle = $(".reserveList1").attr("alt");    
    $(".reserveList1").attr("src","../../files/tn/images/toolbar/btn_003001_on.gif");       
  }else if (mode == 'S' ) {
    changeTitle = $(".reserveList2").attr("alt");    
    $(".reserveList2").attr("src","../../files/tn/images/toolbar/btn_003002_on.gif");
  } else if (mode == 'E' ) {
    changeTitle = $(".reserveList3").attr("alt");    
    $(".reserveList3").attr("src","../../files/tn/images/toolbar/btn_003003_on.gif");
  } else if (mode == 'R' ) {
    changeTitle = $(".reserveList4").attr("alt");    
    $(".reserveList4").attr("src","../../files/tn/images/toolbar/btn_003004_on.gif");
  } else if (mode == 'C' ) {
    changeTitle = $(".reserveList5").attr("alt");    
    $(".reserveList5").attr("src","../../files/tn/images/toolbar/btn_003005_on.gif");    
  } else if (mode == 'I' ) {        
    $(".reserveList6").attr("src","../../files/tn/images/toolbar/btn_003006.gif");    
  }
  if (mode != 'I' ) {    
    var head = "<tr>\n" 
      + " <th  class=\"changeTitle\" scope=\"col\">" + changeTitle + "</th>\n"
      + " <th scope=\"col\">운영기관</th>\n"
      + " <th scope=\"col\">수강료</th>\n"
      + " <th scope=\"col\">대상</th>\n"
      + " <th scope=\"col\">진행상태</th>\n"
      + "</tr>";
    $("#reserveListHead").html(head);
    
    var col = ""
      + "<col width=\"35%\"/>\n"
      + "<col width=\"20%\"/>\n"
      + "<col width=\"10%\"/>\n"
      + "<col width=\"20%\"/>\n"
      + "<col width=\"15%\"/>\n";
    $("#reserveListCol").html(col);
    
    $.post("../../inc/toolbar/toolbar3_getReserveList.jsp",
        { "mode" : mode},
        function(data) {
          $("#reserveList").html("");
          $("#reserveList").html(data);
        }
        ,"text");    
  }
}



/*통합예약서비스 리스트
 * 작성자 : 서경대
 * 작성일 : 2009.08.28
 * */
function fncReserveServiceList(){
  $.post("../../inc/toolbar/toolbar3_getReserveServiceList.jsp",      
      function(data) {
        $("#reserveList").html("");
        $("#reserveList").html(data);
        var head = "<tr>\n" 
          + " <th  class=\"changeTitle\" scope=\"col\">사이트명</th>\n"
          + " <th scope=\"col\">메뉴명</th>\n"
          + " <th scope=\"col\">유형</th>\n"
          + "</tr>";
        $("#reserveListHead").html(head);
        var col= ""
                 + "<col width=\"25%\"/>\n"
                 + "<col width=\"50%\"/>\n"
                 + "<col width=\"25%\"/>\n"
        $("#reserveListCol").html(col);
      },"text");    
}



$(document).ready(function(){
  var currentPosition = 0;  
  if(!isNaN($(".right").css("top"))){    
    currentPosition = parseInt($(".right").css("top"));
  }
	
	$(window).scroll(function() {
		var position = $(window).scrollTop(); // 현재 스크롤바의 위치값을 반환합니다.		
		$(".right").stop().animate({"top":Number(position)+Number(currentPosition)+"px"},1000);
	});
});

/*통합뉴스센터 > 인천시알림창
 * 작성자 : 서경대
 * 작성일 : 2009.08.29
function fncGetBannerList(){  
  $.post("../../inc/toolbar/toolbar1_BannerList.jsp"  
      , function(data) {
        
        $("#toolbarProfileList").html("");
        $("#toolbarProfileList").html(data);
        
        var nextObj = $("#banner100>li:last"); 
        $("#banner100>li").clone().prependTo($("#banner100"));
        nextObj.prependTo($("#banner100"));
        $("#banner100").attr("timer", setInterval("nextBannerList('banner100','top')", 2000));
      }
      ,"text");    
}
 * */
  /* 통합뉴스로딩 스크립트*/
  function listIntegrationBoardToolbar(currentPage){    
    $.post("../../inc/toolbar/listIntegrationBoardToolbar.jsp",
        {"currentPage" : currentPage},
        function (data){
          $("#listtIntegrationNewsBoard").html(data);
    },"text");
  }
  /* 타시도소식List 로딩 스크립트*/
  function listExternalBoardToolbar(currentPage){    
    $.post("../../inc/toolbar/listExternalBoardToolbar.jsp",
        {"boardTypeID":"1914", "currentPage" : currentPage},
        function (data){          
          $("#listtIntegrationNewsBoard").html(data);
        },"text");
  }
  
  /* 타시도소식Detail 로딩 스크립트*/
  function detailExternalBoardToolbar(boardID, currentPage){    
    if(boardID == "#"){      
      alert("더이상 글이 없습니다.");     
    }else{
    $.post("../../inc/toolbar/detailExternalBoardToolbar.jsp",
        {"boardID" : boardID,"boardTypeID" : "1914", "currentPage" : currentPage},
        function (data){          
          $("#listtIntegrationNewsBoard").html(data);
        },"text");
    }
  }
  

  /*  해당 banner의 bannerID, bannerType(top:세로, left:가로)을 파라미터로 받음 
   * */

  /* 다음 배너 보이기 기본 */
  function nextBannerList(bannerID, bannerType, playTime, isStart){
    if( isStart == "false" ){    
      stopBannerList(bannerID);
    }
    
    var obj = $("#"+bannerID+">li:last");  
    if(bannerType == 'top'){
      $("#"+bannerID+">li").animate({ top : getHeight(obj, bannerType)}, playTime, function() {
        $("#"+bannerID+">li").css(bannerType,0); 
        obj.prependTo($("#"+bannerID));    
      });
      
    }else if (bannerType == 'left'){
      $("#"+bannerID+">li").animate({ left : getHeight(obj, bannerType)}, playTime, function() {
        $("#"+bannerID+">li").css(bannerType,0); 
        obj.prependTo($("#"+bannerID));    
      });    
    }  
    if( isStart == "false" ){
      //$("#"+bannerID).attr("timer", setInterval("nextBannerList('"+bannerID+"','"+bannerType+"')", playTime, "false"));
    }
  }

  /* 이전 배너 보이기 */
  function prevBannerList(bannerID, bannerType, playTime, isStart){
    
    stopBannerList(bannerID);
   
    var obj = $("#"+bannerID+">li:first");
    
    if(bannerType == 'top'){    
    $("#"+bannerID+">li").animate({ top : getHeight(obj, bannerType) * (-1)}, playTime, function() {
      $("#"+bannerID+">li").css(bannerType,0);
      obj.appendTo($("#"+bannerID));
      });
    } else if ( bannerType == "left") {
      $("#"+bannerID+">li").animate({ left : getHeight(obj, bannerType) * (-1)}, playTime, function() {
        $("#"+bannerID+">li").css(bannerType,0);
        obj.appendTo($("#"+bannerID));
      });    
    }
    
    //$("#"+bannerID).attr("timer", setInterval("nextBannerList('"+bannerID+"','"+bannerType+"')", playTime, "false"));
  }
  function stopBannerList(bannerID){
    
    clearInterval($("#"+bannerID).attr("timer"));
    
  }

  /* 해당 객체의 높이를 구함 */
  function getHeight(obj, bannerType) {
    
    var height = null;
    if ( bannerType == "top" ) {    
      height = ( obj.outerHeight(true) - obj.outerHeight() ) / 2 + obj.outerHeight();
    }else if ( bannerType == "left" ) {
      height = ( obj.outerWidth(true) - obj.outerWidth() ) / 2 + obj.outerWidth();
    }
    
    return height;
  }