﻿
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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 MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->


function resizeFrame() {
	var obj = document.getElementById("innerDoc");
	var innerBody = obj.contentWindow.document.body;
	var innerHeight = innerBody.offsetHeight;
//	var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight);
	var innerWidth = innerBody.scrollWidth + (innerBody.offsetWidth - innerBody.clientWidth);
	obj.style.height = innerHeight +"px";
}


function embedflash( flname, width, height, flashvar, altText)
{
    document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+width+"' height='"+height+"'>");
    document.write("<param name='wmode' value='transparent'>");
    document.write("<param name='movie' value='"+flname+"'>");
    document.write("<param name='quality' value='high'>");
    
    var embedVar='';
    if(flashvar!=null){
        document.write("<param name='FlashVars' value='"+flashvar+"'>");
        embedVar = " FlashVars='"+flashvar+"' ";
     }
    
    document.write("<!--[if !IE]>-->");
	document.write("<object type='application/x-shockwave-flash' data='" + flname + "' width='" + width + "' height='" + height + "'>");
	
    document.write("<param name='wmode' value='transparent'>");
    document.write("<param name='quality' value='high'>");
    if(flashvar!=null){
        document.write("<param name='FlashVars' value='"+flashvar+"'>");
    }    	
    
	document.write("<!--<![endif]-->");
	if(altText!=null){
	    document.write(altText);
	}
	document.write("<!--[if !IE]>-->");
	document.write("</object>");
	document.write("<!--<![endif]-->");
	
    //document.write("<embed src='"+flname+"' wmode=transparent quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='"+width+"' height='"+height+"'"+embedVar+"></embed>");
    document.write("</object>");
}

function embedflash2( obj)
{
    document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+obj.width+"' height='"+obj.height+"'>");
    
    if(obj.wmode==null) obj.wmode = 'transparent';
    
    document.write("<param name='wmode' value='"+obj.wmode+"'>");
    document.write("<param name='movie' value='"+obj.flname+"'>");
    document.write("<param name='quality' value='high'>");
    
    var embedVar='';
    if(obj.flashvar!=null){
        document.write("<param name='FlashVars' value='"+obj.flashvar+"'>");
        embedVar = " FlashVars='"+obj.flashvar+"' ";
     }
    
    document.write("<!--[if !IE]>-->");
	document.write("<object type='application/x-shockwave-flash' data='" + obj.flname + "' width='" + obj.width + "' height='" + obj.height + "'>");
	
    document.write("<param name='wmode' value='"+obj.wmode+"'>");
    document.write("<param name='quality' value='high'>");
    if(obj.flashvar!=null){
        document.write("<param name='FlashVars' value='"+obj.flashvar+"'>");
    }    	
    
	document.write("<!--<![endif]-->");
	if(obj.altText!=null){
	    document.write(obj.altText);
	}
	document.write("<!--[if !IE]>-->");
	document.write("</object>");
	document.write("<!--<![endif]-->");
	
    document.write("</object>");
}

//param value 
function getParameterValue(ji) {
    hu = window.location.search.substring(1);
    gy = hu.split("&");
    for (i=0;i<gy.length;i++) {
        ft = gy[i].split("=");
        if (ft[0] == ji) {
            return ft[1];
        }
    }
}

function getParameterValue2(url,ji) {
    hu = url;
    gy = hu.split("&");
    for (i=0;i<gy.length;i++) {
        ft = gy[i].split("=");
        if (ft[0] == ji) {
            return ft[1];
        }
    }
}

// param  
function querySt(ji, value) {
    var query = "";
    var hu = window.location.search.substring(1);
    var gy = hu.split("&");
    for (i=0;i<gy.length;i++) {
        ft = gy[i].split("=");
        if (ft[0] == ji) {
            query += (ft[0] + "=" + value);
        } else {
            if(ft[0]!=null && ft[0]!='') {
                query += (ft[0] + "=" + ft[1]);
            }
        }
        
        if(i < gy.length-1) {
            query += "&";   
        }
    }
    return query;
}

function querySt2(url, ji, value) {
    var query = "";
    var hu = url;
    var gy = hu.split("&");
    for (i=0;i<gy.length;i++) {
        ft = gy[i].split("=");
        if (ft[0] == ji) {
            query += (ft[0] + "=" + value);
        } else {
            if(ft[0]!=null && ft[0]!='') {
                query += (ft[0] + "=" + ft[1]);
            }
        }
        
        if(i < gy.length-1) {
            query += "&";   
        }
    }
    return query;
}

//ִ check
function checkQuery(ji) {
    hu = window.location.search.substring(1);
    gy = hu.split("&");
    for (i=0;i<gy.length;i++) {
        ft = gy[i].split("=");
        if (ft[0] == ji) {
            return true;
        }
    }
    return false;
}

function checkQuery2(url,ji) {
    gy = url.split("&");
    for (i=0;i<gy.length;i++) {
        ft = gy[i].split("=");
        if (ft[0] == ji) {
            return true;
        }
    }
    return false;
}

function changeLocation(paramName, paramVal) {
    if (checkQuery(paramName)) {
        var rUrl = querySt(paramName, paramVal);
        location.href = "?" + rUrl;
    } else {
        var str = window.location.search.substring(1);
        if(str!=null && str!="") str = str+"&";
        location.href = "?" + str + paramName+"=" + paramVal;
    }
}

function trim(str) {
    return str.replace(/(^[ \f\n\r\t]*)|([ \f\n\r\t]*$)/g, "");
}

function trim(str) {
    return rtrim(ltrim(str));
}

function ltrim(para) {
    while (para.substring(0, 1) == ' ' || para.substring(0, 1) == '\t' || para.substring(0, 1) == '\r' || para.substring(0, 1) == '\n') {
        para = para.substring(1, para.length);
    }
    return para;
}

function rtrim(para) {
    while (para.substring(para.length - 1, para.length) == ' ' || para.substring(para.length - 1, para.length) == '\t' || para.substring(para.length - 1, para.length) == '\r' || para.substring(para.length - 1, para.length) == '\n') {
        para = para.substring(0, para.length - 1);
    }
    return para;
}

function strStartsWith(str, prefix) {
    return str.indexOf(prefix) === 0;
}

function strEndsWith(str, suffix) {
    return str.match(suffix+"$")==suffix;
}

/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////

function copyClipBoard(tt){
    var tt = document.getElementById(tt);
    if (window.clipboardData) {
        window.clipboardData.setData("Text", tt.value);
        alert('클립보드에 복사되었습니다.');
        hideLayer('urlCopy');
    } else {
        tt.select();
        alert('선택영역을 복사(Ctrl+c)하신 후, 이용해 주세요.');
    }
} 

function scrolTop(){ 
	if(document.documentElement.scrollTop!=0 || document.body.scrollTop!=0){
		document.documentElement.scrollTop=0;
		document.body.scrollTop=0; 
	}
}

function resizeImg(imgObj, max_width, max_height) {
    var dst_width;
    var dst_height;
    var img_width;
    var img_height;

    img_width = parseInt(imgObj.width);
    img_height = parseInt(imgObj.height);

    if (img_width == 0 || img_height == 0) {
        imgObj.style.display = '';
        return false;
    }
    if (img_width > max_width || img_height > max_height) {
        dst_width = max_width;
        dst_height = Math.ceil((max_width / img_width) * img_height);

        //max_height
        if (dst_height > max_height) {
            dst_height = max_height;
            dst_width = Math.ceil((max_height / img_height) * img_width);
        }

        imgObj.width = dst_width;
        imgObj.height = dst_height;
    }

    imgObj.style.display = '';

    return true;
}

function Paging(page, PageStr) {
    if (!PageStr) PageStr = "Page";
    var quot = '&';
    var targetUrl = document.location.href.toString().replace(/\&Page=(.[^&]*)|\?Page=(.[^&]*)/i, "");
    if (targetUrl.indexOf('?') < 0) {
        quot = '?';
    }
    document.location.href = targetUrl + quot + PageStr + "=" + page;
}

function getDocumentSize() {
    var windowWidth, windowHeight;
    if (self.innerHeight) {	// all except Explorer
        windowWidth = self.innerWidth;
        windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
    }
    arrayPageSize = new Array(windowWidth, windowHeight)
    return arrayPageSize;
}

function onChangeLang(lang) {

    if (checkQuery("lang")) {
        var rUrl = querySt("lang", lang);
        location.href = "?" + rUrl;
    } else {
        var str = window.location.search.substring(1);
        if(str!=null && str!="") str = str+"&"

        location.href = "?" + str + "lang=" + lang;
    }
}

/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////

    function visibleLayer(idName) {
        var Obj = document.getElementById(idName);
        Obj.style.visibility = "visible";
    }

    function hiddenLayer(obj) {
        var Obj = document.getElementById(idName);
        Obj.style.visibility = "hidden";
    }

    function showLayer(idName,display) {
        var Obj = document.getElementById(idName);
        if(display==null) display = "block"
        Obj.style.display = display;
    }

    function hideLayer(idName) {
        var Obj = document.getElementById(idName);
        Obj.style.display = "none";
    }

    function toggleLayer(idName) {
        objLayer = document.getElementById(idName);
        if (objLayer.style.display == "block") {
            hideLayer(idName);
        } else {
            showLayer(idName);
        }
    }

    function delayHideLayer(idName) {
        obj_ID = document.getElementById("" + idName + "");
        setTimeout("obj_ID.style.display='none'", 2000);
    }
    
    
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////


    function popWin(wURL, wName, w, h, resize, scroll, status) {
        var opt = "scrollbars=no,width=" + w + ",height=" + h;
        if (resize!=null && resize == "yes") opt += ",resizable=yes";
        if (scroll!=null && scroll == "yes") opt += ",scrollbars=yes";
        if (status!=null && status == "yes") opt += ",status=yes";

        var winpop = window.open(wURL, wName, opt);
        winpop.focus();
    }

    function popWinRate(wURL, wName, rate, resize, scroll,status) {
        //w = (screen.width * rate) / 100.;
        //h = (screen.height * rate) / 100.;
    
        //var opt = "scrollbars=no,width=" + w + ",height=" + h;
        var opt = "scrollbars=no";
        if (resize!=null && resize == "yes") opt += ",resizable=yes";
        if (scroll!=null && scroll == "yes") opt += ",scrollbars=yes";
        if (status!=null && status == "yes") opt += ",status=yes";

        var winpop = window.open(wURL, wName, opt);
        winpop.focus();
    }    
    
/////////////////////////////////////////////////////////////////////
    //var AKS_CENTER_URL = "http://hq.vacusoft.co.kr:2009";
    //var ANCI_DOC_URL = "http://hq.vacusoft.co.kr:2011";
    var AKS_CENTER_URL = "http://"+document.location.hostname + ((document.location.port == "80" || document.location.port == "")?"":(":"+document.location.port));
    //var AKS_CENTER_URL_OVERSEAS = "http://"+document.location.hostname + ":20092";
    var AKS_CENTER_URL_OVERSEAS = "http://region.kostma.net";
    //var ANCI_DOC_URL = "http://"+document.location.hostname + ":2011";
    var ANCI_DOC_URL = "http://archive.kostma.net";


    //var IMGVIEWER_URL = "http://"+document.location.hostname + "";
    var IMGVIEWER_URL = "http://"+document.location.hostname + ((document.location.port == "80" || document.location.port == "")?"":(":"+document.location.port));
    //var IMGVIEWER_URL_ANCI = "http://"+document.location.hostname + ((document.location.port == "80" || document.location.port == "")?"":(":"+document.location.port));
    //var IMGVIEWER_URL_ANCI = "http://"+document.location.hostname + ":2011";
    var IMGVIEWER_URL_ANCI = "http://archive.kostma.net";
    //var IMGVIEWER_URL_OVERSEAS = "http://"+document.location.hostname + ((document.location.port == "80" || document.location.port == "")?"":(":"+document.location.port));
    //var IMGVIEWER_URL_OVERSEAS = "http://"+document.location.hostname + ":20092";
    var IMGVIEWER_URL_OVERSEAS = "http://region.kostma.net";

/////////////////////////////////////////////////////////////////////
	/*
    function goDataView(uci,target) {

        url = "";
    
        if (strStartsWith(uci,"G002+JSK+ARCHIVE")) { 
           var archUCI = uci.substr(17);
           if(strStartsWith(archUCI,"B"))
           {
                url = "http://yoksa.aks.ac.kr/jsp/bb/BookList.jsp?fcs=f&gb=1&cd=&bb10no=" + archUCI;
           }
           else
           {
                //archUCI = archUCI.toLowerCase();
                if (strEndsWith(archUCI,"000"))
                    url = "http://yoksa.aks.ac.kr/jsp/aa/BookList.jsp?aa10no=" + archUCI;
                else
                    url = "http://yoksa.aks.ac.kr/jsp/aa/VolumeList.jsp?aa10up=" + archUCI.substr(0, archUCI.length - 3) + "000&aa10no=" + archUCI;
           }
           
            var winpop = window.open(url, "_dataView");
            winpop.focus();
           
        } else if (strStartsWith(uci,"RIKS")) { 
            url = AKS_CENTER_URL_OVERSEAS+"/inspection/insDirView.aspx?dataUCI="+encodeURI(uci);
            
            var winpop = window.open(url, "_overSeasView");
            winpop.focus();
            
        } else {
            if(target!=null && target=="_self")
                top.document.location.href = "/inspection/insDirView.aspx?dataUCI=" + uci;
            else
            {
                var winpop = window.open("/inspection/insDirView.aspx?dataUCI=" + uci, "_dataView");
                winpop.focus();
            }
        }
    }
    */

    function goDataView(uci,target) {
    
        var refID = "";
        if (strStartsWith(uci,"KCIS"))  //호남권역
        {
            var winpop = window.open("/inspection/sendToKCIS.aspx?uci="+encodeURI(uci), "_dataView");
            winpop.focus();
            
        }
        else
            goDataViewOrg(uci,refID);
    }

    function goDataViewAnci(uci,target) {

        url = ANCI_DOC_URL+"/inspection/insDirView.aspx?dataUCI=" + uci;
        
        var winpop = window.open(url, "_dataView");
        winpop.focus();
    }
    
    function goDataViewOrg(uci,refID) {

        url = "";
    
        if (strStartsWith(uci,"G002+JSK+ARCHIVE")) {
           var archUCI = uci.substr(17);
           if(strStartsWith(archUCI,"B"))
           {
                url = "http://yoksa.aks.ac.kr/jsp/bb/BookList.jsp?fcs=f&gb=1&cd=&bb10no=" + archUCI;
           }
           else
           {
                //archUCI = archUCI.toLowerCase();
                if (strEndsWith(archUCI,"000"))
                    url = "http://yoksa.aks.ac.kr/jsp/aa/VolumeList.jsp?aa10up=" + archUCI;
                else
                    url = "http://yoksa.aks.ac.kr/jsp/aa/VolumeList.jsp?aa10up=" + archUCI.substr(0, archUCI.length - 3) + "000&aa10no=" + archUCI;
           }
        } else if (strStartsWith(uci,"G002+JSK")) { //G002+JSK+KSM-WA.1706.1111-20090525.K22194 ,  JSK_WA_K22194
            
            var jsk_type = uci.substr(13,2);
            
            var idx = uci.lastIndexOf(".")+1;
            var jsk_id = "JSK_" + jsk_type + "_" + uci.substr(idx,uci.length-idx);
            
            if(jsk_type == "WJ") //왕실족보
                url = "http://royal.kostma.net/Ge/DescriptionList?bookId="+jsk_id;
            else if(jsk_type == "WA") //의궤
                url = "http://royal.kostma.net/WA/DescMainDir?idx="+jsk_id;
            else if(jsk_type == "WM") //일기
                url = "http://royal.kostma.net/WM/DescMainDir?idx="+jsk_id;
            else //고문서 XA,XB~XI
                url = "http://royal.kostma.net/Ad/Description?item=owner&idx="+jsk_id;
                
        } else if (strStartsWith(uci,"G001+KYUC"))  { 
            url = "http://kyu.snu.ac.kr/center/hub_call.jsp?uci=" + uci;
        } else if (strStartsWith(uci,"G002+KSMC") || strStartsWith(uci,"G002+AKS")) { 
            url = ANCI_DOC_URL+"/inspection/insDirView.aspx?dataUCI=" + uci;
        } else if (strStartsWith(uci,"KCIS")) {  //호남권역
            //url = "http://115.93.245.51:8081/emuseum/service/data/dataDetail.jsp?data_group="+refID;
            url = "http://203.254.129.108/service/data/dataDetail.jsp?data_group="+refID;
            
        } else if (strStartsWith(uci,"KSAC")) { //영남권역
            //alert('영남권역 서비스 준비중입니다.');
            //return;
            var uci2 = encodeURI(uci);
            //uci2 = uci2.replace('+', '%2B');
            uci2 = uci2.split('+').join('%2B');
            url = "http://yn.ugyo.net/resolver.do?uci="+uci2; 
        } else if (strStartsWith(uci,"RIKS")) { 
            url = AKS_CENTER_URL_OVERSEAS+"/inspection/insDirView.aspx?dataUCI="+encodeURI(uci);
        } else {
            url = ANCI_DOC_URL+"/inspection/insDirView.aspx?dataUCI="+encodeURI(uci);
        }
        
        var winpop = window.open(url, "_dataView");
        winpop.focus();
    }
    
    function openAnciHeje(clsID)
    {
        popWinRate(ANCI_DOC_URL+'/heje/heje.aspx?booknum='+clsID, 'heje',80,'yes','yes','yes');
    }
    
    function goNLKView(uci) {
    
        //url = "http://nl.go.kr/korcis/search/detail.php?rec_key="+uci;
        //var winpop = window.open(url, "_nlkView");
        //winpop.focus();
        
        url = "/dataSearch/popNLKView.aspx?rec_key="+uci;
        popWin(url,'_nlkView',700,600, 'yes', 'yes', 'yes');
    }
    
    function goPersonView(uci) {
        var winpop = window.open("http://uci.or.kr/" + uci, "_personLink"); //, "scrollbars=no,width=750,height=420"
        winpop.focus();
    }

    function goImageView(dataUCI,linkUCI,thumb,type,page, mode) {

        if(thumb==null) thumb = "";
    
        url = "";
    
        if (strStartsWith(dataUCI,"G001+KYUC"))  { 
            url = "http://kyu.snu.ac.kr/center/hub_call.jsp?uci=" + dataUCI+"-IMG";
        } else if (strStartsWith(dataUCI,"KSAC")) {  //고문헌,영남권
            //alert('영남권역 서비스 준비중입니다.');
            //return;
            var uci2 = encodeURI(dataUCI);
            //uci2 = uci2.replace('+', '%2B');
            uci2 = uci2.split('+').join('%2B');
            url = "http://yn.ugyo.net/imgViewer.do?uci="+uci2; 
        } else if (strStartsWith(dataUCI,"G002+JSK")) { 
            alert("장서각 연계준비중입니다."); 
            return;
        } else if (strStartsWith(dataUCI,"KCIS")) { //호남권역
            //url = "http://115.93.245.51:8081/emuseum/structure/save_img/" + dataUCI+"-IMG.JPG";
            url = "http://203.254.129.108/structure/save_img/" + dataUCI+"-IMG.JPG";
        } else if (strStartsWith(dataUCI,"RIKS")) { 
            url = IMGVIEWER_URL_OVERSEAS+"/imageViewer/ImageViewer.aspx?datauci="+dataUCI + "&refuci="+dataUCI + "&fname="+thumb;
            
            if(type==null) type = "true";
            else if(type=="close") type = "true";
            else if(type=="open")   type = "false";
            
            url+="&closed="+type;
        }
        else//strStartsWith(dataUCI,"G002+KSMC")
        {
        	var _p = (page != undefined)?"&defaultpage="+page:"";
        	var _v = (mode != undefined)?"&viewmode="+mode:"";

            url = IMGVIEWER_URL_ANCI+"/imageViewer/ImageViewer.aspx?datauci="+linkUCI  + "&refuci=" + dataUCI + "&fname="+thumb + _p + _v;
            
            if(type==null) type = "true";
            else if(type=="close") type = "true";
            else if(type=="open")   type = "false";
            
            url+="&closed="+type;
        }
        
        var w = (screen.width * 80) / 100;
        var h = (screen.height * 80) / 100;

        var opt = "scrollbars=no,width=" + w + ",height=" + h;
        opt += ",resizable=yes";
        opt += ",status=yes";

        var winpop = window.open(url, "_imageView",opt);
        winpop.focus();
    }
    
    function goImageTextView(uci) {
    
        url = "";
    
        if (strStartsWith(uci,"G001+KYUC"))  { 
            alert("규장각 연계준비중입니다."); 
//        } else if (strStartsWith(uci,"G002+KSMC") || strStartsWith(uci,"KSAC")) { 
        } else if (strStartsWith(uci,"G002+KSMC") || strStartsWith(uci,"G002+AKS")) { //고문헌
            url = ANCI_DOC_URL+"/imageViewer/PopupText.aspx?datauci="+uci;
        } else if (strStartsWith(uci,"G002+JSK")) { 
            alert("장서각 연계준비중입니다."); 
            return;
        } else if (strStartsWith(uci,"KCIS")) { 
            alert("호남권역 연계준비중입니다."); 
            return;
        } else if (strStartsWith(uci,"KSAC")) { 
            alert("영남권역 연계준비중입니다.");
            return;
        } else if (strStartsWith(uci,"RIKS")) { 
            alert("해외권역 연계준비중입니다.");
            return;
        }
        
        var w = (screen.width * 80) / 100;
        var h = (screen.height * 80) / 100;

        var opt = "width=300,height=500";
        opt += ",resizable=yes";
        opt += ",scrollbars=yes";
        opt += ",status=yes";

        var winpop = window.open(url, "_ImageView",opt);
        winpop.focus();
    }

	function goMangaboImageView( book, page, bookmode )
	{
        url = IMGVIEWER_URL+"/imageViewer/ImageViewer.aspx?datauci=" + book + "&imagetype=mangabo&defaultpage=" + page + "&viewmode=" + bookmode ;
        
        var w = (screen.width * 80) / 100;
        var h = (screen.height * 80) / 100;

		var opt = "scrollbars=no,width=" + w + ",height=" + h;
        opt += ",resizable=yes";
        opt += ",scrollbars=yes";
        opt += ",status=yes";

        var winpop = window.open(url, "_ImageMangaboView",opt);
        winpop.focus();
    }

	function goSagaJokboImageView( book, page, bookmode , pinX, pinY)
	{
	    if(pinX == null) pinX = '';
	    if(pinY == null) pinY = '';
	    
        url = IMGVIEWER_URL+"/imageViewer/ImageViewer.aspx?datauci=" + book + "&imagetype=saga&defaultpage=" + page + "&viewmode=" + bookmode+ "&pinX=" + pinX+ "&pinY=" + pinY ;
        
        var w = (screen.width * 80) / 100;
        var h = (screen.height * 80) / 100;

		var opt = "scrollbars=no,width=" + w + ",height=" + h;
        opt += ",resizable=yes";
        opt += ",scrollbars=yes";
        opt += ",status=yes";

        var winpop = window.open(url, "_ImageSagaView",opt);
        winpop.focus();
    }
    
	function goMangaboImageView2( bonID, book, page, bookmode )
	{
	    var target = "_ImageMangaboView";
	    var imagetype="mangabo";
		var bookid = "";
		switch(book)
		{
			case "1":
				bookid = "JOKBO_B001_001";
				break;
			case "2":
				bookid = "JOKBO_B001_002";
				break;
			case "3":
				bookid = "JOKBO_B001_003";
				break;
			case "4":
				bookid = "JOKBO_B001_004";
				break;
			case "5":
				bookid = "JOKBO_B001_005";
				break;
			case "6":
				bookid = "JOKBO_B001_006";
				break;
			case "7":
				bookid = "JOKBO_B001_007";
				break;
			case "8":
				bookid = "JOKBO_B001_008";
				break;
			case "9":
				bookid = "JOKBO_B001_009";
				break;
			case "10":
				bookid = "JOKBO_B001_010";
				break;
			case "11":
				bookid = "JOKBO_B001_011";
				break;
			case "12":
				bookid = "JOKBO_B001_012";
				break;
			case "13":
				bookid = "JOKBO_B001_013";
				break;
			case "14":
				bookid = "JOKBO_B001_014";
				break;
			default:
				bookid = book; //사가족보
				imagetype = "saga";
				
				target = "_ImageSagaView";
				break;
		}
        url = IMGVIEWER_URL+"/imageViewer/ImageViewer.aspx?datauci=" + bookid + "&imagetype="+imagetype+"&bonID=" + bonID+"&defaultpage=" + page + "&viewmode=" + bookmode ;
        
        var w = (screen.width * 80) / 100;
        var h = (screen.height * 80) / 100;

		var opt = "scrollbars=no,width=" + w + ",height=" + h;
        opt += ",resizable=yes";
        opt += ",scrollbars=yes";
        opt += ",status=yes";

        var winpop = window.open(url, target, opt);
        winpop.focus();
    }
    
    function goEventView(uci) {
    }
    
    function goFamilyPerson(personID,personUCI) {
    
        if (personID==null) personID="";
        if (personUCI==null) personUCI="";

        //if (strStartsWith(personID,"pm")) personID = personID.substr(2);
        //if (strStartsWith(personID,"pd")) personID = personID.substr(2);
        //if (strStartsWith(personID,"pb")) personID = personID.substr(2);
        //if (strEndsWith(personID,"w")) personID = personID.substr(0,personID.length-1);

        //var w = (screen.width * 80) / 100;
        //var h = (screen.height * 80) / 100;

        var opt = "scrollbars=yes";
        opt += ",resizable=yes";
        opt += ",status=yes";

        //var winpop = window.open(AKS_CENTER_URL+"/FamilyTree/PersonPopup.aspx?personid="+personID+"&person_uci="+personUCI, "_familyView",opt);
        var winpop = window.open(AKS_CENTER_URL+"/FamilyTree/PersonIndex.aspx?personid="+personID+"&person_uci="+personUCI, "_familyView");
        winpop.focus();
    }

    function goFamilyTree(personID,personUCI) {
    
        if (personID==null) personID="";
        if (personUCI==null) personUCI="";

        //if (strStartsWith(personID,"pm")) personID = personID.substr(2);
        //if (strEndsWith(personID,"w")) personID = personID.substr(0,personID.length-1);

        //var w = (screen.width * 80) / 100;
        //var h = (screen.height * 80) / 100;

        var opt = "scrollbars=yes";
        opt += ",resizable=yes";
        opt += ",status=yes";

        var winpop = window.open(AKS_CENTER_URL+"/FamilyTree/PersonPopup.aspx?personid="+personID+"&person_uci="+personUCI, "_familyTree",opt);
        winpop.focus();
    }

    function goFamilyTreeIndex(personID,personUCI) {
    
        if (personID==null) personID="";
        if (personUCI==null) personUCI="";

        //if (strStartsWith(personID,"pm")) personID = personID.substr(2);
        //if (strEndsWith(personID,"w")) personID = personID.substr(0,personID.length-1);

        //var w = (screen.width * 80) / 100;
        //var h = (screen.height * 80) / 100;

        var opt = "scrollbars=yes";
        opt += ",resizable=yes";
        opt += ",status=yes";

        var winpop = window.open(AKS_CENTER_URL+"/FamilyTree/PersonIndex.aspx?personid="+personID+"&person_uci="+personUCI, "_familyTree",opt);
        winpop.focus();
    }
    
    function popEmapWin2(mapT,mType,sType,sWord,lng,lat) {

        var wURL = '';
        if(mapT=='AN')
            wURL = AKS_CENTER_URL+"/e-map/mapSearch_AN.aspx?mType="+mType+"&sType="+sType+"&sWord="+encodeURI(sWord);
        else
            wURL = AKS_CENTER_URL+"/e-map/mapSearch.aspx?mType="+mType+"&sType="+sType+"&sWord="+encodeURI(sWord)+"&lng="+lng+"&lat="+lat;
            
        var opt = "scrollbars=no";
        opt += ",resizable=yes";
        opt += ",status=yes";

        var winpop = window.open(wURL, "_eMap", opt);
        
        winpop.focus();
    }    

    function popEmapWin(mapT, uci, addr) {

        var wURL = '';
        if(mapT=='AN')
            wURL = AKS_CENTER_URL+"/e-map/mapSearch_AN.aspx?mType=anciNm&sType=anUCI&sWord="+encodeURI(uci);
        else
        var wURL = AKS_CENTER_URL+"/e-map/mapSearch.aspx?mType=search&sType=uci&sWord="+encodeURI(uci)+"&addr="+encodeURI(addr);
            
        var opt = "scrollbars=no";
        opt += ",resizable=yes";
        opt += ",status=yes";

        var winpop = window.open(wURL, "_eMap", opt);
        winpop.focus();
    }    

    function popHistoryWin(type, startdate, enddate, uci, baseYear) {
        var name = "/history_table/history_aks2.aspx";
        if(type=='data')
            name = "/history_table/history_aks.aspx";

        var wURL = AKS_CENTER_URL+name+"?startdate="+startdate+"&enddate="+enddate+"&uci="+uci+"&baseYear="+baseYear;
        
        var opt = "scrollbars=yes";
        opt += ",resizable=yes";
        opt += ",status=yes";

        var winpop = window.open(wURL, "_eMap", opt);
        winpop.focus();
    } 


function getClientHeight()
{
    var myHeight = 0;
    if( typeof( window.innerWidth ) == 'number' )
    {   //Non-IE
        myHeight = window.innerHeight;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
    {   //IE 6+ in 'standards compliant mode'
        myHeight = document.documentElement.clientHeight;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
    {   //IE 4 compatible
        myHeight = document.body.clientHeight;
    }

    return myHeight;
}

function menu_toggle( side )
{
	parent.myLayout.toggle(side);
}

function person_frame_menu_toggle()
{
	var imgopen = "/images/FamilyTree/btn1_open.gif";
	var imgclose = "/images/FamilyTree/btn1_close.gif";

	if ( parent.bopened )
	{
		parent.hidetoc();
		document.images["fold_handle1"].src = imgopen;
	}
	else
	{
		parent.showtoc();
		document.images["fold_handle1"].src = imgclose;
	}
}

function popImageView(path) {
    newWin = window.open("/include/pop_image.aspx?path=" + path, "_popImageView", "width=600, height=500, location=0, directories=0, status=0, menubar=0, scrollbars=yes, resizable=yes");
    newWin.focus();
}

function log( msg ) {
    //$("<div>msg=" + msg +"</div>").appendTo(document.body);
}

