function menu_closeUp(){
	if(skin_btnAct) ebook_closeUp();
}
function menu_additionalFunction(){
	ebook_showFrame("frame_additional","appendix/additional.htm",false,false);
}
function menu_exif(){
	ebook_showFrame("frame_exif","appendix/exif.htm",false, false);
	
	try{frame_exif.init(false);}catch(e){}
}
function menu_search(){
	
}
function menu_index(){
	if(skin_btnAct) ebook_showFrame("frame_index","appendix/index.htm",false, false);
}
function menu_pressBGM(){
	
}
function menu_setTextCapture(){
	if(!skin_btnAct) return;
	
	var ret=ebook_setTextCapture();
	if(ret){
		try{menu_Btn_TextCapture.src="images/menu_b_textcapture_on.gif";}catch(e){}
		try{menu_Btn_ImgCapture.src="images/menu_b_imgcapture.gif";}catch(e){}
	}else{
		try{menu_Btn_TextCapture.src="images/menu_b_textcapture.gif";}catch(e){}
	}
}
function menu_setImgCapture(){
	if(!skin_btnAct) return;
	
	var ret=ebook_setImgCapture();
	if(ret){
		try{menu_Btn_ImgCapture.src="images/menu_b_imgcapture_on.gif";}catch(e){}
		try{menu_Btn_TextCapture.src="images/menu_b_textcapture.gif";}catch(e){}
	}else{
		try{menu_Btn_ImgCapture.src="images/menu_b_imgcapture.gif";}catch(e){}
	}
}
function menu_pressAutoFlip(ipt){
	if(!skin_btnAct) return;
	ebook_pressAutoFlip(ipt);
}
function menu_stopAutoFlip(){
	if(!skin_btnAct) return;
	ebook_stopAutoFlip()
}
function menu_AutoFlipChange(sel){
	if(!skin_btnAct) return;
	var val = sel.value;
	if(val!=""){
		if(val=="0") ebook_stopAutoFlip();
		else dBook.handle_pressAutoFlip(val*1000,1);
	}
	sel.options[0].selected=true;
	document.body.focus();
}
function menu_inputGotoPage(ipt,evt){
	if(!skin_btnAct) return;
	
	var isKeyup=false;
	if(typeof(evt)!="undefined") isKeyup=true;
	var isGo=false;

	if(isKeyup){
		if(evt.keyCode==13) isGo=true;
	}else isGo=true;
	if(isGo){
		ebook_gotoPage(ipt.value);
		ipt.value="";
	}
}
function menu_pressLeftEndPage(){
	if(skin_btnAct) ebook_pressLeftEndPage();
}
function menu_pressLeftPage(){
	if(skin_btnAct) ebook_pressLeftPage();
}
function menu_pressRightPage(){
	if(skin_btnAct) ebook_pressRightPage();

}
function menu_pressRightEndPage(){
	if(skin_btnAct) ebook_pressRightEndPage();
}
function menu_dBookPlayer(){
	var frameID="frame_dBookPlayer";
	try{
		var oFrame=document.getElementById(frameID);
		if( oFrame ){
			if( oFrame.style.visibility=="hidden" || frame_dBookPlayer.g_isClose){
				if(oFrame.style.visibility=="hidden") ebook_showFrame(frameID,"appendix/dBookPlayer.htm",false, false);
				frame_dBookPlayer.startPlayer();
			}else{
				if(oFrame.style.visibility=="visible") ebook_showFrame(frameID,"appendix/dBookPlayer.htm",false, false);
				frame_dBookPlayer.stopPlayer();
			}
		}else ebook_showFrame(frameID,"appendix/dBookPlayer.htm",false, false);
	}catch(e){
		ebook_showFrame(frameID,"appendix/dBookPlayer.htm",false, false);
	}
	
}
function menu_fullScreen(bForce){
	window.moveTo(0,0);
	window.resizeTo(screen.availWidth, screen.availHeight);
	if(e_strFullScreen=="init" || bForce){
		ebook_showFrame("frame_fullscreen","appendix/fullscreen.htm",true, true);
		try{frame_fullscreen.init();}catch(e){}
	}
}
function menu_pressPrint(){
	if(skin_btnAct) ebook_pressPrint();
}
function menu_pressPause(){
	if(skin_btnAct) ebook_pressPause();
}
function menu_showHelp(){
	var oWin=window.open(e_absURL+"appendix/help.htm","HelpWin", "width=580,height="+screen.availHeight+",menubar=no,scrollbars=yes");
	try{ 
		oWin.moveTo(0,0);
		oWin.focus();
	}catch(e){}
}
function menu_winClose(){
	ebook_unload();
	top.window.close();
}
var g_xmlSearchDoc;
var g_bXmlLoaded=false;
var g_xmlLoadState=1;
var g_xmlData="";
function menu_DoSearch(type, curPage, bResearch){
	if(!skin_btnAct) return;
	try{ 
		frame_TextSearchResults.srch_DoSearch();
	}catch(e){}
}
function menu_DoSearch2(){
	try{
		var nPageID		= ebook_getRequestVar("startpage");
		var searchText	= ebook_getRequestVar("stext");
		if(searchText.indexOf("%")>=0) searchText = unescape(searchText);
			if(nPageID!="" && searchText!="") {
			frame_TextSearchResults.srch_DoSearch2(searchText, nPageID);
		}
	}catch(e){
		setTimeout("menu_DoSearch2()",100);
	}
}
function menu_srchStateChangeHandler(oReq){
	try{
		var state;
		if(e_isIEBrowser){
			state = g_xmlSearchDoc.readyState;
			if (state==4 && g_xmlSearchDoc.parseError.errorCode==0){
				g_bXmlLoaded = true;
				g_xmlData = g_xmlSearchDoc.xml;
				setTimeout("menu_DoSearch2()",100);
			}
		}else{
			state = oReq.readyState;
			if(state==4){
				g_xmlData = oReq.responseText;
				g_xmlSearchDoc=oReq.responseXML;
				g_bXmlLoaded = true;
				setTimeout("menu_DoSearch2()",100);
			}
		}
		g_xmlLoadState=state;
		try{frame_TextSearchResults.srch_changeXmlLoadState(state);}catch(e){}
	}catch (stateHandle_e){}
}
function menu_textSearchLoad(){
	g_bXmlLoaded=false;
	var strURL = e_absURL + e_dataDirectory + '/searchdoc.xml';
	if(e_isIEBrowser){
		g_xmlSearchDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
		g_xmlSearchDoc.setProperty("SelectionLanguage", "XPath"); 
		g_xmlSearchDoc.async = true;          
		g_xmlSearchDoc.validateOnParse = false;
		g_xmlSearchDoc.resolveExternals = false;
		g_xmlSearchDoc.onreadystatechange = menu_srchStateChangeHandler;
		g_xmlSearchDoc.load(strURL);
	}else{
		var oReq = new XMLHttpRequest();
		if(oReq.overrideMimeType) oReq.overrideMimeType('text/xml');
		oReq.onreadystatechange = function(){
			menu_srchStateChangeHandler(oReq);
		};
		oReq.open("GET", strURL);
		oReq.send(null);
	}
}
function menu_textSearchInit(){
	if(e_isIEBrowser){
		var strHtml = '<object id="MSXML3" classid="clsid:f5078f32-c551-11d3-89b9-0000f81fe221" codebase="msxml3.cab#version=8,00,7820,0" type="application/x-oleobject" style="display: none"></object>';
		document.body.insertAdjacentHTML("beforeEnd",strHtml);
		if (g_bXmlLoaded){
			try{frame_TextSearchResults.srch_changeXmlLoadState(4);}catch(e){}
		}
	}
	menu_textSearchLoad();
}
function menu_soundPlay(){
	var s_url = skin_soundURL;
	if(s_url.indexOf("://")<0){
		if(e_absHref.indexOf("file")==0) s_url = e_absHref.replace("%20"," ") + s_url;
		else s_url = e_absHref+s_url;
	}
	var sTmp=s_url.toLowerCase();
	if(sTmp.lastIndexOf(".mp3")==sTmp.length-4 || sTmp.lastIndexOf(".flv")==sTmp.length-4){
		document.dBook.handle_bgSound(true,s_url,true);
		if(window.addEventListener) window.addEventListener("keydown", menu_soundStop, true);
		else document.attachEvent("onkeydown", menu_soundStop);
	}else if(e_isIEBrowser){
		if(!document.album_sound){
			var strHtml = '<embed id="album_sound" name="album_sound" type="application/x-mplayer2" src="' + s_url + '"  autostart="1" EnableTracker="0" ShowControls="0" width="1" height="1" autoplay="true" controller="false" style="position:absolute;top:1px;left:1px;"></embed>';
			document.body.insertAdjacentHTML("beforeEnd",strHtml);
		}
	}
}
function menu_soundStop(evt){
	if(evt.keyCode==27) document.dBook.handle_bgSound(false,"",true);
	
}
function menu_addPlayerBtn(){
	var arrMenu=["menu_Search", "menu_Exif", "menu_AdditionalFunction", "menu_ImgCapture", "menu_CloseUp"];
	for(var i=0;i<arrMenu.length;i++){
		try{
			var obj=document.getElementById("menu_Search");
			if(obj){
				var parentTR=obj.parentNode;
				var insertObj=document.createElement("td");
				insertObj.setAttribute("id", "menu_Player");
				insertObj.setAttribute("name", "menu_Player");
				insertObj.setAttribute("align", "right");
				insertObj.setAttribute("valign", "middle");
				insertObj.innerHTML='<img src="images/menu_b_player.gif" onFocus="blur( )" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'menu_Btn_Player\',\'\',\'images/menu_b_player_on.gif\',1)" name="menu_Btn_Player" border="0" alt="Active DBook Player" style="cursor:pointer;" onClick="javascript:menu_dBookPlayer();">';
				parentTR.insertBefore(insertObj,obj);
				break;
			}
		}catch(e){}
	}
}
function menu_initEndHandler(){
	if( typeof(g_isEditable)=="undefined" ) g_isEditable=false;
	if( typeof(skin_bTextSearch)=="undefined" ) skin_bTextSearch=false;
	if( typeof(skin_bExif_Button)=="undefined" ) skin_bExif_Button=false;
	if( typeof(skin_bCloseUp_Button)=="undefined" ) skin_bCloseUp_Button=false;
	if( typeof(skin_bPhoto_Button)=="undefined" ) skin_bPhoto_Button=false;
	if( typeof(skin_bAdditionalFunttion_Button)=="undefined" ) skin_bAdditionalFunttion_Button=false;
	if( typeof(skin_bEditMemo_Button)=="undefined" ) skin_bEditMemo_Button=false;
	if( typeof(skin_bMyFavorite_Button)=="undefined" ) skin_bMyFavorite_Button=false;
	if( typeof(skin_bPrint_Button)=="undefined" ) skin_bPrint_Button=false;
	if( typeof(skin_bIndex_Button)=="undefined" ) skin_bIndex_Button=false;
	if( typeof(skin_bLink_Button)=="undefined" ) skin_bLink_Button=false;
	if( typeof(skin_bMedia_Button)=="undefined" ) skin_bMedia_Button=false;
	if( typeof(skin_bAutoFlip_Button)=="undefined" ) skin_bAutoFlip_Button=false;
	if( typeof(skin_eCommerceUse)=="undefined" ) skin_eCommerceUse="n";
	if( typeof(skin_bCompareImage_Button)=="undefined" ) skin_bCompareImage_Button=false;
	if( typeof(skin_bEditPen_Button)=="undefined" ) skin_bEditPen_Button=false;
	if( typeof(skin_bSearch)=="undefined" ) skin_bSearch=false;
	if( typeof(skin_bFullScreen)=="undefined" ) skin_bFullScreen=false;
	if( typeof(skin_bMedia)=="undefined" ) skin_bMedia=false;
	if( typeof(skin_bPageMarker_Button)=="undefined" ) skin_bPageMarker_Button=false;
	if( typeof(skin_boardPage)=="undefined" ) skin_boardPage=-1000;
	if( typeof(skin_boardPos)=="undefined" ) skin_boardPos="single";
	if( typeof(skin_soundURL)=="undefined" ) skin_soundURL="";
	if( typeof(skin_bUseImgCapture)=="undefined" ) skin_bUseImgCapture=false;
	if( typeof(skin_bUseTextCapture)=="undefined" ) skin_bUseTextCapture=false;
	if( typeof(MSG_FRONT_PAGE)=="undefined" ) MSG_FRONT_PAGE="F";
	if( typeof(MSG_REAR_PAGE)=="undefined" ) MSG_REAR_PAGE="R";
	if( typeof(MSG_DPAGE_EXPRESSION)=="undefined" ) MSG_DPAGE_EXPRESSION="{L}-{R}/{T}";
	if( typeof(MSG_SPAGE_EXPRESSION)=="undefined" ) MSG_SPAGE_EXPRESSION="{P}/{T}";
	if( typeof(skin_btnAct)=="undefined" ) skin_btnAct=true;
	
	if(!g_isEditable || !e_isIEBrowser){
		skin_bCompareImage_Button=false;
		skin_bPhoto_Button=false;
		skin_bMyFavorite_Button=false;
		if(!e_isIEBrowser){
			skin_bExif_Button=false;
			skin_bIndex_Button=false;
			skin_bUseImgCapture=false;
		}
		if(!g_isEditable){
			skin_bEditPen_Button=false;
			skin_bEditMemo_Button=false;
			skin_bLink_Button=false;
		}
	}
	if(g_isEditable && e_absURL.indexOf("file://")==0){
		skin_bEditPen_Button=false;
		skin_bEditMemo_Button=false;
		skin_bLink_Button=false;	
		skin_bMyFavorite_Button=false;
	}
	if(!(e_isIEBrowser || (window.XMLHttpRequest && window.DOMParser))){
		skin_bTextSearch=false;
		skin_bUseTextCapture=false;
	}
	if(!skin_bTextSearch) skin_bUseTextCapture=false;
	if(skin_bPhoto_Button) try{ menu_Photo.style.display=""; }catch(e){}
	if(skin_bTextSearch) try{ menu_TextSearch.style.display=""; }catch(e){}
	if(skin_bExif_Button) try{ menu_Exif.style.display=""; }catch(e){}
	if(skin_bCloseUp_Button) try{ menu_CloseUp.style.display=""; }catch(e){}	
	if(skin_bAdditionalFunttion_Button) try{ menu_AdditionalFunction.style.display=""; }catch(e){}
	if(skin_bSearch) try{ menu_Search.style.display=""; }catch(e){}
	if(skin_bIndex_Button) try{ menu_Index.style.display=""; }catch(e){}
	if(skin_bLink_Button) try{ menu_Link.style.display=""; }catch(e){}
	if(skin_bMedia_Button) try{ menu_Media.style.display=""; }catch(e){}
	if(skin_bAutoFlip_Button) try{ select_AutoFlip.style.display=""; }catch(e){}
	if(skin_bFullScreen) try{ menu_FullScreen.style.display=""; }catch(e){}
	if(skin_bPrint_Button) try{ menu_Print.style.display=""; }catch(e){}
	if(skin_bPageMarker_Button) try{ menu_PageMarker.style.display=""; }catch(e){}
	if(skin_bUseImgCapture) try{ menu_ImgCapture.style.display=""; }catch(e){}
	if(skin_bUseTextCapture) try{ menu_TextCapture.style.display=""; }catch(e){}
	if(e_bHavePlayer) try{ menu_Player.style.display=""; }catch(e){menu_addPlayerBtn();}
	if(skin_bTextSearch || skin_bExif_Button){
		if(skin_bTextSearch) ebook_showFrame("frame_TextSearchResults","appendix/TextSearch.htm", false, true);
		setTimeout("try{menu_textSearchInit();}catch(e){}",2000);
	}
	
	if(e_bHavePlayer && e_bAutoPlayer) setTimeout("try{menu_dBookPlayer();}catch(e){}",1000);
	else if(skin_soundURL.length>0) setTimeout("try{menu_soundPlay();}catch(e){}",1000);
}
function menu_startAutoFlipHandler(){
	menu_btn_AutoFlip_On.style.display="none";
	menu_btn_AutoFlip_Off.style.display="inline";
}
function menu_endAutoFlipHandler(){
	menu_btn_AutoFlip_Off.style.display="none";	
	menu_btn_AutoFlip_On.style.display="inline";
}
function menu_endFlipHandler(){
	var leftPage=-100, rightPage=-100;
	try{
		var realPage = dBook.handle_getCurRealPage();
		if(menu_Btn_GotoPreviousPage.style.display=="none"){
			menu_Btn_GotoFirstPage_no.style.display="none";
			menu_Btn_GotoFirstPage.style.display="";
			menu_Btn_GotoPreviousPage_no.style.display="none";
			menu_Btn_GotoPreviousPage.style.display="";
		}
		if(menu_Btn_GotoNextPage.style.display=="none"){
			menu_Btn_GotoNextPage_no.style.display="none";
			menu_Btn_GotoNextPage.style.display="";
			menu_Btn_GotoLastPage_no.style.display="none";
			menu_Btn_GotoLastPage.style.display="";
		}
		if( realPage<=1 ){
			if(e_isOldTurn){
				menu_Btn_GotoNextPage.style.display="none";
				menu_Btn_GotoNextPage_no.style.display="";
				menu_Btn_GotoLastPage.style.display="none";
				menu_Btn_GotoLastPage_no.style.display="";
			}else{
				menu_Btn_GotoFirstPage.style.display="none";
				menu_Btn_GotoFirstPage_no.style.display="";
				menu_Btn_GotoPreviousPage.style.display="none";
				menu_Btn_GotoPreviousPage_no.style.display="";
			}
		}
		if( (realPage>=e_totalPage) || (e_isDoublePage && !e_isOneImgTwoPage && realPage==(e_totalPage-1)) ){
			if(e_isOldTurn){
				menu_Btn_GotoFirstPage.style.display="none";
				menu_Btn_GotoFirstPage_no.style.display="";
				menu_Btn_GotoPreviousPage.style.display="none";
				menu_Btn_GotoPreviousPage_no.style.display="";
			}else{
				menu_Btn_GotoNextPage.style.display="none";
				menu_Btn_GotoNextPage_no.style.display="";
				menu_Btn_GotoLastPage.style.display="none";
				menu_Btn_GotoLastPage_no.style.display="";				
			}
		}
	}catch(e){}
	try{
		if( typeof(MSG_FRONT_PAGE)=="undefined" ) MSG_FRONT_PAGE="F";
		if( typeof(MSG_REAR_PAGE)=="undefined" ) MSG_REAR_PAGE="R";
		if( typeof(MSG_DPAGE_EXPRESSION)=="undefined" ) MSG_DPAGE_EXPRESSION="{L}-{R}/{T}";
		if( typeof(MSG_SPAGE_EXPRESSION)=="undefined" ) MSG_SPAGE_EXPRESSION="{P}/{T}";
		var vPage;
		var pageFix=ebook_getPageFix();
		var totPage =   dBook.handle_getSlideTotal()+e_pageFix;
		leftPage = dBook.handle_getLeftSlidePage()+pageFix;
		if(e_isDoublePage){
			if(leftPage<=0) leftPage=MSG_FRONT_PAGE;
			else if(leftPage>totPage) leftPage=MSG_REAR_PAGE;
			else leftPage=leftPage + "";
			rightPage=dBook.handle_getRightSlidePage()+pageFix;
			if(rightPage<=0) rightPage=MSG_FRONT_PAGE;
			else if(rightPage>totPage) rightPage=MSG_REAR_PAGE;
			else rightPage=rightPage + "";
			vPage=MSG_DPAGE_EXPRESSION;
			vPage=vPage.replace("{L}", leftPage);
			vPage=vPage.replace("{R}", rightPage);
			vPage=vPage.replace("{T}", totPage);
		}else{
			if(leftPage<=0) leftPage=MSG_FRONT_PAGE;
			else if(leftPage>totPage) leftPage=MSG_REAR_PAGE;
			else leftPage=leftPage + "";
			vPage=MSG_SPAGE_EXPRESSION;
			vPage=vPage.replace("{P}", leftPage);
			vPage=vPage.replace("{T}", totPage);
		}
		span_page.innerHTML = vPage;
	}catch(e){}
	try{
		if(e_isIEBrowser && typeof(skin_boardHost)!="undefined" &&  typeof(skin_boardSeq)!="undefined" && (skin_boardPage==leftPage ||  skin_boardPage==rightPage) ){
			if(skin_boardPage==rightPage) isRight=true;
			else isRight=false;
			menu_setBoard(skin_boardPage, isRight);
		}
	}catch(e){}
}
function menu_boardRightClick(evt){
	var zoomLevel = ebook_getCurrZoomStep();
	if(zoomLevel==e_fitZoomLevel){
		var isRightTurn=false;
		if(skin_boardPos=="single" && e_isDoublePage){
			if(g_boardIsRight) isRightTurn=true;
		}else{
			var oFrame = document.getElementById("album_board");
			if(e_isVerticalTurn){
				if( evt.y>(oFrame.style.height/2) ) isRightTurn=true;
			}else{
				if( evt.x> (e_viewRatio*oFrame.style.pixelWidth/2) ) isRightTurn=true;
			}
		}
		if(isRightTurn) ebook_pressRightPage();
		else ebook_pressLeftPage();
	}else{
		ebook_pressZoom(-1, evt.x, evt.y);
	}
}
function menu_setBoard(page, isRight){
	if( typeof(isRight)=="undefined" ) isRight=g_boardIsRight;
	else g_boardIsRight = isRight;
	var zRect = ebook_getCurZoomRect();
	
	var bndState = dBook.handle_getBoundState();
	var zoomLevel = ebook_getCurrZoomStep();
	var zoomRect = ebook_calcZoomRect( 0 );
	var ratio = e_viewRatio;
	if(zoomLevel>e_fitZoomLevel) ratio=Math.pow(2, zoomLevel);
	else if(zoomLevel==e_fitZoomLevel && e_fitZoomLevel==1) ratio=ratio*2;
	var oFrame = document.getElementById("album_board");
	if(!oFrame){
		var url = "http://"+skin_boardHost+"/boardx/list.asp?brd_id="+skin_boardSeq+"&brd_type=PageDependent";
		var sHtml = '<iframe id="album_board" name="album_board" src="'+url+'" scrolling="auto" frameborder="0" ';
		sHtml+='style="position:absolute;top:0px;left:0px;visibility:hidden;border:1px solid #cccccc;filter: Alpha(Opacity=90)"></iframe>';
		viewerDiv.insertAdjacentHTML("beforeEnd",sHtml);
		oFrame = document.getElementById("album_board");
	}
	var nGapX=15;
	var nGapY=20;
	var x=(ratio*nGapX - zRect.x);
	var y=(ratio*nGapY - zRect.y);
	var w = zoomRect.w-2*nGapX;
	var h = zoomRect.h-2*nGapY;
	if(skin_boardPos=="single" || bndState!="all"){ 
		if(e_isDoublePage && isRight){
			if(bndState=="all" || (bndState=="right" && zoomLevel>e_fitZoomLevel)){
				if(e_isVerticalTurn) y=y + ratio*zoomRect.h/2;
				else x = x + ratio*zoomRect.w/2;
			}else if(bndState=="left"){
				
			}
		}
		if(e_isDoublePage){
			if(e_isVerticalTurn) h = zoomRect.h/2-2*nGapY;
			else w = zoomRect.w/2-2*nGapX;
		}
	}
	oFrame.style.left=x;
	oFrame.style.top=y;
	oFrame.style.width=w*ratio;
	oFrame.style.height=h*ratio;
	oFrame.style.visibility="visible";
}
function menu_startFlipHandler(){
	var oFrame = document.getElementById("album_board");
	if(oFrame && oFrame.style.visibility=="visible") oFrame.style.visibility="hidden";
}
function menu_resizeHandler(){
	var oFrame = document.getElementById("album_board");
	if(oFrame && oFrame.style.visibility=="visible"){
		menu_setBoard(skin_boardPage);
	}
}
function menu_scrollHandler(){
	var oFrame = document.getElementById("album_board");
	if(oFrame && oFrame.style.visibility=="visible"){
		menu_setBoard(skin_boardPage);
	}
}
ebook_addEventListener("initEnd", "menu_initEndHandler");
ebook_addEventListener("startAutoFlip","menu_startAutoFlipHandler");
ebook_addEventListener("endAutoFlip","menu_endAutoFlipHandler");
ebook_addEventListener("endFlip","menu_endFlipHandler");
ebook_addEventListener("startFlip","menu_startFlipHandler");
ebook_addEventListener("resizeAll","menu_resizeHandler");
ebook_addEventListener("scroll","menu_scrollHandler");
function menu_gotoEditWork(work){
	view_gotoWork(work);
}
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 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_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 openReplace(win_url){
    var screen_width = 1024 - 10; 
    var screen_height = 768 - 30; 
    strFeatures = "left=0,top=0,width=" + screen_width + ",height=" + screen_height + ","; 
    strFeatures += "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes";
    var windowname=window.open( win_url, "AlbumPopup", strFeatures ); 
    windowname.focus(); 
    return; 
}
function menu_getOrgFile(isRight){
	var orgFolder = e_absURL + "data/src/";
	var orgFile = menu_getOrgFileName(isRight);
	if(orgFile.length==0 ) return;
	var oLink = document.getElementById("org_Link");
	try{
		oLink.href = orgFolder + orgFile;
		oLink.click();
	}catch(e){
		var oLink = document.createElement("a");
		oLink.id = "org_Link";
		oLink.target = "_blank";
		oLink.style.position="absolute";
		oLink.style.top="0px";
		oLink.style.left="0px";
		document.body.appendChild( oLink );
		oLink.href = orgFolder + orgFile;
		oLink.click();
	}
}
function menu_getOrgFileName(isRight){
	var page=document.dBook.handle_getCurRealPage();
	if(e_isDoublePage && !e_isOneImgTwoPage){
		if(isRight && !e_isOldTurn) page=page+1;
		else if(!isRight && e_isOldTurn) page=page+1;
	}
	var ret="";
	try{
		var oPageDocList = g_xmlSearchDoc.documentElement.selectNodes("//page[@pageID='"+page+"']");
		if( oPageDocList.length>0 ) ret = oPageDocList.item(0).attributes.getNamedItem("origFileName").value;
	}catch(e){}
	return ret;
}

function menu_downloadOrgFile(isRight){
	var orgFolder = e_absURL + "data/src/";
	var orgFile = menu_getOrgFileName(isRight);
	if(orgFile.length==0 ) return;

	var oLink = document.getElementById("org_Link");
	try{
		oLink.href ="/down/download_largeFile.asp?url="+orgFolder + orgFile;
 		oLink.click();
	}catch(e){
		var oLink = document.createElement("a");
		oLink.id = "org_Link";
		oLink.target = "_self";
		oLink.style.position="absolute";
		oLink.style.top="0px";
		oLink.style.left="0px";
		document.body.appendChild( oLink );
		oLink.href = "/down/download_largeFile.asp?url="+orgFolder + orgFile;
		oLink.click();
	}

}

