﻿/*-------------------------------
 * 사이트메뉴이동호출함수
 *------------------------------*/

var menu = new Array;

// 불교전서
menu['t1'] = "bj.aspx";
menu['t1m1'] = "sub.htm"; 
menu['t1m2'] = "01sub.htm"; 
menu['t1m3'] = "01sub.htm";
menu['t1m4'] = "01sub.htm"; 
menu['t1m5'] = "01sub.htm";


// 한글대장경
menu['t2'] = "hd.aspx";
menu['t2m1'] = "02sub.htm";
menu['t2m2'] = "02sub.htm";
menu['t2m3'] = "02sub.htm";
menu['t2m4'] = "02sub.htm";
menu['t2m5'] = "02sub.htm";
menu['t2m6'] = "02sub.htm";


//  불교사전
menu['t3'] = "bs.aspx";
menu['t3m1'] = "03sub.htm"; 
menu['t3m2'] = "03sub.htm"; 
menu['t3m3'] = "03sub.htm";
menu['t3m4'] = "03sub.htm";
menu['t3m5'] = "03sub.htm";




// search
menu['t6'] = "search_result.htm";
menu['result'] = "search_result.htm";
menu['potal_result'] = "portal_search_result.htm";
menu['potal_view'] = "portal_search_view.htm";
menu['ad_search1'] = "detail_search.aspx";
menu['ad_search2'] = "advanced_search_2.htm";





// admin
menu['admin'] = "admin_userlog.aspx";
menu['userlog'] = "admin_userlog.aspx"; 
menu['dblog']="admin_dblog.aspx";
menu['searchlog']="admin_searchlog.aspx";


//member
menu['login'] = "member_login.aspx"; 
menu['bookmark'] = "bookmark_list.aspx"; 
menu['join'] = "member_join.aspx"; 
menu['idpw'] = "member_idpw.aspx"; 
menu['member_modify'] = "member_modify.aspx"; 
menu['member_out'] = "member_out.aspx"; 


// plaza
//menu['about'] = "bbs_list.aspx?boardType=4";
menu['about'] = "javascript:MM_openBrWindow('help_intro/intro.htm', 'dgul_help', 'width=760, height=600, resizable=1, scrollbars=1')";
menu['notice'] = "bbs_list.aspx?boardType=1";
menu['freeboard'] = "bbs_list.aspx?boardType=2";
menu['err'] = "bbs_list.aspx?boardType=3"; 
menu['service_help'] = "bbs_list.aspx?boardType=5";




// notice
//menu['notice_list'] = "notice_list.htm";
//menu['notice_view'] = "notice_view.htm";
//menu['notice_write'] = "notice_write.htm";
//menu['notice_modify'] = "notice_modify.htm";

//// freeboard
//menu['freeboard_list'] = "freeboard_list.htm";
//menu['freeboard_view'] = "freeboard_view.htm";
//menu['freeboard_write'] = "freeboard_write.htm";
//menu['freeboard_modify'] = "freeboard_modify.htm";

//// err
//menu['err_list'] = "err_list.htm";
//menu['err_view'] = "err_view.htm";
//menu['err_report'] = "err_report.htm";
//menu['err_modify'] = "err_modify.htm";






// 부가메뉴
menu['home'] = "default.aspx"; // 홈
menu['sitemap'] = "sitemap.htm"; // 이메일
menu['email'] = "mailto:a@a.co.kr"; // 이메일
menu['help'] = "10_help_about.htm"; // 이메일


function siteLogonGo(t,m,s){
    if(myProp.UserId==''){
        alert('로그온을 하셔야 사용하실 수 있는 메뉴입니다.');
        return;
     }
     siteGo(t,m,s);
}

// 사이트이동
function siteGo( t, m, s)
{
	//alert( t);
	if( ! m && ! s && menu[t])
	{
		document.location.href = menu[t];
		return;
	}
	var mn = "";
	if( t > 0) mn = "t" + t;
	if( t > 0 && m > 0) mn += "m" + m;
	if( t > 0 && m > 0 && s > 0) mn += "s" + s;
	//alert( mn);

	if( mn == 't4m4')
	{
		window.open( menu[mn]);
		return;
	}

	if( ! menu[mn])
	{
		// 준비중으로연결
		alert( "준비중입니다");
		//document.location.href = "/htm/notfound.htm";
	}
	else
	{
		document.location.href = menu[mn];
	}
}

function siteGo_pdf()
{
	frames["__download__"].location = menu['pdf'];
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// data access and page move
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////

//var g_strDataType;
//var g_strTitle;
//var g_strGisaID;
//var g_strLevel;

//var g_strStartPageID;
//var g_strEndPageID;
//var g_strMinPageID;
//var g_strMaxPageID;
//var g_strCurrentPageID;

//var g_strPageMode = 'comp';

//var g_strWritingMode = 'horz';
//var g_nZoomFontSize = 0;

//var g_strXmlData = "";

function cntChange(strConfig)
{
    deeptree.innerHTML = "";
	
	var objP = deeptree.parentNode;
	var newtree = document.createElement('div');

	deeptree.removeNode(true);
	newtree.setAttribute('id', 'deeptree');
	newtree.setAttribute('className', 'deeptree');
	newtree.setAttribute('CfgXMLSrc', 'deeptree/' + strConfig);
	objP.insertBefore( newtree );
	
	if(strConfig=='sd_config.xml'){
	    $('tdLinker').innerHTML='HOME > 불교전서 > 시대별';
	}else if(strConfig=='sm_config.xml'){
	    $('tdLinker').innerHTML='HOME > 불교전서 > 서명별';
	}else if(strConfig=='au_config.xml'){
	    $('tdLinker').innerHTML='HOME > 불교전서 > 저자별 ';
	}
}

function hrefTest(strDataType, strTitle, strLevel, strSeojiID, strGisaID)
{
    myProp.DataType = strDataType;
	myProp.Title = strTitle;
	myProp.GisaId = strGisaID;
	myProp.Level = strLevel;
	myProp.SeojiId = strSeojiID;

	g_bActionStart = true;

    setTimeout('getFirstPageXmlData("' + strDataType + '", "' + strTitle + '", "' + strLevel + '", "' + strSeojiID + '", "' + strGisaID + '")', 250); 
}

function getFirstPageXmlData(strDataType, strTitle, strLevel, strSeojiID, strGisaID)
{
//    strPage = strDataType + decodeURI(strTitle) + strSeojiID;
//    note1.innerHTML = strPage;
    setHeje( strDataType, strSeojiID);
    
    var url = 'pageView.aspx';
    var queryString = 'd_type=' + strDataType + '&';//formData2QueryString(document.MAIN_FORM);
    queryString += 'title=' + strTitle + '&';//formData2QueryString(document.MAIN_FORM);
    queryString += 'level=' + strLevel + '&';
    queryString += 'seoji_id=' + strSeojiID + '&';//formData2QueryString(document.MAIN_FORM);
    queryString += 'gisa_id=' + strGisaID + '&';
    queryString += 'page_mode=' + myProp.PageMode;
//    alert( queryString );
    var resultProcessMethod = 'pageResult';
    
    xmlHttpPost(url, queryString, resultProcessMethod, strLevel, '');
}

function setHeje(strDataType, strSeojiID)
{
    var objHeje = document.getElementById("heje");
    if( strSeojiID != "" )
    {
        myProp.SeojiId=strSeojiID;
        objHeje.setAttribute('href', 'javascript:MM_openBrWindow("heje.aspx?d_type=' + strDataType + '&seoji_id=' + strSeojiID + '","","status=yes,width=500,height=504")');
//        objHeje.setAttribute("href", "javascript:alert('xx');");
    }
    if(strDataType=='hd'){
        $('e_book').href="javascript:showEbook('" + myProp.SeojiId + "')";;
    }
}

function getPageXmlData(strDataType, strPageID)
{
    var url = 'pageView.aspx';
    var queryString = 'd_type=' + strDataType + '&';//formData2QueryString(document.MAIN_FORM);
    queryString += 'page_id=' + strPageID + '&';
    queryString += 'page_mode=' + myProp.PageMode;
//    alert( queryString );
    var resultProcessMethod = 'pageResult'; 

    xmlHttpPost(url, queryString, resultProcessMethod, myProp.Level, strPageID);
}

function xmlHttpPost(actionUrl, submitParameter, resultFunction, strLevel, strPageID)
{
	loading.style.visibility = "visible";

    var xmlHttpRequest = false;
    
    if(window.ActiveXObject)
    {
        xmlHttpRequest = new ActiveXObject('Microsoft.XMLHTTP');
    }
    else
    {
        xmlHttpRequest = new XMLHttpRequest();
        xmlHttpRequest.overrideMimeType('text/xml');
    }    

//    strQuery = actionUrl + "?" + submitParameter;
//    alert(strQuery);
    xmlHttpRequest.open('POST', actionUrl, true);
//    xmlHttpRequest.open('GET', strQuery, true);
    xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlHttpRequest.onreadystatechange = function() {
        if(xmlHttpRequest.readyState == 4)
        {
            switch (xmlHttpRequest.status) 
            {
                case 404:
                alert(actionUrl);
//                    alert('오류: ' + actionUrl + '존재하지 않음');
                    break;
                case 500:
                alert(xmlHttpRequest.responseText);
//                   alert('오류: ' + xmlHttpRequest.responseText);
                   break;
                default:
//                alert(xmlHttpRequest.responseText);
                   eval(resultFunction + '(xmlHttpRequest.responseText,   strLevel ,  strPageID  );');
//                   alert(resultFunction + '('+xmlHttpRequest.responseText+');');
                   break;        
            }            
        }
    }
//    alert(actionUrl);
//    alert(submitParameter);
    xmlHttpRequest.send(submitParameter);                
//    xmlHttpRequest.send();                
}                                    

function pageResult(result, strLevel, strPageID)
{
//alert(strLevel);
//alert(strPageID);
//return;
   // myProp.PageId=strPageID;
   
    ResetByLevel(strLevel);

           
    if(result == "")
    {
	    note1.innerHTML = "error";
    }
    else
    {
//	    xmlData.innerTEXT = '<?xml version="1.0" encoding="utf-8"?>' + result;
//	    xmlData.innerTEXT = result;
		myProp.XmlData = '<?xml version="1.0" encoding="utf-8"?>' + result;
	    pageTransform(strLevel, strPageID, false);
    }
}

function pageTransform(strLevel, strPageID, bSearchResult)
{
    var strXSLSrc;

	if( myProp.DataType == "bj" )
	{
		if( parseInt(strLevel, 10) == 2 )
			strXSLSrc = "xsl/seoji.xsl";
		else if( myProp.PageMode == "two" )
			strXSLSrc = "xsl/page_2.xsl";
		else if( myProp.PageMode == "one" )
			strXSLSrc = "xsl/page_1.xsl";
		else
			strXSLSrc = "xsl/page_comp.xsl";
	}
	else
	{
		if( parseInt(strLevel, 10) == 2 )
			strXSLSrc = "xsl/seoji_hd.xsl";
		else if( myProp.PageMode == "two" )
			strXSLSrc = "xsl/page_2_hd.xsl";
		else if( myProp.PageMode == "one" )
			strXSLSrc = "xsl/page_1_hd.xsl";
		else
			strXSLSrc = "xsl/page_comp_hd.xsl";
	}
	myProp.Level=strLevel;
	
//    else
//        alert(xmlData.innerTEXT);
//  alert(      "strXSLSrc : " + strXSLSrc);
    var objXSLDoc = new ActiveXObject("Microsoft.XMLDOM");
    objXSLDoc.async = false;
    var bXsl = objXSLDoc.load( strXSLSrc );
//	alert( "bXsl : " + bXsl );
    
	var xDoc = new ActiveXObject("Microsoft.XMLDOM");
	xDoc.async = true;
	xDoc.preserveWhiteSpace = true;

    xDoc.onreadystatechange = function() {
        if(xDoc.readyState == 4)
        {
            switch (xDoc.status) 
            {
                case 404:
//                    alert('오류: ' + actionUrl + '존재하지 않음');
                    break;
                case 500:
              //  alert(xDoc.responseText);
                   break;
                default:
                    var imgSubLogo = document.getElementById("sub_logo");
                    if( imgSubLogo != null )
                        imgSubLogo.style.visibility = "hidden";
                        
					var node = xDoc.documentElement.selectSingleNode("/GISA_PAGE");
					if( node != null )
					{   
					    
					    myProp.SeojiId=node.getAttribute("서지ID");
					    myProp.PageId=node.childNodes(0).getAttribute("페이지ID");
					    if(myProp.PageId==null){
					        myProp.PageId=node.childNodes(0).getAttribute("번호");
					    }
					    
					    if(myProp.DataType=='hd'){
					        if($('e_book')!=null){
					            $('e_book').href="javascript:showEbook('" + myProp.SeojiId + "')";
					        }
					        if($('imageViewer')!=null){
					            $('imageViewer').href="#";
					        }
					        $('page_comp').style.backgroundImage="url(image/article/note4_bg.gif)";
					    }else{
					        if($('imageViewer')!=null){
                                $('ImageViewer').href="javascript:showImageViewer('" + myProp.CurrentPageId + "','" + myProp.MaxPageId + "')"; 
                            }
					        if($('e_book')!=null){
					            $('e_book').href="#";
					        }
					        $('page_comp').style.backgroundImage="url(image/article/note3_bg.gif)";
					    }
					    setHeje(myProp.DataType,myProp.SeojiId)
						if( strPageID == '' ) //첫 페이지를 읽는 경우면...
						{
							//setPageInfo(node.getAttribute("StartPage"), node.getAttribute("EndPage"), node.getAttribute("MinPage"), node.getAttribute("MaxPage") );
							setPageInfo(node.getAttribute("MinPage"), node.getAttribute("EndPage"), node.getAttribute("MinPage"), node.getAttribute("MaxPage") );
							showPageInfo( node.getAttribute("StartPage") );

							if( myProp.PageMode == "two" )
								setPageMoveBtn(node.getAttribute("StartPage"))
							else
								setPageMoveBtn(node.getAttribute("StartPage"))
	//                        alert( node.getAttribute("StartPage") + ", " + node.getAttribute("EndPage") );
						}
						else if( bSearchResult == true )
						{
							setPageInfo( node.getAttribute("MinPage"), node.getAttribute("EndPage"), node.getAttribute("MinPage"), node.getAttribute("MaxPage") );
							//setPageInfo( node.getAttribute("StartPage"), node.getAttribute("EndPage"), node.getAttribute("MinPage"), node.getAttribute("MaxPage") );
							showPageInfo( myProp.CurrentPageId );

							setPageMoveBtn(myProp.CurrentPageId)
						}
						else
						{
							showPageInfo( strPageID );
							setPageMoveBtn( strPageID )
						}
					}
					else
					{					    
						showPageInfo( "" );
						setPageInfo( "", "", "", "" );
						setPageMoveBtn("");
					    setHeje(myProp.DataType,myProp.SeojiId)
				        if($('imageViewer')!=null){
        					var min_node = xDoc.documentElement.selectSingleNode("/LIST/MIN_ID");
        					var max_node = xDoc.documentElement.selectSingleNode("/LIST/MAX_ID");
        					if( min_node != null && max_node != null && min_node.text != null && min_node.text.length > 0 && max_node.text != null && max_node.text.length > 0 )
                                $('ImageViewer').href="javascript:showImageViewer('" + min_node.text + "','" + max_node.text + "')"; 
                        }
					}
					if (objXSLDoc.xml != "")
                    {
//						alert( myProp.XmlData );
						var sHtml = xDoc.transformNode( objXSLDoc );
						var objPage1 = document.getElementById("page_1");
						var objPage2 = document.getElementById("page_2");
						var objPageComp = document.getElementById("page_comp");

						if(  strXSLSrc.indexOf("page_2") >= 0 )
						{
							objPage1.style.visibility = "hidden";
							objPageComp.style.visibility = "hidden";
							objPage2.style.visibility = "visible";
	                        objPage2.innerHTML = sHtml;
						}
						else if(  strXSLSrc.indexOf("page_1") >= 0 )
						{
							objPage1.style.visibility = "visible";
							objPage2.style.visibility = "hidden";
							objPageComp.style.visibility = "hidden";
	                        objPage1.innerHTML = sHtml;
						}
						else if(  strXSLSrc.indexOf("page_comp") >= 0 )
						{
							objPage1.style.visibility = "hidden";
							objPage2.style.visibility = "hidden";
							objPageComp.style.visibility = "visible";
	                        objPageComp.innerHTML = sHtml;
						}
						else
						{
							objPage1.style.visibility = "visible";
							objPage2.style.visibility = "hidden";
							objPageComp.style.visibility = "hidden";
	                        objPage1.innerHTML = sHtml;
						}
						changeXsl();
//					alert( "aaa  ===> " + sHtml );
                    }
                    else
                    {
                        var strRep = xDoc.xml;
                        strRep = strRep.replace(/</g, '&lt;');
                        strRep = strRep.replace(/>/g, '&gt;');
                        document.getElementById("page_1").innerHTML = strRep;
//						alert( "bbb  ===> " + strRep );
                    }
					loading.style.visibility = "hidden";
                   break;        
            }            
        }
    }
//	xDoc.loadXML(xmlData.innerTEXT);
xDoc.loadXML(myProp.XmlData);
}

function setPageInfo(strStartID, strEndID, strMinID, strMaxID)
{
    myProp.StartPageId = strStartID;
    myProp.EndPageId = strEndID;
    myProp.MinPageId = strMinID;
    myProp.MaxPageId = strMaxID;

	if( strStartID == "" && strEndID == "" && strMinID == "" && strMaxID == "" )
		return;
//    move_first.href = "javascript:goPage('" + strMinID + "')";
    move_first.href = "javascript:alert('처음 페이지 입니다.')";
	if( myProp.PageMode == "two" )
		nMorePage = 2;
	else
	{
		nMorePage = 1;
		strMinID = strStartID;
		strMaxID = strEndID;
	}

    if( extractPageNum(strMinID) + nMorePage > extractPageNum(strMaxID) )
        move_last.href = "javascript:alert('마지막 페이지 입니다.')";
    else
        move_last.href = "javascript:goPage('" + strMaxID + "')";
}

function showPageInfo(strCurrentPageID)
{
//    nPos = strCurrentPageID.lastIndexOf("_");
//    strPageInfo = parseInt(strCurrentPageID.substring(nPos+1, strCurrentPageID.length), 10) + ' / ';
//    nPos = myProp.EndPageId.lastIndexOf("_");
//    strPageInfo += parseInt(myProp.EndPageId.substring(nPos+1, myProp.EndPageId.length), 10);
    
    myProp.CurrentPageId=strCurrentPageID;
    
	if( strCurrentPageID == "" )
	{
	    page_info.innerHTML = strCurrentPageID;
	    $(gopage).value = "";
	    $(gopage).style.visibility = "hidden";
	    $(gobtn).style.visibility = "hidden";
		return;
	}

    var nCurrentPageNum = extractPageNum(strCurrentPageID);
	var nStartPageNum = extractPageNum(myProp.StartPageId);
    if( nCurrentPageNum < nStartPageNum )
        nCurrentPageNum = nStartPageNum;
        
    $(gopage).value = nCurrentPageNum;
    $(gopage).style.visibility = "visible";
    var strPageInfo = '/ ' + extractPageNum(myProp.EndPageId);
    $(gobtn).style.visibility = "visible";
    
    page_info.innerHTML = strPageInfo;
    if(myProp.DataType=='bj'){
         $('ImageViewer').href="javascript:showImageViewer('" + myProp.CurrentPageId + "','" + myProp.MaxPageId + "')";
    }
}

function setPageMoveBtn(strCurrentPageID)
{
	myProp.CurrentPageId = strCurrentPageID;
	if( strCurrentPageID == "" )
	{
		move_next.href = "#";
		move_last.href = "#";
		move_prev.href = "#";
		move_first.href = "#";
		return;
	}

	var nMorePage;
	var nMinPage;
	var nMaxPage;
	var strStartID;
	var strEndID;
	var nNextPage;
	var nPrevPage;

	if( myProp.PageMode == "two" )
	{
		nMorePage = 2;
		nMinPage = extractPageNum( myProp.MinPageId );
		nMaxPage = extractPageNum( myProp.MaxPageId );

		strStartID = myProp.MinPageId;
		strEndID = myProp.MaxPageId;
	}
	else
	{
		nMorePage = 1;
		nMinPage = extractPageNum( myProp.StartPageId );
		nMaxPage = extractPageNum( myProp.EndPageId );

		strStartID = myProp.StartPageId;
		strEndID = myProp.EndPageId;
	}

    nNextPage = extractPageNum( strCurrentPageID ) + nMorePage;
    nPrevPage = extractPageNum( strCurrentPageID ) - nMorePage;
    
    if( nNextPage > nMaxPage )
    {
        move_next.href = "javascript:alert('마지막 페이지 입니다.')";
        move_last.href = "javascript:alert('마지막 페이지 입니다.')";
    }
    else
    {
        strPage = cvtPageID( strCurrentPageID, nNextPage );
        move_next.href = "javascript:goPage('" + strPage + "')";
        move_last.href = "javascript:goPage('" + strEndID + "')";
    }
    
    if( nPrevPage < nMinPage )
    {
        move_prev.href = "javascript:alert('처음 페이지 입니다.')";
        move_first.href = "javascript:alert('처음 페이지 입니다.')";
    }
    else
    {
        strPage = cvtPageID( strCurrentPageID, nPrevPage );
        move_prev.href = "javascript:goPage('" + strPage + "')";
        move_first.href = "javascript:goPage('" + strStartID + "')";
    }
}

function IsValidPageNum(strPageNum)
{
    var nPageNum = parseInt(strPageNum, 10);

    if( nPageNum >= extractPageNum(myProp.StartPageId) && nPageNum <= extractPageNum(myProp.EndPageId) )
        return true;
    else
        return false;
}

function goDirectPageCheck()
{
	if( event.keyCode == 13 )
	{
		event.returnValue = false;
		goDirectPage();
		return;
	}
}

function goDirectPage()
{
    if( IsValidPageNum($(gopage).value) == false )
    {
        alert( "입력하신 페이지 번호를 다시 확인하세요." );
        return;
    }
    
    var nPage = parseInt($(gopage).value, 10);
    if( myProp.PageMode == "two" )
    {
		if( (nPage % 2) == 1 ) //현재 홀수 페이지를 보고 있었으면...
			nPage--;
    }
	var strPageID = cvtPageID( myProp.CurrentPageId, nPage );
	goPage(strPageID);
}

function goPage(strPageID)
{
    if( strPageID == '' )
        return;
    setTimeout('getPageXmlData("' + myProp.DataType + '", "' + strPageID + '")', 250); 
//    setTimeout('getFirstPageXmlData("' + strDataType + '", "' + strTitle + '", "' + strLevel + '", "' + strSeojiID + '", "' + strGisaID + '")', 250); 
}

function extractPageNum(strPageID)
{
    nPos = strPageID.lastIndexOf("_");
    nPage = parseInt(strPageID.substring(nPos+1, strPageID.length), 10);
   
    return nPage;
}

function cvtPageID(strPageID, nPage)
{
    nPos = strPageID.lastIndexOf("_");
    strRetPage = strPageID.substring(0, nPos+1);
    strPageNum = nPage.toString(10);

    for( i = nPos+1; i<strPageID.length-strPageNum.length; i++ )
        strRetPage += '0';
    strRetPage += strPageNum;

    return strRetPage;
}

function setPageMode(strPageMode)
{
	var nPage;
	var nStartPage;
	var nEndPage;

	if( myProp.PageMode == strPageMode )
		return;

	myProp.PageMode = strPageMode;

	if( myProp.Level <= "2" ) //페이지 데이터가 아니면
		return;

	nPage = extractPageNum(myProp.CurrentPageId);

	if( strPageMode != "two" )
	{
		nStartPage = extractPageNum(myProp.StartPageId);
		nEndPage = extractPageNum(myProp.EndPageId);

		if( nPage < nStartPage )
			goPage( myProp.StartPageId );
		else if( nPage > nEndPage )
			goPage( myProp.EndPageId );
		else
			goPage( myProp.CurrentPageId );
	}
	else
	{
		nStartPage = extractPageNum(myProp.MinPageId);
		nEndPage = extractPageNum(myProp.MaxPageId);

		if( (nPage % 2) == 1 ) //현재 홀수 페이지를 보고 있었으면...
			nPage--;
		if( nPage < 0 )
			nPage = 0;

		strPageID = cvtPageID( myProp.CurrentPageId, nPage );

		if( nPage < nStartPage )
			goPage( myProp.MinPageId );
		else if( nPage > nEndPage )
			goPage( myProp.MaxPageId );
		else
			goPage( strPageID );
	}
	
	
	if(strPageMode=='one'){
        $('imgOne').src='image/article/mode1_on.gif';
        $('imgTwo').src='image/article/mode2_off.gif';
        $('imgComp').src='image/article/mode3_off.gif';
	}else if(strPageMode=='two'){
        $('imgOne').src='image/article/mode1_off.gif';
        $('imgTwo').src='image/article/mode2_on.gif';
        $('imgComp').src='image/article/mode3_off.gif';
	}else{
        $('imgOne').src='image/article/mode1_off.gif';
        $('imgTwo').src='image/article/mode2_off.gif';
        $('imgComp').src='image/article/mode3_on.gif';
	}
	
	setTimeout('setSession()', 250); 

//    setTimeout('getFirstPageXmlData("' + myProp.DataType + '", "' + myProp.Title + '", "' + myProp.Level + '", "", "' + myProp.GisaId + '")', 250); 
}

function setDirMode(strWritingMode)
{
	if( myProp.WritingMode == strWritingMode )
		return;

	myProp.WritingMode = strWritingMode;

	if( myProp.Level == "2" ) //서지 데이터 보는 중이면
		return;

	changeXsl();
	setTimeout('setSession()', 250); 
}

function changeXsl()
{
    var i=0;
    var col=document.getElementsByTagName("div");
    
	if( myProp.WritingMode == "horz" )
    {
        for(i=0;i<col.length;i++)
        {
            if(col.item(i).name=='page_pane')
            {
                col.item(i).className="horz";
            }
            else if(col.item(i).name=="comment")
            {
                col.item(i).className="horzComment";
            }
        }
        $('imgHorz').src='image/article/h_textline_button.gif';
        $('imgVert').src='image/article/v_textline_button_off.gif';
    }
    else
    {
        for(i=0;i<col.length;i++)
        {
            if(col.item(i).name=='page_pane')
            {
                col.item(i).className="vert";
            }
            else if(col.item(i).name=="comment")
            {
                col.item(i).className="vertComment";
            }
        }
        $('imgHorz').src='image/article/h_textline_button_off.gif';
        $('imgVert').src='image/article/v_textline_button.gif';
    }
}

function showComment(objAnchor, strComment)
{

	var objComment = document.getElementById("commentView");
    var strHtml="";

    
    if($(strComment)!=null){
        strHtml="<table width='200' border='0' cellspacing='0' cellpadding='0'><td width='3' height='3'><img src='image/cha/table_01.gif' width='3' height='3'></td><td background='image/cha/table_02.gif'></td><td width='3' height='3'><img src='image/cha/table_03.gif' width='3' height='3'></td></tr><tr><td width='3' background='image/cha/table_04.gif'></td><td background='image/cha/table_05.gif'  style='padding: 10px 10px 10px 10px' class='boardlist'>" + $(strComment).innerHTML + "</td><td width='3' background='image/cha/table_06.gif'></td></tr><tr><td width='3' height='3'><img src='image/cha/table_07.gif' width='3' height='3'></td><td background='image/cha/table_08.gif'></td><td width='3' height='3'><img src='image/cha/table_09.gif' width='3' height='3'></td></tr></table>";
    }
    
    objComment.style.left = event.x + 2;
	objComment.style.top = event.y + 2;
	objComment.style.zIndex = 5;
	
	objComment.style.visibility = "visible";
	objComment.innerHTML = strHtml;
}

function hideComment(objAnchor)
{
	commentView.style.visibility = "hidden";
}

function zoomIn()
{
	if (myProp.ZoomFontSize <= 0)
		return;

	if (myProp.ZoomFontSize < 42)
		myProp.ZoomFontSize++;
	pageArea.style.fontSize = myProp.ZoomFontSize.toString(10) + "pt";

//	setTimeout('setSession("' + myProp.ZoomFontSize + '")', 250); 
	setTimeout('setSession()', 250); 
}

function zoomOut()
{
	if (myProp.ZoomFontSize <= 0)
		return;

	if (myProp.ZoomFontSize > 7)
		myProp.ZoomFontSize--;
	pageArea.style.fontSize = myProp.ZoomFontSize.toString(10) + "pt";

//	setTimeout('setSession("' + myProp.ZoomFontSize + '")', 250); 
	setTimeout('setSession()', 250); 
}

//function setSession(strFontSize)
function setSession()
{
    var url = 'setSession.aspx';
    var queryString = 'fontsize=' + myProp.ZoomFontSize.toString(10) + '&page_mode=' + myProp.PageMode + '&writing_mode=' + myProp.WritingMode;

    xmlSessionHttpPost(url, queryString);
}

function xmlSessionHttpPost(actionUrl, submitParameter)
{
    var xmlSessionHttpRequest = false;
    
    if(window.ActiveXObject)
    {
        xmlSessionHttpRequest = new ActiveXObject('Microsoft.XMLHTTP');
    }
    else
    {
        xmlSessionHttpRequest = new XMLHttpRequest();
        xmlSessionHttpRequest.overrideMimeType('text/xml');
    }    

    xmlSessionHttpRequest.open('POST', actionUrl, true);
    xmlSessionHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlSessionHttpRequest.onreadystatechange = function() {
        if(xmlSessionHttpRequest.readyState == 4)
        {
            switch (xmlSessionHttpRequest.status) 
            {
                case 404:
                alert(actionUrl);
                    break;
                case 500:
                alert(xmlSessionHttpRequest.responseText);
                   break;
                default:
                   break;        
            }            
        }
    }
    xmlSessionHttpRequest.send(submitParameter);                
}                                    

// 불교사전
function bs_Detail( strFrom, strTo, strSrch, strPage, strPos )
{
	var nRowNo = ((parseInt(strPage, 10)-1)*16) + parseInt(strPos, 10);
//	alert(nRowNo);
	location.href = 'bs_detail.aspx?type=detail&from=' +  encodeURI(strFrom) + '&to=' + encodeURI(strTo) + '&srch=' + encodeURI(strSrch) + '&rowno=' + nRowNo.toString();
}

function bs_Srch( )
{
	var objSearch = document.getElementById("bs_srch");
	if( objSearch == null )
		return;

	var objElem = objSearch.elements;
	if( objElem == null )
		return;

	var strQuery = "";
	for( i=0; i<objElem.length; i++ )
	{
		if( objElem[i].type != 'hidden' )
		{
			strQuery += objElem[i].value;
		}
	}

	strQuery = strQuery.replace( / /g, '' );
	if( strQuery == "" )
	{
		alert( '검색어를 입력하신 후 다시 검색하세요.' );
		return;
	}

	for(i=0; i<strQuery.length;i++)
	{
		nCode = strQuery.charCodeAt(i);
		if( nCode< 48 || (nCode >= 58 && nCode <= 64) || (nCode >= 91 && nCode <= 96) || (nCode >= 123 && nCode <= 127) )
		{
			alert( "검색어로 사용할 수 없는 문자가 입력되었습니다. 확인 후 다시 검색하세요." );
			return;
		}
	}

	objSearch.method = "get";
	objSearch.action = "bs_list.aspx";
	objSearch.submit();
}

//불교사전
//17페이지 : '갑삽' 에 imghj 태그 있슴.

///////////////////////////////////////////////////////////////////////////////////////
//
//     검색제시어 관련
//
///////////////////////////////////////////////////////////////////////////////////////

function clearKeywordBg()
{
	var i;

	for(i=1;i<myProp.nKeywordTop;i++)
	{
		objKeyword = "word_" + i;
		
		document.all(objKeyword).style.backgroundColor = '#ffffff';
	}
}

function showSearchWord()
{
	var objSearch = document.getElementById("search_form");
	if( objSearch == null )
		return;
//		alert( objSearch.query.value );

    var strWord = objSearch.query.value;
    if( strWord == "" )
    {
        $(Layer4).style.visibility = "hidden";
        $(Layer4).innerHTML = "";
        return;
    }

    var url;
    var userid;
    var data;

    url="Ajax.aspx";
    data='type=9&word=' + encodeURI(strWord);

    sendRequest(on_GetSearchWord, data,'POST',url,true,true);
}

function on_GetSearchWord(oj)
{
    if( oj.responseText == 'none' )
    {
        $(Layer4).style.visibility = "hidden";
        $(Layer4).innerHTML = "";
        return;
    }
//	alert(oj.responseText);
    $(Layer4).innerHTML = oj.responseText;
    $(Layer4).style.visibility = "visible";
    
    myProp.nKeywordTop = parseInt($(contentsBox).word_count, 10) + 1;
    if( myProp.nKeywordTop < 6 ) //원래는 5였는데... '가지' key in 하면 4건인데 div 높이가 더 길어지네..
    {
    	var searchKeywordDiv = document.all("contentsBox");
        searchKeywordDiv.style.height = "";
    }
}

function setQuery(strQuery)
{
    var objQuery = document.getElementById("query");
    objQuery.value = strQuery;
    
//    $(Layer4).innerHTML = "";
//    $(Layer4).style.visibility = "hidden";
    
//    goSearch();
}

// 통합검색
function submitCheck()
{
	if( event.keyCode == 13 )
	{
		event.returnValue = false;
		goSearch();
		return;
	}
/*	else //검색제시어
	{
	    showSearchWord();
	}
*/

    var keyCode = window.event.keyCode;
	var searchKeywordDiv = document.all("contentsBox");

	if (event.keyCode == 38) // 상향키
	{
//		if (searchKeywordDiv.style.visibility == "visible")
		{
			var objKeyword;
			if (myProp.nKeywordCnt>1)
			{
				clearKeywordBg(); //td 배경색 초기화
				myProp.nKeywordCnt -= 1 ;
				if(myProp.nKeywordCnt<6)
					searchKeywordDiv.scrollTop = 0; 

				objKeyword = "word_" + myProp.nKeywordCnt
				document.all(objKeyword).style.backgroundColor = '#E8E8E8';
				setQuery(document.all(objKeyword).innerHTML);
			}
			return 0;
		}	
	}
	if (event.keyCode == 40) // 하향키
	{
//	alert( searchKeywordDiv.style.visibility );
//		if (searchKeywordDiv.style.visibility == "visible")
//		{
			var objKeyword;
			if (myProp.nKeywordCnt<myProp.nKeywordTop-1)
			{
				clearKeywordBg(); //td 배경색 초기화
				myProp.nKeywordCnt += 1 ;
				if(myProp.nKeywordCnt>5)  // %5*100
					searchKeywordDiv.scrollTop = 100; 

				objKeyword = "word_" + myProp.nKeywordCnt
				document.all(objKeyword).style.backgroundColor = '#E8E8E8';
				setQuery(document.all(objKeyword).innerHTML);
			}
			return 0;
//		}
	}
    
    if(keyCode ==  9)   return;     //Tab 키
    if(keyCode == 13)   return;     //Enter 키
    if(keyCode == 16)   return;     //Shift 키
    if(keyCode == 16)   return;     //Ctrl 키
    if(keyCode == 18)   return;     //Alt 키
    if(keyCode == 45)   return;     //Ins 키
//    if(keyCode == 46)   return;     //Del 키
    if(keyCode == 33)   return;     //PgUp 키
    if(keyCode == 34)   return;     //PgDn 키
    if(keyCode == 35)   return;     //End 키
    if(keyCode == 36)   return;     //Home 키
    
    if(keyCode >= 37 && keyCode <= 40)   return;     //방향키
    
    //Keydown 이벤트 발생 시점에는 아직 TextField에 사용자가 입력한 키 값이 설정되지 않았기 때문에
    //브라우저가 이벤트에 반응하여 값을 설정할때 까지 잠시 기다린다.
    setTimeout('showSearchWord()', 500);    
    myProp.nKeywordCnt = 0;
}

function goSearch( )
{

	var objSearch = document.getElementById("search_form");
	if( objSearch == null )
		return;
/*
	var objElem = objSearch.elements;
	if( objElem == null )
		return;

	var strQuery = "";
	for( i=0; i<objElem.length; i++ )
	{
		if( objElem[i].type != 'hidden' )
		{
			strQuery += objElem[i].value;
		}
	}

	strQuery = strQuery.replace( / /g, '' );
	if( strQuery == "" )
	{
		alert( '검색어를 입력하신 후 다시 검색하세요.' );
		return;
	}

	for(i=0; i<strQuery.length;i++)
	{
		nCode = strQuery.charCodeAt(i);
		if( !(nCode==33 || nCode==38 || nCode==40 || nCode==41 || nCode==124) && (nCode< 48 || (nCode >= 58 && nCode <= 64) || (nCode >= 91 && nCode <= 96) || (nCode >= 123 && nCode <= 127)) )
		{
			alert( "검색어로 사용할 수 없는 문자가 입력되었습니다. 확인 후 다시 검색하세요." );
			return;
		}
	}
*/
    if( checkQuery(objSearch) == false )
        return;
//	objSearch.method = "post";
	objSearch.action = "search_result.aspx";
	objSearch.submit();
}

function searchPage(strDataType, strPageID)
{
	var url;
	var userid;
	var data;	

//alert( strPageID )
	var nPage;
	nPage = extractPageNum(strPageID);
	if (myProp.PageMode == "two")
	{
		if (( nPage % 2) != 0)
			nPage--;
		if( nPage <= 0 )
			nPage++;
	}
	var strCvtPageID = cvtPageID( strPageID, nPage );
//	alert( strCvtPageID );

	myProp.DataType = strDataType;
	myProp.CurrentPageId = strCvtPageID;
	url="Ajax.aspx";
	data='type=3&d_type=' +  strDataType + '&page_id=' + strCvtPageID + '&page_mode=' + myProp.PageMode;
    
    loading.style.visibility = "visible";
	
	sendRequest(on_GetSearchPage, data,'POST',url,true,true);
}

function on_GetSearchPage(oj){
//	var res=decodeURIComponent(oj.responseText);
//	alert( oj.responseText );
	myProp.XmlData = oj.responseText;
    pageTransform("3", myProp.CurrentPageId, true);
}

function checkQuery(objForm)
{
	if( objForm == null )
		return false;

	var objElem = objForm.elements;
	if( objElem == null )
		return false;

	var strQuery = "";
	for( i=0; i<objElem.length; i++ )
	{
		if( objElem[i].type != 'hidden' )
		{
			strQuery += objElem[i].value;
		}
	}

    //and, or, not 연산자를 영문으로 직접입력할 경우도 있으므로 불리언 연산자로 변환하여 쿼리를 체크한다.
    strQuery = strQuery.toLowerCase();
	strQuery = strQuery.replace( / and /g, ' & ' );
	strQuery = strQuery.replace( / or /g, ' | ' );
	strQuery = strQuery.replace( / not /g, ' ! ' );

	strQuery = strQuery.replace( / /g, '' );
	if( strQuery == "" )
	{
		alert( '검색어를 입력하신 후 다시 검색하세요.' );
		return false;
	}

	for(i=0; i<strQuery.length;i++)
	{
		nCode = strQuery.charCodeAt(i);
//		alert( nCode )
		if( !(nCode==33 || nCode==38 || nCode==40 || nCode==41 || nCode==95 || nCode==124 || nCode==126) && (nCode< 48 || (nCode >= 58 && nCode <= 64) || (nCode >= 91 && nCode <= 96) || (nCode >= 123 && nCode <= 127)) )
		{
			alert( "검색어로 사용할 수 없는 문자가 입력되었습니다. 확인 후 다시 검색하세요." );
			return false;
		}
	}
	
	return true;
}
/*
GetUnionXML
<RESULTSET><DATASET name="불교전서" count="11" search="생애"></DATASET><DATASET name="한글대장경" count="0" search="생애"></DATASET></RESULTSET>

GetTotalXML
<RESULTSET><DATASET name="불교전서" count="11" search="생애"></DATASET></RESULTSET>

GetSeojiXML
<RESULTSET><DATASET id="DGUL_BJ_T_0162_001" title="詠月堂大師文集" count="1" search="생애"></DATASET><DATASET id="DGUL_BJ_T_0234_001" title="仁嶽集" count="1" search="생애"></DATASET><DATASET id="DGUL_BJ_T_0206_001" title="請擇法報恩文" count="1" search="생애"></DATASET><DATASET id="DGUL_BJ_T_0320_001" title="東溟遺稿" count="4" search="생애"></DATASET><DATASET id="DGUL_BJ_T_0199_001" title="虛靜集" count="1" search="생애"></DATASET><DATASET id="DGUL_BJ_T_0219_001" title="秋波集" count="3" search="생애"></DATASET></RESULTSET>

GetPageXML
<RESULTSET><DATASET id="DGUL_BJ_T_0162_001_0033" search="생애"></DATASET></RESULTSET>

GetSynonymList
생애
生涯
生涯
生涯
生涯
生涯
生涯
生涯
生涯
生涯
生涯
生涯
*/

///////////////////////////////////////////////////////////////////////////////////////
//
//     상세검색 관련
//
///////////////////////////////////////////////////////////////////////////////////////

function change_DsForm(strShowDiv, strHiddenDiv)
{
    var objShowDiv = document.getElementById(strShowDiv)
    if( objShowDiv == null )
        return;
    var objHiddenDiv = document.getElementById(strHiddenDiv)
    if( objHiddenDiv == null )
        return;
        
	var objPage1 = document.getElementById("page_1");
	var objPage2 = document.getElementById("page_2");
	var objPageComp = document.getElementById("page_comp");
	
	objPage1.style.visibility = "hidden";
	objPage2.style.visibility = "hidden";
	objPageComp.style.visibility = "hidden";

    objShowDiv.style.visibility = "visible";
    objHiddenDiv.style.visibility = "hidden";
    
    if(strShowDiv=='ds_seoji'){
        ResetPageMove();
        ResetImageViewer();
        ResetHeje();
        ResetEbook();
        ResetZoom(false);
        ResetPageMode(false);
        ResetDirMode(false);
        ResetPageInfo();
        $('dvTree').style.visibility = "hidden";
    }else{
        ResetZoom(true);
        ResetPageMode(true);
        ResetDirMode(true);
     }
}

function changeBook(strValue)
{
	var url;
	var userid;
	var data;	

	var nPage;
	url="Ajax.aspx";
	data='type=4&d_type=' +  strValue;
	sendRequest(on_GetBookName, data,'GET',url,true,true);
}

function on_GetBookName(oj){
    var objBook = document.getElementById("seoji_id");
    if( objBook != null )
    {
        var objParent = objBook.parentElement;
        var strHtml = '<select id="seoji_id" name="seoji_id" style="width:208px;">';
        strHtml += oj.responseText;
        strHtml += '</select>';
        objParent.innerHTML = strHtml;
    }
}

function goDetailSearch(objForm)
{
    if( objForm == null )
        return;
    if( checkQuery(objForm) == false )
        return;

//	objForm.action = "ds_tree.aspx";
//	objForm.submit();
	var url;
	var userid;
	var data;	

	url="Ajax.aspx";
	if( objForm.ds_type.value == "fulltext" ) //전문검색
	{
    	data='type=5&ds_type=' + objForm.ds_type.value + '&d_type=' + objForm.d_type.value + '&seoji_id=' + objForm.seoji_id.value + '&ds_query=' + cvtAndOper(objForm.ds_query.value) + '&start=1&level=0&extend=';
	    if( objForm.extend[0].checked )
	        data += '0';
	    else
	        data += '1';
	}
	else //서지검색
	{
    	data='type=5&ds_type=' + objForm.ds_type.value + '&d_type=' + objForm.d_type.value;
	    if( objForm.d_type.value == "1" ) //불교전서
	    {
	        data += '&title=' + cvtAndOper(objForm.title.value) + '&author=' + cvtAndOper(objForm.author.value) + '&publish=' + cvtAndOper(objForm.publish.value) + '&location=' + cvtAndOper(objForm.location.value);
	    }
	    else
	    {
	        data += '&title=' + cvtAndOper(objForm.title.value) + '&kor_author=' + cvtAndOper(objForm.kor_author.value) + '&translation=' + cvtAndOper(objForm.translation.value);
	    }
	}
//	alert( data );
	sendRequest(on_DetailSearch, data,'POST',url,true,true);

}

function cvtAndOper(strText){
    return strText.replace(/&/g, '{{and}}');;
}

function on_DetailSearch(oj){
    cntChange("ds_config.xml");
    dvTree.style.visibility = "visible";
    return;
}

function ds_searchPage(strDataType, strPageID)
{
	var url;
	var userid;
	var data;	

	var nPage;
	nPage = extractPageNum(strPageID);
	if (myProp.PageMode == "two")
	{
		if (( nPage % 2) != 0)
			nPage--;
		if( nPage <= 0 )
			nPage++;
	}
	var strCvtPageID = cvtPageID( strPageID, nPage );

    loading.style.visibility = "visible";

	myProp.DataType = strDataType;
	myProp.CurrentPageId = strCvtPageID;
	url="Ajax.aspx";
	data='type=6&d_type=' +  strDataType + '&page_id=' + strCvtPageID + '&page_mode=' + myProp.PageMode;// + '&query=' + strEncodeQuery;        		
	sendRequest(on_GetSearchPage, data,'POST',url,true,true);

    var objShowDiv = document.getElementById("ds_fulltext")
    var objHiddenDiv = document.getElementById("ds_seoji")

    objShowDiv.style.visibility = "hidden";
    objHiddenDiv.style.visibility = "hidden";

}

function changeForm(strDataType)
{
var strBJSeojiForm;
var strHDSeojiForm;
        strBJSeojiForm = '	<input name="ds_type" type="hidden" value="seoji">';
        strBJSeojiForm += '<table width="740" height="190"  border="0" cellpadding="0" cellspacing="0" class="siz12">';
        strBJSeojiForm += '<tr>';
        strBJSeojiForm += '	<td width="110" align="center" class="searchpage_blue" style="padding: 0px 0px 0px 0px">자료종류</td>';
        strBJSeojiForm += '	<td width="640"><select name="d_type" onchange="javascript:changeForm(this.value);">';
        strBJSeojiForm += '	<option value="1" selected>불교전서</option>';
        strBJSeojiForm += '	<option value="2">한글대장경</option>';
        strBJSeojiForm += '	</select>';
        strBJSeojiForm += '	</td>';
        strBJSeojiForm += '</tr>';
        strBJSeojiForm += '<tr>';
        strBJSeojiForm += '	<td align="center" class="searchpage_blue" style="padding: 0px 0px 0px 0px">제목</td>';
        strBJSeojiForm += '	<td><input name="title" class="imefont" type="text" size="24"></td>';
        strBJSeojiForm += '</tr>';
        strBJSeojiForm += '<tr>';
        strBJSeojiForm += '	<td align="center" class="searchpage_blue" style="padding: 0px 0px 0px 0px">저자</td>';
        strBJSeojiForm += '	<td><input name="author" class="imefont" type="text" size="24"></td>';
        strBJSeojiForm += '</tr>';
        strBJSeojiForm += '<tr>';
        strBJSeojiForm += '	<td align="center" class="searchpage_blue" style="padding: 0px 0px 0px 0px">간행처</td>';
        strBJSeojiForm += '	<td><input name="publish" class="imefont" type="text" size="24"></td>';
        strBJSeojiForm += '</tr>';
        strBJSeojiForm += '<tr>';
        strBJSeojiForm += '	<td align="center" class="searchpage_blue" style="padding: 0px 0px 0px 0px">소장처</td>';
        strBJSeojiForm += '	<td>';
        strBJSeojiForm += '		<table border="0" cellspacing="0" cellpadding="0">';
        strBJSeojiForm += '		<tr>';
        strBJSeojiForm += '			<td><input name="location" class="imefont" type="text" size="24"></td>';
        strBJSeojiForm += '			<td width="60" align="right"><a href="javascript:goDetailSearch(ds_seojiform);"><img src="image/main/search_area_button_01.gif" width="55" height="20" border="0"></a></td>';
//        strBJSeojiForm += '			<td width="67" align="right"><a href="#"><img src="image/main/search_area_button_04.gif" width="62" height="18" border="0"></a></td>';
        strBJSeojiForm += '		</tr>';
        strBJSeojiForm += '		</table>';
        strBJSeojiForm += '	</td>';
        strBJSeojiForm += '</tr>';
        strBJSeojiForm += '</table>';
        
//////////////////////////////////////////////////////
        strHDSeojiForm = '	<input name="ds_type" type="hidden" value="seoji">';
        strHDSeojiForm += '<table width="740" height="190"  border="0" cellpadding="0" cellspacing="0" class="siz12">';
        strHDSeojiForm += '<tr>';
        strHDSeojiForm += '	<td width="110" align="center" class="searchpage_blue" style="padding: 0px 0px 0px 0px">자료종류</td>';
        strHDSeojiForm += '	<td width="640"><select name="d_type" onchange="javascript:changeForm(this.value);">';
        strHDSeojiForm += '	<option value="1">불교전서</option>';
        strHDSeojiForm += '	<option value="2" selected>한글대장경</option>';
        strHDSeojiForm += '	</select>';
        strHDSeojiForm += '	</td>';
        strHDSeojiForm += '</tr>';
        strHDSeojiForm += '<tr>';
        strHDSeojiForm += '	<td align="center" class="searchpage_blue" style="padding: 0px 0px 0px 0px">제목</td>';
        strHDSeojiForm += '	<td><input name="title" class="imefont" type="text" size="24"></td>';
        strHDSeojiForm += '</tr>';
        strHDSeojiForm += '<tr>';
        strHDSeojiForm += '	<td align="center" class="searchpage_blue" style="padding: 0px 0px 0px 0px">한역자</td>';
        strHDSeojiForm += '	<td><input name="kor_author" class="imefont" type="text" size="24"></td>';
        strHDSeojiForm += '</tr>';
        strHDSeojiForm += '<tr>';
        strHDSeojiForm += '	<td align="center" class="searchpage_blue" style="padding: 0px 0px 0px 0px">번역자</td>';
        strHDSeojiForm += '	<td>';
        strHDSeojiForm += '		<table border="0" cellspacing="0" cellpadding="0">';
        strHDSeojiForm += '		<tr>';
        strHDSeojiForm += '			<td><input name="translation" class="imefont" type="text" size="24"></td>';
        strHDSeojiForm += '			<td width="60" align="right"><a href="javascript:goDetailSearch(ds_seojiform);"><img src="image/main/search_area_button_01.gif" width="55" height="20" border="0"></a></td>';
//        strHDSeojiForm += '			<td width="67" align="right"><a href="#"><img src="image/main/search_area_button_04.gif" width="62" height="18" border="0"></a></td>';
        strHDSeojiForm += '		</tr>';
        strHDSeojiForm += '		</table>';
        strHDSeojiForm += '	</td>';
        strHDSeojiForm += '</tr>';
        strHDSeojiForm += '</table>';
        
        var objForm = document.getElementById("ds_seojiform");
        if( strDataType == "1" )
            objForm.innerHTML = strBJSeojiForm;
        else
            objForm.innerHTML = strHDSeojiForm;
}

function ds_GetSeoji(strDataType, strTitle, strLevel, strSeojiID, strGisaID)
{
//    hrefTest(strDataType, strTitle, strLevel, strSeojiID, strGisaID);
    myProp.DataType = strDataType;
	myProp.Title = strTitle;
	myProp.GisaId = strGisaID;
	myProp.Level = strLevel;

	g_bActionStart = true;

	var url;
	var userid;
	var data;	

	url="Ajax.aspx";
	data='type=7&d_type=' +  strDataType + '&title=' + encodeURI(strTitle) + '&level=' + strLevel + '&seoji_id=' + strSeojiID + '&gisa_id=' + strGisaID;        		

    loading.style.visibility = "visible";

	sendRequest(on_GetDSSeoji, data,'GET',url,true,true);

//    setTimeout('getFirstPageXmlData("' + strDataType + '", "' + strTitle + '", "' + strLevel + '", "' + strSeojiID + '", "' + strGisaID + '")', 250); 
    
    var objShowDiv = document.getElementById("ds_fulltext")
    var objHiddenDiv = document.getElementById("ds_seoji")

    objShowDiv.style.visibility = "hidden";
    objHiddenDiv.style.visibility = "hidden";
}

function on_GetDSSeoji(oj){
//	var res=decodeURIComponent(oj.responseText);
//	alert( oj.responseText );
	myProp.XmlData = oj.responseText;
    pageTransform("2", '', true);
}

///////////////////////////////////////////////////////////////////////////////////////
//
//     비교보기 이미지 팝업
//
///////////////////////////////////////////////////////////////////////////////////////
function openImg(strDataType,strFolder,strName)
{
   // var theURL = 'img_content/' + strDataType + '/large/' + strPath;
    var theURL="OpenImg.aspx?datatype=" + strDataType + "&folder=" + strFolder + "&filename=" + strName;
    
//    alert( theURL );
    
    var dgul_image_popup = window.open(theURL,'','toolbar=no,location=no,directories=no,status=no,menubar=no, scrollbars=yes,titlebar=no, resizable=yes,width=790,height=580, top=100, left=100');

//	var	strDoc = '<html>\n<head>\n<title>한국불교문화종합정보서비스 이미지 보기</title>\n';
//	strDoc += '</head>\n';
//	strDoc += '<body style="margin:5 0 0 5;">\n';
//	strDoc += '<center><img src="';
//	strDoc += theURL;
//	strDoc += '">';
//	strDoc += '</body></html>';

//	var	oImgDoc = dgul_image_popup.document.open( "text/html", "replace" );
//	oImgDoc.write( strDoc );
//	
//	oImgDoc.close();
    dgul_image_popup.focus();
}