////////////////////////////////////////////////////
//
//  Since 1998 Copyright(c)
//  Humandream, Inc.
//  All rights reserved
//  file name : dBookFunctions.js
//  version : 3.4 g1120  (made by Humandream, Inc.)
//
/////////////////////////////////////////////////////
var g_nAltFrameLeft, g_nAltFrameTop;

var g_bAutoRotating;

//******************************************************************************************
function showHelp()
{
	var strBase = "";
	try{
		var baseCol = document.all.tags('BASE');
		strBase = baseCol[0].href
	}catch(e){}

	//var helpWin = window.open(strBase+ "help2.htm", "ebook_help", "width=300, height=420, left=5, top=72, scrollbars=yes, scrolling=yes");
	var helpWin = window.open(strBase+ "images/help/help_kor.html", "ebook_help", "width=400, height=550, left=5, top=72, scrollbars=no, scrolling=yes");
	if (helpWin != null)	helpWin.focus();
}

function your_StartZoom() {
//	if(g_isFullScreen != 2 && g_bDbookExtend=="y")
	{
		expand_StartZoom();

		//resizeWindowOrDbook(Math.pow(2,1));
	}
}

function your_EndZoom(){
//	if(g_isFullScreen != 2 && g_bDbookExtend=="y")
	{
		expand_EndZoom();

		//resizeWindowOrDbook(Math.pow(2,0));
	}
}

function hideOtherFrame(frameID){
	var oFrame;
	var arrFrame = new Array("indexList","search","print");
	for(var i=0; i<arrFrame.length; i++){
		oFrame = document.all[arrFrame[i]];
		if(arrFrame[i] != frameID){
			oFrame.style.left = 0;
			oFrame.style.top = 0;
			oFrame.style.width = 10;
			oFrame.style.height = 10;		
			oFrame.style.visibility="hidden";						
		}
	}
}

function moveAndResizeFrame(frameID, w, h){
	var oFrame = document.all[frameID];	
	var cTable = document.all["viewTable"];
	var oRcts = cTable.getBoundingClientRect();	
	oFrame.style.left = oRcts.left+104;
	if(frameID=="print"){
		oFrame.style.top = oRcts.top+210;
	}else if(frameID=="search"){
		oFrame.style.top = oRcts.top+150;	
	}else{
		oFrame.style.top = oRcts.top+85;
	}

	oFrame.style.pixelWidth = w;
	if (h>500){
		h = 500;
	}
	oFrame.style.pixelHeight = h;
}

function HD_eidtLink(mode, linkID, left, top, right, bottom,page){
	try{
		document.frames("editLink").eidtLink(mode, linkID, left, top, right, bottom,page);
	}catch(e){
//			alert("error editLink");
	}
}

/* //////////////////////////////////////////////////
 *
 * 파일명 : dBookFunctions.js
 * version : 3.0 e0806  (made by Humandream, Inc.)
 *
*////////////////////////////////////////////////////

function showFrame(frameID,viewOrHide){
	hideOtherFrame(frameID);
	var oFrame = document.all[frameID];
	if(viewOrHide=="view"){
		if(oFrame.src==""){
			oFrame.src = frameID+".htm";
		}
		oFrame.style.visibility="visible";
		try{
			document.frames(frameID).moveAndResizeFrame();
		}catch(e){}
	}else{
		oFrame.style.left = 0;
		oFrame.style.top = 0;
		oFrame.style.width = 10;
		oFrame.style.height = 10;		
		oFrame.style.visibility="hidden";	
	}
}

// On load defaunt1.html ***********************************************************************
function onLoadProcsss()
{
	// call by html document when the html document load finishing.
	bOnLoaded = true;		
	HD_getSlidePage();

	HD_mediaSetAutoStart(true);
	HD_mediaSetShowControls(false);

	// for enter key input of go to page 
	try {
		page_num.onkeypress = doKey;
	} catch (ePageNum) {}

	if ( getCookie( "ebook_help_show" ) != "no" )
	{
		your_showHelp( -1 );            // help window will NOT be opened.
		//  your_showHelp( 0 );         // help window will be opened immediately.
		//  your_showHelp( 5000 );      // help window will be opened after 5 secs.
	}

	if (getStartPage() > 1)
		setStartPage( getStartPage() );
}

// On Unload defaunt1.html ***********************************************************************
function onUnLoadProcsss()
{
	DigitalBookUnload();
}

//
//***********************************************************************************************
// move page Functions  

// go to nPage 
function your_gotoPage( nPage ) 
{		
	HD_gotoPage( nPage );
	// TODO : Add your implementation code here.
}

// move next Page  
function your_pressNextPage() 
{		
	HD_pressNextPage();
	// TODO : Add your implementation code here.    
}

// move previous Page
function your_pressPreviousPage() 
{	
	HD_pressPreviousPage();
	// TODO : Add your implementation code here.    
}

// move first Page
function your_gotoFirstPage() 
{		
	HD_gotoFirstPage();
	// TODO : Add your implementation code here.    
}

// move last Page
function your_gotoEndPage() 
{			
	HD_gotoEndPage();
	// TODO : Add your implementation code here.    
}

//***********************************************************************************************
// zoom off or auto flip pause 
function your_pressReload() 
{		
	HD_pressPause();
	// TODO : Add your implementation code here.    
}

//***********************************************************************************************
// zoom functions 

// left page zoom in 
function your_pressLeftZoom() 
{		
	var ZoomLevel=dBook.handle_getCurrZoomStep();
	if (ZoomLevel > 0)
		HD_pressPause();

	HD_pressLeftZoom();
	// TODO : Add your implementation code here.    
}

// right page zoom in 
function your_pressRightZoom() 
{			
	var ZoomLevel=dBook.handle_getCurrZoomStep();
	if (ZoomLevel > 0)
		HD_pressPause();

	HD_pressRightZoom();
	// TODO : Add your implementation code here.    
}

// center page zoom in 
function your_pressZoom() 
{			
	HD_pressZoom();
	// TODO : Add your implementation code here.    
}

// activate/deactivate zoom lens
function your_pressCloseUp() 
{		
	HD_pressCloseUp();
	// TODO : Add your implementation code here.    
}

//***********************************************************************************************
//***********************************************************************************************
// Event Functions
//<PARAM NAME=eventFunctions VALUE="
//changePage=your_changePage;
//endRotate=your_endRotate;
//notFlipPrev=your_notFlipPrev;
//notFlipNext=your_notFlipNext;
//linkPressed=your_linkPressed">

// event of moving page (페이지 넘김 이벤트 : 페이지 번호 출력) 
function your_changePage() 
{ 
    HD_setPageNum(); 
    // alert("Page Changes..");
    
    // Related to APPLET Event 'changePage'.
    // TODO : Add your implementation code here.
} 

// event of stopping auto flip 
function your_endRotate() 
{ 
    // alert( "Rotating And" ); 
    
    // Related to APPLET Event 'endRotate'.
    // TODO : Add your implementation code here.
} 

// event of cannot moving previous page 
function your_notFlipPrev() 
{ 
    alert( MSG_DBOOK_004 ); 
    
    // Related to APPLET Parameter 'eventFunctions'.
    // TODO : Add your implementation code here.
} 

// event of cannot moving previous page 
function your_notFlipNext() 
{ 
    alert( MSG_DBOOK_005 ); 
    
    // Related to APPLET Parameter 'eventFunctions'.
    // TODO : Add your implementation code here.
} 

//***********************************************************************************************
// PopUp Help Window
function your_showHelp( delayMilliSec )
{
    /***
    Notice : if delayMilliSec < 0, help window will NOT be opened.
                delayMilliSec = 0, help window will be opened immediately.
                delayMilliSec > 0, help window will be opened after the delayMilliSec.
    ***/
                
    if ( delayMilliSec < 0 )          ;
    else if ( delayMilliSec == 0 )  	showHelp();
    else setTimeout( 'showHelp();', delayMilliSec );
    
    // Related to "setTimeout(...)" of this page.
	  // TODO : Add your implementation code here.
}

//***********************************************************************************************
// minimize current window 
function your_minimizeWindow()
{
	minimizeBrowser();
}

//***********************************************************************************************
// move to url web page 
function your_openReplace( url ) 
{ 
    openReplace( url );
    // Related to the failure of APPLET loading.
    // TODO : Add your implementation code here.    
} 


// **********************************************************
// multimedia link 
function your_endInitLink()
{
	try{
		your_treatSlidePage();
	}catch(e){}
}

