/*--------------------------------------------------------------------------*/
/* $id Selector
/*--------------------------------------------------------------------------*/
/* getElementById : $id("id") */
function $id() {
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string')
element = document.getElementById(element);
if (arguments.length == 1)
return element;
elements.push(element);
}
return elements;
}
/*--------------------------------------------------------------------------*/
/* getElementsByClassName Selector
/*--------------------------------------------------------------------------*/
/* getElementsByClassName : getElementsByClassName("className","parentId","elementName")*/
document.getElementsByClassName = function(_class, el_id, elTag) {
if (elTag == false || elTag == null) {
elTag = '*';
}
var parent, els, returnArr = new Array(), i = 0;
parent = (el_id) ? document.getElementById(el_id) : document;
els = parent.getElementsByTagName(elTag) || parent.all;
for (i; i < els.length; i++)
if (els[i].className == _class)
returnArr[returnArr.length] = els[i];
return returnArr;
}
/*--------------------------------------------------------------------------*/
/* image on off
/*--------------------------------------------------------------------------*/
function imgOn(imgElement)
{
imgElement.src = imgElement.src.replace("_off.gif", "_on.gif");
}
function imgOff(imgElement)
{
imgElement.src = imgElement.src.replace("_on.gif", "_off.gif");
}
/*--------------------------------------------------------------------------*/
/* embed object
/*--------------------------------------------------------------------------*/
var embedSWF = function(url, replaceEl, width, height, wmode, objId) {
try {
if (document.write && document.getElementById)
{
if (wmode == false) wmode = "window";
if (objId == false) objId = "flashObject";
var replaceEl = document.getElementById(replaceEl);
var replaceElContent = replaceEl.innerHTML;
var objectStr = ''+
'' +
'' +
'';
replaceEl.innerHTML = objectStr;
}
}
catch (e) {return false;}
}
/*--------------------------------------------------------------------------*/
/* scrollTop Script
/*--------------------------------------------------------------------------*/
function scrollTop() { //스크롤 위치 함수
var scrollTop = document.scrollTop ? document.scrollTop : document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
return scrollTop;
}
function quickSlide(elId,speed,topPosition,botPosition) {
var quickId = document.getElementById(elId); // 엘레멘트 id 변수
var topPosition = topPosition; // 초기 top 포지션 변수
var botPosition = botPosition; // 최대 스크롤 bottom 변수
quickId.style.top = parseInt(topPosition) + "px"; // 초기 top 위치로 배치
var speedPlus = 0; // 가속도를 위한 변수 지정
var quickSlide = setInterval(function() { // setInterval
// 내려갈때
// 스크롤보다 레이어가 위에 있고 레이어의 아래가 botPosition 보다 작다면 (최대 스크롤 bottom을 넘지 못하게 하기위해)
if (parseInt(quickId.style.top) < parseInt(scrollTop()) + parseInt(topPosition) && parseInt(quickId.style.top) < parseInt(document.body.offsetHeight) - parseInt(quickId.offsetHeight) - parseInt(botPosition))
{
quickId.style.top = parseInt(quickId.style.top) + speedPlus + "px";// 레이어의 탑에 가속도를 줘서 움직이게 함
speedPlus = speedPlus + 1;// 가속도 늘어나기
if (parseInt(quickId.style.top) >= parseInt(scrollTop()) + parseInt(topPosition))// 가속도에 의해 스크롤 탑보다 내려갈수도 있기 때문에.. >=로 체크
{
quickId.style.top = parseInt(scrollTop()) + parseInt(topPosition) + "px"; // 레이어 탑 = 초기 포지션 + 스크롤값
speedPlus = 0;// 다시 내리거나 올릴때를 위해 가속도를 0으로 초기화
if (parseInt(quickId.style.top) >= parseInt(document.body.offsetHeight) - parseInt(quickId.offsetHeight) - parseInt(botPosition)) // 가속도에 의해 최대 스크롤 bottom에 정확히 레이어를 위치시킬수 없음릉 대비하여 >= 로 체크
{
quickId.style.top = parseInt(document.body.offsetHeight) - parseInt(quickId.offsetHeight) - parseInt(botPosition) + "px";// 레이어 탑은 바디전체에서 퀵바 영역의 높이와 최대 bottom 사이즈를 뺀 값으로 줌
}
}
}
// 올라갈때
// 스크롤보다 레이어가 아래에 있을때
if (parseInt(quickId.style.top) > parseInt(scrollTop()) + parseInt(topPosition))
{
quickId.style.top = parseInt(quickId.style.top) - speedPlus + "px"; //레이어의 탑에 가속도를 줘서 움직이게 함
speedPlus = speedPlus + 1;//가속도 늘어나기
if (parseInt(quickId.style.top) <= parseInt(scrollTop()) + parseInt(topPosition))// 가속도에 의해 스크롤 탑보다 올라갈수도 있기 때문에.. <==로 체크
{
quickId.style.top = parseInt(scrollTop()) + parseInt(topPosition) + "px"// 레이어 탑 = 초기 포지션 + 스크롤 값
speedPlus = 0;// 다시 내리거나 올릴때를 위해 가속도를 0으로 초기화
}
}
},speed);
}
/*--------------------------------------------------------------------------*/
/* for subSlideMenu(Left)
/*--------------------------------------------------------------------------*/
function subSlideMenu(subSlideMenuId,firstOn) {
var subSlideMenu = document.getElementById(subSlideMenuId);// 컨텐츠 id 변수지정
var menuUl = subSlideMenu.getElementsByTagName("ul");// 컨텐츠 안 ul 태그 변수지정
var menuLink = subSlideMenu.getElementsByTagName("a");// 컨텐츠 안 a 태그 변수지정
var menuImg = subSlideMenu.getElementsByTagName("img");// 컨텐츠 안 img 태그 변수지정
subSlideMenuFirst(); // 초기화 함수 실행
function subSlideMenuFirst() {//초기화 함수 (1depth 빼고 모두 숨김)
for (i=0;menuUl.length>i;i++)//뎁스 초기화
{
if (menuUl[i].parentNode != subSlideMenu)// 부모가 컨텐츠 div 가 아닌(1뎁스가 아닌) ul은
{
menuUl[i].style.display = "none"; //안보이게
}
}
}
// 온클릭시
/* for (j=0;menuLink.length>j;j++) // a태그
{
menuLink[j].onclick = function() { //클릭시
var thisChild = this.parentNode.childNodes; //이 a태그의 부모(li)의 자식들 변수지정
var thisEl = this; //이 a 태그 변수지정
for (k=0;thisChild.length > k;k++) //li의 자식들 중
{
if (thisChild[k].nodeName=="OL" && thisChild[k].style.display == 'none') { //자식 ul이 안보이는 상태면
subSlideMenuFirst(); //일단 초기화 시키고
thisChild[k].style.display = 'block'; // li의 자식 ul (다음뎁스)을 보이게 함
while (thisEl.parentNode.parentNode) { // 태그의 할아버지 노드가 있을때까지 실행(1뎁스 li까지)
if (thisEl == subSlideMenu) break; // 이 노드가 컨텐츠이면 실행중지 (계속 조상으로 바뀌며 검사하는 것을 방지
thisEl.parentNode.style.display = 'block'; // 조상노드 모두 block (ul과 li임)
thisEl = thisEl.parentNode; // 이 노드를 부모노드로 변경하여 계속 검사
}
return false;//앵커 이동 방지
}
else if (thisChild[k].nodeName=="OL" && thisChild[k].style.display == 'block') { //자식 ul이 보이는 상태면
thisChild[k].style.display = 'none'; // 자식 ul은 안보이게
return false;//앵커 이동 방지
}
}
}
}
*/
//마우스 온오버시 이미지
for (l=0;menuImg.length > l;l++)
{
menuImg[l].onmouseover = function() {
this.src = this.src.replace("_off","_on");
}
menuImg[l].onmouseout = function() {
this.src = this.src.replace("_on","_off");
}
}
if (firstOn) // 초기 on 지정시
{
if (document.getElementById(firstOn).getElementsByTagName("img").length > 0)//이미지 버튼이라면
{
document.getElementById(firstOn).getElementsByTagName("img")[0].src = document.getElementById(firstOn).getElementsByTagName("img")[0].src.replace("_off","_on");//온으로
document.getElementById(firstOn).getElementsByTagName("img")[0].onmouseover = "";//해당 이미지의 온오버 함수 삭제
document.getElementById(firstOn).getElementsByTagName("img")[0].onmouseout = "";//해당 이미지의 온오버 함수 삭제
}
else {//텍스트 버튼이라면
document.getElementById(firstOn).className = "current";//current 클래스 지정
}
var onEl = document.getElementById(firstOn); //초기 on 엘레멘트 변수 지정
while (onEl.parentNode.parentNode) { // 태그의 할아버지 노드가 있을때까지 실행(1뎁스 li까지)
if (onEl == subSlideMenu) break; // 이 노드가 컨텐츠이면 실행중지 (계속 조상으로 바뀌며 검사하는 것을 방지
onEl.parentNode.style.display = 'block'; // 조상노드 모두 block (ul과 li임)
onEl = onEl.parentNode; // 이 노드를 부모노드로 변경하여 계속 검사
}
}
}
/*--------------------------------------------------------------------------*/
/* tabBoard(multi menu ver)
/*--------------------------------------------------------------------------*/
function tabBoard(tabId,tabMenuId)
{
var moreBtn = document.getElementsByClassName("more",tabMenuId); //more 버튼 검사
var tabDivId = document.getElementById(tabId); //div id 변수로 넘김
var tabMenuId = document.getElementById(tabMenuId); //div id 변수로 넘김
//메뉴 영역의 앵커 변수로 넘김 (앵커 숫자와 메뉴의 갯수는 같다) 메뉴 영역(ul)에서 다른 목적의 앵커태그 추가 금지
var tabMenuAnchor = tabMenuId.getElementsByTagName("ul")[0].getElementsByTagName("a");
var first=0; //초기 첫번째 내용만 보이기 위한 변수지정
var temp = tabMenuAnchor[0].href.split("#")[1]; //기존 클릭했던 정보 임시 저장
for (i=0; i 0) && (moreBtn[i] != null)) moreBtn[i].style.display = "none"; //more 버튼이 있다면 일단 안보이게
if (first==0) // 처음으로 페이지에 접속했을때
{
document.getElementById(tabMenuAnchor[0].href.split("#")[1]).style.display = "block"; // 첫번째 내용은 보이게 함
if (moreBtn.length > 0) moreBtn[0].style.display = "block"; // more 버튼이 있다면 1번 more는 보이게
if (tabMenuId.getElementsByTagName("img")[0] !=null) {//이미지 버튼일때
tabMenuId.getElementsByTagName("img")[0].src=
tabMenuId.getElementsByTagName("img")[0].src.replace("_off","_on");//1번 버튼 온
}
else {//텍스트 버튼일때
tabMenuId.getElementsByTagName("li")[0].className="current";//1번 버튼 onTab 클래스
}
first=1; //처음이라는 정보를 지움
}
// 앵커중 하나를 클릭했을때
tabMenuAnchor[i].onclick = function() {
for (j=0; j 0) {// more버튼 전체 숨김
for (k=0;k0){ //if there are switch contents defined on the page
for (var i=0; i'+this.headers[i].innerHTML //Add a span element to original HTML to store indicator
if (opencontents_ids.indexOf(','+i+',')!=-1){ //if index "i" exists within cookie string or default-enabled string (i=position of the content to expand)
this.expandcontent(this.headers[i]) //Expand each content per stored indices (if ""Collapse Previous" is set, only one content)
if (this.collapsePrev) //If "Collapse Previous" set
this.prevHeader=this.headers[i] //Indicate the expanded content's corresponding header as the last clicked on header (for logic purpose)
}
else //else if no indices found in stored string
this.contractcontent(this.headers[i]) //Contract each content by default
this.headers[i].onclick=function(){instanceOf.toggledisplay(this)}
} //END FOR LOOP
switchcontent.dotask(window, function(){instanceOf.rememberpluscleanup()}, "unload") //Call persistence method onunload
}
// -------------------------------------------------------------------
// PRIVATE: rememberpluscleanup()- Stores the indices of content that are expanded inside session only cookie
// If "Collapse Previous" is enabled, only 1st expanded content index is stored
// -------------------------------------------------------------------
//Function to store index of opened ULs relative to other ULs in Tree into cookie:
switchcontent.prototype.rememberpluscleanup=function(){
//Define array to hold ids of open content that should be persisted
//Default to just "none" to account for the case where no contents are open when user leaves the page (and persist that):
var opencontents=new Array("none")
for (var i=0; i1) //If there exists open content to be persisted
opencontents.shift() //Boot the "none" value from the array, so all it contains are the ids of the open contents
if (typeof this.statusOpen!="undefined")
this.statusOpen=this.statusClosed=null //Cleanup code
if (this.persistType=="session") //if session only cookie set
switchcontent.setCookie(this.className, opencontents.join(",")) //populate cookie with indices of open contents: classname=1,2,3,etc
else if (this.persistType=="days" && typeof this.persistDays=="number"){ //if persistent cookie set instead
switchcontent.setCookie(this.className+"_d", opencontents.join(","), this.persistDays) //populate cookie with indices of open contents
switchcontent.setCookie(this.className+"_dtrack", this.persistDays, this.persistDays) //also remember number of days to persist (int)
}
}
// -------------------------------------------------------------------
// A few utility functions below:
// -------------------------------------------------------------------
switchcontent.dotask=function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
if (target.addEventListener)
target.addEventListener(tasktype, functionref, false)
else if (target.attachEvent)
target.attachEvent(tasktype, functionref)
}
switchcontent.connect=function(pageurl, header){
var page_request = false
var bustcacheparameter=""
if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else
return false
page_request.onreadystatechange=function(){switchcontent.loadpage(page_request, header)}
if (switchcontent_ajax_bustcache) //if bust caching of external page
bustcacheparameter=(pageurl.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', pageurl+bustcacheparameter, true)
page_request.send(null)
}
switchcontent.loadpage=function(page_request, header){
var innercontent=document.getElementById(header.id.replace("-title", "")) //Reference content container for this header
innercontent.innerHTML=switchcontent_ajax_msg //Display "fetching page message"
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
innercontent.innerHTML=page_request.responseText
header.ajaxstatus="loaded"
}
}
switchcontent.getCookie=function(Name){
var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
if (document.cookie.match(re)) //if cookie found
return document.cookie.match(re)[0].split("=")[1] //return its value
return ""
}
switchcontent.setCookie=function(name, value, days){
if (typeof days!="undefined"){ //if set persistent cookie
var expireDate = new Date()
var expstring=expireDate.setDate(expireDate.getDate()+days)
document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()
}
else //else if this is a session only cookie
document.cookie = name+"="+value
}
/*--------------------------------------------------------------------------*/
/* Print map
/*--------------------------------------------------------------------------*/
function print_page(html)
{
document.getElementById('PRINT_IFRAME').contentWindow.document.body.innerHTML = html;
if(navigator.userAgent.toLowerCase().indexOf("gecko") >= 0)
document.getElementById('PRINT_IFRAME').contentWindow.print();
else
document.getElementById('PRINT_IFRAME').contentWindow.document.execCommand('Print');
}