var strVersion="2.08a";var strVerDate="20231126.1";var _DEBUG=false;var _CONTEXTMENU=true;var _LAYER_DEBUG=false;var saudio=null;var audio=null;var canvas=null;var bQuickDaisy=false;var bSubLayerOnly=false;var dt=new Date();var vAlwaysShowVertToHorz=false;var vAlwaysVertivalLayout=false;var bAudioNoChath=false;var bImageZoomState=false;var nTimeDiffToBack=0.4;var bPrevKeyRepeat=true;var ctx=null;var bChattyBooksMode;var glipItem=null;var bOverlapAreaMouseDown=false;var bHideOverlapAreaTimer=false;var nDispMode=0;var bHideToolBar=false;var bEasyCaption=false;var nLineReadStop=-1;var bLineReadStopPause=false;var bRepeatFrace=false;var bChattyBooks=false;var bChattyInftyContent=false;var bWin=false;var bIE=false;var bEdge=false;var bChrome=false;var bFireFox=false;var bSafari=false;var iPad=false;var iPod=false;var iPhone=false;var iOS5=false;var bAndroid=false;var bAdjustStartFaster=false;var bMacOS=false;var bChattyInfty3=false;var bLocalFile=false;var strActiveSettingItem='';var nSettinItemTimerID=-1;var nActiveSettingItemColor=0;var bActiveSettingItemColor=false;var cPageDatas=null;var cLayoutData=null;var bShowLayoutCode=false;var nViewArea=0;var strMathImagePathNA='';var strMathImagePathHI='';var nStartX=null;var nStartY=null;var ScrollPos={x:0,y:0};var ScrollRange={x:0,y:0};var bTocClicked=false;var contentArea;var content;var toc;var overlapArea=null;var settingFrame=null;var bibinfoFrame=null;var indexArea=null;var indexListArea=null;var waitingArea=null;var waitingRate=null;var vertSplit=null;var nVertSplit=250;var pageListArea=null;var nZoomValue=100;var nTempScrollStep=nSoftScrollStep;var strLayoutData=null;var nRubyLevel=0;var statusArea=null;var bDoubleSpeed=false;var bDoubleSpeedMode=false;var bResumeSupport=true;var bResumeMode=true;var strContentDirection='horz';var bVerticalButtuon=false;var cAddAreaAudio=null;var cAddAreaSmils=null;var bAddEditMode=false;var strIndexis=new Array();var cssColors=null;var cssRybyLevel=null;var cssAnimations=null;var cssCellStyle=null;var bWbrEnable=false;var bWbrExEnable=false;var cssWbrStyle=null;var bSilentToWbr=true;var bTableReadMode=0;var bCellHighlight=0;var cActiveCell=null;var markerMode=false;var markerIndex=0;var markerType=0;var markerModifyed=false;var bScrollMode=true;var bScriptScroll=false;var nScrollEventTime=-1;var progressPaneSpeed=null;var progressPaneFont=null;var cssSvgMath=null;var nAutomaticTest=undefined;var nAutomaticTestState=0;var m_hSoftScrollTimerID=null;var gContentItem=null;var sTime=new Date().getTime();var cCiStyleH=null;var cCiStyleV=null;Sh5AddEventProc(window,'load',SH5Initalize);Sh5AddEventProc(window,'unload',SH5Exit);function Sh5AddEventProc(obj,eventname,funcname){if(obj!=null&&obj!=undefined){if(obj.addEventListener!=undefined){obj.addEventListener(eventname,funcname);}else{obj.attachEvent('on'+eventname,funcname);}return true;}return false;}
function Sh5RemoveEventProc(obj,eventname,funcname){if(obj!=null&&obj!=undefined){if(obj.removeEventListener!=undefined){obj.removeEventListener(eventname,funcname);}else{obj.detachEvent('on'+eventname,funcname);}return true;}return false;}
String.prototype.right=function(nLen){var strResult=this.valueOf();strResult=strResult.substr(strResult.length-nLen,nLen);return strResult;}
String.prototype.filename=function(bExt){var r=null;if(bExt===false){r=this.match(".+/(.+?)\.[a-z]+([\?#;].*)?$");}else{r=this.match(".+/(.+?)([\?#;].*)?$");}
if(r){return r[1];}}
var WMPPlayState={wmppsUndefined:0,wmppsStopped:1,wmppsPaused:2,wmppsPlaying:3,wmppsScanForward:4,wmppsScanReverse:5,wmppsBuffering:6,wmppsWaiting:7,wmppsMediaEnded:8,wmppsTransitioning:9,wmppsReady:10,wmppsReconnecting:11,wmppsLast:12};var LineReadMode={lrmAll:0,lrmLine:1,lrmBlock:2};function dump_event(strText,color){var eventArea=document.getElementById("dumpArea");var audioDump=document.getElementById("audio_dump");if(audioDump==null){}
if(eventArea){var item=document.createElement("p");var d=new Date;var tm=d.toLocaleTimeString();item.style.margin='0';item.style.padding='0';item.style.textOverflow='ellipsis';item.style.whiteSpace='nowrap';if(saudio.bIntervalID<0){item.innerHTML=tm+' (--) '+strText;}else{item.innerHTML=tm+' ('+(saudio.bIntervalID+100).toString(10).right(2)+') '+strText;}
if(color){item.style.color=color;}
if(eventArea.firstChild==null){eventArea.appendChild(item);}else{try{eventArea.insertBefore(item,eventArea.firstChild);}catch(e){}}}}
var Sh5Audio=function(aAudioItems){Sh5Audio.prototype.AudioEventProc=function(event){if(event.type=='canplaythrough'||event.type=='suspend'){if(window.waitingArea!=null&&window.waitingArea.className!=''){var audio=event.target;window.waitingArea.className='';}}return;}
Sh5Audio.prototype.OnClick=function(event){return false;}
Sh5Audio.prototype.OnItemClick=function(event){var elem=event.target;window.bControlKey=(event.ctrlKey)? true:undefined;window.bTableReadMode=0;if(elem&&elem.tagName=='P'&&(elem.parentElement.tagName=='TH'||elem.parentElement.tagName=='TD')){elem=elem.parentElement;}
if(elem&&(elem.tagName=='TH'||elem.tagName=='TD')){var temp=elem.querySelector("*.read");if(temp){elem=temp;}}
if(elem&&typeof elem.className=='string'&&elem.className.indexOf("wbrspan")!=-1){elem=elem.parentNode;}
while(elem&&(typeof elem.className!='string'||elem.className.indexOf("read")==-1)){elem=elem.parentNode;}
if(elem&&typeof elem.className=='string'&&elem.className.indexOf("wbrspan")!=-1){elem=elem.parentNode;}
if(elem&&elem.cSmilItem&&elem.cSmilItem.Sh5Audio){if(event.type!==undefined&&event.type=='click'&&elem.parentCell&&window.bTableReadMode==0&&!event.resumeTarget){window.bTableReadMode=1;}else if(!elem.parentCell&&window.bTableReadMode!=0){window.bTableReadMode=0;}
if(elem.cSmilItem.Sh5Audio.OnClick(event)){return false;}
if(elem.cSmilItem.Sh5Audio.cNextItem){elem.cSmilItem.Sh5Audio.cNextItem=undefined;}
elem.cSmilItem.Sh5Audio.SetActiveItem(elem.cSmilItem,event.resumeTarget);return true;}else if(elem&&elem.nextReadItem){var next=elem.nextReadItem;do{if(next&&next.cSmilItem&&next.cSmilItem.Sh5Audio){next.cSmilItem.Sh5Audio.SetActiveItem(next.cSmilItem);return true;}
next=next.nextReadItem;}while(next);}return false;}
this.audio=null;this.bWM7=false;this.bIntervalID=-1;this.source=null;this.cActiveItem=null;this.cPlayList=null;this.nSpeed=100;this.nVolume=100;this.cSmilItems=null;this.cAudioFiles=null;this.cFirstSmilItem=null;this.bPlaying=false;this.bDoubleSpeed=false;this.bDoubleSpeedMode=false;this.nLineReadMode=LineReadMode.lrmAll;this.bRateChangeStatus=false;this.nLineReadTimerID=-1;Sh5Audio.prototype.AudioEvent_LoadStart=function(event){document.body.setAttribute('audio_loading','true');}
Sh5Audio.prototype.AudioEvent_Suspend=function(event){document.body.removeAttribute('audio_loading');}
Sh5Audio.prototype.AudioEvent_Play=function(event){console.log(`AudioEvent_Play ${dt.toString()}`);dump_event("<b>AudioEvent_Play</b>","blue");var cThis=event.target.Sh5Audio;var nReadStartTime=0;var nReadStopTime=0;var bInterval=false;var bNotEqualNextAudio=false;document.body.setAttribute('mode','play');document.body.className=document.body.className.replace(/\ mode_pause/g,'');document.body.className+=' mode_play';if(window.nPlayIntervalTimer!==undefined){clearTimeout(window.nPlayIntervalTimer);window.nPlayIntervalTimer=undefined;}
if(cThis.nLineReadTimerID!=-1){clearInterval(cThis.nLineReadTimerID);cThis.nLineReadTimerID=-1;}
if(cThis.nLineReadMode==LineReadMode.lrmBlock){nReadStartTime=cThis.cActiveItem.begin;nReadStopTime=cThis.cActiveItem.end;}else if(cThis.nLineReadMode==LineReadMode.lrmLine){var element=cThis.cActiveItem.element;while(element!=null&&element.bLineLast!==true){if(element.cSmilItem&&element.cSmilItem.nextItem&&element.cSmilItem.nextItem.element){element=element.cSmilItem.nextItem.element;}else{element=null}}
if(element&&element.bLineLast){nReadStartTime=element.cSmilItem.begin;nReadStopTime=element.cSmilItem.end;}}else if(cUserSetting.interval&&!IsNextLayerGtoupItem(cThis.cActiveItem)){nReadStartTime=cThis.cActiveItem.begin;nReadStopTime=cThis.cActiveItem.end;bInterval=true;}else if(window.bTableReadMode){if(window.cActiveCell&&window.cActiveCell.cSmilItem&&window.cActiveCell.cSmilItem.cWorkSmils&&window.cActiveCell.cSmilItem.cWorkSmils.length){var a=0;}
nReadStartTime=cThis.cActiveItem.begin;nReadStopTime=cThis.cActiveItem.end;}else if(cThis.cActiveItem!==undefined&&cThis.cActiveItem.IsPlayModeStop()){nReadStartTime=cThis.cActiveItem.begin;nReadStopTime=cThis.cActiveItem.end;}else if(cThis.nLineReadMode==LineReadMode.lrmAll){if(cThis.cActiveItem.nextItem&&cThis.cActiveItem.nextItem.src&&cThis.cActiveItem.src.file!=cThis.cActiveItem.nextItem.src.file){nReadStartTime=cThis.cActiveItem.begin;nReadStopTime=cThis.cActiveItem.end;bNotEqualNextAudio=true;}}
if(window.bAdjustStartFaster){if(0.5<nReadStopTime){nReadStopTime-=(window.bChattyInfty3===true)? 0.2:0.5;}}
if(0<nReadStopTime){if(!bSafari&&(nReadStopTime-nReadStartTime)<1.0){nReadStopTime-=0.1;}else if(bChattyInfty3&&0.1<nReadStopTime){nReadStopTime-=0.10;}else if(!bNotEqualNextAudio&&0.35<nReadStopTime){nReadStopTime-=0.35;}
cThis.nLineReadTimerID=setInterval(cThis.ItemLastPauseEvent,10,cThis,nReadStopTime,bInterval);}
cThis.bPlaying=true;cThis.OnPlay();}
Sh5Audio.prototype.ItemLastPauseEvent=function(cThis,nReadStopTime,bInterval){var currentTime=cThis.audio.currentTime;if(nReadStopTime<=currentTime){console.log(`Over Time ${dt.toString()}`);dump_event("Over Time");clearInterval(cThis.nLineReadTimerID);cThis.nLineReadTimerID=-1;window.AutoPauseStatus=true;cThis.audio.pause();if(cThis.nLineReadMode==LineReadMode.lrmAll&&window.bTableReadMode&&IsEqualCell(cThis.cActiveItem,cThis.cActiveItem.nextItem)){cThis.SetActiveItem(cThis.cActiveItem.nextItem);}else if(cThis.nLineReadMode==LineReadMode.lrmAll&&cThis.cActiveItem.nextItem&&cThis.cActiveItem.nextItem.src&&cThis.cActiveItem.src.file!=cThis.cActiveItem.nextItem.src.file){cThis.SetActiveItem(cThis.cActiveItem.nextItem);}else if(bInterval===true){window.bPlayIntervalWaite=true;window.nPlayIntervalTimer=setTimeout(function(cThis){if(window.bPlayIntervalWaite===true){cThis.SetActiveItem(cThis.cActiveItem.nextItem);}
window.nPlayIntervalTimer=undefined;},cUserSetting.interval * parseInt(1000 * cSettingItems.interval.rate),cThis);}}}
Sh5Audio.prototype.AudioEvent_Pause=function(event){dump_event("AudioEvent_Pause","red");document.body.className=document.body.className.replace(/\ mode_play/g,'');document.body.className+=' mode_pause';document.body.setAttribute('mode','pause');}
Sh5Audio.prototype.AudioEvent_Seek=function(event){var cThis=event.target.Sh5Audio;if(cThis.cWorkSmil&&cThis.cWorkSmil.begin==cThis.audio.currentTime){cThis.audio.play();}}
if(!this.audio){this.audio=document.createElement('audio');this.audio.preload="auto";this.audio.controls=true;this.audio.onended=function(event){var cThis=event.target.Sh5Audio;cThis.bPlaying=false;cThis.Ended();}
Sh5AddEventProc(this.audio,'play',this.AudioEvent_Play);Sh5AddEventProc(this.audio,'pause',this.AudioEvent_Pause);Sh5AddEventProc(this.audio,'seeked',this.AudioEvent_Seek);if(window.bMacOS){Sh5AddEventProc(this.audio,'loadstart',this.AudioEvent_LoadStart)
Sh5AddEventProc(this.audio,'suspend',this.AudioEvent_Suspend)}
this.audio.onplaying=function(event){window.AutoPauseStatus=undefined;var cThis=event.target.Sh5Audio;this.Sh5Audio.bPlaying=true;}
this.audio.onpause=function(event){var cThis=event.target.Sh5Audio;cThis.bPlaying=false;cThis.OnPause();}
this.audio.onloadstart=function(event){if(window.waitingArea==null){CreateWaitingArea();}
if(window.waitingArea!=null&&window.bLocalFile==false){window.waitingArea.className='show';window.waitingRate.textContent='';}}
this.audio.onprogress=function(event){if(window.waitingArea!=null&&window.waitingArea.className!=''&&window.waitingRate!=null){var audio=event.target;if(audio.buffered!=undefined&&audio.buffered.end!=undefined&&audio.buffered.end.length!=undefined){var rate=0;try{rate=audio.buffered.end(0);}catch(e){rate=0;}
window.waitingRate.textContent=Math.floor(rate * 100)+'%';}}}
if(window.bMacOS==false){Sh5AddEventProc(this.audio,'canplaythrough',this.AudioEventProc);}
Sh5AddEventProc(this.audio,'suspend',this.AudioEventProc);this.audio.volume=this.nVolume/100.0;this.audio.defaultPlaybackRate=cUserSetting.speed/10;}
if(this.audio){if(window._DEBUG){this.audio.style.display='inline-block';this.audio.style.position='absolute';this.audio.style.right='20px';this.audio.style.top='10px';this.audio.style.zIndex='99998';this.audio.style.opacity='0.6';var div=document.createElement("div");div.id='dumpArea';div.ondblclick=function(){var dumpArea=document.getElementById('dumpArea');var paras=dumpArea.querySelectorAll('p');for(var p=0;p<paras.length;p++){paras[p].parentElement.removeChild(paras[p]);}};document.body.appendChild(div);div=document.createElement("div");div.id='audio_dump';div.audio=this.audio;document.getElementById('dumpArea').appendChild(div);document.getElementById('dumpArea').appendChild(this.audio);var audioDumpScript=document.createElement('script');audioDumpScript.onload=function(){SetAudioEventDumpProc(saudio.audio);}
audioDumpScript.type='text/javascript';audioDumpScript.src='./scripts/audiodebug.js';document.head.appendChild(audioDumpScript);setInterval(function(e){var audio_dump=document.getElementById('audio_dump');audio_dump.textContent=audio_dump.audio.currentTime;},10);}else{this.audio.style.display='none';}
if(!this.audio.parentElement){document.body.appendChild(this.audio);}}
this.audio.Sh5Audio=this;Sh5Audio.prototype.SetPlaybackRate=function(nRate){if(nRate==undefined){nRate=this.nSpeed/100.0;}
try{this.audio.defaultPlaybackRate=nRate;}catch(e){}
try{this.audio.playbackRate=nRate;}catch(e){}}
Sh5Audio.prototype.GetLineReadMode=function(){return this.nLineReadMode;}
Sh5Audio.prototype.SetLineReadMode=function(nMode){if(typeof nMode==='number'){if(nMode!=this.nLineReadMode){if(window._DEBUG){dump_event("Sh5Audio.SetLineReadMode ("+nMode+")","#0A0");}
switch(nMode){case 0:this.nLineReadMode=LineReadMode.lrmAll;break;case 1:this.nLineReadMode=LineReadMode.lrmLine;break;case 2:this.nLineReadMode=LineReadMode.lrmBlock;break;default:return false;}}return true;}else{if(window._DEBUG){dump_event("Sh5Audio.SetLineReadMode Error! ("+nMode+")","red");}}return false;}
Sh5Audio.prototype.OnIntervalEvent=function(source,currentTime){return true;}
Sh5Audio.prototype.StartInterval=function(){this.ResetInterval();dump_event("<i>StartInterval --------------------------</i>");if(window._DEBUG){var eventArea=document.getElementById("dumpArea");eventArea.style.backgroundColor='rgba(192,255,192,0.5)';}
this.bIntervalID=setInterval(Sh5Audio.prototype.StartIntervalProc,20,this);}
Sh5Audio.prototype.StartIntervalProc=function(cThis){if(window.cActiveCell&&window.cActiveCell.cSmilItem&&window.cActiveCell.cSmilItem.cWorkSmils&&0<window.cActiveCell.cSmilItem.cWorkSmils.length){}else if(cThis!=undefined){var curTime=cThis.GetCurrentTime();var curItem=cThis.cSmilItems.find(cThis.source,curTime);curTime-=0.4;if(cThis.cActiveItem&&cThis.cActiveItem.end<curTime&&cThis.cActiveItem.nextItem&&cThis.cActiveItem.audioSrc!=cThis.cActiveItem.nextItem.audioSrc){cThis.SetActiveItem(cThis.cActiveItem.nextItem);}else if(curItem&&cThis.cActiveItem){if(curItem==cThis.cActiveItem){var a=0;}else if(curItem==cThis.cActiveItem.nextItem){if(cThis.nLineReadMode==LineReadMode.lrmBlock){return;}
if((cThis.nLineReadMode==LineReadMode.lrmAll||(cThis.nLineReadMode==LineReadMode.lrmLine&&curItem.element&&!curItem.element.bLineFirst))){var oldItem=cThis.cActiveItem;var skipItem=undefined;while(curItem!==undefined&&curItem.IsPlayModeSkip()){if(0<=curItem.IsPlayModeSkip()){skipItem=curItem=curItem.nextItem;}else{break;}}
if(skipItem!==undefined){cThis.SetActiveItem(skipItem);return;}
cThis.cActiveItem=curItem;if(window.bTableReadMode==1&&curItem.element.parentCell!=undefined&&!IsEqualCell(curItem.element,oldItem.element)){if(IsEqualTable(curItem.element,oldItem.element)){cThis.Pause();window.bTableReadMode=0;curItem.element.bCellReadPause=true;}else{SetElementColor(oldItem.element,0);SetElementColor(curItem.element,1);ReadItemAdjustScroll(curItem.element);cThis.Pause();}}else{if(curItem.cAudioItem!==undefined&&curItem.IsPlayModeStop()){console.log('PLAY=STOP');cThis.ItemChanged(curItem.element,oldItem.element);cThis.nLineReadTimerID=setInterval(cThis.ItemLastPauseEvent,10,cThis,curItem.end-0.1,false);return;}else{cThis.ItemChanged(curItem.element,oldItem.element);}}}else{}}else if(cThis.cActiveItem.src&&cThis.cActiveItem.nextItem&&cThis.cActiveItem.src!=cThis.cActiveItem.nextItem.src){if(cThis.nLineReadMode==LineReadMode.lrmLine&&cThis.cActiveItem.nextItem.element&&!cThis.cActiveItem.nextItem.element.bLineFirst){cThis.SetActiveItem(cThis.cActiveItem.nextItem);}else if(cThis.cActiveItem.nextItem&&cThis.cActiveItem.nextItem.element&&cThis.cActiveItem.nextItem.element.id.substr(0,8)=='addarea_'){cThis.SetActiveItem(cThis.cActiveItem.nextItem);}}else{var a=0;}}
cThis.OnIntervalEvent(cThis.source,curTime);}}
Sh5Audio.prototype.ResetInterval=function(){if(window._DEBUG){var eventArea=document.getElementById("dumpArea");eventArea.style.backgroundColor='rgba(255,255,192,0.5)';}
if(this.bIntervalID!=-1){dump_event("<i style='color:red;'>ResetInterval --------------------------</i>");clearInterval(this.bIntervalID);this.bIntervalID=-1;if(this.cActiveItem&&!this.cActiveItem.nextItem&&!saudio.bWM7&&saudio.audio&&saudio.audio.duration<saudio.audio.currentTime){var stop=0;}}}
Sh5Audio.prototype.PlayStateChange=function(nState){var s='<span style="color:red;">['+(100+nState).toString(10).right(2)+']</span> ';switch(nState){case WMPPlayState.wmppsUndefined:dump_event(s+'wmppsUndefined');break;case WMPPlayState.wmppsStopped:dump_event(s+'wmppsStopped');break;case WMPPlayState.wmppsPaused:dump_event(s+'wmppsPaused');break;case WMPPlayState.wmppsPlaying:dump_event(s+'wmppsPlaying','blue');break;case WMPPlayState.wmppsScanForward:dump_event(s+'wmppsScanForward');break;case WMPPlayState.wmppsScanReverse:dump_event(s+'wmppsScanReverse');break;case WMPPlayState.wmppsBuffering:dump_event(s+'wmppsBuffering');break;case WMPPlayState.wmppsWaiting:dump_event(s+'wmppsWaiting');break;case WMPPlayState.wmppsMediaEnded:dump_event(s+'wmppsMediaEnded','red');break;case WMPPlayState.wmppsTransitioning:dump_event(s+'wmppsTransitioning');break;case WMPPlayState.wmppsReady:dump_event(s+'wmppsReady');break;case WMPPlayState.wmppsReconnecting:dump_event(s+'wmppsReconnecting');break;case WMPPlayState.wmppsLast:dump_event(s+'wmppsLast');break;default:dump_event(s+'Unknown','#888');break;}
switch(nState){case WMPPlayState.wmppsUndefined:break;case WMPPlayState.wmppsStopped:break;case WMPPlayState.wmppsPaused:if(this.bRateChangeStatus){this.bRateChangeStatus=false;this.audio.settings.rate=this.nSpeed/100.0;this.OnPause();this.nSeekPosition=this.audio.controls.currentPosition;setTimeout(function(cThis){cThis.audio.controls.play();},100,this);}else{this.bPlaying=false;this.audio.settings.rate=1;this.OnPause();}
break;case WMPPlayState.wmppsPlaying:setTimeout(function(cThis){if(cThis.nSeekPosition){cThis.audio.controls.currentPosition=cThis.nSeekPosition;cThis.nSeekPosition=undefined;}
cThis.bPlaying=true;cThis.OnPlay();cThis.StartInterval();},50,this);break;case WMPPlayState.wmppsScanForward:break;case WMPPlayState.wmppsScanReverse:break;case WMPPlayState.wmppsBuffering:break;case WMPPlayState.wmppsWaiting:break;case WMPPlayState.wmppsMediaEnded:this.ResetInterval();this.bPlaying=false;this.Ended();break;case WMPPlayState.wmppsTransitioning:try{if(this.audio.settings&&this.audio.settings.rate){this.audio.settings.rate=this.nSpeed/100.0;}}catch(e){}
try{if(this.nSeekPosition){this.audio.controls.currentPosition=this.nSeekPosition;this.nSeekPosition=undefined;}}catch(e){}
break;case WMPPlayState.wmppsReady:try{if(this.audio.settings&&this.audio.settings.rate){this.audio.settings.rate=this.nSpeed/100.0;}}catch(e){}
break;case WMPPlayState.wmppsReconnecting:break;case WMPPlayState.wmppsLast:break;}}
Sh5Audio.prototype.SetActiveItem=function(elem,bResumeStart){var strSource=null;var cSmilItem=null;SetReadCellEffect();if(this.nLineReadTimerID!=-1){clearInterval(this.nLineReadTimerID);this.nLineReadTimerID=-1;}
if(window.nPlayIntervalTimer!=undefined){clearTimeout(window.nPlayIntervalTimer);window.nPlayIntervalTimer=undefined;}
if(elem!==undefined&&elem.nodeType!==undefined){cSmilItem=elem.cSmilItem;}else if(elem!==undefined&&elem.element!==undefined){cSmilItem=elem;elem=cSmilItem.element;}else{return false;}
if(this.nWorkIntervalID){clearInterval(this.nWorkIntervalID);this.nWorkLoopState=undefined;this.cWorkSmil=undefined;this.nWorkIntervalID=undefined;}
if(window.cActiveCell!=null){if(window.cActiveCell.cSmilItem&&window.cActiveCell.cSmilItem.cWorkSmils){window.cActiveCell.cSmilItem.cWorkSmils=undefined;}
window.cActiveCell=null;}
if(window.bTableReadMode&&window.bControlKey&&elem.parentCell&&elem.parentCell.cSmilItem&&elem.parentCell.cSmilItem.cSubSmils){dump_event("Create Work Smils");window.cActiveCell=elem.parentCell;window.cActiveCell.cSmilItem.cWorkSmils=[];var hr;for(hr=0;hr<window.cActiveCell.cSmilItem.cSubSmils.length;hr++){window.cActiveCell.cSmilItem.cWorkSmils[hr]=window.cActiveCell.cSmilItem.cSubSmils[hr];}
var curItem=window.cActiveCell.cSmilItem.element;var nextItem=curItem.nextReadItem;while(nextItem&&nextItem.parentCell&&curItem.parentCell&&nextItem.parentCell.cellPos==curItem.parentCell.cellPos){window.cActiveCell.cSmilItem.cWorkSmils[hr++]=nextItem.cSmilItem;nextItem=nextItem.nextReadItem;}}
if(window.bControlKey){window.bControlKey=undefined;}
dump_event("<b>SetActiveItem "+(elem&&elem.id ? elem.id:'')+"</b>");if(cSmilItem&&cSmilItem.cWorkSmils){this.ResetInterval();this.audio.pause();var cOldItem=this.cActiveItem ? this.cActiveItem.element:null;this.cActiveItem=cSmilItem;this.ItemChanged(this.cActiveItem.element,cOldItem);this.audio.onseeked=function(event){var cThis=event.target.Sh5Audio;dump_event("audio.play(#3)","red");cThis.audio.onseeked=null;cThis.audio.play();}
this.nWorkLoopState=true;this.cWorkSmil=null;dump_event("WorkInterval Start");this.nWorkIntervalID=setInterval(function(cThis){if(cThis.cWorkSmil==null){if(cThis.cActiveItem.cWorkSmils&&0<cThis.cActiveItem.cWorkSmils.length){cThis.cWorkSmil=cThis.cActiveItem.cWorkSmils[0];if(cThis.cActiveItem.cWorkSmils.length==1){cThis.cLastWorkSmil=cThis.cWorkSmil;}
var his=document.querySelectorAll("*.sh5_highlight");for(var h=0;h<his.length;h++){his[h].className=his[h].className.replace("sh5_highlight",'').trim();}
cThis.cActiveItem.cWorkSmils.shift();SetReadCellEffect(cThis.cActiveItem.element,cThis.cWorkSmil.element);SetElementColor(cThis.cWorkSmil.element,1);ReadItemAdjustScroll(cThis.cWorkSmil.element,true);if(cThis.source!=cThis.cWorkSmil.src.file){cThis.audio.onloadeddata=function(event){var cThis=event.target.Sh5Audio;cThis.audio.currentTime=cThis.cWorkSmil.begin;}
cThis.audio.src=cThis.source=cThis.cWorkSmil.src.file;}else{try{cThis.audio.currentTime=cThis.cWorkSmil.begin;}catch(e){}}}else{SetReadCellEffect();cThis.ResetInterval();clearInterval(cThis.nWorkIntervalID);cThis.nWorkLoopState=undefined;cThis.cWorkSmil=undefined;cThis.nWorkIntervalID=undefined;window.bTableReadMode=0;var reads;try{if(cThis.cLastWorkSmil!=undefined&&cThis.cLastWorkSmil!=null){var elem=cThis.cLastWorkSmil.element;cThis.cActiveItem=cThis.cLastWorkSmil;SetElementColor(cThis.cLastWorkSmil.element,1);if(cThis.cActiveItem&&cThis.cActiveItem.element){SetElementColor(cThis.cActiveItem.element,0);}
cThis.cLastWorkSmil=undefined;}}catch(e){var ee=e;}}}else{if(cThis.cWorkSmil&&cThis.cWorkSmil.end<=(cThis.audio.currentTime+0.4)){cThis.audio.pause();cThis.cWorkSmil=null;}}},10,this);}else if(cSmilItem&&cSmilItem.src&&(strSource=cSmilItem.src.file)!=null){var cOldItem=this.cActiveItem ? this.cActiveItem.element:null;this.cActiveItem=cSmilItem;try{if(this.source==strSource){this.audio.onseeked=function(event){var cThis=event.target.Sh5Audio;cThis.StartInterval();cThis.audio.onseeked=null;dump_event("<b>audio.play(#5)</b>","red");setTimeout(function(cThis){dump_event("<b>audio.play(#5)</b>","blue");try{saudio.audio.play();}catch(e){console.log(`Seeked Play Error!`);}},50,cThis);return;}
if(this.audio.currentTime!=this.cActiveItem.begin){this.audio.pause();var seekTime=this.cActiveItem.begin;if(window.bAdjustStartFaster){if(0.5<seekTime){seekTime-=(window.bChattyInfty3===true)? 0.2:0.5;}}else{if(0.1<seekTime){seekTime-=0.05;}}
this.audio.currentTime=seekTime;}else{this.StartInterval();dump_event("audio.play(#1)","red");this.audio.play();}}else{this.ResetInterval();this.audio.onsuspend=function(event){var cThis=event.target.Sh5Audio;var cThis=event.target.Sh5Audio;if(window.bMacOS&&cThis.audio.buffered.end(0)<cThis.audio.duration){return;}
cThis.audio.oncanplaythrough=cThis.audio.onsuspend=null;cThis.audio.onseeked=function(event){var cThis=event.target.Sh5Audio;cThis.audio.onseeked=null;dump_event("【onseeked】●●●●●");cThis.audio.onplay=function(event){dump_event("Audio Element Started");event.target.Sh5Audio.StartInterval();}
cThis.SetPlaybackRate();cThis.StartInterval();try{dump_event("audio.play(#4)","red");cThis.audio.onseeked=null;if(bResumeStart!==true){cThis.audio.play();}}catch(e){dump_event("autio.play errr!");}}
if(cThis.audio.paused==false){cThis.audio.pause();}
try{dump_event("cThis.cActiveItem.begin = "+(parseInt(cThis.cActiveItem.begin * 1000)/1000)+" end = "+(parseInt(cThis.cActiveItem.end * 1000)/1000),"blue");cThis.audio.currentTime=cThis.cActiveItem.begin;}catch(e){}
try{dump_event("audio.play(#6)","red");if(bResumeStart!==true){event.target.play();}}catch(e){dump_event("autio.play errr!");}
dump_event("Play Start");}
if(window.bMacOS==false){this.audio.oncanplaythrough=this.audio.onsuspend;}
if(this.audio.paused==false){this.audio.pause();}
this.SetPlaybackRate(1);this.ResetInterval();this.source=this.audio.src=strSource;this.audio.load();if(window._DEBUG){dump_event("Source Change"+strSource,"red");}}
this.ItemChanged(this.cActiveItem.element,cOldItem);return true;}catch(e){window.console.log=e;}}return false;}
Sh5Audio.prototype.ReadElementsInitialize=function(funInitFinish,param){var indexes=document.getElementsByClassName("sh5index");var readSpans=document.getElementsByClassName("read");var reads=Array();var cAudioFile=null;this.cSmilItems=Array();this.cAudioFiles=[];this.cFirstSmilItem=null;var strSource;for(var i=0;i<indexes.length;i++){var ireads=indexes[i].getElementsByClassName("read");if(0<ireads.length){ireads[0].indexItem=true;}}
var indexItem=null;for(var i=0;i<readSpans.length;i++){if(readSpans[i].id.substr(0,1)=='s'){var ids=readSpans[i].id.substr(1).split(/[_]/);var s1=(ids.length==2)? parseInt(ids[0]):0;var i1=(ids.length==2)? parseInt(ids[1]):0;readSpans[i].nReadID=(s1 * 100000)+i1;}else{readSpans[i].nReadID=0;}
reads.push(readSpans[i]);}
reads.sort(function(r1,r2){if(r1.id.substr(0,8)=='addarea_'||r2.id.substr(0,8)=='addarea_'){return 0;}else if(r1.nReadID!=undefined&&r2.nReadID!=undefined){if(r1.nReadID<r2.nReadID){return-1;}
if(r1.nReadID>r2.nReadID){return 1;}else{return 0;}}else if(r1.nReadID==undefined&&r2.nReadID!=undefined){return-1;}else if(r1.nReadID!=undefined&&r2.nReadID==undefined){return 1;}else{return 0;}});var ieDeffTime=0.05;var iosDeffTime=0.0;for(var i=0;i<reads.length;i++){var read=reads[i];var cSmilItem={};var id=read.id;var cAudioItem=null;if(0<i&&this.cSmilItems[this.cSmilItems.length-1].id==id){continue;}
if(id.substr(0,8)=='addarea_'){var cAddAreaAudioItems=window[id.substr(0,14)+'AudioItems'];if(cAddAreaAudioItems&&(cAudioItem=cAddAreaAudioItems[id.substr(14)])){strSource='./sounds/'+id.substr(0,13)+'.mp3';cSmilItem.org_begin=cSmilItem.begin=cAudioItem.begin;cSmilItem.org_end=cSmilItem.end=cAudioItem.end;}}else if((cAudioItem=cAudioItems[id])){cSmilItem.cAudioItem=cAudioItem;cSmilItem.IsPlayModeStop=function(){if(this.cAudioItem!==undefined){if(this.cAudioItem.play!==undefined){if(0<=this.cAudioItem.play.indexOf('stop')){return true;}}}return false;}
cSmilItem.IsPlayModeSkip=function(){if(this.cAudioItem!==undefined){if(this.cAudioItem.play!==undefined){if(0<=this.cAudioItem.play.indexOf('skip')){return true;}}}return false;}
if(cAudioItem.src){cSmilItem.audioSrc=strSource=cAudioItem.src;}else if(cAudioItem.ref){cSmilItem.audioSrc=strSource=cAudioItems[cAudioItem.ref].src;}
if(bIE){cSmilItem.org_begin=cSmilItem.begin=Math.max(cAudioItem.begin-ieDeffTime,0);if(cAudioItems[cAudioItem.ref]){cSmilItem.org_end=cSmilItem.end=Math.max(Math.round((cAudioItem.end-ieDeffTime)* 10000)/10000,0);}else{cSmilItem.org_end=cSmilItem.end=cAudioItem.end;}
if(cSmilItem.org_end<=cSmilItem.org_begin){cSmilItem.org_end=cSmilItem.org_begin+ieDeffTime;}}else if(bChrome||bFireFox){cSmilItem.org_begin=cSmilItem.begin=Math.max(cAudioItem.begin,0);cSmilItem.org_end=cSmilItem.end=Math.max(cAudioItem.end,0);}else if(iosDeffTime){cSmilItem.org_begin=cSmilItem.begin=Math.max(cAudioItem.begin-iosDeffTime,0);cSmilItem.org_end=cSmilItem.end=Math.max(cAudioItem.end-iosDeffTime,0);}else{cSmilItem.org_begin=cSmilItem.begin=cAudioItem.begin;cSmilItem.org_end=cSmilItem.end=cAudioItem.end;}}
cSmilItem.element=read;cSmilItem.Sh5Audio=this;if(strSource&&!(cAudioFile=this.cAudioFiles[strSource])){this.cAudioFiles[strSource]={file:strSource};cAudioFile=this.cAudioFiles[strSource];}
if(cAudioFile){cSmilItem.src=cAudioFile;}
if(cSmilItem.src){read.cSmilItem=cSmilItem;if(window._DEBUG){cSmilItem.id=cSmilItem.element.id;}
this.cSmilItems.push(cSmilItem);if(0&&cAudioItem.subaudio){for(var sa=0;sa<cAudioItem.subaudio.length;sa++){var cSaSmilItem={};cSaSmilItem.audioSrc=cSmilItem.audioSrc;cSaSmilItem.element=cSmilItem.element;cSaSmilItem.Sh5Audio=cSmilItem.Sh5Audio;cSaSmilItem.src=cSmilItem.src;cSaSmilItem.audioSrc=strSource=cAudioItem.subaudio[sa].src;cSaSmilItem.org_begin=cSaSmilItem.begin=cAudioItem.subaudio[sa].begin;cSaSmilItem.org_end=cSaSmilItem.end=cAudioItem.subaudio[sa].end;if(strSource&&!(cAudioFile=this.cAudioFiles[strSource])){this.cAudioFiles[strSource]={file:strSource};cAudioFile=this.cAudioFiles[strSource];}
if(cAudioFile){cSaSmilItem.src=cAudioFile;}
if(window._DEBUG){cSaSmilItem.id=cSaSmilItem.element.id+"_"+sa;}
this.cSmilItems.push(cSaSmilItem);}}}
strSource=null;cAudioFile=null;}
for(var i=0;i<this.cSmilItems.length;i++){if(0<i){this.cSmilItems[i].prevItem=this.cSmilItems[i-1];}
if(i<(this.cSmilItems.length-1)){this.cSmilItems[i].nextItem=this.cSmilItems[i+1];if(this.cSmilItems[i].src==this.cSmilItems[i].nextItem.src){if(this.cSmilItems[i].end<this.cSmilItems[i].nextItem.begin){this.cSmilItems[i].end=this.cSmilItems[i].nextItem.begin;}}
if(window._DEBUG){var cSmilItem=this.cSmilItems[i];cSmilItem.element.title=cSmilItem.element.id+"\n"+cSmilItem.src.file+"\n"+cSmilItem.begin+'～'+cSmilItem.end+'('+(parseInt((cSmilItem.end-cSmilItem.begin)* 1000)/1000.0)+')';}}}
if(0<this.cSmilItems.length){this.cFirstSmilItem=this.cSmilItems[0];this.cSmilItems.sort(function(itemA,itemB){if(itemA.src.file==itemB.src.file){if(itemA.begin==itemB.begin){return 0;}else{return(itemA.begin<itemB.begin)?-1:1;}}else{return(itemA.src.file<itemB.src.file)?-1:1;}}
);}
this.cSmilItems.find=function(src,tm){var nLow=0;var nHig=this.length-1;while(nLow<=nHig){var i=Math.floor((nLow+nHig)/2);if(src==this[i].src.file){if(this[i].begin<=tm&&tm<this[i].end){if(0<i&&this[i-1].src==this[i].src&&this[i-1].begin==this[i].begin&&this[i-1].begin<=tm&&tm<this[i-1].end){return this[i-1];}return this[i];}else if(tm<this[i].begin){nHig=i-1;}else{nLow=i+1;}}else{if(src<this[i].src.file){nHig=i-1;}else{nLow=i+1;}}}return null;}
var cParas=document.querySelectorAll("div#contentArea div, div#contentArea p, div#contentArea fieldset, div#contentArea table, div#contentArea table.infty_itemize_list tr");for(var p=0;p<cParas.length;p++){var reads=null;var cPara=cParas[p];var tagName=cPara.tagName;if(tagName=='TR'){reads=cPara.querySelectorAll('.read');}
if(cPara.id&&cPara.id.substr(0,4)=='pid_'){reads=cPara.querySelectorAll('.read');}
if(reads!=null&&0<reads.length){reads[0].bLineFirst=true;reads[0].setAttribute('line_first','true');reads[reads.length-1].bLineLast=true;reads[reads.length-1].setAttribute('line_last','true');if(window._DEBUG){for(var n=0;n<reads.length-1;n++){reads[n].style.border='1px blue solid';}
reads[reads.length-1].style.border='1px red solid';}}}
var cReads=document.querySelectorAll("div#contentArea *[class=read]");for(var r=0;r<cReads.length;r++){var resd=cReads[r];var image=resd.querySelector("img");if(image!=null&&1<resd.childNodes.length){if(!bChattyInfty3&&resd.textContent.trim().length==0){resd.style.display='inline';}else{resd.style.display='inline';}}}
if(funInitFinish){funInitFinish(param);}return;}
Sh5Audio.prototype.Ended=function(event){this.ResetInterval();if(this.cActiveItem&&this.cActiveItem.nextItem&&this.cActiveItem.nextItem.element){if(this.bWM7){this.audio.controls.pause();this.audio.controls.stop();}else{this.audio.pause();}
if(this.nLineReadMode==LineReadMode.lrmAll||(this.nLineReadMode==LineReadMode.lrmLine&&this.cActiveItem.element&&!this.cActiveItem.element.bLineLast)){setTimeout(function(cThis){cThis.SetActiveItem(cThis.cActiveItem.nextItem);},100,this);}else{this.cNextItem=this.cActiveItem.nextItem;this.OnPause();}}else if(this.cActiveItem!==undefined&&this.cActiveItem.nextItem===undefined){this.cActiveItem=undefined;}
this.OnEnded();return;}
Sh5Audio.prototype.Play=function(){try{if(this.cNextItem){var cNewItem=this.cNextItem;this.cNextItem=undefined;this.SetActiveItem(cNewItem.element);return true;}
if(this.bWM7){if((this.audio.playState==WMPPlayState.wmppsUndefined||this.audio.playState==WMPPlayState.wmppsStopped)&&this.cFirstSmilItem){this.SetActiveItem(this.cFirstSmilItem.element);}else if(this.bPlaying!==true||this.bIntervalID==-1){this.audio.settings.rate=this.nSpeed/100.0;this.audio.controls.play();this.bPlaying=true;this.StartInterval();this.OnPlay();}}else{this.ResetInterval();if(this.cActiveItem){if(this.cActiveItem.element&&this.cActiveItem.element.className){if(this.cActiveItem.element.className.indexOf('read')!=-1){if(this.cActiveItem.element.className.indexOf('sh5_highlight')==-1){SetElementColor(this.cActiveItem.element,1);}}}
dump_event("audio.play(#2)","red");this.audio.play();this.StartInterval();this.OnPlay();}else{this.SetActiveItem(this.cFirstSmilItem.element);}}return true;}catch(e){return false;}}
Sh5Audio.prototype.Stop=function(){if(window.bPlayIntervalWaite){window.bPlayIntervalWaite=false;}
if(window.nPlayIntervalTimer!=undefined){clearTimeout(window.nPlayIntervalTimer);window.nPlayIntervalTimer=undefined;}
this.ResetInterval();if(this.cActiveItem){var oldElement=this.cActiveItem.element;this.cActiveItem=null;this.source=null;this.bPlaying=false;this.ItemChanged(null,oldElement);}
if(this.bWM7){this.audio.controls.stop();this.audio.src=null;this.bPlaying=false;}else{this.audio.pause();this.audio.onseeked=function(event){}
if(this.audio.currentTime){this.audio.currentTime=0;}}
if(window.external&&typeof(window.external.AudioStatusChange)!='undefined'){window.external.AudioStatusChange('stop');}}
Sh5Audio.prototype.Pause=function(){if(this.bIntervalID!=-1){this.ResetInterval();this.bPlaying=false;if(this.bWM7){this.audio.controls.pause();}else{this.audio.pause();}
if(window.external&&typeof(window.external.AudioStatusChange)!='undefined'){window.external.AudioStatusChange('pause');}}}
Sh5Audio.prototype.ItemChanged=function(newElement,oldElement){if(window.bDisableScrollEvent){window.bDisableScrollEvent=undefined;dump_event("--- Disable Scroll Reset ---",'#F0F');}
var strNewItemID=(newElement&&newElement.id)? newElement.id:'(null)';var strOldItemID=(oldElement&&oldElement.id)? oldElement.id:'(null)';console.log(`Sh5Audio.ItemChanged:ID=${newElement.id},window.bTableReadMode=${window.bTableReadMode}`);dump_event('Sh5Audio.ItemChanged('+strNewItemID+', '+strOldItemID+')['+this.audio.defaultPlaybackRate+']','#0A0');this.OnChanged(newElement,oldElement)}
Sh5Audio.prototype.MovePrevSection=function(){if(pageListArea&&pageListArea.style.display==''){var activePage=pageListArea.querySelector('td.page.sh5_active');if(activePage!=null){var prevPage=activePage.parentElement.previousElementSibling;if(prevPage&&(prevPage=prevPage.firstChild)){OnTocClick({target:prevPage});}}return;}
try{dump_event('Sh5Audio.MovePrevSection()');if(this.cActiveItem){if(indexListArea.style.display!='none'){var tocItem=indexListArea.querySelector("*.toc.sh5_active");var prevToc=tocItem ? tocItem.prevToc:null;if(prevToc){if(prevToc.readElement&&prevToc.readElement.cSmilItem){prevToc.parentElement.scrollIntoView({behavior:'auto',block:'center'});prevToc.click();}else if(prevToc.id){var readID=prevToc.id.replace("toc_",'');var read=document.getElementById(readID);if(read&&read.cSmilItem){this.SetActiveItem(read.cSmilItem);}}}}else if(pageListArea!=null){var pageItem=pageListArea.querySelector("*.page.sh5_active");if(pageItem&&(pageItem=pageItem.prevPage)&&pageItem.readElement&&pageItem.readElement.cSmilItem){try{var targetItem=pageItem.readElement;if(targetItem!=null&&targetItem.style.display=='none'){while(targetItem!=null&&targetItem.style.display=='none'){targetItem=targetItem.parentElement;}
if(targetItem!=null){ShowReadElement(pageItem.readElement);targetItem.scrollIntoView({behavior:'auto',block:'start',inline:'start'});}}}catch(e){}
this.SetActiveItem(pageItem.readElement.cSmilItem);}}}else if(this.cFirstSmilItem&&this.cFirstSmilItem.element){this.SetActiveItem(this.cFirstSmilItem.element);}}catch(e){}}
Sh5Audio.prototype.MoveNextSection=function(){if(pageListArea&&pageListArea.style.display==''){var activePage=pageListArea.querySelector('td.page.sh5_active');if(activePage!=null){var nextPage=activePage.parentElement.nextElementSibling;if(nextPage&&(nextPage=nextPage.firstChild)){OnTocClick({target:nextPage});}}return;}
try{dump_event('Sh5Audio.MoveNextSection()');if(this.cActiveItem){if(indexListArea.style.display!='none'){var item=this.cActiveItem.nextItem;while(item&&item.element&&!item.element.indexItem){item=item.querySelector;}
if(item){if(item.element){this.SetActiveItem(item.element);}}else{var tocItem=indexListArea.querySelector("*.toc.sh5_active");var nextToc=tocItem ? tocItem.nextToc:null;if(nextToc){if(nextToc.readElement&&nextToc.readElement.cSmilItem){nextToc.parentElement.scrollIntoView({behavior:'auto',block:'center'});nextToc.click();}else if(nextToc.id){var readID=nextToc.id.replace("toc_",'');var read=document.getElementById(readID);if(read&&read.cSmilItem){this.SetActiveItem(read.cSmilItem);}}}}}else if(pageListArea!=null){var pageItem=pageListArea.querySelector("*.page.sh5_active");if(pageItem&&(pageItem=pageItem.nextPage)&&pageItem.readElement&&pageItem.readElement.cSmilItem){try{var targetItem=pageItem.readElement;if(targetItem!=null&&targetItem.style.display=='none'){while(targetItem!=null&&targetItem.style.display=='none'){targetItem=targetItem.parentElement;}
if(targetItem!=null){ShowReadElement(pageItem.readElement);targetItem.scrollIntoView({behavior:'auto',block:'center',inline:'center'});}}}catch(e){}
this.SetActiveItem(pageItem.readElement.cSmilItem);}}}else if(this.cFirstSmilItem&&this.cFirstSmilItem.element){this.SetActiveItem(this.cFirstSmilItem.element);}}catch(e){}}
Sh5Audio.prototype.MovePrevItem=function(){if(window.bPrevKeyRepeat&&0<window.nTimeDiffToBack&&this.cActiveItem&&(this.cActiveItem.begin+window.nTimeDiffToBack)<this.audio.currentTime){this.SetActiveItem(this.cActiveItem.element);return;}
dump_event('Sh5Audio.MovePrevItem()');if(this.cActiveItem&&this.cActiveItem.prevItem&&this.cActiveItem.prevItem.element){var prevItem=this.cActiveItem.prevItem;var timeSpan;while((timeSpan=prevItem.end-prevItem.begin)<0.1){if(prevItem.prevItem!=undefined&&prevItem.prevItem!=null){prevItem=prevItem.prevItem;}else{break;}}
if(prevItem!=undefined&&prevItem!=null){this.SetActiveItem(prevItem.element);}}}
Sh5Audio.prototype.MoveNextItem=function(){dump_event('Sh5Audio.MoveNextItem()');if(this.cActiveItem==null){this.SetActiveItem(this.cFirstSmilItem.element);}else if(this.cActiveItem.nextItem&&this.cActiveItem.nextItem.element){this.SetActiveItem(this.cActiveItem.nextItem.element);}}
Sh5Audio.prototype.OnPlay=function(){if(window.external&&typeof(window.external.AudioStatusChange)!='undefined'){window.external.AudioStatusChange('play');}
dump_event('Sh5Audio.OnPlay()');}
Sh5Audio.prototype.OnPause=function(){if(window.external&&typeof(window.external.AudioStatusChange)!='undefined'){window.external.AudioStatusChange('pause');}
dump_event('Sh5Audio.OnPause()');}
Sh5Audio.prototype.OnEnded=function(){if(window.external&&typeof(window.external.AudioStatusChange)!='undefined'){window.external.AudioStatusChange('ended');}
dump_event('Sh5Audio.OnEnded()');}
Sh5Audio.prototype.SetVolume=function(nValue){dump_event('Sh5Audio.SetVolume( '+nValue+' )');if(0<=nValue&&nValue<=100){this.nVolume=nValue;if(this.bWM7){this.audio.settings.volume=this.nVolume * 2;}else{this.audio.volume=this.nVolume/100.0;}return true;}return false;}
Sh5Audio.prototype.GetVolume=function(){dump_event('Sh5Audio.GetVolume()');return this.nVolume;}
Sh5Audio.prototype.SetSpeed=function(nValue){dump_event('Sh5Audio.SetSpeed( '+nValue+' )');if(0<=nValue&&nValue<=300){this.nSpeed=nValue;if(this.bWM7){var bPlaying=this.bPlaying;if(this.audio.settings&&this.audio.settings.rate){if(bPlaying){this.bRateChangeStatus=true;this.audio.controls.pause();}else{this.audio.settings.rate=this.nSpeed/100.0;}}}else{this.SetPlaybackRate();}return true;}return false;}
Sh5Audio.prototype.GetSpeed=function(){dump_event('Sh5Audio.GetSpeed()');return this.nSpeed;}
Sh5Audio.prototype.IsPlay=function(bInterval){if(this.bWM7){return this.bPlaying ? true:false;}else{if(bInterval!==undefined){return(this.audio.paused&&window.nPlayIntervalTimer==undefined)? false:true;}else{return this.audio.paused ? false:true;}}}
Sh5Audio.prototype.IsPause=function(){if(window.nPlayIntervalTimer!=undefined){return false;}else if(this.bWM7){return this.bPlaying ? false:true;}else{return this.audio.paused ? true:false;}}
Sh5Audio.prototype.GetCurrentTime=function(){if(this.bWM7){if(this.audio&&this.audio.controls&&this.audio.controls.currentPosition){return this.audio.controls.currentPosition;}return 0;}else{return this.audio.currentTime;}}
Sh5Audio.prototype.SetDobuleSpeed=function(bDoubleSpeed){this.bDoubleSpeed=bDoubleSpeed;}
Sh5Audio.prototype.SetDobuleSpeedMode=function(bMode){bMode=(bMode)? true:false;if(this.bDoubleSpeed&&this.bDoubleSpeedMode!=bMode){var bPlay=this.IsPlay();this.bDoubleSpeedMode=bMode;if(bPlay){this.Pause();}
for(var name in this.cAudioFiles){var cAudioFile=this.cAudioFiles[name];if(this.bDoubleSpeedMode){cAudioFile.file=cAudioFile.file.replace(/.mp3$/,"_x2.mp3");}else{cAudioFile.file=cAudioFile.file.replace(/_x2.mp3$/,".mp3");}}
for(var i=0;i<this.cSmilItems.length;i++){var cSmilItem=this.cSmilItems[i];if(this.bDoubleSpeedMode){cSmilItem.begin=cSmilItem.org_begin/2;cSmilItem.end=cSmilItem.org_end/2;}else{cSmilItem.begin=cSmilItem.org_begin;cSmilItem.end=cSmilItem.org_end;}}
this.source=null;if(bPlay&&this.cActiveItem){var cItem=this.cActiveItem;this.cActiveItem=null;this.source=null;this.SetActiveItem(cItem.element);}}}
this.ReadElementsInitialize();if(this.bWM7&&this.audio&&this.audio.settings){this.audio.settings.volume=this.nVolume * 2;}}
function OnSh5AudioEnded(event){this.Stop();var nextElement=null;for(var name in this.oAudioItems){var item=this.oAudioItems[name];if(item.element){if(item.element.readNext){nextElement=item.element.readNext;}}}
if(nextElement!=null){nextElement.Sh5Audio.SetActiveItem(nextElement.id);SetContentsHighlight(nextElement.id,true,false);}return false;}
function OnSh5AudioClick(event){return false;}
function OnSh5AudioChanged(newElement,oldElement){window.bDisableScrollEvent=true;if(oldElement){SetContentsHighlight(oldElement.id,false,false);}
if(newElement){SetContentsHighlight(newElement.id,true,false);}}
var SoftScroll=function(){var m_Instance=this;SoftScroll.prototype.Reset=function(){if(m_hSoftScrollTimerID!=null){clearInterval(m_hSoftScrollTimerID);m_hSoftScrollTimerID=null;}}
SoftScroll.prototype.Set=function(){this.Reset();m_hSoftScrollTimerID=setInterval(this.SoftScrollProc,10);}
SoftScroll.prototype.SoftScrollProc=function(event){if(ScrollPos.x==contentArea.scrollLeft||ScrollPos.y==contentArea.scrollTop){if(m_hSoftScrollTimerID!=null){m_Instance.Reset();}}else{var xGap=Math.abs(ScrollPos.x-contentArea.scrollLeft);var yGap=Math.abs(ScrollPos.y-contentArea.scrollTop);var xDir=(ScrollPos.x<contentArea.scrollLeft)?-1:1;var yDir=(ScrollPos.y<contentArea.scrollTop)?-1:1;if(ScrollRange.x<xGap){contentArea.scrollLeft+=ScrollRange.x * xDir;}else if(contentArea.scrollLeft!=ScrollPos.x){contentArea.scrollLeft=ScrollPos.x;}
if(ScrollRange.y<yGap){contentArea.scrollTop+=ScrollRange.y * yDir;}else if(contentArea.scrollTop!=ScrollPos.y){contentArea.scrollTop=ScrollPos.y;}}}}
var cSoftScroll=new SoftScroll;function ShowWaitMessage(){if(wmsg!=undefined){wmsg.style.position="absolute";wmsg.style.display='';wmsg.style.top="0px";wmsg.style.left="0px";wmsg.style.width="100%";wmsg.style.height="100%";wmsg.style.textAlign="center";wmsg.style.verticalAlign="middle";wmsg.style.color="#FFF";wmsg.innerHTML="<table class='MS' class='loadmessage'><tr><td class='loadmessage'>"+strLoadMessage.replace("$TITLE$",document.title)+"</td></tr></table>";}}
function SH5Initalize(){var us=navigator.userAgent;var pair=location.search.substring(1).split('&');var argv=[];try{for(var i=0;pair[i];i++){var kv=pair[i].split('=');argv[kv[0]]=(1<kv.length)? kv[1]:0;}}catch(e){}
if(us.indexOf('Safari')!=-1){var addStyle=document.createElement("style");addStyle.type='text/css';addStyle.id='sh5_add_style';addStyle.textContent="html,body {width: 100%;height: 100%;overflow: hidden;}";document.head.appendChild(addStyle);}
if(window.external&&typeof(window.external.ChattyBooksMode)!='undefined'&&window.external.ChattyBooksMode()){bChattyBooksMode=true;}
if(vAlwaysVertivalLayout){bVerticalMode=true;}
if(document.body.className.indexOf("quick_daisy")!=-1){bQuickDaisy=true;if(document.body.className.indexOf("back_layer_only")!=-1){bSubLayerOnly=true;}}
if(argv.unlazyload!==undefined){var images=document.querySelectorAll("img[loading=lazy][data-src]");for(var i=0;i<images.length;i++){var img=images[i];var srcPath=img.getAttribute("data-src");img.src=srcPath;img.removeAttribute("loading");img.removeAttribute("data-src");};}else{var images=document.querySelectorAll("img[loading=lazy][data-src]");for(var i=0;i<images.length;i++){var img=images[i];if(img.width!=""){img.style.minWidth=img.width+"px";}
if(img.height!=""){img.style.minWidth=img.height+"px";}
img.onload=function(event){var img=event.target;img.style.minWidth="";img.style.minHeight="";}}}
window.generator=document.head.querySelector("meta[name=generator]");if(window.generator!=null){if(window.generator.content.indexOf("ChattyInfty3")!=-1||window.generator.content.indexOf("IMLX2DAISY")!=-1){window.bChattyInfty3=true;}}
if(window.sAppTitle&&typeof window.sAppTitle=='string'){document.title="["+document.title+"] "+window.sAppTitle;}{var cRubys=document.querySelectorAll(".sh5content ruby.ruby_level_0");var nRubys=cRubys.length;for(var rb=0;rb<nRubys;rb++){cRubys[rb].className=cRubys[rb].className.replace("ruby_level_0","original");}}
if(document.baseURI){window.bLocalFile=document.baseURI.substr(0,8)=="file:\x2F\x2F\x2F";}else if(document.URL){window.bLocalFile=document.URL.match(/file:/)=="file:\x2F\x2F\x2F";}
if(bSilentToWbr){var cSpans=document.querySelectorAll(".sh5content span.infty_silent_wide_space");var nSpans=cSpans.length;if(0<nSpans){for(var ss=0;ss<nSpans;ss++){var cSpan=cSpans[ss];var cParent=cSpan.parentElement;if(cParent!=null){var wbr=document.createElement("wbr");cParent.replaceChild(wbr,cSpan);}}}}
if(bChattyInfty3){var cCiStyles=document.head.querySelectorAll("link");for(var cis=0;cis<cCiStyles.length;cis++){if(cCiStyles[cis].href.indexOf('style.css')!=-1){cCiStyleH=cCiStyles[cis];}else if(cCiStyles[cis].href.indexOf('style_v.css')!=-1){cCiStyleV=cCiStyles[cis];}}
var cBous=document.querySelectorAll("div.sh5content section.vertical_section p span:not([class])[style]");var nBous=cBous.length;for(var b=0;b<nBous;b++){var cBou=cBous[b];if(cBou.style.borderRight.toLowerCase().indexOf("1px solid")!=-1){var u=document.createElement("u");while(cBou.firstChild!=null){u.appendChild(cBou.firstChild);}
cBou.parentElement.replaceChild(u,cBou);}}
var cTParas=document.querySelectorAll("table.infty tr.infty th > p,table.infty tr.infty td > p");var nTParas=cTParas.length;for(var t=0;t<nTParas;t++){var cTPara=cTParas[t];if(cTPara.firstChild==null){cTPara.innerHTML="<span><br/></span>";}}
var cStbs=document.querySelectorAll("div[id^='pid_'] > span.read > table.infty");var nStbs=cStbs.length;if(nStbs){for(var t=0;t<nStbs;t++){var cStb=cStbs[t];var span=cStb.parentElement;var div=span.parentElement;var read=cStb.querySelector("*.read");if(read!=null&&div!=null&&span.childNodes.length==1&&div.childNodes.length==1){div.parentElement.insertBefore(span,div);div.parentElement.insertBefore(cStb,div);div.parentElement.removeChild(div);}}}
var cItems=document.querySelectorAll("p, p > b, p > i, p > i > b, p > b > i");var nItems=cItems.length;for(var i=0;i<nItems;i++){if(cItems[i].childNodes.length==1&&cItems[i].firstChild.nodeType==document.TEXT_NODE){if(cItems[i].innerHTML==" &nbsp;"){cItems[i].textContent=String.fromCharCode(0xA0)+" ";}}}}
var cItemizes=document.querySelectorAll(".sh5content td.infty_itemize_item");var nItemizes=cItemizes.length;for(var it=0;it<nItemizes;it++){var cItemize=cItemizes[it];var first=cItemize.firstChild;if(first!=null&&first.nodeType==document.TEXT_NODE){var text=first.textContent;text=text.replace(/\xA0/g," ");text=text.replace(/  /g,"　");first.textContent=text;var a=0;}}
if(bChattyInfty3){var cBrs=document.querySelectorAll(".sh5content span.read br:last-child");var nBrs=cBrs.length;for(var br=0;br<nBrs;br++){var cBr=cBrs[br];if(cBr.nextSibling!=null){continue;}
var parent=cBr.parentNode;parent.removeChild(cBr);if(parent.nextSibling!=null){if(parent.nextSibling.nodeType==null||parent.nextSibling.tagName!='BR'){parent.parentNode.insertBefore(cBr,parent.nextSibling);}}else{parent.parentNode.appendChild(cBr);}
if(parent.childNodes.length==0){parent.innerHTML="&thinsp;";}}
var cItems=document.querySelectorAll(".sh5content span.boxstyle.ruby_in_box");var nItems=cItems.length;for(var it=0;it<nItems;it++){var cItem=cItems[it];if(cItem.querySelector("svg.math")!=null&&cItem.className.indexOf('svg_box')==-1){if(cItem.querySelector("ruby")==null){cItem.className=cItem.className.replace('ruby_in_box','');cItem.className+=' svg_box';cItem.style.paddingTop='';}}}
var cBoxes=document.querySelectorAll("span.boxstyle");var nBoxes=cBoxes.length;for(var b=0;b<nBoxes;b++){if(cBoxes[b].querySelector("ruby")!=null){cBoxes[b].className+=" include_ruby";}}}
window.bWbrExEnable=document.querySelector(".sh5content wbr.level2")!=null;var cWbrs=document.querySelectorAll(".sh5content wbr");var nWbrs=cWbrs.length;if(0<nWbrs){window.bWbrEnable=true;var cItems=document.querySelectorAll(".sh5content span.phrase");var nItems=cItems.length;for(var i=0;i<nItems;i++){var cItem=cItems[i];var cParent=cItem.parentElement;while(cItem.firstChild!=null){cParent.insertBefore(cItem.firstChild,cItem);}
cParent.removeChild(cItem);}
for(var w=0;w<nWbrs;w++){var cWbr=cWbrs[w];}
var cLayerReads=document.querySelectorAll("div.layer_group span.read,span.layer_group span.read");var nLayerReads=cLayerReads.length;for(var l=0;l<nLayerReads;l++){cLayerReads[l].className+=' layer_item';}
var bWbrReset=false;for(var w=0;w<nWbrs;w++){var cWbr=cWbrs[w];if(cWbr.previousSibling==null){var pParent=cWbr.parentElement;pParent.parentElement.insertBefore(cWbr,pParent);bWbrReset=true;}}
if(bWbrReset){cWbrs=document.querySelectorAll(".sh5content wbr");nWbrs=cWbrs.length;}
for(var w=0;w<nWbrs;w++){var cWbr=cWbrs[w];var prev=cWbr.previousSibling;if(prev&&prev.nodeType==document.ELEMENT_NODE&&prev.nodeName=="SPAN"){prev=prev.lastChild;var wbrspan=document.createElement("span");wbrspan.className='wbrspan';if(window.bWbrExEnable&&IsClassName(cWbr,'level2')){AppendClassName(wbrspan,'wbr_level2');}
while(prev!=null&&(prev.nodeType!=document.ELEMENT_NODE||!IsClassName(prev,'wbrspan'))){var temp=prev.previousSibling;if(wbrspan.firstChild==null){wbrspan.appendChild(prev);}else{wbrspan.insertBefore(prev,wbrspan.firstChild);}
prev=temp;}
cWbr.previousSibling.appendChild(wbrspan);if(wbrspan.parentElement.childNodes.length==1){var a=0;}}else if(prev){var wbrspan=document.createElement("span");wbrspan.className='wbrspan';if(window.bWbrExEnable&&IsClassName(cWbr,'level2')){AppendClassName(wbrspan,'wbr_level2');}
if(prev.nodeType==document.TEXT_NODE){if(/\u00A0\u00A0$/.test(prev.nodeValue)){prev.nodeValue=prev.nodeValue.replace(/\u00A0\u00A0$/,'')}else if(/　$/.test(prev.nodeValue)){prev.nodeValue=prev.nodeValue.replace(/　$/,'')}}
while(prev!=null&&(prev.nodeType!=document.ELEMENT_NODE||!IsClassName(prev,'wbrspan'))){var temp=prev.previousSibling;if(wbrspan.firstChild==null){wbrspan.appendChild(prev);}else{wbrspan.insertBefore(prev,wbrspan.firstChild);}
prev=temp;}
cWbr.parentElement.insertBefore(wbrspan,cWbr);}else{cWbr.parentElement.replaceChild(document.createTextNode(''),cWbr);}
if(cWbr.parentElement!=null){cWbr.parentElement.removeChild(cWbr);}}
var cWbrSpans=document.querySelectorAll(".sh5content span:not(.read) > span.wbrspan");var nWbrSpans=cWbrSpans.length;for(var w=0;w<nWbrSpans;w++){if(cWbrSpans[w].parentElement.childNodes.length==1){var cWbrSpan=cWbrSpans[w];var parent=cWbrSpan.parentElement;while(cWbrSpan.firstChild!=null){parent.appendChild(cWbrSpan.firstChild);}
parent.removeChild(cWbrSpan);parent.parentElement.replaceChild(cWbrSpan,parent);cWbrSpan.appendChild(parent);}}
var cReads=document.querySelectorAll(".sh5content span.read");var nReads=cReads.length;for(var r=0;r<nReads;r++){var cRead=cReads[r];var last=cRead.lastChild;if(cRead.className.indexOf('layer_item')!=-1||cRead.parentElement.className.indexOf('layerArea')!=-1){continue;}
if(cRead.childNodes.length==1&&cRead.firstChild.nodeType==document.ELEMENT_NODE&&cRead.firstChild.tagName=='IMG'){cRead.style.display='inline-block';continue;}
if(last!=null&&!IsClassName(last,'wbrspan')){if(last!=null&&last.nodeType==document.TEXT_NODE){if(last.textContent.trim().length==0){continue;}}
var wbrspan=document.createElement("span");wbrspan.className+='wbrspan read_last_wbr';while(last!=null&&(last.nodeType!=document.ELEMENT_NODE||last.tagName!='SPAN'||last.className.indexOf('wbrspan')==-1)){if(wbrspan.firstChild==null){wbrspan.appendChild(last);}else{wbrspan.insertBefore(last,wbrspan.firstChild);}
last=cRead.lastChild;}
cRead.appendChild(wbrspan);}}
var cAllElems=document.querySelectorAll(".sh5content *");var nAllElems=cAllElems.length;for(var a=0;a<nAllElems;a++){var cElem=cAllElems[a];for(cChild=cElem.firstChild;cChild;cChild=cChild.nextSibling){if(cChild.nodeType==document.TEXT_NODE&&/\u00A0\u00A0/.test(cChild.nodeValue)){cChild.nodeValue=cChild.nodeValue.replace(/\u00A0\u00A0/g,"　");}}}
cWbrSpans=document.querySelectorAll(".sh5content table span.wbrspan");nWbrSpans=cWbrSpans.length;for(var w=0;w<nWbrSpans;w++){cWbrSpans[w].className+=' cell_wbr';}
cWbrSpans=document.querySelectorAll(".sh5content span.wbrspan:not(.cell_wbr)");nWbrSpans=cWbrSpans.length;for(var w=0;w<nWbrSpans;w++){var cWbrSpan=cWbrSpans[w];if(cWbrSpan.tagName!="SPAN"){continue;}
var cNext=cWbrSpan.nextSibling;var cParent=cWbrSpan.parentElement;var wbr=document.createElement("wbr");if(cNext==null){cParent.appendChild(wbr);}else{cParent.insertBefore(wbr,cNext);}
for(var cChild=cWbrSpan.firstChild;cChild!=null;){var next=cChild.nextSibling;if(cChild.nodeType==3&&/[\,　,\xA0]/g.test(cChild.nodeValue)){var newSpan=document.createElement('span');var newWbr=document.createElement('wbr');newSpan.innerHTML=cChild.nodeValue.replace(/[\ ]/g,' <wbr/>').replace(/[　]/g,'　<wbr/>');if(newSpan.lastChild&&newSpan.lastChild.nodeType==1&&newSpan.lastChild.nodeName=='WBR'){newSpan.removeChild(newSpan.lastChild);}
cWbrSpan.replaceChild(newSpan,cChild)
if(next){cWbrSpan.insertBefore(newWbr,next);}else{cWbrSpan.appendChild(newWbr);}}
cChild=next;}}
cItems=document.querySelectorAll("table.infty > tbody > tr > td > p > br, table.infty > tbody > tr > th > p > br");nItems=cItems.length;for(var i=0;i<nItems;i++){if(cItems[i].previousSibling!=null&&cItems[i].nextSibling==null){cItems[i].parentElement.removeChild(cItems[i]);}}
cReads=document.querySelectorAll("*.table_last_cell");nReads=cReads.length;for(var r=0;r<nReads;r++){if(cReads[r].firstElementChild==null&&cReads[r].textContent.trim().length==0){for(var cRead=cReads[r].parentElement;cRead.tagName!="TABLE";cRead=cRead.parentElement){if(cRead.className.indexOf('read')!=-1&&0<cRead.id.length){cRead.style.visibility='hidden';break;}}}}
cReads=document.querySelectorAll("table.infty + span.read");nReads=cReads.length;for(var r=0;r<nReads;r++){if(cReads[r].firstElementChild==null&&cReads[r].textContent.trim().length==0){cRead.style.visibility='hidden';}}
var cWbrs=document.querySelectorAll(".sh5content span.wbrspan:not(.read_last_wbr) span.wbrspan.read_last_wbr");var nWbrs=cWbrs.length;for(var w=0;w<nWbrs;w++){var cWbr=cWbrs[w];var cParent=cWbr.parentElement;while(cParent!=null&&!IsClassName(cParent,'wbrspan')){cParent=cParent.parentElement;}
if(cParent!=null&&IsClassName(cParent,'wbrspan')){if(cParent.nextSibling&&cParent.nextSibling.nodeType==document.ELEMENT_NODE&&cParent.nextSibling.querySelector(".wbrspan")){cParent.className='';cWbr.className='wbrspan';cParent=null;}}}
var cWbrBrs=document.querySelectorAll(".sh5content span.wbrspan > br");var nWbrBrs=cWbrBrs.length;for(var w=0;w<nWbrBrs;w++){var cWbrBr=cWbrBrs[w];if(cWbrBr.nextSibling!=null){var wbrspanA=cWbrBr.parentElement;var wbrspanB=document.createElement("span");wbrspanB.className='wbrspan';if(wbrspanA.textContent.indexOf("AAA")!=-1){var a=0;}
while(cWbrBr.nextSibling!=null){wbrspanB.appendChild(cWbrBr.nextSibling);}
if(wbrspanA.nextElementSibling!=null){wbrspanA.parentElement.insertBefore(wbrspanB,wbrspanA.nextElementSibling);}else{wbrspanA.parentElement.appendChild(wbrspanB);}
wbrspanA.parentElement.insertBefore(cWbrBr,wbrspanA.nextElementSibling);if(wbrspanA.className=="wbrspan read_last_wbr"){wbrspanB.className=wbrspanA.className;wbrspanA.className=wbrspanA.className.replace("read_last_wbr",'').trim();}}}
cItems=document.querySelectorAll("table.infty span.read > span.wbrspan + br");nItems=cItems.length;for(var i=0;i<nItems;i++){var cItem=cItems[i];if(cItem.tagName=="BR"){var cPrev=cItem.previousSibling;if(cPrev!=null&&cPrev.previousSibling==null){if(cPrev.tagName=="SPAN"&&cPrev.className=="wbrspan"){if(cPrev.childNodes.length==0){cPrev.parentNode.removeChild(cPrev);if(cItem.previousSibling==null){cItem.parentNode.parentNode.insertBefore(cItem,cItem.parentNode);}}}}}}
var cBrs=document.querySelectorAll(".sh5content span.wbrspan:not(.read_last_wbr) + br");var nBrs=cBrs.length;for(var br=0;br<nBrs;br++){if(cBrs[br].previousElementSibling){cBrs[br].previousElementSibling.className+=" read_last_wbr";}}}
if(document.querySelector("*.layer_group")){var cLayerChild=document.querySelectorAll("*.layer_group *");var nLayerChild=cLayerChild.length;for(var c=0;c<nLayerChild;c++){var strClassName=cLayerChild[c].className;cLayerChild[c].className=(strClassName+" layer_child").trim();}
var temp=document.createElement("div");temp.style.display="normal";temp.style.boxSizing="border-box";temp.style.position="absolute";temp.style.display="inline-block";temp.style.left="0";temp.style.top="0";temp.style.width="100px";temp.style.height="100px";temp.style.zoom="200%";document.body.appendChild(temp);setTimeout(function(temp){var rect=temp.getBoundingClientRect();if(rect.width<200){window.bImageZoomState=true;}
document.body.removeChild(temp);},10,temp);}else if(window.bChattyInfty3){var cImageSpan=document.querySelectorAll("span.read > img.sh5_img");var nImageSpan=cImageSpan.length;for(var imn=0;imn<nImageSpan;imn++){var span=cImageSpan[imn].parentElement;if(span&&span.childNodes.length==1){if(span.style.display==''){span.style.display='inline-block';}
span.style.padding='2px';}}}
if(bQuickDaisy){var cQdLayers=document.querySelectorAll("body.quick_daisy *.layer_group.layer_type2");var nQdLayers=cQdLayers.length;for(var i=0;i<nQdLayers;i++){var cQdLayer=cQdLayers[i];var cImageSpan=cQdLayer.querySelector('span.read.layer_type2');var cImage=cImageSpan.querySelector('img');var cSpan=document.createElement(`span`);var cLayerChilds=cQdLayer.querySelectorAll("span.read.border_layer.layer_child");var nLayerChilds=cLayerChilds.length;cQdLayer.style.padding='0';cQdLayer.style.display='inline-block';cImageSpan.style.position='absolute';cImageSpan.style.padding='0';cImageSpan.style.left='-1px';cImageSpan.style.top='-1px';cImageSpan.style.margin='0';cImageSpan.className+=' transparent_layer';cImageSpan.style.cssText+="background-color:transparent !important;border:solid 4px transparent;";cImage.style.cssText+="background-color:transparent !important;padding:0;margin:0;";cQdLayer.style.width=(parseInt(cImage.style.width)+8)+'px';cQdLayer.style.height=(parseInt(cImage.style.height)+8)+'px';for(var c=0;c<nLayerChilds;c++){var cLayerChild=cLayerChilds[c];var cBackChild=document.createElement(`span`);var nBorder=parseInt(cLayerChild.style.borderWidth);var x=parseInt(cLayerChild.style.left);var y=parseInt(cLayerChild.style.top);var cx=parseInt(cLayerChild.style.width);var cy=parseInt(cLayerChild.style.height);cBackChild.textContent=cLayerChild.textContent;cBackChild.style.cssText=cLayerChild.style.cssText;cBackChild.style.margin=nBorder;cBackChild.style.left=(x)+'px';cBackChild.style.top=(y)+'px';cBackChild.style.width=(cx+(nBorder * 2))+'px';cBackChild.style.height=(cy+(nBorder * 2))+'px';cBackChild.id=cLayerChild.id+'_s';cBackChild.className='sub_layer';cBackChild.style.position='absolute';cQdLayer.insertBefore(cBackChild,cImageSpan);}}}
if(!window.bChattyInfty3){if(window.getComputedStyle!==undefined){var cImages=document.querySelectorAll(".sh5content img.read");var nImages=cImages.length;for(var i=0;i<nImages;i++){var cImage=cImages[i];var style=window.getComputedStyle(cImage);if(style.padding==''||style.padding=="0px"){cImage.style.padding="2px";var a=0;}}}
var cImages=null;var nImages=0;while((cImages=document.querySelectorAll(".sh5content p > img"))!=null&&0<(nImages=cImages.length)){for(var i=0;i<nImages;i++){var image=cImages[i];var span=document.createElement("span");image.parentElement.replaceChild(span,image);span.appendChild(image);if(image.style.verticalAlign==''&&bChattyInfty3){image.style.verticalAlign="middle";}}}
var cSentences=null;var nSentences=0;if((cSentences=document.querySelectorAll(".sh5content span.read > span.sentence[id]"))!=null&&0<(nSentences=cSentences.length)){for(var i=0;i<nSentences;i++){var sentences=cSentences[i];var span=sentences.parentElement;if(span.childElementCount==1){var images=sentences.querySelectorAll("img");if(images.length==1&&sentences.textContent.trim().length==0){if(images[0].id==''){images[0].id=sentences.id;}
for(var s=sentences.childNodes.length-1;0<=s;s--){if(sentences.childNodes[s].nodeType==document.TEXT_NODE){sentences.removeChild(sentences.childNodes[s]);}}}
span.removeChild(sentences);sentences.org_id=sentences.id;sentences.id=span.id;sentences.className=String(sentences.className+" read").trim();span.parentElement.replaceChild(sentences,span);}}}
if((cImages=document.querySelectorAll(".sh5content span.read > img[id]"))!=null&&0<(nImages=cImages.length)){for(var i=0;i<nImages;i++){var image=cImages[i];var span=image.parentElement;if(span.childElementCount==1){span.removeChild(image);image.org_id=image.id;image.id=span.id;image.className=String(image.className+" read").trim();if(image.style.padding==''&&image.style.paddingLeft==''&&image.style.paddingTop==''&&image.style.paddingRight==''&&image.style.paddingBottom==''){image.style.padding="2px";}
span.parentElement.replaceChild(image,span);}}}
var cUnderlines=document.querySelectorAll(".sh5content u");var nUnderlines=cUnderlines.length;for(var i=0;i<nUnderlines;i++){var cUnderline=cUnderlines[i];while(cUnderline.nextSibling!=null&&cUnderline.nextSibling.nodeName=='U'&&cUnderline.parentNode!=null){while(cUnderline.nextSibling.firstChild!=null){cUnderline.appendChild(cUnderline.nextElementSibling.firstChild);}
cUnderline.parentNode.removeChild(cUnderline.nextElementSibling);}}
var cCellRubys=document.querySelectorAll(".sh5content th ruby, .sh5content td ruby");var nCellRubys=cCellRubys.length;for(var i=0;i<nCellRubys;i++){var cCellRuby=cCellRubys[i];var cCell=cCellRuby.parentElement;while(cCell!=null&&cCell.tagName!='TH'&&cCell.tagName!='TD'){cCell=cCell.parentElement;}
if(cCell.style.paddingTop==''){cCell.style.paddingTop='0.5em';}}
var cHeaders=document.querySelectorAll(".sh5content h1, .sh5content h2, .sh5content h3, .sh5content h4, .sh5content h5, .sh5content h6");var nHeaders=cHeaders.length;for(var i=0;i<nHeaders;i++){var cHeader=cHeaders[i];if(cHeader.querySelector("ruby")!=null){cHeader.style.lineHeight="2em";}}
var style=document.createElement("style");style.type="text/css";style.id="in_chattyinfty3";style.textContent="section span.read { padding:0; }";document.head.appendChild(style);var cSh5Indexs=document.querySelectorAll(".read .sh5index");var nSh5Indexs=cSh5Indexs.length;for(var s=0;s<nSh5Indexs;s++){var item=cSh5Indexs[s];var read=item.parentElement;while(read!=null&&read.className.indexOf("read")==-1){read=read.parentElement;}
if(read!=null){var nccTag=item.attributes.getNamedItem("ncc_tag");read.className+=" sh5index";read.title=item.title;item.className=item.className.replace("sh5index",'').trim();if(nccTag!=null){item.attributes.removeNamedItem(nccTag.name);read.attributes.setNamedItem(nccTag);}
s=s;}}
var cImageSpan=document.querySelectorAll("span.read > img.sh5_img");var nImageSpan=cImageSpan.length;for(var imn=0;imn<nImageSpan;imn++){var span=cImageSpan[imn].parentElement;if(span&&span.childNodes.length==1){if(span.style.display==''){span.style.display='inline-block';}
span.style.padding='2px';}}
var cAnimationSpan=document.querySelectorAll("span.animation_group span");var nAnimationSpan=cAnimationSpan.length;for(var as=0;as<nAnimationSpan;as++){var span=cAnimationSpan[as];if(span.style.display=='none'&&span.parentElement!=null){span.parentElement.removeChild(span);}}}
if(us.indexOf("MSIE ")!=-1){var str=us.substr(us.indexOf("MSIE ")+5);var version=parseFloat(str);if(version<=9){document.write('<body style="text-align:center;"><b>Internet Explorer '+version+'では再生することができません。<br/>最新のバージョンに更新してください。</b></body>');return;}}
try{if(argv.debug!==undefined){window._DEBUG=true;AppendClassName(document.body,'debug_mode');}
if(argv.read_area!==undefined){AppendClassName(document.body,'read_area');}
if(argv.right_bottom!==undefined){AppendClassName(document.body,'dw_right_bottom');}
if(argv.wbr!==undefined){window._WBR_DEBUG=true;AppendClassName(document.body,'wbr_debug_mode');}
if(argv.layer_debug!==undefined){window._LAYER_DEBUG=true;AppendClassName(document.body,'layer_debug_mode');}}catch(e){}
var sectionTotal=document.querySelectorAll("section.html_page.html_page").length;var sectionVert=document.querySelectorAll("section.html_page.html_page.vertical_section").length;if(0<sectionTotal&&0<sectionVert&&sectionTotal==sectionVert){if(window.bChattyInfty3!==false){var style=null;for(var s=0;s<document.styleSheets.length;s++){var styleHref=document.styleSheets[s].href;if(styleHref!=null&&styleHref.indexOf("/style.css")!=-1){style=document.styleSheets[s];}
if(styleHref!=null&&styleHref.indexOf("/style_v.css")!=-1){style=null;break;}}
try{if(style!=null){if(style.cssText!==undefined){var cssText=style.cssText.cssText.replace(/.vertical_section/g,'');if(cssText!=style.cssText){style.cssText=cssText;}}else if(style.cssRules!==undefined){for(var r=0;r<style.cssRules.length;r++){var cssText=style.cssRules[r].cssText;var selectorText=style.cssRules[r].selectorText;cssText=cssText.replace(/.vertical_section/g,'');selectorText=selectorText.replace(/.vertical_section/g,'');style.cssRules[r].cssText=cssText;style.cssRules[r].selectorText=selectorText;cssText='';}
style=null;}}}catch(e){e=null;}}}
if(cSettingItems['interval'].rate==0.1){cSettingItems['interval'].rate=0.5;if(cUserSetting['interval']){cUserSetting['interval']/=5;}}
var cReads=document.querySelectorAll("div.contentArea *.read");var nReads=cReads.length;for(var r=0;r<nReads;r++){if(0<r){cReads[r].prevReadItem=cReads[r-1];}
if(r<nReads-1){cReads[r].nextReadItem=cReads[r+1];}}
cReads=document.querySelectorAll("div.contentArea *.layer_group:not(layer_type2) *.layerArea > span.read");nReads=cReads.length;for(var r=0;r<nReads;r++){var cRead=cReads[r];var cParent=cRead.parentElement;cParent.removeChild(cRead);cParent.parentElement.replaceChild(cRead,cParent);while(cRead.firstChild!=null){cParent.appendChild(cRead.firstChild);}
cRead.appendChild(cParent);}
if(_DEBUG||window.bAudioNoChath){for(var name in cAudioItems){var item=cAudioItems[name];if(item.src!==undefined){item.src+="?rand="+Math.floor(Math.random()* 100000).toString(10);}}}
for(var name in cAudioItems){var item=cAudioItems[name];if(item.begin==item.end&&item.begin==0){item.end=0.01;}else if(item.begin==item.end){delete cAudioItems[name];}}
if((generator!=null&&bChattyInfty3&&bWin!=false)||(window.dGoogleChromeTimeLagCorrection!==undefined&&window.dGoogleChromeTimeLagCorrection)){}
if(bChattyInfty3){var cTables=document.querySelectorAll("span.read > table.infty");var nTables=cTables.length;for(var t=0;t<nTables;t++){var cTable=cTables[t];var cSpan=cTable.parentElement;var cParent=cSpan.parentElement;cSpan.removeChild(cTable);if(cSpan.nextSibling!=null){cParent.insertBefore(cTable,cSpan.nextSibling);}else{cParent.appendChild(cTable);}}}
if(1){for(var name in cAudioItems){if(cAudioItems[name].begin!=undefined&&cAudioItems[name].end!=undefined){var diff=cAudioItems[name].end-cAudioItems[name].begin;if(diff<0.01&&cAudioItems[name].src==undefined&&cAudioItems[name].subaudio==undefined){delete cAudioItems[name];var a=0;}}}}
if(window.external&&typeof(window.external.IsDebugMode)!='undefined'&&window.external.IsDebugMode()){this.window._DEBUG=true;}
canvas=document.createElement("canvas");if(canvas&&canvas.getContext){ctx=canvas.getContext("2d");}
if(us.indexOf("Windows")!=-1){bWin=true;}
if(us.indexOf("MSIE ")!=-1||us.indexOf("Trident")!=-1){bIE=true;}
if(us.indexOf("Edge")!=-1){window.bEdge=true;}
if(us.indexOf("iPad")!=-1){iPad=true;}
if(us.indexOf("Android")!=-1){bAndroid=true;}
if(us.indexOf("iPhone")!=-1){iPhone=true;}
if(us.indexOf(' Mac OS ')!=-1){window.bMacOS=true;}
if((iPad||iPod||iPhone)&&us.indexOf(" OS 5_")!=-1){iOS5=true;}
if(us.indexOf("Windows")!=-1&&us.indexOf("Chrome")!=-1){bChrome=true;}
if(us.indexOf("Windows")!=-1&&us.indexOf("Firefox")!=-1){bFireFox=true;}
if(us.indexOf("Safari")!=-1&&us.indexOf("Mac OS")!=-1){bSafari=true;}
var strSvgMathCssText='';if(bIE){var cParagraphs=document.querySelectorAll(".sh5content p");var nParagraphs=cParagraphs.length;for(var i=0;i<nParagraphs;i++){var lastChild=cParagraphs[i].lastChild;if(lastChild!=null&&lastChild.nodeType!=lastChild.TEXT_NODE){cParagraphs[i].appendChild(document.createTextNode("\n"));}}}
for(var s=0;s<document.styleSheets.length;s++){var styleSheet=document.styleSheets[s];if(styleSheet.href==null){for(var r=0;r<styleSheet.cssRules.length;r++){if(styleSheet.cssRules[r].selectorText=='svg.math'){if(strSvgMathCssText.length==0&&styleSheet.cssRules[r].cssText.indexOf('font-size:')!=-1){window.cssSvgMath=styleSheet.cssRules[r];strSvgMathCssText=window.cssSvgMath.cssText;}else if(styleSheet.cssRules[r].style.fontSize.length!=0){styleSheet.cssRules[r].style.fontSize='';}}}}}
if(bChattyBooksMode!==true&&!iPad&&!iPhone&&!iPod){var elem=document.getElementById('sh5content');var bState=false;if(window.getComputedStyle!=undefined){var elemStyle=window.getComputedStyle(elem,null);if(elemStyle!=null&&elemStyle.fontFamily&&elemStyle.fontFamily.indexOf('ＭＳ ')!=-1){bState=true;}}
if(bState==false){MathSvgSizeChange(true);}}
saudio=new Sh5Audio(cAudioItems);saudio.OnChanged=OnSh5AudioChanged;saudio.OnClick=OnSh5AudioClick;saudio.OnPlay=function(){if(window.external&&typeof(window.external.OnHtmlPlay)!=='undefined'){window.external.OnHtmlPlay();}
if(window.external&&typeof(window.external.AudioStatusChange)!='undefined'){window.external.AudioStatusChange('play');}};saudio.OnPause=function(){cSoftScroll.Reset();if(window.nPlayIntervalTimer===undefined){if(window.external&&typeof(window.external.OnHtmlPause)!=='undefined'){window.external.OnHtmlPause();}}else{}
if(window.external&&typeof(window.external.AudioStatusChange)!='undefined'){window.external.AudioStatusChange('pause');}};saudio.OnEnded=function(){cSoftScroll.Reset();if(window.external&&typeof(window.external.OnHtmlEnded)!=='undefined'){window.external.OnHtmlEnded();}
if(window.external&&typeof(window.external.AudioStatusChange)!='undefined'){window.external.AudioStatusChange('ended');}};{var cSvgs=document.querySelectorAll('#contentArea svg');var nSvgs=cSvgs.length;for(var ns=0;ns<nSvgs;ns++){TrimSpaces(cSvgs[ns].parentNode);}}
if(wmsg!=undefined){wmsg.parentNode.removeChild(wmsg);}
ParagraphIndexRenumber();if(typeof bHideToolBar==="undefined"){bHideToolBar=false;}
if(typeof bEasyCaption==="undefined"){bEasyCaption=false;}
if(typeof bVerticalMode!=='undefined'&&bVerticalMode===true){bVerticalMode=false;bVerticalButtuon=true;strContentDirection='vert';var cSections=document.getElementsByClassName('html_page');for(var s=0;s<cSections.length;s++){var cSection=cSections[s];cSection.className+=' vertical_section';cSection.setAttribute("direction","vert");}}else{bVerticalMode=false;bVerticalButtuon=false;var cSections=document.getElementsByClassName('html_page');for(var s=0;s<cSections.length;s++){var cSection=cSections[s];cSection.setAttribute("direction",cSection.className.indexOf('vertical_section')==-1 ? "horz":"vert");}
if(0<document.querySelectorAll('section.vertical_section').length){bVerticalButtuon=true;strContentDirection='bosh';}}
if(cUserSetting['readmode']!==undefined){nLineReadStop=cUserSetting['readmode'];}else{nLineReadStop=0;}
nLineReadStop=GetSettingValue("LineReadStop",nLineReadStop);bEasyCaption=GetSettingValue("EasyCaption",bEasyCaption ? 1:0)!=0 ? true:false;if(typeof(window.console)==="undefined"){window.console={}}
if(typeof window.console.log!=="function"){window.console.log=function(a){var b=a;}}
if(1||us.indexOf("Chrome")!=-1){var Images=document.querySelectorAll('img.sh5_img,img.sh5_img_group');for(var i=0;i<Images.length;i++){var Image=Images[i];if(!bChattyInfty3){Image.className=Image.className.replace('sh5_img','');}}
var cLayers=document.querySelectorAll('*.layer_group');var nLayers=cLayers.length;for(var l=0;l<nLayers;l++){var layer=cLayers[l];var reads=layer.querySelectorAll('span.read');var anchors=layer.querySelectorAll('span > a');var subItems=layer.querySelectorAll('span.read span.layerItem');for(var r=0;r<reads.length;r++){var read=reads[r];read.style.display='inline-block';read.parentLayer=layer;}
for(var a=0;a<anchors.length;a++){anchors[a].layer=layer;anchors[a].className=(anchors[a].className+" layer_anchor").trim();anchors[a].layerAnchor=true;}
for(var s=0;s<subItems.length;s++){subItems[s].layer=layer;subItems[s].layerSubItem=true;}}}
FieldSetTrace();nDispMode=GetSettingValue("DispMode",0);if(GetDisplayMode()==1){Sh5AddEventProc(document,'keydown',OnKeyDownEvent);}
Sh5AddEventProc(document,'dblclick',OnDocumentDblClick);content=document.getElementById('sh5content');content.tabIndex=1;contentArea=document.getElementById('contentArea');if(bChattyInfty3){contentArea.className=(contentArea.className+' chattyinfty').trim();}
if(bIE&&!bChattyInfty3){var nStyleSheets=document.styleSheets.length;for(var ss=0;ss<nStyleSheets;ss++){var styleSheet=document.styleSheets[ss];var nRules=styleSheet.cssRules.length;for(var rs=0;rs<nRules;rs++){var cssRule=document.styleSheets[ss].cssRules[rs];if(cssRule.style!=undefined&&cssRule.style.fontFamily.indexOf("@")!=-1){var newFontFamily=cssRule.style.fontFamily.replace(/@/g,'');cssRule.style.fontFamily=newFontFamily;}}}
if(content.currentStyle.fontFamily.indexOf("@")!=-1){var newStyle=content.currentStyle.fontFamily.replace(/@/g,'');content.style.fontFamily=newStyle;}}
for(var c=0;c<content.childNodes.length;c++){if(content.childNodes[c].nodeType==3){var text=content.childNodes[c].textContent.replace(/\t|\n| /g,'');if(text.length==0){content.removeChild(content.childNodes[c]);c--;}}}
for(var c=0;c<contentArea.childNodes.length;c++){if(contentArea.childNodes[c].nodeType==3){var text=contentArea.childNodes[c].textContent.replace(/\t|\n| /g,'');if(text.length==0){contentArea.removeChild(contentArea.childNodes[c]);c--;}}}
if(bVerticalMode===true){contentArea.style.padding="0";content.className+=" VerticalMode";content.style.margin="1em 0.5em";content.style.padding="0";content.style.overflowY="visible";content.style.overflowX="visible";var tates=document.querySelectorAll("div.tate");for(var t=0;t<tates.length;t++){var tate=tates[t];tate.className=tate.className.replace("tate",'');tate.style.direction='ltr';}}else{content.style.padding="0";content.className+=" HorizontalMode";content.style.margin="0.5em 1em";content.style.overflowY="visible";content.style.overflowX="visible";content.style.overflow="visible";contentArea.style.overflowY="scroll";contentArea.style.overflowX="auto";}
toc=document.getElementById('toc');if(toc==null){toc=document.createElement('div');toc.id='toc';toc.className='toc';}
indexArea=document.getElementById('indexArea');if(typeof bVerticalMode!=="undefined"&&bVerticalMode===true){contentArea.className+=" vertical";}
Sh5AddEventProc(document.body,'selectstart',ClearEvent);Sh5AddEventProc(content,'click',OnContentClick);if(!iPad&&!iPod&&!iPhone){Sh5AddEventProc(content,'dblclick',OnContentDblClick);}
if('ontouchstart' in window){Sh5AddEventProc(content,'touchstart',OnContentTouchStart);}
Sh5AddEventProc(contentArea,'scroll',function(event){if(bScrollMode&&!bScriptScroll){if(saudio.IsPlay()){if(window.nScrollEventTime==-1){window.nScrollEventTime=event.timeStamp;}else if(100<(event.timeStamp-window.nScrollEventTime)){dump_event("--- Scroll to Play Stop Event ---");OnCmdPauseButton();window.nScrollEventTime=-1;}}else{window.nScrollEventTime=-1;}}else if(window.nScrollEventTime!=-1){window.nScrollEventTime=-1;}});Sh5AddEventProc(toc,'click',OnTocClick);Sh5AddEventProc(toc,'dblclick',OnTocDblClick);{var cSections=document.querySelectorAll("section.html_page");var nSections=cSections.length;for(var s=0;s<nSections;s++){var cSection=cSections[s];var cReads=cSection.querySelectorAll(".read");var nReads=cReads.length;for(var r=0;r<nReads;r++){cReads[r].parentSection=cSection;}{cSection.style.display='none';}}}
if(cssColors==null){cssColors=document.createElement("style");cssColors.id="color_setting";cssColors.type="text/css";document.head.appendChild(cssColors);}
if(cssRybyLevel==null){cssRybyLevel=document.createElement("style");cssRybyLevel.id="ruby_level_setting";cssRybyLevel.type="text/css";document.head.appendChild(cssRybyLevel);}
ImageGroupInit();SH5OverlapInitalize();var buttonImages=document.createElement("script");buttonImages.onload=function(event){var span=document.createElement('span');span.innerHTML=buttonSvgBase;document.body.insertBefore(span,document.body.firstChild);var button_vertohorz=document.getElementById('button_vertohorz');if(button_vertohorz!=null){button_vertohorz.innerHTML=bVerticalButtuon ? window.buttonImages.verttohorz:window.buttonImages.horztovert;}
SetShowRubyLevel();SetToolButtonCaptions(bEasyCaption);SetVerticalSectionMode();}
buttonImages.type='text/javascript';buttonImages.src='./scripts/buttonImages.js?time='+window.sTime;document.head.appendChild(buttonImages);SetToolButtonCaptions(bEasyCaption);var settingValue;window.bPrevKeyRepeat=GetSettingBool('prevKeyRepeat',window.bPrevKeyRepeat);SetPrevKeyRepeat();if((settingValue=GetSettingValue('repeatFrace',null))==null){window.bRepeatFrace=false;}else{window.bRepeatFrace=(settingValue===1)? true:false;}
SetRepeatFrace();if((settingValue=GetSettingValue('swapArrowKeys',null))==null){window.bSwapArrowKeysInVerticalSection=true;}else{window.bSwapArrowKeysInVerticalSection=(settingValue===1)? true:false;}
SetSwapArrowKeys();if((settingValue=GetSettingValue('AdjustStartFaster',null))!=null){window.bAdjustStartFaster=settingValue ? true:false;}
SetAdjustStartFaster();toc.style.display='';contentArea.style.display='';if(window._DEBUG!==true&&window._CONTEXTMENU!==true){Sh5AddEventProc(document.body,"contextmenu",ClearEvent);}
Sh5AddEventProc(window,"resize",ClientResizeEvent);Sh5AddEventProc(contentArea,"scroll",function(event){});if(GetDisplayMode()==2){}
if(cUserSetting['fontface']!==undefined&&bVerticalMode!==true){if(cUserSetting['fontface']!=''){document.getElementById('sh5content').style.fontFamily=indexArea.style.fontFamily=cUserSetting['fontface'];var sections=document.querySelectorAll("section.html_page");for(var s=0;s<sections.length;s++){sections[s].style.fontFamily=indexArea.style.fontFamily=cUserSetting['fontface'];}}}else{var strFontName="'ＭＳ ゴシック','Hiragino Kaku Gothic ProN','Hiragino Kaku Gothic Pro',Osaka";if(cUserSetting['fontface']!==undefined&&cUserSetting['fontface']!=''){if(cUserSetting['fontface']!==undefined&&cUserSetting['fontface'].match(/明朝/)){var strFontName="'ＭＳ 明朝','Hiragino Mincho ProN','Hiragino Mincho Pro'";}
if(cUserSetting['fontface']!==undefined){document.getElementById('sh5content').style.fontFamily=indexArea.style.fontFamily=cUserSetting['fontface'];}
var sections=document.querySelectorAll("section.html_page");for(var s=0;s<sections.length;s++){sections[s].style.fontFamily=indexArea.style.fontFamily=cUserSetting['fontface'];}}}
if((nRubyLevel=GetSettingValue("ruby_level",-1))==-1){if(cUserSetting['ruby']!==undefined){nRubyLevel=cUserSetting['ruby'];}}
SetShowRubyLevel(nRubyLevel);if(GetDisplayMode()==2){}
var uuid=GetUUID();if('strDefaultLayout' in window&&(typeof strDefaultLayout)=='string'&&0<strDefaultLayout.length){cLayoutData=JSON.parse(strDefaultLayout);}else{cLayoutData=Array();}
RestoreLayoutData();AdjustImageSize(false);nLoadTimeOut=setTimeout(function(){clearTimeout(nLoadTimeOut);ClientResize();},10);ClientResize();doubleSpeedTest=function(){var atest=document.createElement("audio");saudio.SetDobuleSpeed(false);atest.onerror=function(event){saudio.SetDobuleSpeed(false);}
atest.onloadeddata=function(event){saudio.SetDobuleSpeed(true);if(document.getElementById('button_speedA')!=null){document.getElementById('button_speedA').style.display='';document.getElementById('button_speedB').style.display='none';}}
for(var n in cAudioItems){var item=cAudioItems[n];if(item.src&&item.src.substr(0,11)!="data:audio/"){var src=cAudioItems[n].src;if(src.indexOf("?")!=-1){src=src.substr(0,src.indexOf("?"));}
var ext=src.right(4).toLowerCase();if(ext=='.wav'){atest.src=src.replace(/.wav$/,"_x2.wav");}else{atest.src=src.replace(/.mp3$/,"_x2.mp3");}
break;}}}
TableCellEffectInitalize();BackslashCellInitalize();if(window._LAYER_DEBUG){window.cLayerDebugArea=document.createElement("div");window.cLayerDebugArea.id="layer_debug";window.cLayerDebugArea.style.position="absolute";window.cLayerDebugArea.style.display="inline-block";window.cLayerDebugArea.style.border="solid 1px #283";window.cLayerDebugArea.style.backgroundColor="rgba(240,255,255,0.9)";window.cLayerDebugArea.style.width='300px';window.cLayerDebugArea.style.height='100px';window.cLayerDebugArea.style.bottom='10px';window.cLayerDebugArea.style.left='20px';window.cLayerDebugArea.style.zIndex='1000';window.cLayerDebugArea.style.textAlign="left"
window.cLayerDebugArea.style.fontSize='6pt';window.cLayerDebugArea.style.lineHeight='1pt';window.cLayerDebugArea.style.paddingTop='1.2em';window.cLayerDebugArea.style.zoom="150%";window.cLayerDebugArea.style.boxSizing="border-box";document.body.appendChild(window.cLayerDebugArea);}
ColorSettingCSS();MakerInitizlise();if(typeof window.bDoubleSpeedState=='undefined'||window.bDoubleSpeedState!==false){doubleSpeedTest();}
if(!bVerticalMode&&contentArea){}
if(window.external&&typeof(window.external.InitializeFinished)!='undefined'){window.external.InitializeFinished();}
if(window._DEBUG){var p=document.createElement("p");p.textContent=navigator.userAgent;document.getElementById('sh5content').appendChild(p);}
if(window._DEBUG===true){setTimeout(function(){var reads=document.querySelectorAll("span.read");for(var r=0;r<reads.length;r++){var read=reads[r];read.title+="\n("+read.offsetLeft+"-"+read.offsetTop+")["+read.offsetWidth+"-"+read.offsetHeight+"]";}},2000);}
ShowReadElement(document.getElementById('s001_00001'));var firstSection=document.querySelector("section.html_page");if(firstSection!=null&&firstSection.className.indexOf('vertical_section')!=-1){contentArea.scrollLeft=contentArea.scrollWidth;var nTimeOut=setTimeout(function(nTimeOut){clearTimeout(nTimeOut);contentArea.scrollLeft=contentArea.scrollWidth;},100,nTimeOut);}
if(bResumeSupport&&bResumeMode){var resumeItem=null;if(window.external&&typeof(window.external.GetResumePosition)!=='undefined'){var contentID=GetUUID();if(contentID==null||contentID.length==0){contentID=document.title;}
resumeItem=window.external.GetResumePosition(contentID);}else{var contentID=GetUUID();if(contentID==null||contentID.length==0){contentID=document.title;}
contentID+="_item_position";resumeItem=GetSettingString(contentID,null);}
if(resumeItem!=null&&(resumeItem=document.getElementById(resumeItem))!=null){setTimeout(function(resumeItem){ShowReadElement(resumeItem);saudio.OnItemClick({'target':resumeItem,'resumeTarget':true});},1000,resumeItem);}}}
function SH5Exit(){if(bResumeSupport&&bResumeMode){var contentID=GetUUID();if(contentID==null||contentID.length==0){contentID=document.title;}
contentID+="_item_position";if(saudio!=null&&saudio.cActiveItem!=null&&saudio.cActiveItem.element){SetSettingValue(contentID,saudio.cActiveItem.element.id);}else{SetSettingValue(contentID);}}
if(window.bClearSettingWhenClose===true){for(var name in window.localStorage){if(name.substr(0,16)=='SH5_SettingValue'){window.localStorage.removeItem(name);}}}}
function ScrollContentTop(){if(contentArea){contentArea.scrollTop=0;var firstSection=document.querySelector("section.html_page");if(firstSection!=null&&firstSection.className.indexOf('vertical_section')!=-1){contentArea.scrollLeft=contentArea.scrollWidth;}}}
function bindTouch(event){event.preventDefault();}
function ClientResizeEvent(e){ClientResize();ClientResize();}
function ClientResize(e){var statusArea=document.getElementById('statusArea');var controlArea=document.getElementById('controlArea');var saHeight=(statusArea!=null&&bHideToolBar==false)? statusArea.offsetHeight:0;var infoArea=document.getElementById('infomation_area');var ifHeight=(infoArea!=null&&bHideToolBar==false)? infoArea.offsetHeight:0;if(window._DEBUG){dump_event("HideToolBar="+bHideToolBar+"("+bChattyBooks+")");}
if(bHideToolBar==true){controlArea.style.display='none';}
if(GetDisplayMode()!=2){var LayoutToolBar=document.getElementById('layout_tool_bar');var nBarSize=52;var nToolBarHeight=controlArea.offsetHeight;if(LayoutToolBar!=null){nToolBarHeight=LayoutToolBar.offsetHeight;if(bHideToolBar!=false){LayoutToolBar.style.display='none';nToolBarHeight=0;}}
if((document.body.offsetWidth-100)<vertSplit.offsetLeft){vertSplit.style.left=(document.body.offsetWidth-100)+'px';}
nVertSplit=vertSplit.offsetLeft;SetSettingValue('VerticalSplitterPosition',nVertSplit);indexArea.style.width=vertSplit.offsetLeft+'px';var nContentCX=document.body.offsetWidth-indexArea.offsetWidth-0;var nContentX=indexArea.offsetWidth+4;contentArea.style.top=indexArea.style.top=nToolBarHeight+'px';contentArea.style.left=(indexArea.offsetWidth+4)+'px';contentArea.style.height=(document.body.offsetHeight-contentArea.offsetTop-1-ifHeight)+'px';if(indexArea.style.display!=='none'){indexArea.style.display="block";}
indexArea.style.bottom="2px";indexArea.style.height='';contentArea.style.width=(document.body.offsetWidth-contentArea.offsetLeft)+'px';vertSplit.style.top=contentArea.style.top;vertSplit.style.height=contentArea.style.height;if(infoArea!=null){infoArea.style.display=(bHideToolBar!=false)? 'none':'';infoArea.style.top=(document.body.offsetHeight-infoArea.clientHeight)+'px';}}else if(GetDisplayMode()==2){var LayoutToolBar=document.getElementById('layout_tool_bar');var nBarSize=52;if(LayoutToolBar==null){controlArea.style.left='0px';controlArea.style.width=document.body.clientWidth+'px';nBarSize=controlArea.offsetHeight;controlArea.style.top=(document.body.clientHeight-nBarSize)+'px';contentArea.style.top='0px';contentArea.style.left='0px';contentArea.style.width=document.body.clientWidth+'px';contentArea.style.height=(document.body.clientHeight-nBarSize)+'px';controlArea.style.display='';}else{controlArea.style.display='none';contentArea.style.top='0px';contentArea.style.left='0px';contentArea.style.width=document.body.clientWidth+'px';contentArea.style.height=(document.body.clientHeight-LayoutToolBar.clientHeight)+'px';LayoutToolBar.style.top=(document.body.clientHeight-LayoutToolBar.clientHeight)+"px";contentArea.style.height=LayoutToolBar.style.top;}}else{var LayoutToolBar=document.getElementById('layout_tool_bar');var nContentCY=document.body.clientHeight;var nContentCX=document.body.clientWidth;if(LayoutToolBar!=null){nContentCY-=LayoutToolBar.clientHeight;LayoutToolBar.style.top=(document.body.offsetHeight-LayoutToolBar.clientHeight)+"px";}
contentArea.style.height=nContentCY+"px";contentArea.style.width=nContentCX+"px";}
if(settingFrame.style.display!='none'){var ranges=document.getElementsByClassName("rangeGlip");for(var i=0;i<ranges.length;i++){var name=ranges[i].id.split("_")[0];SetRangePos(name,null);}}
if(GetDisplayMode()==2&&indexFrame.style.display!='none'){indexArea.style.width=Math.round(document.body.clientWidth * 0.85)+"px";indexArea.style.height=Math.round((document.body.clientHeight-60)* 0.85)+"px";if(window.innerWidth<=600){indexFrame.style.width='250px';indexFrame.style.maxWidth='250px';}else{indexFrame.style.width='600px';}
if(window.innerHeight<=600){indexFrame.style.height='200px';indexFrame.style.maxHeight='200px';}else{indexFrame.style.height='600px';}}
if(helpFrame.style.display!='none'){helpArea.style.width=Math.round(document.body.clientWidth * 0.85)+"px";helpArea.style.height=Math.round(document.body.clientHeight * 0.85)+"px";}
if(statusArea!=null&&statusArea.style.display==''){statusArea.style.width=document.body.clientWidth+"px";statusArea.style.height="20px";statusArea.style.top=(document.body.clientHeight-20)+"px";if(GetDisplayMode()==1){indexArea.style.height=contentArea.style.height=(contentArea.offsetHeight-20)+'px';}
statusArea.style.zIndex=900;}
AdjustImageSize(false);}
function SH5OverlapInitalize(){overlapArea=document.createElement("table");var ocerlapRow=overlapArea.insertRow(0);var ocerlapArea=ocerlapRow.insertCell(0);overlapArea.className="overlapArea";overlapArea.id="overlapArea";Sh5AddEventProc(overlapArea,'selectstart',ClearEvent);overlapArea.style.display='none';ocerlapRow.className="overlapArea";ocerlapArea.className="overlapArea";ocerlapArea.id="overlapCell";document.body.appendChild(overlapArea);Sh5AddEventProc(overlapArea,'click',HideOverlapArea);Sh5AddEventProc(overlapArea,"mousedown",OverlapAreaMouseDown);var cPanelItems=new Array("control","index","setting","bibinfo","marker","help");for(var i=0;i<cPanelItems.length;i++){var name=cPanelItems[i];var panel=document.createElement("table");panel.style.display='none';panel.className="panelFrame";panel.id=name+"Frame";var row1=panel.insertRow(0);var row2=panel.insertRow(1);var row3=panel.insertRow(2);var head=row1.insertCell(0);var clos=row1.insertCell(1);var cell=row2.insertCell(0);var foot=row3.insertCell(0);var area=document.createElement("div");panel.style.display='none';panel.style.backgroundColor="#FFF";cell.appendChild(area);row1.className="panelRow1";row2.className="panelRow2";row3.className="panelRow3";head.className="panelHeader";clos.className="panelClose";cell.className="panelCell";foot.className="panelFooter";area.className="panelArea";row1.id=name+"Row1";row2.id=name+"Row2";row3.id=name+"Row3";head.id=name+"Header";clos.id=name+"Close";cell.id=name+"Cell";foot.id=name+"Footer";area.id=name+"Area";head.innerHTML=sPanelHeaders[name]? sPanelHeaders[name]:name;if(name=='setting'){head.innerHTML+=' <span title="(Ver '+strVersion+' / '+strVerDate+')" style="cursor:pointer;">&nbsp;&nbsp;</span>';}
clos.innerHTML="<span class='panelClose' onclick='HideOverlapArea();'>&times;</span>";foot.innerHTML=sPanelFooters[(GetDisplayMode()==2)? "mobile":"desktop"];area.innerHTML='';cell.colSpan=2;foot.colSpan=2;ocerlapArea.appendChild(panel);}
window.settingFrame=document.getElementById('settingFrame');window.bibinfoFrame=document.getElementById('bibinfoFrame');nVertSplit=GetSettingValue('VerticalSplitterPosition',nVertSplit);if(nVertSplit<50){nVertSplit=50;}
vertSplit=document.createElement('div');vertSplit.className='sh5_vertSplit';vertSplit.style.left=nVertSplit+'px';document.body.appendChild(vertSplit);DnsSplitter(vertSplit);if(GetDisplayMode()==1){ControlAreaInitializeByTablet();}else if(GetDisplayMode()==2){vertSplit.style.display='none';ControlAreaInitializeByTablet();}else{ControlAreaInitializeByMobile();}
Sh5AddEventProc(document.getElementById('button_font1'),'mouseenter',ShowProgressPaneFont);Sh5AddEventProc(document.getElementById('button_font2'),'mouseenter',ShowProgressPaneFont);Sh5AddEventProc(document.getElementById('button_font3'),'mouseenter',ShowProgressPaneFont);Sh5AddEventProc(document.getElementById('button_font1'),'mouseleave',HideProgressPaneFont);Sh5AddEventProc(document.getElementById('button_font2'),'mouseleave',HideProgressPaneFont);Sh5AddEventProc(document.getElementById('button_font3'),'mouseleave',HideProgressPaneFont);Sh5AddEventProc(document.getElementById('button_speed1'),'mouseenter',ShowProgressPaneSpeed);Sh5AddEventProc(document.getElementById('button_speed2'),'mouseenter',ShowProgressPaneSpeed);Sh5AddEventProc(document.getElementById('button_speed3'),'mouseenter',ShowProgressPaneSpeed);Sh5AddEventProc(document.getElementById('button_speed1'),'mouseleave',HideProgressPaneSpeed);Sh5AddEventProc(document.getElementById('button_speed2'),'mouseleave',HideProgressPaneSpeed);Sh5AddEventProc(document.getElementById('button_speed3'),'mouseleave',HideProgressPaneSpeed);var uuid=GetUUID();if(uuid==null||uuid.length==0){var item1=document.getElementById('separator_blank5');var item2=document.getElementById('button_areaedit');if(item1!=null){item1.style.display='none';}
if(item2!=null){item2.style.display='none';}}
if(document.querySelector("span.infty_silent_wide_space")!=null||window.bWbrEnable){window.bWbrEnable=true;var wakaMode=document.getElementById('button_waka_mode');var vWakaMode=GetSettingBool('Wakachigaki',true);var vWakaModeEx=GetSettingBool('WakachigakiLv2',false);if(vWakaMode){AppendClassName(document.body,'wakachigaki');if(window.bWbrExEnable&&vWakaModeEx){AppendClassName(document.body,'wakachigaki_level2');}}}else{document.getElementById('button_waka_mode').style.display='none';}
var metas=document.getElementsByTagName("meta");var bibTable=document.createElement("table");bibTable.className="bibTable";bibinfoArea.appendChild(bibTable);for(var name in sBibItems){if(!bChattyInfty3&&name=='generator'){continue;}
var pMeta=document.querySelector("html > head > meta[name='"+name+"']");if(pMeta==null&&name.indexOf('_')!=-1){pMeta=document.querySelector("html > head > meta[name='"+name.replace(/_/g,':')+"']");}
if(pMeta!=null){{var row=bibTable.insertRow(-1);var cell1=row.insertCell(0);var cell2=row.insertCell(1);cell1.className="bibCaption";cell1.id="bibCaption_"+name;cell2.className="bibItem";cell1.innerHTML=sBibItems[name].caption;if(name=='smil_count'){cell1.onclick=function(){var sysInfo=document.getElementById('system_info');if(sysInfo==null){var bib_title=document.getElementById('bibCaption_title');if(bib_title){bib_title.onclick=function(){var bib_title=document.getElementById('bibCaption_title');if(bib_title){bib_title.onclick=null;}
var bibinfoArea=document.getElementById('bibinfoArea');if(bibinfoArea!=null){var sysInfo=document.createElement('textarea');sysInfo.id='system_info';sysInfo.style.whiteSpace="normal";sysInfo.style.display="inline-block";sysInfo.style.textAlign='left';sysInfo.style.width='400px';sysInfo.style.border='solid 1px #000';sysInfo.rows=16;var strMessage='';strMessage+='ChattyBook Version\n'+strVersion+'('+strVerDate+')\r\n\r\n';strMessage+='Modes Safari:'+(bSafari ? 'OK':'NO')+' / iOS:'+(iOS5 ? 'OK':'NO')+' / iPad:'+(iPad ? 'OK':'NO')+' / iPhone:'+(iPhone ? 'OK':'NO')+'\n\n';strMessage+='navigator userAgent\n'+navigator.userAgent+'\n\n';strMessage+='Screen Size '+window.screen.width+'px X '+window.screen.height+'px\n';strMessage+='Client Size '+document.body.clientWidth+'px X '+document.body.clientHeight+'px\n\n';if(document.baseURI){strMessage+='Document URL '+document.baseURI.replace(/\x2F/g,"/ ");}else if(document.URL){strMessage+='Document URL '+document.URL.replace(/\x2F/g,"/ ");}
sysInfo.innerHTML=strMessage;bibinfoArea.appendChild(sysInfo);}}
setTimeout(function(){var bib_title=document.getElementById('bibCaption_title');if(bib_title){bib_title.onclick=null;}},2000,bib_title);}}}}
switch(name){case "create_date":{var strs=pMeta.content.split("-");var text=sBibItems[name].option;var yy=Number(strs[0]);var mm=Number(strs[1]);var dd=Number(strs[2]);text=text.replace("yyyy",yy);text=text.replace("mm",String("00"+mm).right(2));text=text.replace("dd",String("00"+dd).right(2));cell2.innerHTML=text;}
break;case "total_time":if(sBibItems[name].option!=undefined){var strs=pMeta.content.split(":");var text=sBibItems[name].option;var hh=Number(strs[0]);var mm=Number(strs[1]);var ss=Number(strs[2]);var tm=Math.round((hh * 3600)+(mm * 60)+ss);hh=Math.floor(tm/3600);mm=Math.floor(tm/60)%60;ss=tm%60;if(text.indexOf("hh")!=-1){text=text.replace("hh",String("00"+hh).right(2));text=text.replace("mm",String("00"+mm).right(2));text=text.replace("ss",String("00"+Math.round(ss)).right(2));}else{text=text.replace("mm",''+(hh * 60+mm));text=text.replace("ss",String("00"+Math.round(ss)).right(2));}
cell2.innerHTML=text;}else{cell2.innerHTML=pMeta.content;}
break;default:cell2.innerHTML=pMeta.content+((sBibItems[name].option!=undefined)? sBibItems[name].option:'');break;}}}}
var helpSubArea=document.createElement("iframe");helpSubArea.id="helpSubArea";helpSubArea.className="helpSubArea";helpSubArea.style.width="100%";helpSubArea.style.height="100%";helpSubArea.style.border='none';helpArea.appendChild(helpSubArea);if(GetDisplayMode()==2){Sh5AddEventProc(helpSubArea,"touchstart",HelpTouchStart);Sh5AddEventProc(helpSubArea,"touchmove",HelpTouchMove);Sh5AddEventProc(helpSubArea,"touchend",HelpTouchEnd);}
indexArea=document.getElementById('indexArea');indexArea.appendChild(toc);toc=document.getElementById('toc');MakeTableOfContent();indexArea.style.height="400px";toc.style.position="relative";toc.style.textAlign="left";toc.style.display='';toc.style.overflow="hidden";toc.style.backgroundColor="#FFE";toc.style.width="100%";toc.style.height="100%";toc.style.borderTop="solid 1px #888";toc.style.borderBottom="solid 1px #888";cSettingItems["color"].max=cColors.length-1;for(var name in cUserSetting){if(cSettingItems[name]!=undefined){if(cSettingItems[name]!==0&&cSettingItems[name]!=cSettingItems[name].defval){cUserSetting[name]=GetSettingValue(name,cUserSetting[name]);}else{cUserSetting[name]=GetSettingValue(name,cSettingItems[name].defval);}}}
var str='';var table=document.createElement("table");table.id="settingTable";table.border="0";table.className="setting";settingArea.innerHTML='';settingArea.appendChild(table);var prevItem=null;var firstItem=null;for(var name in cSettingItems){if(GetDisplayMode()==2&&name=="volume"){continue;}
if(iOS5&&name=="speed"){continue;}
var cItem=cSettingItems[name];var tr=document.createElement("tr");var th=document.createElement("th");var td=document.createElement("td");cItem.name=name;cItem.element=tr;cItem.prevItem=prevItem;if(cItem.prevItem&&!cItem.prevItem.nextItem){cItem.prevItem.nextItem=cItem;}
prevItem=cItem;if(!firstItem){firstItem=cItem;}
lastItem=cItem;tr.className="setting";th.className="setting";td.className="setting";tr.id=name+"Row";th.id=name+"Head";td.id=name+"Cell";td.colSpan=2;table.appendChild(tr);tr.appendChild(th);tr.appendChild(td);if(typeof(sSettingLabels[name])=="string"){th.innerHTML=sSettingLabels[name];}else if(typeof(sSettingLabels[name])=="object"&&sSettingLabels[name].label){th.innerHTML=sSettingLabels[name].label;}
if(cItem.type=="range"){str='';str+="<span class='settingItem' id='"+name+"_Range'>";str+="<span type='text' class='stgValue'  id='"+name+"_Value'>999</span>";str+="<span class='stgButton' id='"+name+"_Left' title='"+sSettingLabels["left"]+"'>C</span>";str+="<span class='rangeSlider' id='"+name+"_Slider'>";str+="<span class='rangeGlip'   id='"+name+"_Glip'></span>";str+="</span>";str+="<span class='stgButton' id='"+name+"_Right' title='"+sSettingLabels["right"]+"'>D</span>&thinsp;";str+="<span class='stgButton' id='"+name+"_Reset' title='"+sSettingLabels["reset"]+"'>W</span>";str+="</span>";td.innerHTML=str;var nameSlider=document.getElementById(name+"_Slider");var nameLeft=document.getElementById(name+"_Left");var nameRight=document.getElementById(name+"_Right");var nameReset=document.getElementById(name+"_Reset");var nameGlip=document.getElementById(name+"_Glip");Sh5AddEventProc(nameSlider,'click',RangeSliderClick);Sh5AddEventProc(nameLeft,'click',RangeButtonClick);Sh5AddEventProc(nameRight,'click',RangeButtonClick);Sh5AddEventProc(nameReset,'click',RangeButtonClick);Sh5AddEventProc(nameGlip,"pointerdown",GripPointerDonw);}else{var str='';str+="<span class='settingItem' id='"+name+"_Item'>";str+="<span class='stgValue'    id='"+name+"_Value'>999</span>";str+="<span class='stgButton'   id='"+name+"_Left' title='"+sSettingLabels["left"]+"'>C</span>";str+="<div class='colorArea'   id='"+name+"_Area'>";var tests=sSettingLabels["sample_text"].split(" ");for(var s in tests){if(s!=1){str+=tests[s];}else{str+="<span id='color_Highlight' class='colorHighlight'>"+tests[s]+"</span>";}}
str+="</div>";str+="<span class='stgButton' id='"+name+"_Right' title='"+sSettingLabels["right"]+"'>D</span>&ensp;";str+="</span>";td.innerHTML=str;Sh5AddEventProc(document.getElementById(name+"_Area"),'click',RangeButtonClick);Sh5AddEventProc(document.getElementById(name+"_Left"),'click',RangeButtonClick);Sh5AddEventProc(document.getElementById(name+"_Right"),'click',RangeButtonClick);}
if(GetDisplayMode()==1){th.style.backgroundColor=td.style.backgroundColor="#FFF";if(strActiveSettingItem==''){ActiveSettingItem(name);}}
SetRangePos(name,cUserSetting[name]);}
var tab=100;if(1||"ontouchstart" in window){var tr=AppendElememnt(table,'tr','class=setting,id=dispModeRow');var td=AppendElememnt(tr,'td','id=dispMode,class=setting,colSpan=3');var input;var label;AppendElememnt(td,'span','style="font-weight:bold;"',sControlCaptions.dispMode.normal);input=AppendElememnt(td,'input','type=radio,name=dispMode,id=dispMode1');input.tabIndex=tab++;input.onclick=DispModeChange1;input.checked=(nDispMode==1);label=AppendElememnt(td,'label','id=dispMode1_label,for=dispMode1',sControlCaptions.dispModePC.normal);input=AppendElememnt(td,'input','type=radio,name=dispMode,id=dispMode2');input.tabIndex=tab++;input.onclick=DispModeChange2;input.checked=(nDispMode==2);label=AppendElememnt(td,'label','id=dispMode2_label,for=dispMode2',sControlCaptions.dispModeTablet.normal);input=AppendElememnt(td,'input','type=radio,name=dispMode,id=dispMode3');input.tabIndex=tab++;input.onclick=DispModeChange0;input.checked=(nDispMode==0);label=AppendElememnt(td,'label','id=dispMode3_label,for=dispMode3',sControlCaptions.dispModeAuto.normal);cSettingItems['dispMode']={name:'dispMode','prevItem':prevItem,'element':td};prevItem.nextItem=cSettingItems['dispMode'];prevItem=cSettingItems['dispMode'];}{var tr=AppendElememnt(table,'tr','class=setting,id=optionRow');var td=AppendElememnt(tr,'td','class=setting,id=optionCell,colSpan=3');var input;var span;var name="option";var strDesc="";if(sControlCaptions!==undefined&&sControlCaptions.otherSettings!==undefined){if(sControlCaptions.otherSettings.description!==undefined){strDesc=sControlCaptions.otherSettings.description;}else if(sControlCaptions.otherSettings.caption!==undefined){strDesc=sControlCaptions.otherSettings.caption;}}
AppendElememnt(td,'span','style="font-weight:bold;"',strDesc);{window.bScrollMode=GetSettingBool('ScrollMode',bScrollMode);var caption=(sControlCaptions.scrollMode ? sControlCaptions.scrollMode.description:'- - - ');span=document.createElement("span");span.innerHTML='<input type="checkbox" id="scrollMode"/><label id="scrollMode_label" for="scrollMode">'+caption+'</label>';Sh5AddEventProc(span.querySelector('#scrollMode'),'click',ScrollModeChange,false);cSettingItems['ScrollMode']={name:'ScrollMode','prevItem':prevItem,'element':span};prevItem.nextItem=cSettingItems.ScrollMode;prevItem=cSettingItems.ScrollMode;span.style.cursor="pointer";td.appendChild(span);ScrollModeChange();}
if(bResumeSupport){if(!bChattyBooks){bResumeMode=GetSettingBool("EnableResume",bResumeMode);}
window.bResumeMode=GetSettingBool('resumeMode',window.bResumeMode);var caption=(sControlCaptions.resumeMode ? sControlCaptions.resumeMode.description:'- - - ');span=document.createElement("span");span.innerHTML='<input type="checkbox" id="resumeMode"/><label id="resumeMode_label" for="resumeMode">'+caption+'</label>';Sh5AddEventProc(span.querySelector('#resumeMode'),'click',ResumeModeChange,false);cSettingItems['resumeMode']={name:'resumeMode','prevItem':prevItem,'element':span};prevItem.nextItem=cSettingItems.resumeMode;prevItem=cSettingItems.resumeMode;span.style.cursor="pointer";td.appendChild(span);ResumeModeChange();}{span=document.createElement("span");span.innerHTML='<input type="checkbox" id="swapArrowKeys"/>'+
'<label id="swapArrowKeys_label" for="swapArrowKeys">'+sControlCaptions["swapArrowKeys"].description+'</label>';Sh5AddEventProc(span.querySelector('#swapArrowKeys'),'click',SetSwapArrowKeys,false);cSettingItems['swapArrowKeys']={name:'swapArrowKeys','prevItem':prevItem,'element':span};prevItem.nextItem=cSettingItems['swapArrowKeys'];prevItem=cSettingItems['swapArrowKeys'];span.style.cursor="pointer";td.appendChild(span);}{var caption=(sControlCaptions.repeatFrace ? sControlCaptions.repeatFrace.description:'- - - ');span=document.createElement("span");span.innerHTML='<input type="checkbox" id="repeatFrace"/><label id="repeatFrace_label" for="repeatFrace">'+caption+'</label>';Sh5AddEventProc(span.querySelector('#repeatFrace'),'click',SetRepeatFrace,false);cSettingItems['repeatFrace']={name:'repeatFrace','prevItem':prevItem,'element':span};prevItem.nextItem=cSettingItems['repeatFrace'];prevItem=cSettingItems['repeatFrace'];span.style.cursor="pointer";td.appendChild(span);}{var caption=(sControlCaptions.prevKeyRepeat ? sControlCaptions.prevKeyRepeat.description:'- - - ');span=document.createElement("span");span.innerHTML='<input type="checkbox" id="prevKeyRepeat"/><label id="prevKeyRepeat_label" for="prevKeyRepeat">'+caption+'</label>';Sh5AddEventProc(span.querySelector('#prevKeyRepeat'),'click',SetPrevKeyRepeat,false);cSettingItems['prevKeyRepeat']={name:'prevKeyRepeat','prevItem':prevItem,'element':span};prevItem.nextItem=cSettingItems['prevKeyRepeat'];prevItem=cSettingItems['prevKeyRepeat'];span.style.cursor="pointer";td.appendChild(span);}
if(!bChattyBooksMode&&sControlCaptions["easyCaption"]){var caption=(sControlCaptions.easyCaption ? sControlCaptions.easyCaption.description:'- - - ');span=document.createElement("span");span.innerHTML='<input id="EasyCaptionCheck" type="checkbox" value="1">'+
'<label id="easyCaption_label" for="EasyCaptionCheck">'+caption+'</label>';cSettingItems['easyCaption']={'name':'easyCaption','prevItem':prevItem,'element':span};prevItem.nextItem=cSettingItems['easyCaption'];prevItem=cSettingItems['easyCaption'];span.style.cursor="pointer";td.appendChild(span);Sh5AddEventProc(span.querySelector('#EasyCaptionCheck'),'click',SetToolButtonCaptions,false);}{var caption=(sControlCaptions.AdjustStartFaster ? sControlCaptions.AdjustStartFaster.description:'- - - ');span=document.createElement("span");span.innerHTML='<input type="checkbox" id="AdjustStartFaster"/>'+
'<label id="AdjustStartFaster_label" for="AdjustStartFaster">'+caption+'</label>';Sh5AddEventProc(span.querySelector('#AdjustStartFaster'),'click',SetAdjustStartFaster,false);cSettingItems['AdjustStartFaster']={name:'AdjustStartFaster','prevItem':prevItem,'element':span};prevItem.nextItem=cSettingItems['AdjustStartFaster'];prevItem=cSettingItems['AdjustStartFaster'];span.style.cursor="pointer";td.appendChild(span);}}
if(prevItem&&firstItem){prevItem.nextItem=firstItem;if(!firstItem.prevItem){firstItem.prevItem=prevItem;}}
var span=document.createElement("span");span.id="settingDescription";span.innerHTML=sSettinInfo;settingArea.parentElement.appendChild(span);if(GetDisplayMode()==2){document.getElementById("settingDescription").style.display='none';}
ClientResize();}
function ControlAreaInitializeByTablet(){var controlCell=document.getElementById('controlCell');var indexCell=document.getElementById('indexCell');var controlArea=document.getElementById('controlArea');var indexArea=document.getElementById('indexArea');if((iPod||iPhone||bMacOS||bAndroid)&&GetDisplayMode()!=1){controlArea.className+=" SmartPhoneStyle";}
var cButtons={indexA:{caption:"R",events:{click:ShowIndexPanel}},blank0:'none',play:{caption:"D",events:{click:OnCmdPlayButton}},pause:{caption:"B",events:{click:OnCmdPauseButton}},speedA:{caption:"@",events:{click:OnCmdAudioSpeedChange},display:'none'},speedB:{caption:"?",events:{click:OnCmdAudioSpeedChange},display:'none'},blank1:'none',prev:{caption:!bVerticalMode ? 'G':'H',events:{click:OnCmdMovePrevItem}},next:{caption:!bVerticalMode ? 'H':'G',events:{click:OnCmdMoveNextItem}},up:{caption:"M",events:{click:OnCmdMovePrevSection}},down:{caption:"N",events:{click:OnCmdMoveNextSection}},blank2:'none',font1:{type:'R1',caption:"w",events:{click:SetFontSizeDown}},font3:{type:'R3',caption:"x",events:{click:SetFontSizeUp}},blank22:'none',speed1:{type:'R1',caption:"y",events:{click:SetPlaySpeedDown}},speed3:{type:'R3',caption:"z",events:{click:SetPlaySpeedUp}},blank3:'none',colorCh:{caption:"v",events:{click:SetColorChange}},blank5:'none',waka_mode:{caption:"m",events:{click:WakachigakiChange}},setting:{caption:"O",events:{click:ShowSettingPanel}},linemode1:{caption:"i",events:{click:LineReadModeChange}},linemode2:{caption:"j",events:{click:LineReadModeChange}},linemode3:{caption:"k",events:{click:LineReadModeChange}},blank6:'none',rubylevel:{caption:"\xa1",events:{click:SetShowRubyLevelMenu}},vertohorz:{caption:"\xB1",events:{click:VerticalModeChange}},blank7:'none',bibinfo:{caption:"P",events:{click:ShowBibInfoPanel}},last:null};if(vAlwaysShowVertToHorz||document.querySelector('section.vertical_section')!=null){cButtons.vertohorz.caption="\xB2";}else{delete cButtons.vertohorz;}
if((rubys=document.querySelectorAll('ruby')).length==0){delete cButtons.rubylevel;}
if(0&&!bVerticalMode){delete cButtons.vertohorz;}
var controlSubArea=controlArea.firstElementChild;if(controlSubArea==null){controlArea.innerHTML='<div style="margin:0;padding:0;background-position-x:right;background-position-y:bottom;background-repeat:no-repeat;"></div>';controlSubArea=controlArea.firstElementChild;}
if(!bMacOS){var canvas=document.createElement('canvas');var ctx;var fontSize=12;var text1='Ver '+window.strVersion;var text2='['+window.strVerDate+']';var si1,si2;var w;canvas.width=100;canvas.height=16 * 2;canvas.style.position='absolute';canvas.style.border='solid 1px red';canvas.style.backgroundColor='#000000';canvas.style.left=0;canvas.style.top=0;canvas.style.zIndex=90000;ctx=canvas.getContext('2d');ctx.font=fontSize+'px sans-serif';si1=ctx.measureText(text1);si2=ctx.measureText(text2);si1={cx:si1.actualBoundingBoxRight,cy:si1.fontBoundingBoxAscent};si2={cx:si2.actualBoundingBoxRight,cy:si2.fontBoundingBoxAscent};w=(si1.cx<si2.cx)? si2.cx:si1.cx;ctx.fillStyle='#808080';ctx.strokeStyle='none';ctx.textAlign='left';ctx.textBaseline='top';ctx.fillText(text1,100-(w-(w-si1.cx)/2)-2,(16 * 2)-(si1.cy+si2.cy)-2);ctx.fillText(text2,100-(w-(w-si2.cx)/2)-2,(16 * 2)-(si2.cy));controlSubArea.style.backgroundImage='url('+canvas.toDataURL("image/png")+')';}else{var versionInfo=document.createElement("span");versionInfo.className='versionInfo';versionInfo.innerHTML='<p style="text-align:center;">Ver '+window.strVersion+'</p><p style="text-align:center;font-size:60%;">['+strVerDate+"]</p>";versionInfo.title='Ver '+window.strVersion+"\nDATE["+strVerDate+"]";controlSubArea.appendChild(versionInfo);}
try{controlArea.style.textAlign='center';controlArea.style.verticalAlign='top';controlArea.style.lineHeight='0em';var button=null;var groupParent;var group=null;if(GetDisplayMode()==1){groupParent=controlSubArea;}else{controlSubArea.appendChild(groupParent=document.createElement("div"));groupParent.className="tabletControl";}
var nGroup=1;for(var name in cButtons){if(name=='last'){break;}
if(bVerticalMode){switch(name){case 'next':name='prev';break;case 'prev':name='next';break;}}else if(bVerticalMode&&name=='next'){name='prev';}
var item=cButtons[name];var strCaption=sControlCaptions[name];var ShortcutKey=ShortcutKeys[name];if(strCaption!=undefined&&strCaption.iAarray!=false){strCaption=strCaption[bEasyCaption ? 1:0];}
if(iOS5!=false&&(name=='speed1'||name=='speed2'||name=='speed3'||name=='blank3')){continue;}
if(group==null||item.caption==undefined){groupParent.appendChild(group=document.createElement("div"));group.id="group_"+nGroup++;group.className='toolButtonGroup';group.style.display="inline-block";group.style.marginRight="4px";group.style.whiteSpace='nowrap';}
if(item.caption!=undefined){button=document.createElement("span");button.className="buttonM"+((item.type==undefined)? '':item.type)+" toolButton";button.id="button_"+name;group.appendChild(button);if(item.caption.length==1){button.innerHTML=item.caption;}else if(sControlCaptions[name]!=undefined){button.innerHTML=sControlCaptions[name];button.style.fontFamily='"メイリオ" , Meiryo, "Hiragino Kaku Gothic Pro"';button.style.fontSize='14px';}
if(name=='index'){button.style.borderRadius='8px';}
if(item.display!=undefined){button.style.display=item.display;if(name!='pause'&&name!='speedA'&&name!='speedB'&&name!='waka_on'&&name!='waka_off'){group.style.display='none';}}
if(item.events!=undefined){for(var e in item.events){button.addEventListener(e,item.events[e],true);}}}}
if(GetDisplayMode()==1&&!window._DEBUG){document.getElementById("button_indexA").parentNode.style.display='none';}
LineReadModeChange(nLineReadStop);DispModeChange(nDispMode);}catch(e){alert('SH5OverlapInitalize\n'+e.message);}
if(GetDisplayMode()==1){var ctrl=controlArea;controlCell.removeChild(controlArea);document.body.appendChild(ctrl);controlArea.style.position="absolute";controlArea.style.display='';controlArea.style.top="0px";controlArea.style.left="0px";controlArea.style.width="100%";controlArea.style.textAlign="left";controlArea.style.backgroundColor="#888";controlArea.style.whiteSpace="normal";var ctrl=indexArea;indexCell.removeChild(indexArea);document.body.appendChild(ctrl);indexArea.style.position="absolute";indexArea.style.display='';indexArea.style.top=controlArea.offsetHeight+"px";indexArea.style.left="0px";indexArea.style.width=vertSplit.offsetLeft+'px';indexArea.style.border='none';indexArea.style.padding="0";indexArea.style.backgroundColor="#F00";toc.style.margin="0";toc.style.padding="0";toc.style.border='none';toc.style.height="100%";contentArea.style.overflow="auto";contentArea.style.position="absolute";contentArea.style.top=controlArea.offsetHeight+"px";contentArea.style.left=(indexArea.offsetWidth+4)+"px";controlArea.className+=" toolBarBack";contentArea.style.zIndex=0;controlArea.style.zIndex=1;indexArea.style.zIndex=2;if(statusArea!=null){statusArea.style.zIndex=3;}
overlapArea.style.zIndex=4;}else{var ctrl=controlArea;controlCell.removeChild(controlArea);document.body.appendChild(ctrl);controlArea.style.position="absolute";controlArea.style.display='';controlArea.style.top="0px";controlArea.style.left="0px";controlArea.style.width="100%";controlArea.style.textAlign="center";controlArea.style.backgroundColor="#888";controlArea.style.whiteSpace="normal";contentArea.style.fontSize='2px';contentArea.style.lineHeight='1px';contentArea.style.overflow="auto";contentArea.style.position="absolute";contentArea.style.verticalAlign='top';contentArea.style.top="0px";contentArea.style.left="0px";indexArea.style.display='';indexArea.style.left='0px';indexArea.style.top='0px';contentArea.style.zIndex=0;controlArea.style.zIndex=1;overlapArea.style.zIndex=2;indexArea.style.zIndex=3;}
if(bStatusArea==true){statusArea=document.createElement("div");statusArea.id="statusArea";statusArea.className="StatusArea";statusArea.style.backgroundColor="#FF8";statusArea.style.position="absolute";statusArea.style.display='';document.body.appendChild(statusArea);}
CreateWaitingArea();}
function ControlAreaInitializeByMobile(){var cButtons={index:{type:"L",caption:"R",events:{click:ShowIndexPanel}},blank1:"sep",play:{type:"L",caption:"D",events:{click:OnCmdPlayButton}},pause:{type:"L",caption:"B",events:{click:OnCmdPauseButton}},speedA:{caption:"?",events:{click:OnCmdAudioSpeedChange},display:'none'},speedB:{caption:"@",events:{click:OnCmdAudioSpeedChange},display:'none'},blank2:"sep",setting:{type:"L",caption:"O",events:{click:ShowSettingPanel}},bibinfo:{type:"L",caption:"P",events:{click:ShowBibInfoPanel}},blank3:"sep",layoutedit:{type:"L",caption:"X",events:{click:LayoutEditMode}}};var controlSubArea=controlArea.firstElementChild;if(controlSubArea==null){controlArea.innerHTML='<div style="margin:0;padding:0;background-position-x:right;background-position-y:bottom;background-repeat:no-repeat;"></div>';controlSubArea=controlArea.firstElementChild;}
for(var name in cButtons){var item=cButtons[name];var strCaption;if(sControlCaptions[name]!==undefined){strCaption=sControlCaptions[name]['normal'];}else{strCaption='';}
var bType=(GetDisplayMode()==2)? item.type:"S";if(item.type==undefined){if(item=="sep"){var span=document.createElement("span");span.className="buttonSeparator";span.innerHTML="&ensp;";controlSubArea.appendChild(span);}else{var br=document.createElement("br");controlSubArea.appendChild(br);}}else{var button=document.createElement("span");button.innerHTML=item.caption;button.title=strCaption;var span=document.createElement("span");span.className="buttonLabel";span.innerHTML=strCaption+"<br/>";span.appendChild(button);controlSubArea.appendChild(span);button.className="button"+bType+"M"+' toolButton';span.id="button_"+name;if(item.display!=undefined){span.style.display=item.display;}
if(item.events!=undefined){for(var e in item.events){button.addEventListener(e,item.events[e],true);}}}}
contentArea.style.overflow="auto";contentArea.style.position="absolute";contentArea.style.top="0px";contentArea.style.left="0px";}
var tocId=1;function MakeTableOfContent(){var sh5indexis=document.getElementsByClassName("sh5index");var pageNumbers=document.getElementsByClassName("sh5page");var toc=document.getElementById('toc');var index=null;var page=null;var ul;var srcItemID;for(var ai in cAudioItems){if(cAudioItems[ai].src!=undefined){srcItemID=ai;}else{cAudioItems[ai].refIndex=srcItemID;}}
if(0<pageNumbers.length){var tabArea;var tab1;var tab2;toc.appendChild(tabArea=document.createElement('div'));tabArea.appendChild(tab1=document.createElement('div'));tabArea.appendChild(tab2=document.createElement('div'));tabArea.className="topTabArea";tab1.id="topTabIndex";tab2.id="topTabPage";tab1.className="topTabItem topTabActive";tab2.className="topTabItem";tab1.innerHTML=sControlCaptions['index'].normal;tab2.innerHTML=sControlCaptions['page'].normal;toc.appendChild(page=document.createElement('div'));page.id='pageListArea';page.className='pageListArea';page.style.display='none';pageListArea=page;}
toc.appendChild(index=document.createElement('div'));index.id='indexListArea';index.className='indexListArea';index.appendChild(ul=document.createElement('ul'));indexListArea=index;if(pageListArea!=null){indexListArea.style.top=pageListArea.style.top="33px";indexListArea.style.bottom=pageListArea.style.bottom="0px";indexListArea.style.position=pageListArea.style.position="absolute";}else{indexListArea.style.top="0px";}
ul.className='toc';for(var i=0;i<sh5indexis.length;i++){var item=sh5indexis[i];var li=document.createElement('li');var reads=item.getElementsByClassName("read");var readItem=(0<reads.length)? reads[0]:null;var span=document.createElement('span');var tree=document.createElement('span');var tagName=item.tagName;if(item.attributes.getNamedItem("ncc_tag")!=null){tagName=item.attributes.getNamedItem("ncc_tag").value;}
if(tagName.substr(0,1).toLowerCase()!='h'){var parent;for(parent=item.parentElement;parent!=null;parent=parent.parentElement){if(parent.tagName.length==2&&parent.tagName.substr(0,1).toLowerCase()=='h'){tagName=parent.tagName;break;}}
parent=null;}
var nLevel=0;var nPos;if((nPos=item.className.indexOf("index_level_"))!=-1){nPos+=12;nLevel=parseInt(item.className.substr(nPos,1))-1;}else if(item.firstChild&&item.firstChild.className&&(nPos=item.firstChild.className.indexOf("index_level_"))!=-1){nPos+=12;nLevel=parseInt(item.firstChild.className.substr(nPos,1))-1;}else{nLevel=Math.round(tagName.right(1))-1;}
var strTree=String("&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;").substr(0,nLevel * 6);li.className="toc level"+(nLevel+1);span.className="toc";span.readElement=readItem ? readItem:item;item.tocElement=span;if(readItem){readItem.tocElement=span;}
if(readItem==null){if(item.className.indexOf("read")!=-1&&item.id.substr(0,1)=='s'){readItem=item;}else if(item.parentElement!=null&&item.parentElement.className.indexOf("read")!=-1&&item.parentElement.id.substr(0,1)=='s'){readItem=item.parentElement;}}
if(readItem!=null){span.id='toc_'+readItem.id;li.id='tocLi_'+readItem.id;span.name=readItem.id;span.targetItem=readItem;var data=span.id.split("_");strIndexis[data[0]+'_'+data[1]+'_00001']=span.id;}
tree.className="tree";if(window.tocTreeEx===undefined){tree.innerHTML=strTree;}
CopyContentChild(span,item);if(typeof item.title==="string"&&0<item.title.length){span.innerHTML=item.title;}
if(0){var cSubitems=item.querySelectorAll("*[id],*[class],*[title],*[style]");var nSubitems=cSubitems.length;for(var s=0;s<nSubitems;s++){cSubitems[s].className=cSubitems[s].id=cSubitems[s].title=cSubitems[s].style.cssText='';var a=0;}}{var cAnchors=span.getElementsByTagName("A");for(var a=0;a<cAnchors.length;a++){var cAnchor=cAnchors[a];var cParent=cAnchor.parentElement;while(cAnchor.firstChild){cParent.insertBefore(cAnchor.firstChild,cAnchor);}
cParent.removeChild(cAnchor);}}
ul.appendChild(li);li.appendChild(tree);li.appendChild(span);}
var cTocs=indexListArea.querySelectorAll("ul.toc li.toc span.toc");var nTocs=cTocs.length;for(var t=1;t<nTocs;t++){cTocs[t-1].nextToc=cTocs[t];cTocs[t].prevToc=cTocs[t-1];}
if(window.tocTreeEx!==undefined){indexListArea.className+=" tree_line";for(var l=1;l<6;l++){var sLevel="level"+l.toString();var cItems=ul.querySelectorAll("li.toc."+sLevel);var nItems=cItems.length;for(var i=0;i<nItems;i++){var cItem=cItems[i];var next=cItem.nextSibling;var subUl=null;while(next!=null){var subLevel=parseInt(next.className.substr(next.className.length-1));if(l<subLevel){if(subUl==null){subUl=document.createElement("ul");subUl.className='toc';cItem.appendChild(subUl);}
subUl.appendChild(next);next=cItem.nextSibling;}else{break;}}}}}
if(0<pageNumbers.length){var table=document.createElement('table');var tbody=document.createElement('tbody');var tr;table.appendChild(tbody);table.id="pageList";table.className="pagelist";page.appendChild(table);for(var i=0,c=0;i<pageNumbers.length;i++,c++){var item=pageNumbers[i];var strClassName=item.className.replace("sh5page",'').trim();var td=document.createElement('td');var reads=item.getElementsByClassName("read");var title=item.attributes.getNamedItem('title');item.pageListElement=td;if(0<reads.length){td.readElement=reads[0];}else if(item.className.indexOf("read")!=-1){td.readElement=item;}
td.className="page";if(1||(c%5)==0){tbody.appendChild(tr=document.createElement('tr'));c=0;}else if(0<i&&pageNumbers[i-1].className!=item.className){var tdBlank;var hr;tbody.appendChild(tr=document.createElement('tr'));tr.appendChild(tdBlank=document.createElement('td'));tdBlank.colSpan=5;tdBlank.cssText="padding:0;margin:0;text-align:center;";tdBlank.appendChild(hr=document.createElement('hr'));hr.style.cssText="width:99%;height:1px;border:0;background:#CCC;";tbody.appendChild(tr=document.createElement('tr'));c=0;}
tr.appendChild(td);if(0<reads.length){td.id='page_'+String(reads[0].id);}
if(title!=null){if(0<title.value.length){td.textContent=item.title;}else{td.innerHTML='&ensp;&ensp;&ensp;&ensp;'}}else{CopyElementText(td,item);}}
var pageTds=tbody.querySelectorAll("td.page");for(var p=0;p<pageTds.length;p++){if(0<p){pageTds[p].prevPage=pageTds[p-1];}
if(p<(pageTds.length-1)){pageTds[p].nextPage=pageTds[p+1];}}}
var items=document.querySelectorAll("#sh5content *.sh5index, #sh5content *.sh5page, #sh5content *.read");var itemsCount=items.length;var pageItem=null;var tocItem=null;for(var i=0;i<itemsCount;i++){var item=items[i];if(item.className.indexOf('sh5index')!=-1){if(tocItem==null){for(var n=i-1;n>=0;n--){items[n].tocElement=item.tocElement;}}
tocItem=item.tocElement;}else if(item.className.indexOf('sh5page')!=-1){if(pageItem==null){for(var n=i-1;n>=0;n--){items[n].pageElement=item.pageListElement;}}
pageItem=item.pageListElement;}else{item.tocElement=tocItem;item.pageElement=pageItem;}}
if(typeof bLoadTocLevel!=='undefined'&&bLoadTocLevel!==false&&window.tocTreeEx===undefined){var tocLevels=document.createElement("script");tocLevels.onload=function(event){var cTocs=document.querySelectorAll("div.indexListArea li.toc");var nTocs=cTocs.length;for(var t=0;t<nTocs;t++){var cToc=cTocs[t];var nPos=cToc.className.indexOf("level");var image;if(-1<nPos){image='item'+cToc.className.substr(nPos+5,1);image=window.tocLevels[image];cToc.firstChild.innerHTML+=image;var svg=cToc.firstChild.lastChild;if(svg!=null&&svg.nodeType==document.ELEMENT_NODE&&svg.nodeName=="svg"){svg.style.verticalAlign="middle";}}}}
tocLevels.type='text/javascript';tocLevels.src='./scripts/tocLevels.js?time='+window.sTime;document.head.appendChild(tocLevels);}}
function CopyElementText(dsc,src){var s=src.nodeValue;for(var i=0;i<src.childNodes.length;i++){var node=src.childNodes[i];var nType=node.nodeType;switch(nType){case 1:if(node.nodeName=="svg"){continue;}
CopyElementText(dsc,node);break;case 3:dsc.appendChild(document.createTextNode(node.nodeValue));break;}}}
function CopyContentChild(dsc,src){var strHTML=new String(src.innerHTML);while(strHTML.indexOf('class="sentence ')!=-1){strHTML=strHTML.replace('class="','');}
while(strHTML.indexOf('class="read"')!=-1){strHTML=strHTML.replace('class="read"','');}
while(strHTML.indexOf('<span id="s')!=-1){strHTML=strHTML.replace('<span id="s','<span id="page_s');}
dsc.innerHTML=src.innerHTML;var reads=dsc.getElementsByClassName('read');for(var r=0;r<reads.length;r++){var read=reads[r];var parent=read.parentNode;while(read.firstChild!=null){parent.insertBefore(read.firstChild,read);}
parent.removeChild(read);}
delete strHTML;}
function ImageGroupInit(item){var result=null;if(item==undefined||item==null){var imggps=document.getElementsByClassName('image_group');var nImageGroups=imggps.length;var strCssText='';for(var i=0;i<imggps.length;i++){var imggp=imggps[i];var imgElement=document.querySelector('span#'+imggp.id+' img.image');if(imgElement!=null&&imgElement.nodeName=='IMG'&&imgElement.style.verticalAlign){imggp.style.verticalAlign=imgElement.style.verticalAlign;if(imgElement.width&&imgElement.height){strCssText+="span#"+imggp.id+"{ width:"+imgElement.width+"px;height:"+imgElement.height+"px; }\n";}}
imggp.style.display='inline-block';imggp.style.position='relative';var reads=imggp.getElementsByClassName('read');for(var r=0;r<reads.length;r++){var read=reads[r];read.style.position='absolute';read.style.left='0px';read.style.top='0px';var imgs=read.getElementsByTagName('IMG');var img=(0<imgs.length)? imgs[0]:null;if(r==0){read.style.zIndex=100;}
if(img!=null){imggp.style.height=img.style.height;read.style.display='';img.style.display='';}}}
if(0<strCssText.length){cssAnimations=document.createElement("style");cssAnimations.id="infty_animations";cssAnimations.type="text/css";cssAnimations.textContent=strCssText;document.head.appendChild(cssAnimations);}}else if(item.className=='read'){var parent=item.parentNode;if(parent!=null&&parent.tagName=='SPAN'&&parent.className=='image_group'){var reads=parent.getElementsByClassName('read');for(var r=0;r<reads.length;r++){var read=reads[r];var img=read.firstElementChild;if(img!=null){if(r==0){read.style.display='';img.style.display='';read.style.left='';read.style.top='';result=read;}else{read.style.display='none';img.style.display='none';}}}}}return result;}
function PreEventDefault(){event.preventDefault();return false;}
function ClearEvent(event){if(event!=null&&event!=undefined&&event.preventDefault!=undefined){event.preventDefault();}
try{window.event.preventDefault();}catch(e){}return false;}
function ShowControlPanel(){if(GetDisplayMode()==2){for(var i=0;i<overlapCell.children.length;i++){overlapCell.children[i].style.display='none';}
controlFrame.style.display='';overlapArea.style.display='';ClientResize();}else{controlArea.focus();}}
function ShowSettingPanel(){for(var i=0;i<overlapCell.children.length;i++){overlapCell.children[i].style.display='none';}
var cScrollMode=document.getElementById('scrollMode');var cResumeMode=document.getElementById('resumeMode');cScrollMode.checked=window.bScrollMode;cResumeMode.checked=window.bResumeMode;settingFrame.style.display='';overlapArea.style.display='';window.SettingPaneShowing=true;ClientResize();window.SettingPaneShowing=undefined;}
function ShowBibInfoPanel(){for(var i=0;i<overlapCell.children.length;i++){overlapCell.children[i].style.display='none';}
bibinfoFrame.style.display='';overlapArea.style.display='';ClientResize();}
function ShowHelpPanel(){var item=document.getElementById("helpSubArea");if(item!=null&&item.src==''){item.src=strHelpUrl;}
for(var i=0;i<overlapCell.children.length;i++){overlapCell.children[i].style.display='none';}
helpFrame.style.display='';overlapArea.style.display='';ClientResize();}
function ShowIndexPanel(){if(GetDisplayMode()==1&&window._DEBUG){ShowIndexArea(IsShowIndexArea()? false:true);return;}
for(var i=0;i<overlapCell.children.length;i++){overlapCell.children[i].style.display='none';}
indexFrame.style.display='';overlapArea.style.display='';ClientResize();}
function GripPointerDonw(event){var target=event.target;if(event.target.className=='rangeGlip'){event.target.setPointerCapture(event.pointerId);event.target.GripStartPos=event.screenX;event.target.EventStartPos=parseInt(event.target.style.left);event.target.onpointermove=GripPointerMove;}}
function GripPointerMove(event){if(event.buttons!=0&&event.target.GripStartPos){var limitX=event.target.parentElement.clientWidth-event.target.offsetWidth;var gapX=event.screenX-event.target.GripStartPos;var newPos=event.target.EventStartPos+gapX;if(newPos<0){newPos=0;}else if(limitX<=newPos){newPos=limitX;}
newPos=newPos+'px'
if(event.target.style.left!=newPos){event.target.style.left=newPos;var x=parseInt(newPos);var name=event.target.id.split("_")[0];var nMin=cSettingItems[name].min;var nMax=cSettingItems[name].max;var nRange=(nMax-nMin);SetRangePos(name,Math.round((nRange *(x/limitX))+nMin));}}else{event.target.onpointermove=null;event.target.GripStartPos=undefined;event.target.EventStartPos=undefined;event.target.releasePointerCapture(event.pointerId);}}
function GripPointerUp(event){event.target.onpointermove=null;event.target.GripStartPos=undefined;event.target.EventStartPos=undefined;event.target.releasePointerCapture(event.pointerId);}
function RangeSliderClick(event){try{var nDisplayMode=GetDisplayMode();if(event.target.className=="rangeSlider"){var name=event.target.id.split("_")[0];var nMin=cSettingItems[name].min;var nMax=cSettingItems[name].max;var nRange=(nMax-nMin);var glip=document.getElementById(name+"_Glip");var rc=event.target.getBoundingClientRect();var nSpan=event.target.clientWidth-glip.offsetWidth;var nXpos=event.offsetX;if(nDisplayMode==2&&event.touches){nXpos=event.touches[0].pageX;}
var x=0;if(nDisplayMode==2&&event.touches){x=nXpos-rc.left-(glip.offsetWidth/2);}else{x=nXpos-(glip.offsetWidth/2);}
if(x<0){x=0;}else if(nSpan<x){x=nSpan;}
SetRangePos(name,Math.round((x *(nRange/nSpan))+nMin));}}catch(e){StatusOutput(e.message);}}
function RangeGlipMouseDown(event){if(event.target.className=="rangeGlip"){glipItem=event.target.id.split("_")[0];if("ontouchstart" in window){document.addEventListener("touchmove",RangeGlipMouseMove,true);document.addEventListener("touchend",RangeGlipMouseUp,true);}else{document.addEventListener("mousemove",RangeGlipMouseMove,true);document.addEventListener("mouseup",RangeGlipMouseUp,true);}}}
function RangeGlipMouseUp(event){glipItem=null;if("ontouchstart" in window){document.removeEventListener("touchmove",RangeGlipMouseMove,true);document.removeEventListener("touchend",RangeGlipMouseUp,true);}else{document.removeEventListener("mousemove",RangeGlipMouseMove,true);document.removeEventListener("mouseup",RangeGlipMouseUp,true);}
ClearEvent();}
function RangeGlipMouseMove(event){var nDisplayMode=GetDisplayMode();if(event.target){if(nDisplayMode!=2&&event.target.className!=='rangeSlider'){return;}else if(nDisplayMode==2&&event.target.className!=='rangeGlip'){return;}}
var nXpos=event.offsetX;if(event.touches){nXpos=event.touches[0].pageX;}
if(glipItem!=null){var slider=document.getElementById(glipItem+"_Slider");var nMin=cSettingItems[glipItem].min;var nMax=cSettingItems[glipItem].max;var nRange=(nMax-nMin);var glip=document.getElementById(glipItem+"_Glip");var rc=slider.getBoundingClientRect();var nSpan=slider.clientWidth-glip.offsetWidth;var x=nXpos-rc.left-(glip.offsetWidth/2);if(event.touches){x=nXpos-rc.left-(glip.offsetWidth/2);}else{x=nXpos-(glip.offsetWidth/2);}
if(x<0){x=0;}else if(nSpan<x){x=nSpan;}
SetRangePos(glipItem,Math.round((x *(nRange/nSpan))+nMin));}}
function RangeButtonClick(event){var splitval=event.target.id.split("_");var name=splitval[0];var type=splitval[1];if(event.target.className=="stgButton"){switch(type){case "Left":SetRangePos(name,cUserSetting[name]-1);break;case "Right":SetRangePos(name,cUserSetting[name]+1);break;case "Reset":SetRangePos(name,cSettingItems[name].defval);}}else if(name=="color"){SetRangePos(name,cUserSetting[name]+1);}}
function SetRangePos(name,nNewVal){var nMin=cSettingItems[name].min;var nMax=cSettingItems[name].max;var value=document.getElementById(name+"_Value");{if(nNewVal==null||isNaN(nNewVal)){nNewVal=cUserSetting[name];}else{nNewVal=Math.round(nNewVal);if(name!="color"){if(nNewVal<nMin){nNewVal=nMin;}else if(nMax<nNewVal){nNewVal=nMax;}}else{nNewVal=(nNewVal+cColors.length)%cColors.length;}}
if(nNewVal!=cUserSetting[name]){cUserSetting[name]=nNewVal;ColorSettingCSS();SetSettingValue(name,cUserSetting[name]);}
if(name!="color"){}
if(cSettingItems[name].type=="range"){var slider=document.getElementById(name+"_Slider");var glip=document.getElementById(name+"_Glip");var rcSlider=slider.getBoundingClientRect();var strText='';if(cUserSetting[name]!=nNewVal){cUserSetting[name]=nNewVal;}
if(cSettingItems[name].rate!=undefined){if(cSettingItems[name].rate<1.0){var valFl=(cUserSetting[name]* cSettingItems[name].rate)+0.0001;var valDg=parseInt(valFl).toString(10);strText=String(valFl);strText=strText.substr(0,valDg.length+2);}else{strText=String((cUserSetting[name]* cSettingItems[name].rate));}}else{strText=cUserSetting[name];}
if(sSettingLabels[name].unit){strText+=sSettingLabels[name].unit;}else if(cSettingItems[name].opt!=undefined){strText+=cSettingItems[name].opt;}
value.innerHTML=strText;if(((GetDisplayMode()==2)||GetDisplayMode()==1)&&(name=='font'||name=='speed')){var button=document.getElementById('button_'+name+'2');if(button!=null){button.innerHTML=value.innerHTML;}}
var nPos=cUserSetting[name]-nMin;var nRange=(nMax-nMin);var nSpan=slider.clientWidth-glip.offsetWidth;nPos=nSpan *(nPos/nRange);glip.style.top='0px';glip.style.left=Math.round(nPos)+"px";switch(name){case 'speed':if(progressPaneSpeed!=null){var pps_value=document.getElementById('pps_value');var pps_reset=document.getElementById('pps_reset');if(pps_value!=null){pps_value.textContent=(cUserSetting.speed * 10)+'%';}
if(pps_reset!=null){pps_reset.disabled=(cUserSetting.speed==cSettingItems.speed.defval);}
var pps_rates=progressPaneSpeed.querySelectorAll('span.progress_rate');for(var r=0;r<pps_rates.length;r++){pps_rates[r].className='progress_rate'+(((r+5)==cUserSetting.speed)? ' pp_active':'');}}
SetPlaySpeed();break;case 'font':if(progressPaneFont!=null){var ppf_value=document.getElementById('ppf_value');var ppf_reset=document.getElementById('ppf_reset');if(ppf_value!=null){ppf_value.textContent=(cUserSetting.font)+'pt';}
if(ppf_reset!=null){ppf_reset.disabled=(cUserSetting.font==cSettingItems.font.defval);}}
SetFontSize();break;case 'volume':SetPlayVolume();break;case 'interval':SetPlayInterval();break;case 'line':SetLineHeight();break;case 'space':SetLetterSpacing();break;}}else if(nNewVal!=undefined){value.innerHTML=(nNewVal+1)+"/"+(nMax+1);color_Area.style.color=cColors[nNewVal].text;color_Area.style.backgroundColor=cColors[nNewVal].back;color_Highlight.style.color=cColors[nNewVal].text_h;color_Highlight.style.backgroundColor=cColors[nNewVal].back_h;SetDisplayColor();}}{}}
function OverlapAreaMouseDown(event){if(event.target.id=="overlapCell"){bOverlapAreaMouseDown=true;}}
function HideOverlapArea(event){var overlapArea=document.getElementById('overlapArea');if(nSettinItemTimerID!=-1){clearInterval(nSettinItemTimerID);nSettinItemTimerID=-1;}
if(overlapArea!=null){if(event==undefined){overlapArea.style.display='none';}else if((event.target.id=="overlapCell"&&bOverlapAreaMouseDown!=false)||event.target.className=="panelClose"){overlapArea.style.display='none';bOverlapAreaMouseDown=false;}}
bHideOverlapAreaTimer=true;setTimeout(function(){bHideOverlapAreaTimer=undefined;},500);}
function GetSettingValue(name,nDefault){try{if(typeof window.localStorage!=='undefined'){if(name==='color'&&bQuickDaisy){name+='q'}
var nResult=window.localStorage["SH5_SettingValue_"+name];if(nResult!=undefined&&!isNaN(nResult)){return parseInt(nResult);}}}catch(e){try{StatusOutput("LocalStrage Data Get Error("+e.message+")! [name="+name+"]");}catch(e){}}return nDefault;}
function GetSettingString(name,nDefault){try{if(typeof window.localStorage!=='undefined'){var strResult=window.localStorage["SH5_SettingValue_"+name];if(strResult!=undefined){return strResult;}}}catch(e){StatusOutput("LocalStrage Data Get Error("+e.message+")! [name="+name+"]");}return nDefault;}
function GetSettingBool(name,bDefault){try{if(typeof window.localStorage!=='undefined'){var strResult=window.localStorage["SH5_SettingValue_"+name];if(strResult!=undefined){return(strResult=='true'||strResult=='1');}}}catch(e){StatusOutput("LocalStrage Data Get Error("+e.message+")! [name="+name+"]");}return bDefault;}
function SetSettingValue(name,nValue){try{if(typeof window.localStorage!=='undefined'){if(name==='color'&&bQuickDaisy){name+='q'}
if(nValue!=null&&nValue!=undefined){window.localStorage.setItem("SH5_SettingValue_"+name,nValue);StatusOutput("Local Strage Data Set Safe ! [name="+name+",Value="+nValue+"]");}else{window.localStorage.removeItem("SH5_SettingValue_"+name);StatusOutput("Local Strage Data Remove Safe ! [name="+name+"]");}}}catch(e1){StatusOutput("Local Strage Data Set Error("+e1.message+")! [name="+name+"]");}}
var sContentTouchPos={x:0,y:0};var sIndexTouchPos={x:0,y:0};var sToushPosID=null;var nStartDist=-1;var sToushImageSize={x:0,y:0};var nZoomMode=1;function GetTouchDist(touches){if(touches.length==2){try{var x=Math.abs(touches[0].pageX-touches[1].pageX);var y=Math.abs(touches[0].pageY-touches[1].pageY);return Math.round(Math.sqrt(Math.pow(Math.max(x,1),2)+Math.pow(Math.max(y,1),2)));}catch(e){return-1;}}else{return 0;}}
function ContentTouchStart(event){if(nZoomMode==0){if(event.touches.length==2){nStartDist=GetTouchDist(event.touches);sToushImageSize.x=parseInt(event.target.style.width,10);sToushImageSize.y=parseInt(event.target.style.height,10);return;}}else if(nZoomMode==1){if(event.touches.length==2&&event.target.tagName=="IMG"&&(event.target.className=="sh5_img"||event.target.className=="sh5_img_group")){sToushPosID=event.target.id;nStartDist=GetTouchDist(event.touches);sToushImageSize.x=parseInt(event.target.style.width,10);sToushImageSize.y=parseInt(event.target.style.height,10);return;}}
sContentTouchPos.x=event.touches[0].pageX;sContentTouchPos.y=event.touches[0].pageY;}
function ContentTouchMove(event){var item;if(nZoomMode==0){if(event.touches.length==2&&0<nStartDist){var nNewDist=GetTouchDist(event.touches);if(nStartDist<nNewDist){nZoomValue+=10;}else{nZoomValue-=10;}
if(nZoomValue<100){nZoomValue=100;}
content.style.zoom=nZoomValue+'%';return;}}else if(nZoomMode==1){if(event.touches.length==2&&sToushPosID!=null&&(item=document.getElementById(sToushPosID))!=null){var nNewDist=GetTouchDist(event.touches);var nNewCX=Math.round(sToushImageSize.x *(nNewDist/nStartDist));var nNewCY=Math.round(sToushImageSize.y *(nNewDist/nStartDist));var nBaseCX=parseInt(item.attributes.getNamedItem("width").value,10);var nBaseCY=parseInt(item.attributes.getNamedItem("height").value,10);if(!isNaN(nBaseCX)){nBaseCX=Math.round(nBaseCX * cUserSetting.font/12.0);if(0<content.offsetWidth&&content.offsetWidth<(item.offsetLeft+nBaseCX)){var r=(content.offsetWidth-item.offsetLeft-20)/nBaseCX;nBaseCX=Math.round(nBaseCX * r);nBaseCY=Math.round(nBaseCY * r);}
nNewCX=Math.max(nNewCX,nBaseCX);}
if(!isNaN(nBaseCY)){nBaseCY=Math.round(nBaseCY * cUserSetting.font/12.0);nNewCY=Math.max(nNewCY,nBaseCY);}
item.style.width=nNewCX+'px';item.style.height=nNewCY+'px';if(item.className=='sh5_img_group'){for(var s=0;1;s++){var siblingId=item.id.substr(0,13)+String("00"+s).right(2);if(siblingId!=item.id){var sibling=document.getElementById(siblingId);if(sibling!=null){sibling.style.width=nNewCX+'px';sibling.style.height=nNewCY+'px';}else{break;}}}}return;}}
contentArea.scrollLeft+=(sContentTouchPos.x-event.touches[0].pageX);contentArea.scrollTop+=(sContentTouchPos.y-event.touches[0].pageY);sContentTouchPos.x=event.touches[0].pageX;sContentTouchPos.y=event.touches[0].pageY;event.preventDefault();}
function ContentTouchEnd(){nStartDist=-1;sToushPosID=null;}
function IndexTouchStart(event){sIndexTouchPos.x=event.touches[0].pageX;sIndexTouchPos.y=event.touches[0].pageY;}
function IndexTouchMove(event){indexListArea.scrollLeft+=(sIndexTouchPos.x-event.touches[0].pageX);indexListArea.scrollTop+=(sIndexTouchPos.y-event.touches[0].pageY);sIndexTouchPos.x=event.touches[0].pageX;sIndexTouchPos.y=event.touches[0].pageY;event.preventDefault();}
function IndexTouchEnd(event){sToushPosID=null;}
function HelpTouchStart(event){sHelpTouchPos.x=event.touches[0].pageX;sHelpTouchPos.y=event.touches[0].pageY;}
function HelpTouchMove(event){helpSubArea.scrollLeft+=(sHelpTouchPos.x-event.touches[0].pageX);helpSubArea.scrollTop+=(sHelpTouchPos.y-event.touches[0].pageY);sHelpTouchPos.x=event.touches[0].pageX;sHelpTouchPos.y=event.touches[0].pageY;event.preventDefault();}
function HelpTouchEnd(){}
function SetPlaySpeed(){if(Math.round(saudio.GetSpeed()/10)!=cUserSetting.speed){saudio.SetSpeed(cUserSetting.speed * 10);}}
function SetPlayVolume(){if(Math.round(saudio.GetVolume()/10)!=cUserSetting.volume){saudio.SetVolume(cUserSetting.volume * 10);}}
function SetPlayInterval(){if(saudio.audio.paused==false&&window.SettingPaneShowing!==true){saudio.audio.onpause_temp=saudio.audio.onpause;saudio.audio.onpause=function(event){saudio.audio.onpause=saudio.audio.onpause_temp;saudio.audio.onpause_temp=undefined;saudio.audio.play();}
saudio.audio.pause();}}
function SetSpeedDown(){SetRangePos("speed",cUserSetting.speed-1);}
function SetSpeedUp(){SetRangePos("speed",cUserSetting.speed+1);}
function FontSizeChange(newSize){var scrollPos=null;if(window.cActiveSection!==undefined&&window.cActiveSection!=null){if(window.cActiveSection.className.indexOf("vertical_section")!=-1){scrollPos=(contentArea.scrollLeft+contentArea.clientWidth)/contentArea.scrollWidth;}else{scrollPos=contentArea.scrollTop/contentArea.scrollHeight;}}
SetRangePos("font",newSize);if(scrollPos!=null){setTimeout(function(scrollPos){if(window.cActiveSection.className.indexOf("vertical_section")!=-1){contentArea.scrollLeft=(contentArea.scrollWidth * scrollPos)-contentArea.clientWidth;}else{contentArea.scrollTop=contentArea.scrollHeight * scrollPos;}},50,scrollPos);}}
function SetFontSizeDown(){ShowProgressPaneFont();FontSizeChange(cUserSetting.font-1);}
function SetFontSizeReset(){FontSizeChange(cSettingItems.font.defval);}
function SetFontSizeUp(){ShowProgressPaneFont();FontSizeChange(cUserSetting.font+1);}
var nProgressPaneSpeedTimerID=null;var nProgressPaneFontTimerID=null;function ShowProgressPaneSpeed(){if(window.nProgressPaneSpeedTimerID!=undefined){dump_event("<i>HideProgressPaneSpeed Reset</i>");clearInterval(window.nProgressPaneSpeedTimerID);window.nProgressPaneSpeedTimerID=undefined;}
if(progressPaneSpeed==null){var prefix='pps';progressPaneSpeed=document.createElement("div");progressPaneSpeed.className="progressPane";progressPaneSpeed.id="progressPane_speed";progressPaneSpeed.innerHTML="<table><tr><td id='"+prefix+"_value'>100%</td><td id='"+prefix+"_rate'></td><td><input type='button' id='"+prefix+"_reset' value='"+sSettingLabels.reset+"'/></td></tr></table>";var nCenterPos=document.getElementById('button_speed3').offsetLeft;if(window.external&&typeof(window.external.GetPopupPaneCenterPos)!=='undefined'){nCenterPos=window.external.GetPopupPaneCenterPos('speed');}
if(iPad||iPhone||iPod){progressPaneSpeed.style.right=(nCenterPos-150)+'px';}else{progressPaneSpeed.style.left=(nCenterPos-150)+'px';}
document.body.appendChild(progressPaneSpeed);document.getElementById(prefix+'_reset').onclick=SetPlaySpeedEvent;var ratearea=document.getElementById(prefix+'_rate');for(var r=50;r<=300;r+=10){var span=document.createElement("span");ratearea.appendChild(span);span.innerHTML='<br/>';span.className="progress_rate";span.id=prefix+'_rate_'+r.toString();span.title=r+'%';span.onclick=SetPlaySpeedEvent;}
if(controlArea.offsetTop==0){progressPaneSpeed.style.top=(contentArea.offsetTop+2)+'px';}else{progressPaneSpeed.style.top=(contentArea.offsetTop+contentArea.offsetHeight-progressPaneSpeed.offsetHeight-2)+'px';}
SetRangePos("speed",cUserSetting.speed);Sh5AddEventProc(progressPaneSpeed,'mouseenter',ShowProgressPaneSpeed);Sh5AddEventProc(progressPaneSpeed,'mouseleave',HideProgressPaneSpeed);}
if(progressPaneFont!=null){progressPaneFont.style.display='none';progressPaneFont.style.opacity='0';}
progressPaneSpeed.style.display='inline-block';progressPaneSpeed.style.opacity='1';}
function ShowProgressPaneFont(){if(window.nProgressPaneFontTimerID!=undefined){dump_event("<i>HideProgressPaneFont Reset</i>");clearInterval(window.nProgressPaneFontTimerID);window.nProgressPaneFontTimerID=undefined;}
if(progressPaneFont==null){var prefix='ppf';progressPaneFont=document.createElement("div");progressPaneFont.className="progressPane";progressPaneFont.id="progressPane_font";progressPaneFont.innerHTML="<table><tr><td id='"+prefix+"_value'>100%</td><td id='"+prefix+"_rate' style='display:none;'></td><td><input type='button' id='"+prefix+"_reset' value='"+sSettingLabels.reset+"'/></td></tr></table>";var nCenterPos=document.getElementById('button_font3').offsetLeft;if(window.external&&typeof(window.external.GetPopupPaneCenterPos)!=='undefined'){nCenterPos=window.external.GetPopupPaneCenterPos('font');}
progressPaneFont.style.left=(nCenterPos-70)+'px';document.body.appendChild(progressPaneFont);document.getElementById(prefix+'_reset').onclick=SetPlayFontEvent;if(controlArea.offsetTop==0){progressPaneFont.style.top=(contentArea.offsetTop+2)+'px';}else{progressPaneFont.style.top=(contentArea.offsetTop+contentArea.offsetHeight-progressPaneFont.offsetHeight-2)+'px';}
SetRangePos("font",cUserSetting.font);Sh5AddEventProc(progressPaneFont,'mouseenter',ShowProgressPaneFont);Sh5AddEventProc(progressPaneFont,'mouseleave',HideProgressPaneFont);}
if(progressPaneSpeed!=null){progressPaneSpeed.style.display='none';progressPaneSpeed.style.opacity='0';}
progressPaneFont.style.display='inline-block';progressPaneFont.style.opacity='1';}
function HideProgressPaneSpeed(){var nStep=0;window.nProgressPaneSpeedStep=0;if(window.nProgressPaneSpeedTimerID!=undefined){clearInterval(window.nProgressPaneSpeedTimerID);}
window.nProgressPaneSpeedTimerID=setInterval(function(){if(300<window.nProgressPaneSpeedStep&&progressPaneSpeed.style.opacity!='0'){if(progressPaneSpeed.style.opacity==''){progressPaneSpeed.style.opacity='1';}else{progressPaneSpeed.style.opacity=((parseFloat(progressPaneSpeed.style.opacity)* 10)-2)/10;}}else if(300<window.nProgressPaneSpeedStep){progressPaneSpeed.style.display='none';progressPaneSpeed.style.opacity='0';clearInterval(window.nProgressPaneSpeedTimerID);window.nProgressPaneSpeedTimerID=undefined;}
window.nProgressPaneSpeedStep+=10;},10);}
function HideProgressPaneFont(){var nStep=0;window.nProgressPaneFontStep=0;if(window.nProgressPaneFontTimerID!=undefined){clearInterval(window.nProgressPaneFontTimerID);}
window.nProgressPaneFontTimerID=setInterval(function(){if(300<window.nProgressPaneFontStep&&progressPaneFont.style.opacity!='0'){if(progressPaneFont.style.opacity==''){progressPaneFont.style.opacity='1';}else{progressPaneFont.style.opacity=((parseFloat(progressPaneFont.style.opacity)* 10)-2)/10;}}else if(300<window.nProgressPaneFontStep){progressPaneFont.style.display='none';progressPaneFont.style.opacity='0';clearInterval(window.nProgressPaneFontTimerID);window.nProgressPaneFontTimerID=undefined;}
window.nProgressPaneFontStep+=10;},10);}
function SetPlaySpeedEvent(event){if(event.target.className.indexOf('progress_rate')!=-1&&event.target.id.substr(0,9)=='pps_rate_'){SetRangePos("speed",parseInt(event.target.id.substr(9))/10);}else if(event.target.id.substr(0,9)=='pps_reset'){SetRangePos("speed",10);}}
function SetPlayFontEvent(event){if(event.target.id.substr(0,9)=='ppf_reset'){FontSizeChange(cSettingItems.font.defval);}}
function SetPlaySpeedDown(){ShowProgressPaneSpeed();SetRangePos("speed",cUserSetting.speed-1);}
function SetPlaySpeedReset(){SetRangePos("speed",cSettingItems.speed.defval);}
function SetPlaySpeedUp(){ShowProgressPaneSpeed();SetRangePos("speed",cUserSetting.speed+1);}
function SetFontSize(){if(content!=undefined){content.style.fontSize=cUserSetting.font+"pt";indexArea.style.fontSize=cUserSetting.font+"pt";AdjustImageSize(true);}}
function FindStyle(selecter,name){for(var s=0;s<document.styleSheets.length;s++){try{for(var r=0;document.styleSheets[s].cssRules&&r<document.styleSheets[s].cssRules.length;r++){var rule=document.styleSheets[s].cssRules[r];if(rule.selectorText==selecter){if(name){if(rule.style[name]){return rule.style[name];}return null;}else{return rule.style;}}}}catch(e){continue;}}}
function AdjustImageSize(bMathInclude){var cLayerGroups=document.querySelectorAll("*:not(.layer_type2).layer_group");var nLayerGroups=cLayerGroups.length;var cLayerAnchors=document.querySelectorAll("*.layer2_anchor_item");var nLayerAnchors=cLayerAnchors.length;for(var lg=0;lg<nLayerGroups;lg++){var cLayerGroup=cLayerGroups[lg];var cFirstRead=cLayerGroup.querySelector("span.read");var tag=cLayerGroup.tagName.toLowerCase();var w=FindStyle(tag+"#"+cLayerGroup.id,'width');var h=FindStyle(tag+"#"+cLayerGroup.id,'height');if(w==undefined){var cFirstImage=cLayerGroup.querySelector("img");var tag=cFirstImage.tagName.toLowerCase();w=FindStyle(tag+"#"+cFirstImage.id,'width');h=FindStyle(tag+"#"+cFirstImage.id,'height');}
cLayerGroup.style.zoom=(cUserSetting.font/12.0 * 100)+'%';if(0&&cFirstRead){cFirstRead.style.width=w;cFirstRead.style.height=h;}}
var cLayer2=document.querySelectorAll('div.layer_group');var nLayer2=cLayer2.length;for(var l=0;l<nLayer2;l++){var cLayer=cLayer2[l];cLayer.style.zoom=((cUserSetting.font/12.0)* 100).toString()+"%";}
if(bChattyInfty3){var sImageClassis=new Array('math','sh5_img');for(var n=bMathInclude ? 0:1;n<sImageClassis.length;n++){var images=document.getElementsByClassName(sImageClassis[n]);for(var i=0;i<images.length;i++){var item=images[i];if(item.id&&(item.id.indexOf("layerAreaImage")!=-1||item.id.indexOf("layerItemImage")!=-1)){continue;}
if(item.attributes['width']!=undefined&&item.attributes['height']==undefined){var value=item.naturalHeight *(parseInt(item.attributes['width'].value)/item.naturalWidth);item.setAttribute('height',value);}else if(item.attributes['height']!=undefined&&item.attributes['width']==undefined){var value=item.naturalHeight *(parseInt(item.attributes['height'].value)/item.naturalWidth);item.setAttribute('width',value);}else if(item.style&&item.style.width!=''&&item.style.height==''){var value=item.naturalHeight *(parseInt(item.style.width)/item.naturalWidth);item.style.height=value+item.style.width.replace(/[-0-9\.]/g,'');}else if(item.style&&item.style.width==''&&item.style.height!=''){var value=item.naturalWidth *(parseInt(item.style.height)/item.naturalHeight);item.style.width=value+item.style.height.replace(/[-0-9\.]/g,'');}
if(item.tagName=="IMG"){if(item.className.indexOf('layerImage')!=-1){continue;}
var attCX=item.attributes.getNamedItem("width");var attCY=item.attributes.getNamedItem("height");var cx=(attCX!=null)? parseInt(attCX.value,10):Math.round(item.naturalWidth);var cy=(attCY!=null)? parseInt(attCY.value,10):Math.round(item.naturalHeight);if(!isNaN(cx)&&!isNaN(cy)){cx=Math.round(cx * cUserSetting.font/12.0);cy=Math.round(cy * cUserSetting.font/12.0);if(sImageClassis[n]!="math"){var dtrSrc=item.src;if(dtrSrc!=undefined&&0<=dtrSrc.indexOf('mspc.jpg')){dtrSrc=dtrSrc;}}
item.style.width=cx+"px";item.style.height=cy+"px";}}}}
var cImageGroups=document.querySelectorAll("span.sh5_img_group, span.image_group ");var nImageGroups=cImageGroups.length;if(0<nImageGroups){for(var ig=0;ig<nImageGroups;ig++){var cImageGroup=cImageGroups[ig];var cImage=cImageGroup.querySelector("img");cImageGroup.style.width=cImage.style.width;cImageGroup.style.height=cImage.style.height;}}
cImageGroups=document.querySelectorAll("span.layer_group");var nImageGroups=cImageGroups.length;if(0<nImageGroups){for(var ig=0;ig<nImageGroups;ig++){var cImageGroup=cImageGroups[ig];cImageGroup.style.zoom=((cUserSetting.font/12.0)* 100)+'%';}}}else{var images=contentArea.getElementsByTagName("img");for(var i=0;i<images.length;i++){var item=images[i];if(item.attributes['width']!=undefined&&item.attributes['height']==undefined){var value=item.naturalHeight *(parseInt(item.attributes['width'].value)/item.naturalWidth);item.setAttribute('height',value);}else if(item.attributes['height']!=undefined&&item.attributes['width']==undefined){var value=item.naturalWidth *(parseInt(item.attributes['height'].value)/item.naturalHeight);item.setAttribute('width',value);}else if(item.style.width!=''&&item.style.height==''){var value=item.naturalHeight *(parseInt(item.style.width)/item.naturalWidth);item.style.height=value+item.style.width.replace(/[-0-9\.]/g,'');}else if(item.style.width==''&&item.style.height!=''){var value=item.naturalWidth *(parseInt(item.style.height)/item.naturalHeight);item.style.width=value+item.style.height.replace(/[-0-9\.]/g,'');}
if(item.className.indexOf('layerImage')!=-1){continue;}
var attCX=item.attributes.getNamedItem("width");var attCY=item.attributes.getNamedItem("height");var cx=(attCX!=null)? parseInt(attCX.value,10):Math.round(item.naturalWidth);var cy=(attCY!=null)? parseInt(attCY.value,10):Math.round(item.naturalHeight);if(!isNaN(cx)&&!isNaN(cy)){cx=Math.round(cx * cUserSetting.font/12.0);cy=Math.round(cy * cUserSetting.font/12.0);var dtrSrc=item.src;if(dtrSrc!=undefined&&0<=dtrSrc.indexOf('mspc.jpg')){dtrSrc=dtrSrc;}
item.style.width=cx+"px";item.style.height=cy+"px";}}}
var cells=document.querySelectorAll('td.backslashCell');for(var c=0;c<cells.length;c++){var cell=cells[c];var field=cell.querySelector("span.backslashField");var spanLB=cell.getElementsByClassName('labelLB');var spanRT=cell.getElementsByClassName('labelRT');if(0<spanLB.length&&0<spanRT.length){spanLB=spanLB[0];spanRT=spanRT[0];field.style.width=(spanLB.offsetWidth+spanRT.offsetWidth)+'px';field.style.height=(spanLB.offsetHeight+spanRT.offsetHeight+6)+'px';if(field.firstElementChild.className.indexOf('read')!=-1){field.firstElementChild.style.width=field.style.width;field.firstElementChild.style.height=field.style.height;}}}
CreateBackslashCellLine();}
function CreateBackslashCellLine(section){var cells=null;if(section!=undefined){cells=section.querySelectorAll('th.backslashCell,td.backslashCell');}else{cells=document.querySelectorAll('th.backslashCell,td.backslashCell');}
for(var c=0;c<cells.length;c++){var cell=cells[c];var parent=cell.parentElement;var cx=cell.offsetWidth;var cy=cell.offsetHeight;var bVert=false;while(parent!=null){if(parent.tagName=="SECTION"&&parent.className.indexOf("html_page")!=-1){if(parent.className.indexOf("vertical_section")!=-1){bVert=true;}
break;}
parent=parent.parentElement;}
if(0<cx&&0<cy){canvas.width=cx;canvas.height=cy;ctx.beginPath();ctx.strokeStyle=cColors[cUserSetting.color].text;ctx.lineWidth=0.7;if(bVert!=true){ctx.moveTo(0,0);ctx.lineTo(cx,cy);}else{ctx.moveTo(0,cy);ctx.lineTo(cx,0);}
ctx.stroke();cell.style.backgroundImage='url('+canvas.toDataURL("image/png")+')';bVert=false;}}}
function SetLineHeight(){ColorSettingCSS();CreateBackslashCellLine();}
function SetLetterSpacing(){content.style.letterSpacing=(cUserSetting.space/10)+"em";CreateBackslashCellLine();}
function SetDisplayColor(){var nTocPanels=document.getElementsByClassName('topTabItem');if(nTocPanels!=null&&0<nTocPanels.length){for(var p=0;p<nTocPanels.length;p++){nTocPanels[p].style.backgroundColor=cColors[cUserSetting.color].toc;nTocPanels[p].style.color=cColors[cUserSetting.color].text;}}
var maths=document.getElementsByClassName('math');strMathImagePathNA=strMathImagePathHI='./images/';strMathImagePathNA+='math_'+cColors[cUserSetting.color].text.substr(1,6)+'/';strMathImagePathHI+='math_'+cColors[cUserSetting.color].text_h.substr(1,6)+'/';var nR=parseInt(cColors[cUserSetting.color].text.substr(1,2),16);var nG=parseInt(cColors[cUserSetting.color].text.substr(3,2),16);var nB=parseInt(cColors[cUserSetting.color].text.substr(5,2),16);for(var m=0;m<maths.length;m++){if(maths[m].tagName=="IMG"&&maths[m].src.substr(0,11)=="data:image/"){var cx=maths[m].naturalWidth;var cy=maths[m].naturalHeight;canvas.width=cx;canvas.height=cy;ctx.drawImage(maths[m],0,0);var workimage=ctx.getImageData(0,0,cx,cy);var bTranParent=false;for(var i=0;bTranParent==false&&i<(cx * cy)* 4;i+=4){if(workimage.data[i+3]!=255){bTranParent=true;}}
if(bTranParent==false){for(var i=0;i<(cx * cy)* 4;i+=4){if(workimage.data[i+0]==255&&workimage.data[i+1]==255&&workimage.data[i+2]==255){workimage.data[i+3]=0;}}}
for(var i=0;i<(cx * cy)* 4;i+=4){workimage.data[i+0]=nR;workimage.data[i+1]=nG;workimage.data[i+2]=nB;}
ctx.putImageData(workimage,0,0);maths[m].src=canvas.toDataURL("image/png");continue;}else if(maths[m].tagName=='IMG'){var pos=maths[m].src.lastIndexOf('/');var name=maths[m].src.substr(pos+1);maths[m].src=strMathImagePathNA+name;}}
CreateBackslashCellLine();var pItem;}
function StatusOutput(str){if(statusArea!=undefined&&statusArea!=null){statusArea.innerHTML=str;}}
function MouseOver(event){var item=event.target;while(item!=null){if(item.className.indexOf("read")!=-1){SetElementColor(item,2);return;}
item=item.parentNode;}
StatusOutput('');}
function MouseOut(event){var item=event.target;while(item!=null){if(item.className.indexOf("read")!=-1){SetElementColor(item,(item.id==strActiveID)? 1:0);return;}
item=item.parentNode;}
StatusOutput('');}
function TocMouseOver(event){StatusOutput('');}
function TocMouseOut(event){StatusOutput('');}
function SetElementColor(srcItem,nMode){var item=srcItem;if(item!=undefined&&item.className.indexOf("read")!=-1){{var textC;var backC;switch(nMode){case 1:item.className=item.className+" sh5_highlight";{var item_sub=document.querySelector('#'+item.id+'_s');if(item_sub!=null){item_sub.className=item_sub.className+" sh5_highlight";}}
textC=cColors[cUserSetting.color].text_h;backC=cColors[cUserSetting.color].back_h;if(item.parentElement.className=='backslashField'){var nR=parseInt(backC.substr(1,2),16);var nG=parseInt(backC.substr(3,2),16);var nB=parseInt(backC.substr(5,2),16);backC='rgba('+nR+','+nG+','+nB+',0.7) !important';}
if(window.bCellHighlight==1&&item.parentCell!=undefined){item.parentCell.className+=" sh5_active_cell";SetActiveCellEffect(item.parentCell);}
break;case 2:item.className=item.className.replace("sh5_highlight",'').trim();{var item_sub=document.querySelector('#'+item.id+'_s');if(item_sub!=null){item_sub.className=item_sub.className.replace("sh5_highlight",'').trim();}}
textC=cSelectColor.text;backC=cSelectColor.back;if(window.bCellHighlight==1&&item.parentCell!=undefined){item.parentCell.className=item.parentCell.className.replace("sh5_active_cell",'').trim();SetActiveCellEffect();}
break;default:item.className=item.className.replace("sh5_highlight",'').trim();{var item_sub=document.querySelector('#'+item.id+'_s');if(item_sub!=null){item_sub.className=item_sub.className.replace("sh5_highlight",'').trim();}}
textC='';backC='';if(window.bCellHighlight==1&&item.parentCell!=undefined){item.parentCell.className=item.parentCell.className.replace("sh5_active_cell",'').trim();SetActiveCellEffect();}
break;}
if(item.nodeName=="DIV"&&item.firstElementChild!=null&&item.firstElementChild.nodeName=='TABLE'){item=item.firstElementChild;}
SetElementColorSub(item,nMode,textC,backC);if(bVerticalMode&&(iPad||iPhone||iPod)){setTimeout(ContentAreaRefreshA,10);}
if(bResumeSupport&&bResumeMode){var contentID=GetUUID();if(contentID==null||contentID.length==0){contentID=document.title;}
contentID+="_item_position";if(saudio!=null&&saudio.cActiveItem!=null&&saudio.cActiveItem.element){SetSettingValue(contentID,saudio.cActiveItem.element.id);}else{SetSettingValue(contentID);}}return true;}}return false;}
function ContentAreaRefreshA(){contentArea.style.left=(contentArea.offsetLeft+1)+"px";contentArea.style.width=(contentArea.offsetWidth-1)+"px";setTimeout(ContentAreaRefreshB,10);}
function ContentAreaRefreshB(){contentArea.style.left=(contentArea.offsetLeft-1)+"px";contentArea.style.width=(contentArea.offsetWidth+1)+"px";}
function SetElementColorSub(item,nMode,textC,backC){for(var c=0;item.children!==undefined&&c<item.children.length;c++){var child=item.children[c];if(child.tagName=="IMG"){if(child.className=='math'&&child.src.substr(0,11)=="data:image/"){var strColor=(nMode==2)? cSelectColor.text:cColors[cUserSetting.color].text;var nR=parseInt(strColor.substr(1,2),16);var nG=parseInt(strColor.substr(3,2),16);var nB=parseInt(strColor.substr(5,2),16);var cx=child.naturalWidth;var cy=child.naturalHeight;canvas.width=cx;canvas.height=cy;ctx=canvas.getContext("2d");ctx.drawImage(child,0,0);var workimage=ctx.getImageData(0,0,cx,cy);for(var i=0;i<(cx * cy)* 4;i+=4){workimage.data[i+0]=nR;workimage.data[i+1]=nG;workimage.data[i+2]=nB;}
ctx.putImageData(workimage,0,0);child.src=canvas.toDataURL("image/png");continue;}else if(child.className=='math'){var name=child.src.substr(child.src.lastIndexOf('/')+1);switch(nMode){case 0:child.src=strMathImagePathNA+name;break;case 1:child.src=strMathImagePathHI+name;break;}}else if(bEnableImageFilter&&(child.className=='sh5_img')){child.style.webkitFilter=(backC=='')? '':"opacity(75%)";}}else if(child.tagName=="SPAN"&&0<child.childNodes.length){}else if(child.tagName=="RUBY"||(child.tagName=="SPAN"&&child.className=="ruby")){}else if(child.tagName=="TABLE"){}
SetElementColorSub(child,nMode,textC,backC);}}
function SetColorChange(event){SetRangePos("color",(cUserSetting["color"]+1)%(cSettingItems["color"].max+1));ColorSettingCSS();}
function OnCmdMovePrevItem(e){MoveHighlightItem(false);}
function OnCmdMoveNextItem(e){MoveHighlightItem(true);}
function MoveHighlightItem(bNext){bNext=(bNext===true)? true:false;if(controlArea.className.indexOf('vertical_mode')!=-1){bNext=!bNext;}
var cActiveElement=document.querySelector('*.sh5_highlight');if(bNext&&cActiveElement){if(cActiveElement.parentCell!=undefined){var cRead=null;if(cActiveElement.parentCell.nextHorzCell!=undefined){if((cRead=cActiveElement.parentCell.nextHorzCell.querySelector('*.read'))!=null){saudio.SetActiveItem(cRead);return;}}else if((cRead=cActiveElement.parentCell.querySelector('*.read:last-child'))!=null){if(cRead.cSmilItem!=undefined&&cRead.cSmilItem.nextItem!=undefined){saudio.SetActiveItem(cRead.cSmilItem.nextItem);return;}}}
saudio.MoveNextItem();}else if(cActiveElement){if(cActiveElement.parentCell!=undefined){var cRead=null;if(cActiveElement.parentCell.prevHorzCell!=undefined){if((cRead=cActiveElement.parentCell.prevHorzCell.querySelector('*.read'))!=null){saudio.SetActiveItem(cRead);return;}}else if((cRead=cActiveElement.parentCell.querySelector('*.read'))!=null&&cRead.cSmilItem!=undefined&&cRead.cSmilItem.prevItem!=undefined){saudio.SetActiveItem(cRead.cSmilItem.prevItem);return;}}
saudio.MovePrevItem();}}
function OnCmdMovePrevSection(e){var cActiveElement=document.querySelector('*.sh5_highlight');if(cActiveElement&&cActiveElement.parentCell!=undefined){var cRead=null;if(cActiveElement.parentCell.prevVertCell!=undefined){if((cRead=cActiveElement.parentCell.prevVertCell.querySelector('*.read'))!=null){saudio.SetActiveItem(cRead);return;}}else if((cRead=cActiveElement.parentCell.querySelector('*.read'))!=null&&cRead.cSmilItem!=undefined&&cRead.cSmilItem.prevItem!=undefined){saudio.SetActiveItem(cRead.cSmilItem.prevItem);return;}}
saudio.MovePrevSection();}
function OnCmdMoveNextSection(e){var cActiveElement=document.querySelector('*.sh5_highlight');if(cActiveElement&&cActiveElement.parentCell!=undefined){var cRead=null;var cReads=null;if(cActiveElement.parentCell.nextVertCell!=undefined){if((cRead=cActiveElement.parentCell.nextVertCell.querySelector('*.read'))!=null){saudio.SetActiveItem(cRead);return;}}else if((cReads=cActiveElement.parentCell.querySelectorAll('*.read'))!=null&&0<cReads.length){cRead=cReads[cReads.length-1];if(cRead.cSmilItem!=undefined&&cRead.cSmilItem.nextItem!=undefined){saudio.SetActiveItem(cRead.cSmilItem.nextItem);return;}}else if((cRead=cActiveElement.parentCell.querySelector('*.read:last-child'))!=null){if(cRead.cSmilItem!=undefined&&cRead.cSmilItem.nextItem!=undefined){saudio.SetActiveItem(cRead.cSmilItem.nextItem);return;}}}
saudio.MoveNextSection();}
function OnCmdAudioSpeedChange(event){var speedA=document.getElementById('button_speedA');var speedB=document.getElementById('button_speedB');if(speedA&&speedB&&(speedA.style.display==''||speedB.style.display=='')){if(speedA.style.display==''){speedA.style.display='none';speedB.style.display='';saudio.SetDobuleSpeedMode(true);}else{speedA.style.display='';speedB.style.display='none';saudio.SetDobuleSpeedMode(false);}
SetRangePos("speed",10);}}
function OnCmdPlayButton(){if(saudio.IsPause()){if(window.bRepeatFrace&&saudio.cActiveItem&&saudio.cActiveItem.element){var item=saudio.cActiveItem.element;saudio.OnItemClick({target:item});return;}else if(saudio.audio.paused&&window.AutoPauseStatus===true){window.AutoPauseStatus=undefined;var item=document.querySelector('.read.sh5_highlight');if(window.bTableReadMode){window.bTableReadMode=0;}
if(item&&item.cSmilItem&&item.cSmilItem.nextItem&&item.cSmilItem.nextItem.element){saudio.OnItemClick({target:item.cSmilItem.nextItem.element});if(window.bTableReadMode){window.bTableReadMode=0;}return;}}}
saudio.Play();return;}
function OnCmdPauseButton(){AutomaticTest(false);if(window.bPlayIntervalWaite){window.bPlayIntervalWaite=false;}
if(window.nPlayIntervalTimer!=undefined){clearTimeout(window.nPlayIntervalTimer);window.nPlayIntervalTimer=undefined;}
saudio.Pause();return;}
function OnCmdStopButton(){AutomaticTest(false);saudio.Stop();ShowReadElement(document.getElementById('s001_00001'));var firstSection=document.querySelector("section.html_page");if(bVerticalMode==false||(firstSection!=null&&firstSection.className.indexOf('vertical_section')!=-1)){contentArea.scrollTop=0;contentArea.scrollLeft=contentArea.scrollWidth;}else{contentArea.scrollTop=0;contentArea.scrollLeft=0;}}
function OnCmdPrint(bAddareaOnly){if(saudio.IsPlay()){OnCmdPauseButton();}
try{var bodyStyle=document.body.style.cssText;var bodyOverflow=document.body.style.overflow;var sh5content=document.getElementById("sh5content");var printContent=document.createElement("div");printContent.style.backgroundColor="white";printContent.innerHTML=sh5content.innerHTML;printContent.style.zIndex=9999;var cDivs=printContent.getElementsByTagName("DIV");for(var d=0;d<cDivs.length;d++){if(cDivs[d].id.match(/^pid_\d\d\d\d\d/)!==null){cDivs[d].style.display='';}}
var strTags=Array("H1","H2","H3","H4","H5","H6","P");if(bAddareaOnly!==true){for(var t=0;t<strTags.length;t++){var cParagraphs=printContent.getElementsByTagName(strTags[t]);for(var p=0;p<cParagraphs.length;p++){cParagraphs[p].style.display='';}}
var cAddAreas=printContent.getElementsByClassName("addarea");for(var a=0;a<cAddAreas.length;a++){cAddAreas[a].style.display='';}}else{var pItems=printContent.querySelectorAll("H1, H2, H3, H4, H5, H6, P, TABLE, span.sh5page");for(var i=0;i<pItems.length;i++){pItems[i].style.display='none';}
var cAddAreas=printContent.querySelectorAll("div.addarea");for(var a=0;a<cAddAreas.length;a++){cAddAreas[a].style.display='';var cParagraphs=cAddAreas[a].getElementsByTagName("P");for(var p=0;p<cParagraphs.length;p++){cParagraphs[p].style.display='';}}}
printContent.style.textAlign="left";printContent.style.position='';printContent.style.padding=0;printContent.style.margin=0;document.body.style.overflow='scroll';printContent.style.overflow='visible';printContent.style.height='100%';document.body.appendChild(printContent);var display1=contentArea.style.display;var display2=vertSplit.style.display;var display3=indexArea.style.display;var display4=controlArea.style.display;contentArea.style.display='none';vertSplit.style.display='none';indexArea.style.display='none';controlArea.style.display='none';if(bVerticalMode){document.body.style.cssText='background-color:#FFF;writing-mode: tb-rl;writing-mode:vertical-rl;-moz-writing-mode: vertical-rl;-o-writing-mode: vertical-rl;-webkit-writing-mode: vertical-rl;'+document.body.style.cssText;printContent.className='sh5content VerticalMode vertical';}
if(bIE===true){var objPreview=document.createElement("object");objPreview.width=0;objPreview.height=0;objPreview.classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2";printContent.appendChild(objPreview);objPreview.ExecWB(7,1);}else{window.print();}
document.body.removeChild(printContent);document.body.style.cssText=bodyStyle;document.body.style.overflow=bodyOverflow;contentArea.style.display=display1;vertSplit.style.display=display2;indexArea.style.display=display3;controlArea.style.display=display4;}catch(e){alert('Print No Support');}}
function OnAudioErrorEvent(event){if(event.target!=null&&event.target.error!=null&&event.target.error.code!=undefined){if(1<event.target.error.code){var nExtPos;var strExt;if((nExtPos=event.target.src.lastIndexOf('.'))==-1){return;}else if((strExt=new String(event.target.src).substring(nExtPos+1).toUpperCase())=="HTML"){return;}
var strErrorMessage=new String(sAudioErrors[event.target.error.code]);if(strErrorMessage.indexOf("$TYPE$")!=-1){strErrorMessage=strErrorMessage.replace("$TYPE$",strExt);}
alert(strErrorMessage);}}}
function SetContentsHighlight(itemId,bState,bDirectScroll){var item=null;var toci=null;var oldItem=null;if(!bState){var curItems=document.querySelectorAll('*.sh5_highlight');for(var c=0;c<curItems.length;c++){SetElementColor(oldItem=curItems[c],0);}}
var item=document.getElementById(itemId);if(item!=null){cActiveItem=item;if(item.className.indexOf('audio_only_item')!=-1){if(item.parentElement.className.indexOf('audio_only_item_area')!=-1){if(item.parentElement.id.substr(0,4)=='alt_'){var altId=item.parentElement.id.substr(4);var altItem=document.getElementById(altId);if(altItem!=null){item=altItem;}}}}
if(bState){if(item.parentNode!=null&&item.parentNode.className=='image_group'){var reads=item.parentNode.getElementsByClassName('read');var reads=item.parentNode.getElementsByClassName('read');for(var r=0;r<reads.length;r++){var read=reads[r];var img=read.firstElementChild;if(img!=null){if(read.id==item.id){read.style.display='';img.style.display='';}else{read.style.display='none';img.style.display='none';}}}}
SetElementColor(item,1);strActiveID=item.id;if(window.bPlayIntervalWaite){window.bPlayIntervalWaite=false;var cSh5Highlights=document.getElementsByClassName("sh5_highlight");if(cSh5Highlights&&1<cSh5Highlights.length){for(var h=0;h<cSh5Highlights.length;h++){var item=cSh5Highlights[h];if(item.id!=strActiveID){item.className=item.className.replace('sh5_highlight','').trim();}}}}
var strTocID;if(cAudioItems[strActiveID]!=undefined&&cAudioItems[strActiveID].ref!=undefined){strTocID="toc_"+cAudioItems[strActiveID].ref;}else{for(var name in strIndexis){if(name.substr(4,5)==strActiveID.substr(0,5)){strTocID=strIndexis[name];break;}}}}else if(bState==false&&item.parentNode!=null&&item.parentNode.className=='image_group'){disp=item.parentNode.attributes.getNamedItem('disp');if(disp==undefined||disp.textContent!=='free'){var reads=item.parentNode.getElementsByClassName('read');if(reads[0].id!==strActiveID){for(var r=0;r<reads.length;r++){var read=reads[r];var img=read.firstElementChild;if(img!=null){if(r==0){read.style.display='';img.style.display='';}else{read.style.display='none';img.style.display='none';}}}}}}
if(bState!=false){try{if(window.getComputedStyle!==undefined){for(var elem=item;elem!=null&&elem.tagName!='SECTION';elem=elem.parentElement){if(window.getComputedStyle(elem).display=='none'){return;}}}}catch(e){return;}
ShowReadElement(item);ReadItemAdjustScroll(item,bDirectScroll);}}}
function OnContentClick(event){cActiveItem=null;cAddAreaAudio=null;cAddAreaSmils=null;if(window.bCellClick){window.bCellClick=undefined;dump_event("OnContentClick !!R-1");return;}
if(window.nAutomaticTest!==undefined){AutomaticTest(false);}
if(markerMode){ClearEvent();dump_event("OnContentClick !!R-2");return;}
if(event.target!=null&&event.target.tagName!="VIDEO"){var item=event.target;if(item!=null&&typeof item.className=='string'&&item.className.indexOf('wbrspan')!=-1){item=item.parentElement;}
dump_event("OnContentClick !");var anchor=null;for(var parent=item.parentElement;parent!=null&&parent.tagName!='P';parent=parent.parentElement){if(parent.tagName=='A'&&parent.href&&parent.href.indexOf("#")!=-1){anchor=parent;}}
if(anchor!=null){var strID=anchor.href.split("#")[1];var elem=document.getElementById(strID);if(elem){elem.cSmilItem.Sh5Audio.SetActiveItem(elem);ClearEvent(event);return;}}
if(item.parentElement!=null&&item.parentElement.tagName=="A"&&item.parentElement.href&&item.parentElement.href.indexOf("#")!=-1){var strID=item.parentElement.href.split("#")[1];var elem=document.getElementById(strID);if(elem){elem.cSmilItem.Sh5Audio.SetActiveItem(elem);return;}}
if(0){for(var item=event.target;item&&item.tagName!='SECTION';item=item.parentElement){if(item.parentCell){if(saudio.OnItemClick({target:item.parentCell})){return;}return;}}}
if(window.bTableReadMode&&saudio.nLineReadMode==LineReadMode.lrmAll&&saudio.audio.paused==false){saudio.audio.pause();if(window.nPlayIntervalTimer!==undefined){clearTimeout(window.nPlayIntervalTimer);window.nPlayIntervalTimer=undefined;}
if(saudio.nLineReadTimerID!=-1){clearInterval(saudio.nLineReadTimerID);saudio.nLineReadTimerID=-1;}}
if(saudio.OnItemClick(event)){return;}}
if(GetDisplayMode()==2){}}
function ReloadAudio(){if(window.nReloadAudioTimerID!=undefined){return false;}
if(saudio.cActiveItem&&saudio.cActiveItem.element){saudio.ResetInterval();saudio.audio.pause();saudio.source=saudio.audio.src='';window.nReloadAudioTimerID=setTimeout(function(){window.nReloadAudioTimerID=undefined;saudio.SetActiveItem(saudio.cActiveItem.element);},10);}}
function OnContentDblClick(event){var item=null;if(event.target!=null){for(var cell=event.target;cell!=null;cell=cell.parentElement){if(cell.tagName=='TD'||cell.tagName=='TH'){item=cell.querySelector("span.read");break;}}}
if(item&&item.parentCell&&item.cSmilItem&&item.cSmilItem.cSubSmils&&1<item.cSmilItem.cSubSmils.length){ClearEvent(event);saudio.audio.pause();setTimeout(function(event,item){try{saudio.audio.currentTime=0;}catch(e){}
event.target=item;event.ctrlKey=true;saudio.OnItemClick({target:item,ctrlKey:true});item.className=item.className.replace(" sh5_highlight",'');},100,event,item);SetElementColor(item,0);return;}else{return;}
ReloadAudio();}
var TouchCount=0;function OnContentTouchStart(event){if(window.TouchCount==0){window.TouchCount++;setTimeout(function(){window.TouchCount=0;},500);}else{event.preventDefault();window.TouchCount=0;OnContentDblClick(event);}}
function OnTocDblClick(event){ReloadAudio();}
function SwitchTopTabOfToc(){var indexTab=document.getElementById('topTabIndex');var pageTab=document.getElementById('topTabPage');if(indexTab&&pageTab){if(indexTab.className.indexOf('topTabActive')!=-1){indexTab.className="topTabItem";pageTab.className="topTabItem topTabActive";indexListArea.style.display='none';pageListArea.style.display='';}else{indexTab.className="topTabItem topTabActive";pageTab.className="topTabItem";indexListArea.style.display='';pageListArea.style.display='none';}}}
function OnTocClick(event){if(event.target!=null){var id=event.target.id;var nIndex;var obj;if(event.target.tagName=='DIV'&&event.target.className=='topTabItem'){if(indexListArea!=null&&pageListArea!=null){var indexTab=document.getElementById('topTabIndex');var pageTab=document.getElementById('topTabPage');if(event.target.id=='topTabIndex'){indexTab.className="topTabItem topTabActive";pageTab.className="topTabItem";indexListArea.style.display='';pageListArea.style.display='none';}else if(event.target.id=='topTabPage'){indexTab.className="topTabItem";pageTab.className="topTabItem topTabActive";indexListArea.style.display='none';pageListArea.style.display='';}}return;}
if(event.target.tagName=='TD'&&event.target.id.substr(0,6)=='page_s'&&event.target.className.indexOf('page')!=-1){var strReadID=String(event.target.id).substr(5,10);if(cAudioItems[strReadID]!=undefined){try{var targetItem=document.getElementById(strReadID);if(targetItem!=null&&targetItem.style.display=='none'){while(targetItem!=null&&targetItem.style.display=='none'){if(targetItem.cSmilItem&&targetItem.cSmilItem.nextItem&&targetItem.cSmilItem.nextItem.element){targetItem=targetItem.cSmilItem.nextItem.element;}else{targetItem=null;}}
if(targetItem!=null){ShowReadElement(targetItem);var showState=ShowVisibleItem(targetItem);ReadItemAdjustScroll(targetItem,true);}}}catch(e){}
strActiveID=strReadID;var activeItem=document.getElementById(strActiveID);ShowActiveSection(activeItem);if(activeItem.offsetWidth==0&&activeItem.offsetHeight==0&&activeItem.offsetLeft==0&&activeItem.offsetTop==0){for(var parentItem=activeItem.parentElement;parentItem!=null&&parentItem.tagName!="SECTION";parentItem=parentItem.parentElement){if(parentItem.offsetLeft!=0&&parentItem.offsetTop!=0){var parent=parentItem.parentElement;if(parent&&parent.tagName=='SECTION'&&parent.className.indexOf('html_page')!=-1){break;}
parentItem.scrollIntoView({behavior:'auto',block:'start',inline:'start'});break;}}}
ShowReadElement(activeItem);saudio.SetActiveItem(activeItem);if(GetDisplayMode()==2){HideOverlapArea();bOverlapAreaMouseDown=false;}return;}return;}
obj=event.target;if(obj!=null&&obj.tagName=="LI"&&obj.id.substr(0,6)=='tocLi_'){var temp=obj.querySelector("span.toc");if(temp!=null&&temp.id.substr(0,5)=="toc_s"){obj=temp;}}
while(obj!=null){id=obj.id;name=obj.name;if(id!=null&&0<id.length&&id.substr(0,5)=="toc_s"&&0<name.length){var sh5Actives=indexListArea.querySelectorAll(".toc.sh5_active");for(var a=0;a<sh5Actives.length;a++){RemoveClassName(sh5Actives[a],'sh5_active');}
AppendClassName(obj,'sh5_active');window.bPlayIntervalWaite=false;var newID=id.substr(4);var newElem=document.getElementById(newID);if(newElem!=null){var elemID=id.substr(4);var readItem=document.getElementById(elemID);var showState=false;ShowActiveSection(readItem);showState=ShowVisibleItem(readItem);saudio.SetActiveItem(readItem);if(!showState){for(var elem=saudio.cActiveItem.element;elem&&elem.className!='sh5content';elem=elem.parentElement){if(elem.style.display=='none'){ShowReadElement(saudio.cActiveItem.element);break;}}}}
bTocClicked=false;}
obj=obj.parentNode;}}
if(1||GetDisplayMode()==2){var nTimeOutA=setTimeout(function(){clearTimeout(nTimeOutA);HideOverlapArea();bOverlapAreaMouseDown=false;},200);}}
function ActiveSettingItem(name){var items=document.querySelectorAll('.activeSettingItem');for(var i=0;i<items.length;i++){items[i].className=items[i].className.replace(' activeSettingItem','');}
if(cSettingItems[name]&&cSettingItems[name].element){var cSettingResetComment=document.getElementById('setting_reset_comment');var element=cSettingItems[name].element;var radios=element.querySelectorAll('input[type=radio],input[type=checkbox]');var stgValue=element.querySelector('.stgValue');if(0<radios.length){for(var r=0;r<radios.length;r++){if(radios[r].checked){radios[r].focus();break;}}
if(r==radios.length){radios[0].focus();}}else if(stgValue){stgValue.focus();if(cSettingResetComment!=null){cSettingResetComment.style.display='';}}
if(cSettingResetComment!=null){cSettingResetComment.style.display=(stgValue==null)? 'none':'';}
cSettingItems[name].element.className+=' activeSettingItem';cSettingItems[name].element.scrollIntoView(false);}
strActiveSettingItem=name;}
function GetNextSetting(bNext){if(strActiveSettingItem&&cSettingItems[strActiveSettingItem]){if(bNext&&cSettingItems[strActiveSettingItem].nextItem){return cSettingItems[strActiveSettingItem].nextItem.name;}else if(!bNext&&cSettingItems[strActiveSettingItem].prevItem){return cSettingItems[strActiveSettingItem].prevItem.name;}}
for(var name in cSettingItems){if(cSettingItems[name].name){return name;}}return '';}
function SettingItemBlink(){if(bActiveSettingItemColor==false){nActiveSettingItemColor+=32;if(255<nActiveSettingItemColor){nActiveSettingItemColor=255;bActiveSettingItemColor=true;}}else{nActiveSettingItemColor-=32;if(nActiveSettingItemColor<128){nActiveSettingItemColor=128;bActiveSettingItemColor=false;}}
var th=document.getElementById(strActiveSettingItem+"Head");var td=document.getElementById(strActiveSettingItem+"Cell");if(th!=null&&td!=null){th.style.backgroundColor=td.style.backgroundColor="RGB(0,0,"+nActiveSettingItemColor+")";}}
function ScriptKeyDown(code,shift,ctrl,alt){var event={'keyCode':code,'shiftKey':shift ? true:false,'ctrlKey':ctrl ? true:false,'altKey':alt};OnKeyDownEvent(event);}
function OnKeyDownEvent(event){var code=event.keyCode;var bShiftKey=event.shiftKey;var bCtrlKey=event.ctrlKey;var bAltKey=event.altKey;window.bControlKey=undefined;var overlapArea=document.getElementById('overlapArea');if(event.shiftKey&&event.ctrlKey&&event.altKey&&code==0x52){ClearEvent();ClearStorage();window.bClearSettingWhenClose=true;}
if(event.shiftKey&&event.ctrlKey&&event.altKey&&code==0x41){if(4<++nAutomaticTestState){AutomaticTest();}}else{nAutomaticTestState=0;}
if(overlapArea.style.display==''&&code==0x1B){HideOverlapArea();}else if(overlapArea.style.display==''&&settingFrame.style.display==''){switch(code){case 0x26:ActiveSettingItem(GetNextSetting(false));break;case 0x28:ActiveSettingItem(GetNextSetting(true));break;case 0x25:case 0x27:if(cUserSetting[strActiveSettingItem]!=undefined){SetRangePos(strActiveSettingItem,cUserSetting[strActiveSettingItem]+(code==0x27 ?+1:-1));}else{return;}
break;case 0x0D:SetRangePos(strActiveSettingItem,cSettingItems[strActiveSettingItem].defval);break;default:return;}}else if(overlapArea.style.display==''&&bibinfoFrame.style.display==''){if(event.ctrlKey&&code==0x41){HideOverlapArea();AutomaticTest(true);return;}}else if(overlapArea.style.display=='none'){if(event.ctrlKey&&event.shiftKey){return false;}
switch(code){case 0x10:break;case 0x20:if(overlapArea.style.display!=''){if(saudio.IsPause()){OnCmdPlayButton();}else if(event.ctrlKey){OnCmdStopButton();}else{OnCmdPauseButton();}
ClearEvent(event);return;}
break;case 0x25:if(!event.shiftKey){window.bControlKey=event.ctrlKey;MoveHighlightItem(false);}else if(!event.ctrlKey&&event.shiftKey){SetSpeedDown();}else{return false;}
ClearEvent(event);break;case 0x27:if(!event.shiftKey){window.bControlKey=event.ctrlKey;MoveHighlightItem(true);}else if(!event.ctrlKey&&event.shiftKey){SetSpeedUp();}else{return false;}
ClearEvent(event);break;case 0x26:if(!event.shiftKey){window.bControlKey=event.ctrlKey;OnCmdMovePrevSection();}else if(!event.ctrlKey&&event.shiftKey){SetFontSizeUp();}else{return false;}
ClearEvent(event);break;case 0x28:if(!event.shiftKey){window.bControlKey=event.ctrlKey;OnCmdMoveNextSection();}else if(!event.ctrlKey&&event.shiftKey){SetFontSizeDown();}else if(event.ctrlKey&&!event.shiftKey){}else{return false;}
ClearEvent(event);break;case 0x31:bDoubleSpeed ? PlaySpeedChange(1):SetRangePos("speed",10);break;case 0x32:bDoubleSpeed ? PlaySpeedChange(2):SetRangePos("speed",20);break;case 0x33:if(bDoubleSpeed){PlaySpeedChange(2);SetRangePos("speed",15);}else{SetRangePos("speed",30);}
break;case 0x43:if(!bAltKey&&!bCtrlKey&&!bShiftKey){SetRangePos("color",(cUserSetting.color+1)%(cSettingItems.color.max+1));}
break;case 0x44:case 0x56:if(bCtrlKey){VerticalModeChange();ClearEvent(event);return;}
break;case 0x45:LayoutEditMode();break;case 0x49:if(!bAltKey&&!bCtrlKey&&!bShiftKey){ShowBibInfoPanel();}
break;case 0x48:if(!bAltKey&&!bCtrlKey&&!bShiftKey){ShowHelpPanel();}
break;case 0x50:SwitchTopTabOfToc();break;case 0x53:if(!bAltKey&&!bCtrlKey&&!bShiftKey){ShowSettingPanel();}
break;case 0x52:if(bAltKey===true&&bShiftKey!==true){SetShowRubyLevel('loop');}else{return false;}
break;case 0x57:WakachigakiChange();break;case 0x4C:LineReadModeChange();break;default:return false;}}else{return false;}
ClearEvent();return false;}
function IsSafeElement(elem){if(elem!=null&&elem!=undefined){try{var nodeType=elem.nodeType;if(elem.nodeType==1){return true;}}catch(e){return false;}}return false;}
function LayoutEditModeGetData(){var reads=document.getElementsByClassName('read');var data=new Array();for(var i=0;i<reads.length;i++){var read=reads[i];if(0<read.id.length){var prev=read.previousElementSibling;if(prev!=null&&prev!=undefined&&prev.nodeName=='SPAN'&&prev.className=='aditem_e'){var strParams='';while(IsSafeElement(prev)&&prev.className=='aditem_e'){var sub=prev.firstElementChild;var strSubClass=IsSafeElement(sub)? sub.className:'';switch(strSubClass){case 'aditem_sub_space':strParams='S'+strParams;break;case 'aditem_sub_leftalign':strParams='L'+strParams;break;case 'aditem_sub_centeralign':strParams='C'+strParams;break;case 'aditem_sub_rightalign':strParams='R'+strParams;break;case 'aditem_sub_newpage':strParams='P'+strParams;break;case 'aditem_sub_breakline':strParams='B'+strParams;break;}
prev=prev.previousElementSibling;}
if(0<strParams.length){var itemId=ReadIdToIndex(read);var itemdata=new Array(itemId.section,itemId.index,strParams);data.push(itemdata);delete itemdata;}}}}return data;}
function LayoutEditModeGetDataString(){return JSON.stringify(LayoutEditModeGetData());}
function GetUUID(){var metas=document.getElementsByTagName('meta');for(var m=0;m<metas.length;m++){var meta=metas[m];if(meta!=null&&meta.name=='uuid'&&meta.content!=''){return meta.content;}}return null;}
function GetReadElement(section,index){var result=document.getElementById(MakeReadId(section,index));if(result!=null&&result!=undefined){return result;}return null;}
function MakeReadId(section,index){var s1='00'+section;var s2='0000'+index;return 's'+s1.right(3)+'_'+s2.right(5);}
function ReadIdToIndex(item){if(typeof item=="object"&&item!==null){if(IsSafeElement(item)&&item.className.indexOf("read")!=-1){item=item.id;}}
if(typeof item=="string"){var data;if(item.match(/^addarea_/)===null){data=item.substr(1).split('_');}else{data=item.substr(15).split('_');}
if(data.length==2){var nSection=Number(data[0]);var nIndex=Number(data[1]);if(!isNaN(nSection)&&!isNaN(nIndex)){var result={section:nSection,index:nIndex};return result;}}}return null;}
function IsPrevieusTable(item){if(item!=null&&item!=undefined){var prev=item.previousElementSibling;if(prev!=null&&prev!=undefined&&prev.nodeName=='TABLE'){return true;}}return false;}
function GetParagraphElement(item){try{if(item!=null&&item!=undefined){for(var para=item.parentNode;para!=null&&para!=undefined;para=para.parentNode){if(0<para.id.length&&para.id.substr(0,4)=='pid_'){return para;}}}}catch(e){}return null;}
function GetParagraphId(item){if(item!=null&&item!=undefined){var id=null;if(0<item.id.length&&item.id.match(/^pid_\d\d\d\d\d/)!==null){id=item.id;}else if(0<item.id.length&&item.id.match(/^addarea_\d\d\d\d\d/)!==null){if(item.previousElementSibling!==null){while((item=item.previousElementSibling)!==null){if(item.id.match(/^pid_\d\d\d\d\d/)!==null){break;}}}else{while((item=item.nextElementSibling)!==null){if(item.id.match(/^pid_\d\d\d\d\d/)!==null){break;}}}
if(item!==null){id=item.id;}}else{var para=GetParagraphElement(item);if(para!=null){id=para.id;}}
if(id!=null&&0<id.length&&(typeof id)=='string'){var idnum=Number(id.substr(4,5));if(!isNaN(idnum)){return idnum;}}}return 0;}
function GetParagraphLastReadBlock(para){var reads=para.getElementsByClassName("read");return reads[reads.length-1];}
function GetClientRect(item){var rc={left:0,top:0,right:0,bottom:0,width:0,height:0};if(item!=null&&item!=undefined){var rcItem=item.getBoundingClientRect();rc.left=rcItem.left;rc.top=rcItem.top;rc.right=rcItem.right;rc.bottom=rcItem.bottom;rc.width=rcItem.width;rc.height=rcItem.height;if(bImageZoomState&&item.className.indexOf("layer_child")!=-1){var temp=item.parentElement;while(temp){if(temp.style.zoom&&temp.style.zoom.indexOf("%")){var zoom=parseFloat(temp.style.zoom)/100.0;if(zoom!=1){rc.left *=zoom;rc.top *=zoom;rc.right *=zoom;rc.bottom *=zoom;rc.width *=zoom;rc.height *=zoom;}
break;}
temp=temp.parentElement;}}}return rc;}
function SetRect(rc,x1,y1,x2,y2){rc.left=x1;rc.right=x2;rc.top=y1;rc.bottom=y2;rc.width=rc.right-rc.left;rc.height=rc.bottom-rc.top;return rc;}
function OffsetRect(rc,x,y){rc.left+=x;rc.right+=x;rc.top=(rc.top+y);rc.bottom=(rc.bottom+y);return rc;}
function InfrateRect(rc,x,y){rc.left+=x;rc.right-=x;rc.top+=y;rc.bottom-=y;rc.width=rc.right-rc.left;rc.height=rc.bottom-rc.top;return rc;}
function RectToString(rect){return "("+Math.round(rect.left)+","+Math.round(rect.top)+")-("+Math.round(rect.right)+","+Math.round(rect.bottom)+")["+Math.round(rect.width)+" x "+Math.round(rect.height)+"]"}
function ReadItemAdjustScroll(item,bDirectScroll){var bCurScrollMode=bScrollMode;var rcItem=GetClientRect(item);var rcArea=GetClientRect(contentArea);if(bScrollMode){bScrollMode=false;}
try{if(item.style.display=='none'||item.parentElement.style.display=='none'){bScrollMode=bCurScrollMode;return;}}catch(e){return;}
var ls=item.querySelectorAll("*.layerArea, *.img_frame");if(ls&&0<ls.length){item=ls[0];rcItem=GetClientRect(item);}
if(item.firstElementChild!=null){if(item.firstElementChild.className=='img_frame'){rcItem=GetClientRect(item.firstElementChild.firstElementChild);}else if(item.firstElementChild.className=='img_group_frame'){rcItem=GetClientRect(item.firstElementChild.firstElementChild);}else if(item.firstElementChild.tagName=='IMG'){rcItem=GetClientRect(item.firstElementChild);}else if(rcItem.width==0&&item.firstElementChild.layerAnchor==true){rcItem=GetClientRect(item.firstElementChild);}}
rcItem=OffsetRect(rcItem,contentArea.scrollLeft-contentArea.offsetLeft,contentArea.scrollTop-contentArea.offsetTop);rcArea=SetRect(rcArea,0,0,contentArea.clientWidth,contentArea.clientHeight);rcArea=OffsetRect(rcArea,contentArea.scrollLeft,contentArea.scrollTop);var h=rcArea.height * dAreaBottomLimit;rcArea.bottom=rcArea.top+rcArea.height * dAreaBottomLimit;rcArea.height=rcArea.bottom-rcArea.top;ScrollPos.x=contentArea.scrollLeft;ScrollPos.y=contentArea.scrollTop;if(bVerticalMode!=false||(item.parentSection&&item.parentSection.className.indexOf('vertical_section')!=-1)){ReadItemAdjustScrollSub(item,bDirectScroll,rcArea,rcItem,true);}else{ReadItemAdjustScrollSub(item,bDirectScroll,rcArea,rcItem,false);}
bScrollMode=bCurScrollMode;}
var g_intervalID=null;function ReadItemAdjustScrollSub(item,bDirectScroll,rcArea,rcItem,bVirtical){if(bVirtical==undefined){bVirtical=false;}
if(item){var rcContentAreaClient={'left':contentArea.scrollLeft,'top':contentArea.scrollTop,'right':contentArea.scrollLeft+contentArea.clientWidth,'bottom':contentArea.scrollTop+contentArea.clientHeight,'width':contentArea.clientWidth,'height':contentArea.clientHeight};var r1=GetClientRect(contentArea);var r2=GetClientRect(item);var img;if(window._LAYER_DEBUG){if(item.className.indexOf("layer_child")!=-1){var anchor=item.querySelector("a");var image=item.querySelector("span.layerItem,img");var rcTemp=window.cLayerDebugArea.getBoundingClientRect();var rcRead=GetClientRect(item);var rcArea=GetClientRect(contentArea);var strHtml='';strHtml+="ID:"+item.id+"&nbsp;/&nbsp;class"+item.className+"<hr/>\n";strHtml+="L:"+RectToString(GetClientRect(item.parentElement))+"<hr/>\n";strHtml+="R:"+RectToString(rcItem)+"<hr/>\n";if(anchor){strHtml+="A:"+RectToString(GetClientRect(anchor))+"<hr/>\n";}
if(image){strHtml+="I:"+RectToString(GetClientRect(image))+"<hr/>\n";}
strHtml+="C:"+RectToString(rcArea)+"<hr/>\n";strHtml+="(ScrollX="+contentArea.scrollLeft+" / ScrollY="+contentArea.scrollTop+")";window.cLayerDebugArea.innerHTML=strHtml;}else{window.cLayerDebugArea.innerHTML='';}}
if(item.parentLayer){var anchor=item.querySelector("a");if(anchor!=null){r2=GetClientRect(anchor);}else if((anchor=item.querySelector("img"))!=null){r2=GetClientRect(anchor);}else if(item.className.indexOf('border_layer')!=-1){r2=GetClientRect(item);}else{r2=GetClientRect(item.parentLayer);}}
if(r2.width==0&&r2.height==0){var pagestate=false;try{for(var elem=item;elem!=null;elem=elem.parentElement){if(elem.className.indexOf('page-normal')!=-1){pagestate=true;break;}}}catch(e){}
if(!pagestate){return false;}}
if(r1.width!=rcContentAreaClient.width){r1.width=rcContentAreaClient.width;r1.right=r1.left+rcContentAreaClient.width;}
if(r1.height!=rcContentAreaClient.height){r1.height=rcContentAreaClient.height;r1.bottom=r1.top+rcContentAreaClient.height;}
OffsetRect(r1,contentArea.scrollLeft-contentArea.offsetLeft,contentArea.scrollTop-contentArea.offsetTop);OffsetRect(r2,contentArea.scrollLeft-contentArea.offsetLeft,contentArea.scrollTop-contentArea.offsetTop);var nScrollX=r1.left;var nScrollY=r1.top;var nMarginX=bVirtical ? parseInt(r1.width/20):0;var nMarginY=bVirtical ? 0:parseInt(r1.height/20);if(r1.bottom<r2.bottom){nScrollY=r2.top-(r1.height/4);if(r1.height<r2.height){nScrollY=r2.top;}else if((nScrollY+r1.height)<r2.bottom){nScrollY=r2.bottom-r1.height;}}else if(r2.top<r1.top){nScrollY=r2.top-(r1.height/20);}
if(r1.width<r2.width){nScrollX=r2.left;}else if((r1.right-nMarginX)<r2.right){nScrollX=(r2.right-r1.width+100)+nMarginX;}else if(r2.left<(r1.left+nMarginX)){nScrollX=undefined;if(bVerticalMode){for(var parent=item.parentElement;parent&&parent.id!='sh5content';parent=parent.parentElement){if(parent.className.indexOf('sh5index')!=-1){if(bVerticalMode){nScrollX=(r2.right-r1.width)+nMarginX;}else{}
break;}}}
if(nScrollX==undefined){nScrollX=(r2.left+r2.right-r1.width)/2;}}
if(nScrollX!=r1.left||nScrollY!=r1.top){if(g_intervalID){clearInterval(g_intervalID);g_intervalID=null;}
if(!bDirectScroll&&r1.width<Math.abs(contentArea.scrollLeft-nScrollX)||r1.height<Math.abs(contentArea.scrollTop-nScrollY)){bDirectScroll=true;}
if(bDirectScroll||!nSoftScrollStep||bFireFox){bScriptScroll=true;contentArea.scrollLeft=nScrollX;contentArea.scrollTop=nScrollY;setTimeout(function(){bScriptScroll=false;},100);return;}else{var xStep=(nScrollX-r1.left)/nSoftScrollStep;var yStep=(nScrollY-r1.top)/nSoftScrollStep;var i=0;g_intervalID=setInterval(function(){if(i++<nSoftScrollStep){bScriptScroll=true;contentArea.scrollLeft+=xStep;contentArea.scrollTop+=yStep;}else{clearInterval(g_intervalID);g_intervalID=null;bScriptScroll=false;}},10);}}return true;}return false;}
function GetParagraphList(){var list=null;var tags=Array('H1','H2','H3','H4','H5','H6','P','DIV',"TABLE","FIELDSET","DL");for(var t=0;t<tags.length;t++){var items=content.getElementsByTagName(tags[t]);for(var i=0;i<items.length;i++){var item=items[i];if(item.id!=''){if(item.id.match(/^pid_/)!==null){if(list==null){list=Array(item);}else{list.push(item);}}else if(item.tagName=='DIV'&&item.id.match(/^addarea_\d\d\d\d\d/)!==null){if(list==null){list=Array(item);}else{list.push(item);}}}}}
if(list!=null){list.sort(function(a,b){var n=0;if(a.id<b.id){return-1;}else if(a.id>b.id){return 1;}else{return 0;}});}return list;}
function RestoreLayoutData(){if(cLayoutData!=null&&0<cLayoutData.length){var items=document.querySelectorAll("section.html_page > div > div.content");if(items){for(var i=0;i<items.length;i++){var item=items[i];var parent=item.parentElement;if(parent.id&&parent.id.substr(0,4)=='pid_'){if(parent.nextElementSibling!=null){parent.parentElement.insertBefore(item,parent.nextElementSibling);}else{parent.parentElement.appendChild(item);}}}}
for(var i=0;i<cLayoutData.length;i++){var section=cLayoutData[i][0];var index=cLayoutData[i][1];var strLayout=cLayoutData[i][2];var item=GetReadElement(section,index);var parent;var para;if(item!=null&&(parent=item.parentNode)!=null){for(var s=0;s<strLayout.length;s++){var c=strLayout.substr(s,1);var span=document.createElement('span');var align=null;switch(c){case 'S':span.innerHTML='<span class="aditem_sub_space">&emsp;</span>';break;case 'L':span.innerHTML='<span class="aditem_sub_leftalign">L</span>';align='left';break;case 'C':span.innerHTML='<span class="aditem_sub_centeralign">C</span>';align='center';break;case 'R':span.innerHTML='<span class="aditem_sub_rightalign">R</span>';align='right';break;case 'P':span.innerHTML='<hr class="aditem_sub_newpage" section_id="'+section+'" item_id="'+index+'" code_id="'+s+'"/>';break;case 'B':span.innerHTML='<span class="aditem_sub_breakline">s</span><br/>';span.style.fontFamily='SH5';break;default:continue;}
if(align!=null&&(para=GetParagraphElement(item))!=null){if(para.attributes.getNamedItem('default_align')==null){para.setAttribute('default_align',(para.style.textAlign!='')? para.style.textAlign:'left');}
para.style.textAlign=align;}
span.className="aditem";parent.insertBefore(span,item);}}}}
MakePageSplitDatas();}
function MakePageSplitDatas(){if(cPageDatas!=null){delete cPageDatas;}
cPageDatas=null;if(cLayoutData!=null){var pages=document.getElementsByClassName('aditem_sub_newpage');if(0<=pages.length){var pageitem={section:0,paragraph:1,index:0};var reads=document.getElementsByClassName('read');var lastRead=(0<reads.length)? reads[reads.length-1]:null;cPageDatas=new Array();cPageDatas.push(pageitem);for(var p=0;p<pages.length;p++){var page=pages[p];var sectionId=GetElementAttribute(page,'section_id');var paraId=GetParagraphId(page);var indexId=GetElementAttribute(page,'item_id');var codeidId=GetElementAttribute(page,'code_id');{var strParaID='pid_'+String(100000+paraId).right(5);var para=document.getElementById(strParaID);if(para){for(var prev=para.previousElementSibling;prev!=null;prev=prev.previousElementSibling){var read=prev.getElementsByClassName('read');if(read==null||read.length==0){paraId--;}else{break;}}}else{para=null;}}
if(sectionId!=null&&indexId!=null){var pageitem={section:parseInt(sectionId),paragraph:paraId,index:parseInt(indexId)};cPageDatas.push(pageitem);}}
if(lastRead!=null){var itemId=ReadIdToIndex(lastRead);var paraId=GetParagraphId(lastRead);if(itemId!=null&&0<paraId){var pageitem={section:itemId.section+1,paragraph:paraId+1,index:0};cPageDatas.push(pageitem);}}return cPageDatas;}}return cPageDatas;}
function ShowReadElement(item){if(item&&cPageDatas!=null&&0<=nViewArea&&nViewArea<cPageDatas.length){var itemId=ReadIdToIndex(item);if(itemId!=null){var paraid=GetParagraphId(item);var firstPage=cPageDatas[nViewArea];var lastPage=cPageDatas[nViewArea+1];if(item.tocElement&&item.tocElement.className.indexOf('sh5_active')==-1){var activeToc=document.querySelector('#indexListArea *.sh5_active');var newToc=item.tocElement;if(activeToc!=null){var className=activeToc.className;className=className.replace('sh5_active','');className=className.trim();activeToc.className=className;}
newToc.className+=' sh5_active';var rcToc=newToc.getBoundingClientRect();var rcIdx=indexListArea.getBoundingClientRect();var iTop=indexListArea.scrollTop;var iBtm=indexListArea.scrollTop+indexListArea.clientHeight;var tTop=(rcToc.top-rcIdx.top)+indexListArea.scrollTop-(rcToc.height/2);var tBtm=(rcToc.bottom-rcIdx.top)+indexListArea.scrollTop+(rcToc.height/2);if(iBtm<tBtm){indexListArea.scrollTop=tBtm-indexListArea.clientHeight;}else if(iTop>tTop){indexListArea.scrollTop=tTop;}}
if(item.pageElement&&item.pageElement.className.indexOf('sh5_active')==-1){var activePage=document.querySelector('#pageList *.sh5_active');if(activePage!=null){var className=activePage.className;className=className.replace('sh5_active','');className=className.trim();activePage.className=className;}
item.pageElement.className+=' sh5_active';if(0<pageListArea.scrollHeight){if(item.pageElement.offsetTop<pageListArea.scrollTop){pageListArea.scrollTop=item.pageElement.offsetTop;}else if((pageListArea.scrollTop+pageListArea.clientHeight)<(item.pageElement.offsetTop+item.pageElement.offsetHeight)){pageListArea.scrollTop=item.pageElement.offsetTop-(pageListArea.clientHeight/2);}}}
ShowActiveSection(item);if(item.style.display=='none'){for(var elem=item.parentElement;elem&&elem.tagName!='P';elem=elem.parentElement){if(elem.style.display!='none'){try{if(elem.scrollIntoView!==undefined){elem.scrollIntoView(true);}}catch(e){}
break;}}
var a=0;}
if(window.external&&typeof(window.external.ChageReadElement)!=='undefined'){window.external.ChageReadElement(item,item.tocElement,item.pageElement);}
if(firstPage.paragraph<=paraid&&(lastPage==undefined||paraid<lastPage.paragraph)){return false;}else if(lastPage!=undefined&&paraid==lastPage.paragraph){if(itemId.index<lastPage.index){return false;}}return true;}}return false;}
function ShowActiveSection(item){if(item.parentSection&&item.parentSection.style.display=='none'){dump_event(" Show Active Section Method Start");window.bDisableScrollEvent=true;var cSections=document.querySelectorAll("section.html_page");var nSections=cSections.length;for(var s=0;s<nSections;s++){var cSection=cSections[s];if(cSection==item.parentSection){window.cActiveSection=cSection;cSection.style.display='';StyleSheetChange(cSection);SetVerticalSectionMode();if(cSection.className.indexOf('vertical_section')!=-1){contentArea.style.overflowX='scroll';contentArea.style.overflowY='auto';contentArea.scrollLeft=cSection.clientWidth;document.getElementById('sh5content').style.height='100%';}else{contentArea.style.overflowX='auto';contentArea.style.overflowY='scroll';contentArea.scrollTop=0;contentArea.scrollLeft=0;document.getElementById('sh5content').style.height='';}
CreateBackslashCellLine(cSection);{var cReads=cSection.querySelectorAll("*.read");for(var r=0;r<cReads.length;r++){cReads[r].className+=" sh5_temp";}
setTimeout(function(){for(var r=0;r<cReads.length;r++){cReads[r].className=cReads[r].className.replace(" sh5_temp",'');}},500,cReads);}}else{cSection.style.display='none';}}
dump_event(" Show Active Section Method End");return true;}else{return false;}}
function GetElementAttribute(item,name){var a=typeof item;if(item!=null&&item!=undefined&&item.nodeType==1){var attr=item.attributes.getNamedItem(name);if(attr!=null){return attr.value;}}return null;}
function GetAudioSource(item){if(item!=undefined){if(item.src!=undefined){return String(item.src);}else if(item.ref!=undefined){var refItem=cAudioItems[item.ref];if(refItem!=undefined&&refItem.src!=undefined){return String(refItem.src);}}}return null;}
function ContentDirectionChangeHorz(){ContentDirectionChange(false);}
function ContentDirectionChangeVert(){ContentDirectionChange(true);}
function ContentDirectionChange(bMode){if(bMode===true||bMode===false){bVerticalMode=bMode;}else{bVerticalMode=!bVerticalMode;}
if(bVerticalMode==true&&contentArea.className.indexOf("vertical")==-1){contentArea.className+=" vertical";}else{contentArea.className=contentArea.className.replace("vertical",'');contentArea.className=contentArea.className.trim();}}
function GetLineReadMode(){return saudio ? saudio.GetLineReadMode():0;}
function LineReadModeChange(nNewMode){var vname=typeof nNewMode;if(saudio&&saudio.audio&&saudio.audio.paused==false){saudio.audio.pause();}
if(nNewMode==undefined){nLineReadStop=(nLineReadStop+1)%3;}else if(vname==="number"){nLineReadStop=nNewMode;}else if(vname==="boolean"){nLineReadStop=nNewMode ? 1:0;}else if(vname==="object"&&nNewMode.target!=undefined){var item=nNewMode.target;while(item!=null&&item.tagName!='SPAN'){item=item.parentNode;}
if(item!=null&&item.id!=undefined){switch(item.id){case "button_linemode3":nLineReadStop=0;break;case "button_linemode1":nLineReadStop=1;break;case "button_linemode2":nLineReadStop=2;break;default:return;}}}else{return;}
if(saudio&&saudio.SetLineReadMode){saudio.SetLineReadMode(nLineReadStop);}
var buttonLineMode1=document.getElementById("button_linemode1");var buttonLineMode2=document.getElementById("button_linemode2");var buttonLineMode3=document.getElementById("button_linemode3");if(buttonLineMode1&&buttonLineMode2&&buttonLineMode3){switch(nLineReadStop){case 0:buttonLineMode1.style.display='';buttonLineMode2.style.display='none';buttonLineMode3.style.display='none';break;case 1:buttonLineMode1.style.display='none';buttonLineMode2.style.display='';buttonLineMode3.style.display='none';break;case 2:buttonLineMode1.style.display='none';buttonLineMode2.style.display='none';buttonLineMode3.style.display='';break;}}
SetSettingValue("LineReadStop",nLineReadStop);}
function DispModeRadioUpdate(){try{document.getElementById("dispModeAuto").checked=(nDispMode==0)? true:false;document.getElementById("dispModePC").checked=(nDispMode==1)? true:false;document.getElementById("dispModeTablet").checked=(nDispMode==2)? true:false;}catch(e){}}
function ScrollModeChange(event){var ScrollMode=document.getElementById('scrollMode');if(ScrollMode){if(event===undefined){ScrollMode.checked=window.bScrollMode;}else{window.bScrollMode=ScrollMode.checked;SetSettingValue('ScrollMode',window.bScrollMode ? 1:0);}}}
function GetScrollMode(){return bScrollMode;}
function GetResumeMode(){return bResumeMode;}
function ResumeModeChange(event){var resumeMode=document.getElementById('resumeMode');if(resumeMode){if(event===undefined){resumeMode.checked=window.bResumeMode;}else{window.bResumeMode=resumeMode.checked;SetSettingValue('resumeMode',window.bResumeMode ? 1:0);}}}
function DispModeChange0(nNewMode){DispModeChange(0,true);}
function DispModeChange1(nNewMode){DispModeChange(1,true);}
function DispModeChange2(nNewMode){DispModeChange(2,true);}
function DispModeChange(nNewMode,bUpdate){var vname=typeof nNewMode;if(vname==="boolean"&&bUpdate!==true){nDispMode=nNewMode ? 2:1;DispModeRadioUpdate();return;}else if(vname==="number"&&bUpdate!==true){nDispMode=nNewMode;DispModeRadioUpdate();return;}
if(bUpdate!==true){nDispMode=GetDisplayMode()==1 ? 2:1;}else if(vname==="number"){nDispMode=nNewMode;}
if(GetDisplayMode()==1){document.getElementById("button_indexA").parentNode.style.display='none';controlArea.style.top="0";controlArea.style.textAlign="left";indexArea.style.position="absolute";indexArea.style.top="62px";indexArea.style.left="0px";indexArea.style.width=vertSplit.offsetLeft+'px';indexArea.style.border='none';vertSplit.style.display='';indexArea.parentNode.removeChild(indexArea);document.body.appendChild(indexArea);document.getElementById("settingDescription").style.display='';}else{document.getElementById("button_indexA").parentNode.style.display="inline-block";controlArea.style.textAlign="center";indexArea.style.position='';indexArea.style.top="0px";indexArea.style.left="0px";vertSplit.style.display='none';indexArea.parentNode.removeChild(indexArea);document.getElementById("indexCell").appendChild(indexArea);document.getElementById("settingDescription").style.display='none';}
SetSettingValue("DispMode",nDispMode);DispModeRadioUpdate();ClientResize();}
function SetToolButtonCaptions(nNewMode){var vname=typeof nNewMode;if(window.buttonImages!=undefined){var cItems=document.querySelectorAll("#controlArea span.toolButton");var nItems=cItems.length;for(var i=0;i<cItems.length;i++){var cItem=cItems[i];if(cItem.querySelector("img")==null){var id=cItem.id.substr(7,20);var data=window.buttonImages[id];if(data){cItem.innerHTML=data;}}}}
if(vname==="boolean"){bEasyCaption=nNewMode ? true:false;}else{bEasyCaption=!bEasyCaption;SetSettingValue("EasyCaption",bEasyCaption ? 1:0);}
var cCheckBox=document.getElementById("inputEasyCaptionCheck");var Buttons=controlArea.getElementsByTagName("span");if(cCheckBox){cCheckBox.checked=bEasyCaption;}
var nTabIndex=10;for(var b=0;b<Buttons.length;b++){var Button=Buttons[b];var id=Button.id;if(id!=null&&0<id.length){id=id.substr(7);var cCaption=sControlCaptions[id];if(cCaption!=undefined){var ShortcutKey=ShortcutKeys[id];if(bEasyCaption&&cCaption.easy!=undefined){Button.title=cCaption.easy;Button.ariaLabel=cCaption.easy;}else{Button.ariaLabel=cCaption.normal;if(cCaption.description!=undefined){Button.title='['+cCaption.normal+']\n'+cCaption.description;}else{Button.title=cCaption.normal;}}
if(ShortcutKey!=undefined){Button.title+="\n"+sSeparatorText+"\n"+sShortcutLabel+"["+ShortcutKey.key+"]";if(ShortcutKey.ctrl===true){Button.title+="+Ctrl";}
if(ShortcutKey.shift===true){Button.title+="+Shift";}}}}}}
function SetPrevKeyRepeat(event){var prevKeyRepeat=document.getElementById('prevKeyRepeat');if(prevKeyRepeat){if(event===undefined){prevKeyRepeat.checked=window.bPrevKeyRepeat;}else{window.bPrevKeyRepeat=prevKeyRepeat.checked;SetSettingValue('prevKeyRepeat',window.bPrevKeyRepeat ? 1:0);}
(window.bPrevKeyRepeat ? AppendClassName:RemoveClassName)(document.body,'prevKeyRepeat');}}
function SetRepeatFrace(event){var repeatFrace=document.getElementById('repeatFrace');if(repeatFrace){if(event===undefined){repeatFrace.checked=window.bRepeatFrace;}else{window.bRepeatFrace=repeatFrace.checked;SetSettingValue('repeatFrace',window.bRepeatFrace ? 1:0);}
(window.bRepeatFrace ? AppendClassName:RemoveClassName)(document.body,'repeatFrace');}}
function SetSwapArrowKeys(event){var swapArrowKeys=document.getElementById('swapArrowKeys');if(swapArrowKeys){if(event!==undefined){window.bSwapArrowKeysInVerticalSection=swapArrowKeys.checked ? true:false;SetSettingValue('swapArrowKeys',window.bSwapArrowKeysInVerticalSection ? 1:0);}else{swapArrowKeys.checked=window.bSwapArrowKeysInVerticalSection ? true:false;SetSettingValue('swapArrowKeys',window.bSwapArrowKeysInVerticalSection ? 1:0);}
SetVerticalSectionMode();return true;}return false;}
function SetAdjustStartFaster(event){var AdjustStartFaster=document.getElementById('AdjustStartFaster');if(AdjustStartFaster){if(event===undefined){AdjustStartFaster.checked=window.bAdjustStartFaster;}else{window.bAdjustStartFaster=AdjustStartFaster.checked;SetSettingValue('AdjustStartFaster',window.bAdjustStartFaster ? 1:0);}}}
function GetDisplayMode(){if(nDispMode==0){var us=navigator.userAgent;if(us.indexOf("Windows NT 10")!=-1&&(us.indexOf("Chrome")!=-1||us.indexOf("Firefox")!=-1)){return 1;}else if("ontouchstart" in window){return 2;}else if(us.indexOf("Mobile")!=-1||us.indexOf("Android")!=-1){return 2;}return 1;}return nDispMode;}
function OnDocumentDblClick(event){}
function GetNearAddArea(x,y){var rcArea=contentArea.getBoundingClientRect();if(overlapArea.style.display!='none'){return null;}
if(x<rcArea.left||rcArea.right<x||y<rcArea.top||rcArea.bottom<y){return null;}
var cAddAreas=document.getElementsByClassName("addarea");for(var a=0,count=cAddAreas.length;a<count;a++){var item=cAddAreas[a];var rcItem=item.getBoundingClientRect();if(rcItem.left<=x&&x<rcItem.right&&rcItem.top<=y&&y<rcItem.bottom){item.className="addarea editmode";return item;}}
var items=document.querySelectorAll("div.sh5content div.addarea, div.sh5content table, div.sh5content p, div.sh5content h1, div.sh5content h2, div.sh5content h3, div.sh5content h4, div.sh5content h5, div.sh5content h6");var tempItems=[];x-=contentArea.offsetLeft-contentArea.scrollLeft;y-=contentArea.offsetTop-contentArea.scrollTop;if(bVerticalMode==false){for(var i=0,count=items.length;i<count;i++){var item=items[i];var rc1=item.getBoundingClientRect();var y1=Math.round(rc1.top-contentArea.offsetTop+contentArea.scrollTop);var y2=Math.round(rc1.bottom-contentArea.offsetTop+contentArea.scrollTop);if(2<(y2-y1)){tempItems.push({item:item,y1:y1,y2:y2,h:y2-y1});if(1<tempItems.length){tempItems[tempItems.length-2].y2=tempItems[tempItems.length-1].y1;}}}
for(i=0,count=tempItems.length-1;i<count;i++){var tempItem=tempItems[i];var item=tempItem.item;var parent=item.parentElement;var insertPos=undefined;if(i==0&&y<tempItem.y1){insertPos=item;}else if(i==(count-1)&&tempItem.y2<=y){insertPos=item.nextElementSibling;}else if(tempItem.y1<=y&&y<tempItem.y2){if(item.textContent==''&&(item.childElementCount==0||(item.childElementCount==1&&item.firstElementChild.tagName=='BR'))){if(y<(tempItem.y1+tempItem.h)){insertPos=item;}else{insertPos=item.nextElementSibling;}}else if(y<tempItem.y1+(tempItem.h/4)){insertPos=item;}else{insertPos=item.nextElementSibling;}}
if(insertPos!==undefined){if(parent.className.indexOf('addarea')!=-1){parent.className="addarea editmode";return parent;}
var newArea=CreateNewAddArea();if(insertPos!=null){parent.insertBefore(newArea,insertPos);}else{parent.appendChild(newArea);}return newArea;}}}else{for(var i=0,count=items.length;i<count;i++){var item=items[i];var rc1=item.getBoundingClientRect();var x1=Math.round(rc1.right-contentArea.offsetLeft+contentArea.scrollLeft);var x2=Math.round(rc1.left-contentArea.offsetLeft+contentArea.scrollLeft);if(2<(x1-x2)){tempItems.push({item:item,x1:x1,x2:x2,w:x1-x2});if(1<tempItems.length){tempItems[tempItems.length-2].x2=tempItems[tempItems.length-1].x1;}}}
for(i=0,count=tempItems.length-1;i<count;i++){var tempItem=tempItems[i];var item=tempItem.item;var parent=item.parentElement;var insertPos=undefined;if(i==0&&tempItem.x1<x){insertPos=item;}else if(i==(count-1)&&x<=tempItem.x2){insertPos=item.nextElementSibling;}else if(tempItem.x2<=x&&x<=tempItem.x1){if(item.textContent==''&&(item.childElementCount==0||(item.childElementCount==1&&item.firstElementChild.tagName=='BR'))){if(x<(tempItem.x1-tempItem.w)){insertPos=item.nextElementSibling;}else{insertPos=item;}}else if(tempItem.x1-(tempItem.w/4)<x){insertPos=item;}else{insertPos=item.nextElementSibling;}}
if(insertPos!==undefined){var newArea=CreateNewAddArea();if(insertPos!=null){parent.insertBefore(newArea,insertPos);}else{parent.appendChild(newArea);}return newArea;}}}return null;}
function CreateNewAddArea(){var cNewElem=document.createElement("div");for(var iNewID=1;1;iNewID++){cNewElem.id="addarea_"+String(100000+iNewID).right(5);if(document.getElementById(cNewElem.id)==null){break;}}
cNewElem.className="addarea editmode";if(window.sNewEditAreaCaption!=undefined){cNewElem.innerHTML='&thinsp; '+sNewEditAreaCaption;}else{cNewElem.innerHTML="&thinsp; 新しい編集領域";}return cNewElem;}
function StyleSheetChange(cSection){if(bChattyInfty3&&cCiStyleH!=null&&cCiStyleV!=null){try{if(cSection.className.indexOf('vertical_section')!=-1){if(cCiStyleH.parentNode!=null){document.head.removeChild(cCiStyleH);}
if(cCiStyleV.parentNode==null){document.head.appendChild(cCiStyleV);}}else{if(cCiStyleV.parentNode!=null){document.head.removeChild(cCiStyleV);}
if(cCiStyleH.parentNode==null){document.head.appendChild(cCiStyleH);}}}catch(e){console.log(e);}}}
function VerticalModeChange(){var cSections=document.querySelectorAll('section.html_page');var nSections=cSections.length;if(bVerticalButtuon==true){bVerticalButtuon=false;for(var s=0;s<nSections;s++){var cSection=cSections[s];var strClassName=cSection.className;strClassName=strClassName.replace(/vertical_section/g,'');strClassName=strClassName.trim();cSection.className=strClassName;if(cSection.style.display==''){StyleSheetChange(cSection);}}
var inftyDLs=document.querySelectorAll("dl.infty_dl");for(var i=0;i<inftyDLs.length;i++){var dds=inftyDLs[i].getElementsByTagName("dd");for(var d=0;d<dds.length;d++){var dd=dds[d];if(dd.style.marginTop!=''){var margin=parseFloat(dd.style.marginTop);dd.style.marginTop='';dd.style.marginLeft=margin+"em";}}}}else{bVerticalButtuon=true;for(var s=0;s<nSections;s++){var cSection=cSections[s];var strClassName=cSection.className;if(cSection.getAttribute('direction')!='horz'||strContentDirection=='horz'){strClassName+=' vertical_section';}
cSection.className=strClassName;if(cSection.style.display==''){StyleSheetChange(cSection);}}
var inftyDLs=document.querySelectorAll("dl.infty_dl");for(var i=0;i<inftyDLs.length;i++){var dds=inftyDLs[i].getElementsByTagName("dd");for(var d=0;d<dds.length;d++){var dd=dds[d];if(dd.style.marginLeft!=''){var margin=parseFloat(dd.style.marginLeft);dd.style.marginLeft='';dd.style.marginTop=margin+"em";}}}}
CreateBackslashCellLine();SetVerticalSectionMode();setTimeout(function(){var item=document.querySelector('.sh5_highlight');if(item==null){item=document.getElementById('s001_00001');}
ShowReadElement(item);if(item.parentSection&&item.parentSection.className.indexOf('vertical_section')!=-1){contentArea.scrollLeft=item.parentSection.clientWidth;}{ReadItemAdjustScroll(item,true);}
var button_vertohorz=document.getElementById('button_vertohorz');if(button_vertohorz!=null){if(window.buttonImages==undefined){button_vertohorz.textContent=(bVerticalButtuon)? "\xB2":"\xB1";}else{button_vertohorz.innerHTML=bVerticalButtuon ? window.buttonImages.verttohorz:window.buttonImages.horztovert;}}},100);}
function SetShowRubyLevelMenu(){var button=document.getElementById('button_rubylevel');if(button){var rect=button.getBoundingClientRect();var ruby_menu_area=document.getElementById('ruby_level_menu_list_area');var menu=document.getElementById('ruby_level_menu_list');if(!ruby_menu_area){ruby_menu_area=document.createElement("div");menu=document.createElement("ol");ruby_menu_area.className='ruby_level_menu_list_area';ruby_menu_area.id='ruby_level_menu_list_area';menu.className='ruby_level_menu_list';menu.id='ruby_level_menu_list';ruby_menu_area.onclick=function(){ruby_menu_area.style.display='none';};var items=Array('rubylevelA','rubylevel1','rubylevel2','rubylevel3','rubylevel4','rubylevel5','rubylevel6','rubylevel7','rubylevel0','rubylevelN');var bEnableLevel=(document.querySelector('ruby[class^="ruby_level_"]')!=null)? true:false;for(var i=0;i<items.length;i++){var menuitem=document.createElement('li');menuitem.id='rlml_'+items[i];menuitem.className='ruby_level_menu_list_item';menuitem.innerHTML='<span></span>'+sControlCaptions[items[i]].normal;menuitem.onclick=SetShowRubyLevel;menuitem.RubuLevelValue=(i==0)?-1:i;menu.appendChild(menuitem);if(bEnableLevel==false&&items[i]!='rubylevelA'&&items[i]!='rubylevelN'){menuitem.style.display='none';}}
ruby_menu_area.appendChild(menu);document.body.appendChild(ruby_menu_area);}else if(ruby_menu_area.style.display==''){ruby_menu_area.style.display='none';return;}
menu.style.left=rect.left+'px';if(GetDisplayMode()==2){menu.style.top='';menu.style.bottom=(button.clientHeight+8)+'px';}else{menu.style.top=rect.bottom+'px';}
var items=menu.querySelectorAll('.ruby_level_menu_list_item_active');for(var i=0;i<items.length;i++){items[i].className='ruby_level_menu_list_item';}
switch(nRubyLevel){case-1:document.getElementById('rlml_rubylevelA').className+=' ruby_level_menu_list_item_active';break;case 1:document.getElementById('rlml_rubylevel1').className+=' ruby_level_menu_list_item_active';break;case 2:document.getElementById('rlml_rubylevel2').className+=' ruby_level_menu_list_item_active';break;case 3:document.getElementById('rlml_rubylevel3').className+=' ruby_level_menu_list_item_active';break;case 4:document.getElementById('rlml_rubylevel4').className+=' ruby_level_menu_list_item_active';break;case 5:document.getElementById('rlml_rubylevel5').className+=' ruby_level_menu_list_item_active';break;case 6:document.getElementById('rlml_rubylevel6').className+=' ruby_level_menu_list_item_active';break;case 7:document.getElementById('rlml_rubylevel7').className+=' ruby_level_menu_list_item_active';break;case 8:document.getElementById('rlml_rubylevel0').className+=' ruby_level_menu_list_item_active';break;}
SetSettingValue("ruby_level",nRubyLevel);ruby_menu_area.style.display='';}}
function SetShowRubyLevel(nNewValue){var ruby_menu_area=document.getElementById('ruby_level_menu_list_area');if(ruby_menu_area){if(ruby_menu_area.style.display==''){ruby_menu_area.style.display='none';}}
if(nNewValue==='loop'){nRubyLevel++;if(9<nRubyLevel){nRubyLevel=-1;}
SetSettingValue("ruby_level",nRubyLevel);}else if(nNewValue==undefined){if((nNewValue=GetSettingValue("ruby_level",-1))==-1){if(cUserSetting['ruby']!==undefined){nNewValue=cUserSetting['ruby'];}}}else if(typeof nNewValue=='object'&&nNewValue.target&&nNewValue.target.RubuLevelValue!=undefined){nRubyLevel=nNewValue.target.RubuLevelValue;SetSettingValue("ruby_level",nRubyLevel);}else if(typeof nNewValue=='object'&&nNewValue.type){nRubyLevel=(nRubyLevel+1)%8;}else if(nNewValue!==undefined){nRubyLevel=nNewValue;}else{nRubyLevel=-1;}
var strCssText='';if(0<nRubyLevel){if(nRubyLevel==8){strCssText+="#sh5content ruby:not(.original) rt { display:none; }";strCssText+="#sh5content ruby:not(.original) { padding-top:0;padding-right:0; }";}else if(nRubyLevel==9){strCssText+="#sh5content ruby rt { display:none; }";strCssText+="#sh5content ruby { padding-top:0;padding-right:0; }";}else{for(var i=1;i<nRubyLevel;i++){strCssText+="#sh5content ruby.ruby_level_"+i+" rt,";}
strCssText=strCssText.replace(/,+$/,'');strCssText+="{font-size:0px !important;color:transparent !important;}";for(var i=1;i<nRubyLevel;i++){strCssText+="#sh5content ruby.ruby_level_"+i+",";}
strCssText=strCssText.replace(/,+$/,'');strCssText+="{ padding-top:0;padding-right:0; }";}}
cssRybyLevel.textContent=strCssText;var button=document.getElementById('button_rubylevel');if(button){if(window.buttonImages==undefined){switch(nRubyLevel){case-1:button.textContent="\xA1";break;case 0:button.textContent="\xA1";break;case 1:button.textContent="\xA2";break;case 2:button.textContent="\xA3";break;case 3:button.textContent="\xA4";break;case 4:button.textContent="\xA5";break;case 5:button.textContent="\xA6";break;case 6:button.textContent="\xA7";break;case 7:button.textContent="\xA8";break;case 8:button.textContent="\xA9";break;case 9:button.textContent="\xAA";break;default:button.textContent='';break;}}else{switch(nRubyLevel){case-1:button.innerHTML=window.buttonImages['rubylevelA'];break;case 0:button.innerHTML=window.buttonImages['rubylevelA'];break;case 1:button.innerHTML=window.buttonImages['rubylevel1'];break;case 2:button.innerHTML=window.buttonImages['rubylevel2'];break;case 3:button.innerHTML=window.buttonImages['rubylevel3'];break;case 4:button.innerHTML=window.buttonImages['rubylevel4'];break;case 5:button.innerHTML=window.buttonImages['rubylevel5'];break;case 6:button.innerHTML=window.buttonImages['rubylevel6'];break;case 7:button.innerHTML=window.buttonImages['rubylevel7'];break;case 8:button.innerHTML=window.buttonImages['rubylevel0'];break;case 9:button.innerHTML=window.buttonImages['rubylevelN'];break;default:button.innerHTML='';break;}}}
if(window.getComputedStyle!=undefined){var cBoxes=document.querySelectorAll(".sh5content span.boxstyle");var nBoxes=cBoxes.length;for(var b=0;b<nBoxes;b++){var cBox=cBoxes[b];var cRts=cBox.querySelectorAll("rt");var nRts=cRts.length;if(0<nRts){for(var r=0;r<cRts.length;r++){var cRt=cRts[r];var bState=false;var style=getComputedStyle(cRt);if(style.display=='none'||style.fontSize=='0px'||cRt.clientHeight==0){}else{bState=true;break;}}
cBox.className=cBox.className.replace(' include_ruby','');if(bState){cBox.className+=' include_ruby';}else{}}}}
CreateBackslashCellLine();}
function ShowIndexArea(bMode){if(bMode===true||bMode===false){indexArea.style.display=bMode ? '':'none';if(vertSplit!=null){vertSplit.style.display=indexArea.style.display;}
ClientResize();}}
function IsShowIndexArea(){if(indexArea!==undefined&&indexArea!==null){return indexArea.style.display!=='none';}return true;}
var DnsSplitter=function(obj){nXpos=null;splitter=obj;Sh5AddEventProc(splitter,'mousedown',MoveStart);function MoveStart(event){var style=event.target.currentStyle||document.defaultView.getComputedStyle(event.target,'');if(style.cursor=='w-resize'){splitter.style.zIndex='1000';nXpos=event.clientX-splitter.offsetLeft;Sh5AddEventProc(window,'mousemove',MouseMove);Sh5AddEventProc(window,'mouseup',MoveEnd);}}
function MoveEnd(event){console.log(this+" "+event.type+" "+event.clientX);splitter.style.zIndex='0';nXpos=null;Sh5RemoveEventProc(window,'mousemove',MouseMove);Sh5RemoveEventProc(window,'mouseup',MoveEnd);Sh5RemoveEventProc(window,'mouseout',MoveEnd);ClientResize();}
function MouseMove(event){console.log(this+" "+event.type+" "+event.clientX);if(nXpos!==null){nNewLeft=event.clientX-nXpos;if(nNewLeft<100){splitter.style.left='100px';MoveEnd(event);}else if((document.body.clientWidth-100)<nNewLeft){splitter.style.left=(document.body.clientWidth-100)+'px';MoveEnd(event);}else{splitter.style.left=(event.clientX-nXpos)+'px';}}}};function PlaySpeedChange(index){var speedA=document.getElementById('button_speedA');var speedB=document.getElementById('button_speedB');if(speedA&&speedB&&(speedA.style.display==''||speedB.style.display=='')){if((index==1&&speedA.style.display=='none')||(index==2&&speedB.style.display=='none')){OnCmdAudioSpeedChange();}
SetRangePos("speed",10);}}
function WakachigakiChange(event){if(!window.bWbrEnable){return;}
var wakaMode=document.getElementById('button_waka_mode');if(wakaMode!==null&&wakaMode.style.display==''){var scrollPos=null;if(window.cActiveSection!==undefined&&window.cActiveSection!=null){if(window.cActiveSection.className.indexOf("vertical_section")!=-1){scrollPos=(contentArea.scrollLeft+contentArea.clientWidth)/contentArea.scrollWidth;}else{scrollPos=contentArea.scrollTop/contentArea.scrollHeight;}}
var vWakaMode=true;var vWakaModeEx=false;var sWakas=document.getElementsByClassName('infty_silent_wide_space');vWakaMode=IsClassName(document.body,'wakachigaki');vWakaModeEx=IsClassName(document.body,'wakachigaki_level2');if(!window.bWbrExEnable){vWakaMode=!vWakaMode;(vWakaMode ? AppendClassName:RemoveClassName)(document.body,'wakachigaki');SetSettingValue('Wakachigaki',vWakaMode)}else{if(vWakaMode&&vWakaModeEx){vWakaMode=false;vWakaModeEx=false;}else if(!vWakaMode){vWakaMode=true;vWakaModeEx=false;}else if(vWakaMode&&!vWakaModeEx){vWakaMode=true;vWakaModeEx=true;}
(vWakaMode ? AppendClassName:RemoveClassName)(document.body,'wakachigaki');(vWakaModeEx ? AppendClassName:RemoveClassName)(document.body,'wakachigaki_level2');SetSettingValue('Wakachigaki',vWakaMode)
SetSettingValue('WakachigakiLv2',vWakaModeEx)}
if(cssWbrStyle==null){cssWbrStyle=document.createElement("style");cssWbrStyle.id="infty_wbr_effect";cssWbrStyle.type="text/css";document.head.appendChild(cssWbrStyle);}
for(var w=0;w<sWakas.length;w++){sWakas[w].style.display=vWakaMode ? '':'none';}
if(scrollPos!=null){setTimeout(function(scrollPos){if(window.cActiveSection.className.indexOf("vertical_section")!=-1){contentArea.scrollLeft=(contentArea.scrollWidth * scrollPos)-contentArea.clientWidth;}else{contentArea.scrollTop=contentArea.scrollHeight * scrollPos;}},50,scrollPos);}}
CreateBackslashCellLine();contentArea.firstChild.style.display='none';setTimeout(function(){contentArea.firstChild.style.display='';},1);}
function RubyDispModeChange(event){var texts=document.querySelectorAll("span.ruby_text");var rubys=document.getElementsByTagName("ruby");if(event==true&&0<texts.length){return;}
if(texts.length==0){for(var r=0;r<rubys.length;r++){var text=rubys[r].getElementsByTagName("rt");if(text!=null&&0<text.length){var ruby=rubys[r];var parent=ruby.parentElement;var ruby_text=document.createElement("span");ruby_text.className="ruby_text";ruby_text.textContent=text[0].textContent;ruby.style.display='none';parent.insertBefore(ruby_text,ruby);}}}else{for(var r=0;r<texts.length;r++){texts[r].parentElement.removeChild(texts[r]);}
for(r=0;r<rubys.length;r++){rubys[r].style.display='';}}}
function MoveSplitCellItem(source,parentLB){var bResult=false;for(var c=0;bResult==false&&c<source.childNodes.length;c++){var child=source.childNodes[c];if(child.nodeType==3){var sToken=/[＼]/;if(child.textContent.match(sToken)!=null){var texts=child.textContent.split(sToken);if(texts.length==2){parentLB.appendChild(document.createTextNode(texts[0]));child.textContent=texts[1];return true;}}}else if(child.nodeType==1){if(child.nodeName!="svg"&&child.nodeName!="RUBY"&&(bResult=MoveSplitCellItem(child,parentLB))!=false){break;}}else{console.log('Unknown Type '+child.nodeType+' Name='+child.nodeName);}
source.removeChild(child);parentLB.appendChild(child);c--;}return bResult;}
function ReplaceChildText(node,src,dsc){for(var child=node.firstChild;child!=null;child=child.nextSibling){if(child.nodeType==1){ReplaceChildText(child,src,dsc);}else if(child.nodeType==3&&child.textContent.indexOf(src)!=-1){child.textContent=child.textContent.replace(src,dsc);}}}
function BackslashCellInitalize(){var tables=document.querySelectorAll('table.infty');var sTokenG=/[＼]/g;var sToken=/[＼]/;for(var t=0;t<tables.length;t++){var elem;var table=tables[t];var cells=table.querySelectorAll('TD,TH');for(var c=0;c<cells.length;c++){var cell=cells[c];var bs=cell.textContent.match(sToken);if(bs!=null&&bs.length==1){if(cell.querySelector("p > span.read > span.wbrspan")!=null){while((elem=cell.querySelector("span.wbrspan"))!=null){while(elem.firstChild!=null){elem.parentElement.insertBefore(elem.firstChild,elem);}
elem.parentElement.removeChild(elem);}
while((elem=cell.querySelector("p,br"))!=null){while(elem.firstChild!=null){elem.parentElement.insertBefore(elem.firstChild,elem);}
elem.parentElement.removeChild(elem);}}
var field=document.createElement('span');var hide=document.createElement('span');var reads;if(cell.lastChild!=null&&cell.lastChild.nodeType==document.ELEMENT_NODE&&cell.lastChild.tagName=='BR'){cell.removeChild(cell.lastChild);}
while(0<cell.childNodes.length){field.appendChild(cell.childNodes[0]);}
cell.appendChild(field);TrimSpaces(cell);field.className='backslashField';cell.className+=' backslashCell';hide.innerHTML=cell.innerHTML;{var cChilds=hide.querySelectorAll("span,ruby,rt,rb,rp");var nChilds=cChilds.length;for(var hc=0;hc<nChilds;hc++){var cChild=cChilds[hc];if(cChild.parentNode!=null){if(cChild.tagName=='SPAN'||cChild.tagName=='RUBY'||cChild.tagName=='RB'){while(cChild.firstChild!=null){cChild.parentNode.insertBefore(cChild.firstChild,cChild);}}
cChild.parentNode.removeChild(cChild);}}
try{for(var a=0;a<40&&1<hide.childNodes.length&&hide.lastChild.nodeType==document.TEXT_NODE&&hide.lastChild.previousSibling.nodeType==document.TEXT_NODE;a++){hide.lastChild.previousSibling.textContent+=hide.lastChild.textContent;hide.removeChild(hide.lastChild);}}catch(e){}
hide.style.opacity='0';hide.style.letterSpacing='0';hide.style.whiteSpace='nowrap';}
reads=field.querySelectorAll('span.read');if(reads.length==0){var items=cell.querySelectorAll('*');for(var i=0;i<items.length;i++){var item=items[i];for(var c=0;c<item.childNodes.length;c++){var child=item.childNodes[c];if(child.nodeType==3){child.textContent=child.textContent.replace(/＼/," ");}}}}else if(reads.length==1){var read=reads[0];var spanLB=document.createElement('span');var spanRT=document.createElement('span');spanLB.className='labelLB';spanRT.className='labelRT';MoveSplitCellItem(reads[0],spanLB);while(0<read.childNodes.length){var child=read.childNodes[0];read.removeChild(child);spanRT.appendChild(child);}
field.appendChild(hide);read.appendChild(spanLB);read.appendChild(spanRT);}else{var spanLB=document.createElement('span');var spanRT=document.createElement('span');var state=false;spanLB.className='labelLB';spanRT.className='labelRT';while(0<field.childNodes.length){var child=field.childNodes[0];field.removeChild(child);if(child.textContent.search(/[＼,／]/)!=-1){state=true;}
if(spanLB.childNodes.length==0||state==false){spanLB.appendChild(child);}else{spanRT.appendChild(child);}}
field.appendChild(hide);field.appendChild(spanLB);field.appendChild(spanRT);}
if(hide!=null){var hidec=hide.querySelectorAll("*");for(var h=0;h<hidec.length;h++){hidec[h].style.opacity='0';hidec[h].style.letterSpacing='0';hidec[h].style.whiteSpace='nowrap';hidec[h].style.padding='0 0.2em';}}
RemoveBackslash(field);var textLB=spanLB.textContent.replace(/^\s+/g,'');var textRT=spanRT.textContent.replace(/^\s+/g,'');if(textLB.length==0&&textRT.length==0&&spanLB.querySelector("img,svg")==null&&spanRT.querySelector("img,svg")==null){while(spanLB.firstChild!=null){spanLB.parentElement.insertBefore(spanLB.firstChild,spanLB);}
while(spanRT.firstChild!=null){spanRT.parentElement.insertBefore(spanRT.firstChild,spanRT);}
if(spanLB.parentElement!=null){spanLB.parentElement.removeChild(spanLB);}
if(spanRT.parentElement!=null){spanRT.parentElement.removeChild(spanRT);}}}}}}
function TrimSpaces(parent){for(var i=0;parent!=undefined&&i<parent.childNodes.length;i++){var child=parent.childNodes[i];if(child.nodeType==3){child.textContent=child.textContent.replace(/^[ \r\n\t]+|[\r\n\t ]+$/g,'');}else if(child.nodeType==1){TrimSpaces(child);}}}
function RemoveBackslash(parent){for(var i=0;i<parent.childNodes.length;i++){var child=parent.childNodes[i];if(child.nodeType==3){if(child.textContent.search(/[＼,／]/)!=-1){child.textContent=child.textContent.replace(/[＼,／]/,'');if(child.textContent.length==0&&child.nextSibling==null&&parent.className!='infty_silent'){child.textContent=String.fromCharCode(8195);}else{}}}else if(child.nodeType==1){RemoveBackslash(child);}}}
function FieldSetTrace(){if(bIE){var items=document.querySelectorAll("DIV,FIELDSET");for(var i=0;i<items.length;i++){var item=items[i];for(var prev=item.previousElementSibling;prev!=null;prev=prev.previousElementSibling){if(prev.tagName=="P"&&prev.id.substr(0,4)=="pid_"&&prev.style.textAlign=="right"){var div=document.createElement("div");prev.parentElement.replaceChild(div,prev);while(prev.firstChild!=null){div.appendChild(prev.firstChild);}
div.style.cssText=prev.style.cssText;div.id=prev.id;prev=div;}}}}}
function ParagraphIndexRenumber(){var cIdItems=document.querySelectorAll('*[id]');var cParas=Array();for(var idi=0;idi<cIdItems.length;idi++){if(cIdItems[idi].id&&cIdItems[idi].id.substr(0,4)=='pid_'){if(bChattyBooksMode||window._DEBUG){cIdItems[idi].setAttribute('pid_org',cIdItems[idi].id);}
cParas.push(cIdItems[idi]);}}
if(0<cParas.length){for(var idi=0;idi<cParas.length;idi++){var eid=parseInt(cParas[idi].id.substr(5),10);if(idi!=(eid-1)){cParas[idi].id='pid_'+(100001+idi).toString(10).right(5);}}}}
function SetColorsJson(strColors){cColors=JSON.parse(strColors);ColorSettingCSS();SetColorChange();}
function GetColorsJson(){return JSON.stringify(cColors);}
function ColorSettingCSS(){var cColor=cColors[cUserSetting.color];var strStyles='';strStyles+="#contentArea, #sh5content { color:"+cColor.text+";background-color:"+cColor.back+";border-color:"+cColor.text+";}\n";strStyles+="#contentArea p *, #contentArea p, #sh5content p * { line-height:"+(cUserSetting.line/10)+"em}\n";strStyles+="#sh5content *.read, #sh5content *.read * { color:"+cColor.text+";background-color:transparent;border-color:"+cColor.text+";line-height:"+(cUserSetting.line/10)+"em;}\n";if(window.bEdge){strStyles+="#sh5content section:not(.vertical_section) rt { line-height:0.3em !important; }\n";strStyles+="#sh5content section.vertical_section rt { line-height:1.2em !important; }\n";}
strStyles+="#indexArea, #indexArea * { color:"+cColor.text+";background-color:"+cColor.toc+";}\n";strStyles+="#sh5content *.read.sh5_temp, #sh5content *.read.sh5_temp *, .sh5_active, .sh5_active * { color:"+cColor.text+";background-color:rgba(255,255,255,0.01) !important;}\n";strStyles+="#sh5content *.read.sh5_highlight:not(.border_layer), #sh5content *.read.sh5_highlight *:not(.wbrspan), .sh5_active, .sh5_active * { color:"+cColor.text_h+";background-color:"+cColor.back_h+" !important;}\n";strStyles+="#sh5content *.sub_layer.sh5_highlight { background-color:"+cColor.back_h+" !important;}\n";if(0<=document.body.className.indexOf('layer_alpha_color')){strStyles+="#sh5content *.read.sh5_highlight.border_layer { background-color:"+ColorToRgbAlpha(cColor.back_h,0.2)+" !important;border-color:"+ColorToRgbAlpha(cColor.back_h,0.8)+" !important;}\n";strStyles+="span.read.border_layer:hover{ border-color:"+ColorToRgbAlpha(cColor.text_h,0.3)+" !important; background-color:"+ColorToRgbAlpha(cColor.text_h,0.05)+" !important;}";}else{if(bSubLayerOnly){strStyles+="#sh5content *.read.sh5_highlight.border_layer, #sh5content *.read.sh5_highlight.transparent_layer { border-color:transparent !important;}\n";}else{strStyles+="#sh5content *.read.sh5_highlight.border_layer, #sh5content *.read.sh5_highlight.transparent_layer { border-color:"+cColor.back_h+" !important;}\n";}
if(0<=document.body.className.indexOf('border_layer')){strStyles+="span.read.border_layer:hover{ border-color:"+ColorToRgbAlpha(cColor.text_h,0.1)+" !important;}";}}
strStyles+="#sh5content span.layeritem.read.sh5_highlight { color:"+cColor.text_h+";background-color:transparent !important;border-color:"+cColor.back_h+" !important;}\n";strStyles+="span.wbrspan{ background-color:transparent !important;}";if(cColor.ruby&&cColor.ruby_h){strStyles+="#sh5content rt { color:"+cColor.ruby+" !important;}\n";strStyles+="#sh5content *.sh5_highlight rt { color:"+cColor.ruby_h+" !important;}\n";strStyles+="#sh5content svg g.ruby text { fill:"+cColor.ruby+" !important;}\n";strStyles+="#sh5content *.sh5_highlight svg g.ruby text { fill:"+cColor.ruby_h+" !important;}\n";}else{strStyles+="#sh5content rt { color:"+cColor.text+" !important;}\n";strStyles+="#sh5content *.sh5_highlight rt { color:"+cColor.text_h+" !important;}\n";}
if(cColor.border){strStyles+="#sh5content *:not(.border_layer, .transparent_layer) { border-color:"+cColor.border+" !important;}\n";strStyles+="#sh5content table.hissan * { border-color:"+cColor.text+" !important;}\n";strStyles+="#sh5content span.layeritem:not(.sh5_highlight):hover { border-style:dotted !important;border-color:"+cColor.border+" !important;}\n";}
if(cColor.border_h){strStyles+="#sh5content *.sh5_highlight * { border-color:"+cColor.border_h+" !important;}\n";strStyles+="#sh5content table.hissan *.sh5_highlight * { border-color:"+cColor.text_h+" !important;}\n";}
strStyles+="#sh5content span.layeritem { border-color:transparent !important;}\n";if(window.bWbrEnable){strStyles+="#sh5content *.sh5_highlight span.wbrspan:nth-child(n+2) { background-color:transparent !important;}\n";}
if(window.tocTreeEx!==undefined){strStyles+="div.indexListArea.tree_line ul.toc ul.toc li:after,\n";strStyles+="div.indexListArea.tree_line ul.toc ul.toc li:before,\n";strStyles+="div.indexListArea.tree_line ul.toc ul.toc span.tree\n";strStyles+="{\n background-color:"+ColorToRgbAlpha(cColor.text,0.5)+" !important;\n}\n";}
cssColors.textContent=strStyles;}
function AddAreaTrace(){var pAddAreas=contentArea.getElementsByClassName('addarea');var nAddAreas=pAddAreas.length;if(0<nAddAreas){var pAddArea;var pPrev;var pNext;var pid_org;var pReads;for(var a=0;a<nAddAreas;a++){pAddArea=pAddAreas[a];pReads=pAddArea.getElementsByClassName("read");pPrev=pAddArea.previousElementSibling;pNext=pAddArea.nextElementSibling;pAddArea.removeAttribute("prev_pid");pAddArea.removeAttribute("next_pid");if(pPrev){if((pid_org=pPrev.attributes.getNamedItem('pid_org'))){pAddArea.setAttribute("prev_pid",pid_org.value);}else if(pPrev.id){pAddArea.setAttribute("prev_pid",pPrev.id);}else if(pAddArea.parentElement.attributes.getNamedItem('pid_org')){pAddArea.setAttribute("prev_pid",pAddArea.parentElement.attributes.getNamedItem('pid_org').value);}}else if(pNext){if((pid_org=pNext.attributes.getNamedItem('pid_org'))){pAddArea.setAttribute("next_pid",pid_org.value);}else if(pNext.id){pAddArea.setAttribute("next_pid",pNext.id);}else if(pAddArea.parentElement.attributes.getNamedItem('pid_org')){pAddArea.setAttribute("next_pid",pAddArea.parentElement.attributes.getNamedItem('pid_org').value);}}}return true;}return false;}
function ShowMarkerSetting(){var markerFrame=document.getElementById('markerFrame');var panelFrames=document.getElementsByClassName('panelFrame');var markerArea=document.getElementById('markerArea');OnCmdPauseButton();var item=null;if(window.strActiveID!=undefined&&window.strActiveID){item=document.getElementById(strActiveID);if(item!=null){SetElementColor(item,0);strActiveID=null;}}
if(markerArea&&markerArea.childNodes.length==0){var htmlText='<span class="markerCheck" id="markerType1"></span><span class="markerCheck" id="markerType2"></span><br/>';for(var i=0;i<16;i++){if(i==14){continue;}
htmlText+='<span class="markerItem" id="marker'+(i+100).toString().right(2)+'"> </span>';if((i%5)==4||i==15){htmlText+='<br/>';}}
htmlText+='<span class="markerButton" id="markerApply"></span><span class="markerButton" id="markerCancel"></span>';markerArea.innerHTML=htmlText;for(var c=0;c<markerArea.childNodes.length;c++){var item=markerArea.childNodes[c];var caption=item.id ? sControlCaptions[item.id]:null;if(caption){item.textContent=caption.normal;if(caption.description){item.title=caption.description;}}}
document.getElementById('marker'+(markerIndex+100).toString().right(2)).className+=' active';document.getElementById(markerType==0 ? 'markerType1':'markerType2').className+=' active';Sh5AddEventProc(markerArea,"click",OnMarkerClick);Sh5AddEventProc(markerArea,"dblclick",OnMarkerDblClick);}
if(overlapArea.style.display=='none'){overlapArea.style.display='';Sh5RemoveEventProc(document.body,"contextmenu",ClearEvent);for(var f=0;f<panelFrames.length;f++){panelFrames[f].style.display=(panelFrames[f].id==markerFrame.id)? '':'none';}}else{HideOverlapArea();for(var f=0;f<panelFrames.length;f++){panelFrames[f].style.display='none';}}}
function OnMarkerClick(event){if(event.target&&event.target.id){var item=event.target;if(item.className.indexOf('markerItem')!=-1){document.getElementById('marker'+(markerIndex+100).toString().right(2)).className='markerItem';markerIndex=parseInt(item.id.right(2),10);document.getElementById('marker'+(markerIndex+100).toString().right(2)).className+=' active';}else if(item.className.indexOf('markerCheck')!=-1){markerType=parseInt(item.id.right(1),10)-1;document.getElementById(markerType!=0 ? 'markerType1':'markerType2').className='markerCheck';document.getElementById(markerType==0 ? 'markerType1':'markerType2').className='markerCheck active';}else if(item.id=='markerApply'){SetMakerMode();HideOverlapArea();}else if(item.id=='markerCancel'){if(markerMode){var markerPenButton=document.getElementById('button_markerPen');markerMode=false;Sh5AddEventProc(document.body,'selectstart',ClearEvent);Sh5AddEventProc(document.body,"contextmenu",ClearEvent);content.className=content.className.replace(' markingMode','');if(markerPenButton){markerPenButton.className=markerPenButton.className.replace(' btnActive','');}
content.addEventListener('click',OnContentClick,true);content.removeEventListener('mousedown',MakerEditMouseDown,true);content.removeEventListener('mousemove',MakerEditMouseMove,true);content.removeEventListener('mouseout',MakerEditMouseOut,true);content.removeEventListener('mouseup',MakerEditMouseUp,true);var selection=window.getSelection();selection.collapse(document.body,0);}
HideOverlapArea();}}}
function OnMarkerDblClick(event){if(event.target&&event.target.id){var item=event.target;if(item.className.indexOf('markerItem')!=-1||item.className.indexOf('markerCheck')!=-1){SetMakerMode();HideOverlapArea();}}}
function SetMakerMode(){markerMode=true;var markerPenButton=document.getElementById('button_markerPen');content.className+=' markingMode';if(markerPenButton){markerPenButton.className+=' btnActive';}
Sh5RemoveEventProc(document.body,'selectstart',ClearEvent);Sh5RemoveEventProc(document.body,"contextmenu",ClearEvent);content.removeEventListener('click',OnContentClick,true);content.addEventListener('mousedown',MakerEditMouseDown,true);content.addEventListener('mousemove',MakerEditMouseMove,true);content.addEventListener('mouseout',MakerEditMouseOut,true);content.addEventListener('mouseup',MakerEditMouseUp,true);}
function MakerEditMouseDown(event){}
function MakerEditMouseMove(event){}
function MakerEditMouseOut(event){ClearEvent(event);}
function MakerEditMouseUp(event){var selection=window.getSelection();if(0<selection.rangeCount){MarkerApplyRange();if(window.external&&typeof(window.external.OnMarking)!=='undefined'){window.external.OnMarking(markerIndex,markerType);}
markerModifyed=true;}
selection.collapse(document.body,0);ClearEvent(event);}
function MarkerApplyRange(){var selection=getSelection();if(selection.rangeCount>0){var range=selection.getRangeAt(0);var currentNode=document.body;var currentRange=document.createRange();if(range.startContainer.nodeType==Node.TEXT_NODE){range.startContainer.splitText(range.startOffset);range.setStartAfter(range.startContainer);}
if(range.endContainer.nodeType==Node.TEXT_NODE){range.endContainer.splitText(range.endOffset);range.setEndAfter(range.endContainer);}
while(currentNode){currentRange.selectNode(currentNode);if(currentRange.compareBoundaryPoints(Range.END_TO_START,range)>=0){break;}
if(currentRange.compareBoundaryPoints(Range.START_TO_END,range)<=0){MoveNextSibling();continue;}
if(currentRange.compareBoundaryPoints(Range.START_TO_START,range)>=0&&0>=currentRange.compareBoundaryPoints(Range.END_TO_END,range)){SetMaker(currentNode,1);MoveNextSibling();continue;}
if(currentNode.firstChild){currentNode=currentNode.firstChild;}else{MoveNextSibling();}}
MakerInitizlise();function SetMaker(node,nMakerIndex){if(node.nodeType==Node.ELEMENT_NODE&&(node.nodeName=='RT'||node.nodeName=='RB')){SetMaker(node.parentNode,nMakerIndex);}else if(node.nodeType==Node.TEXT_NODE){if(node.parentNode.nodeType==Node.ELEMENT_NODE&&node.parentNode.nodeName=='RUBY'){var childs=node.parentNode.querySelectorAll("rt");for(var c=0;c<childs.length;c++){SetMaker(childs[c],nMakerIndex);}return;}
var range=document.createRange();range.selectNode(node);node=document.createElement("span");node.className="marker";range.surroundContents(node);}else if(node.nodeType==Node.ELEMENT_NODE&&node.nodeName=='P'){var childs=node.querySelectorAll("span");for(var c=0;c<childs.length;c++){SetMaker(childs[c],nMakerIndex);}return;}
if(node.parentElement.tagName!="RT"&&node.nodeName!="RT"){node.setAttribute("marker",(markerIndex+100).toString().right(2));node.setAttribute("marker_type",markerType);var childs=node.querySelectorAll("*[marker]");for(var c=0;c<childs.length;c++){childs[c].setAttribute("marker",(markerIndex+100).toString().right(2));childs[c].setAttribute("marker_type",markerType);}}}
function MoveNextSibling(){do{if(currentNode.nextSibling){currentNode=currentNode.nextSibling;return;}}while(currentNode=currentNode.parentNode);}}}
function MakerInitizlise(){for(var i=0;i<16;i++){var markers=document.querySelectorAll("*[marker='"+(100+i).toString().right(2)+"']");if(0<markers.length){var strColor='';switch(i){case 0:strColor="rgba(255,255,  0,0.7)";break;case 1:strColor="rgba(  0,255,  0,0.7)";break;case 2:strColor="rgba(  0,255,255,0.7)";break;case 3:strColor="rgba(255,  0,255,0.7)";break;case 4:strColor="rgba(  0,  0,255,0.7)";break;case 5:strColor="rgba(255,  0,  0,0.7)";break;case 6:strColor="rgba(  0,  0,128,0.7)";break;case 7:strColor="rgba(  0,128,128,0.7)";break;case 8:strColor="rgba(  0,128,  0,0.7)";break;case 9:strColor="rgba(128,  0,128,0.7)";break;case 10:strColor="rgba(128,  0,  0,0.7)";break;case 11:strColor="rgba(128,128,  0,0.7)";break;case 12:strColor="rgba(128,128,128,0.7)";break;case 13:strColor="rgba(192,192,192,0.7)";break;case 14:strColor="rgba(  0,  0,  0,0.7)";break;default:strColor='';break;}
for(var m=0;m<markers.length;m++){var item=markers[m];var type=item.getAttribute("marker_type");if(i<15&&type=="0"){item.style.backgroundColor=strColor;item.style.borderBottom='';item.style.borderRight='';}else if(i<15&&type=="1"){item.style.backgroundColor='';item.style.borderBottom=bVerticalMode ? '':('solid 2px '+strColor);item.style.borderRight=bVerticalMode ?('solid 2px '+strColor):'';}else{item.style.backgroundColor='';item.style.borderBottom='';item.style.borderRight='';if(item.className=="marker"){var cPrev=item.previousSibling;var cNext=item.nextSibling;if(cPrev&&cPrev.nodeType==Node.TEXT_NODE){cPrev.textContent+=item.textContent;item.parentElement.removeChild(item);}else if(cNext&&cNext.nodeType==Node.TEXT_NODE){cNext.textContent=item.textContent+cNext.textContent;item.parentElement.removeChild(item);}else if(!cPrev&&!cNext){item.parentElement.textContent=item.textContent;}}}}}}
var markers=document.querySelectorAll("*[marker]");for(var m=0;m<markers.length;m++){var marker=markers[m];var submarkers=marker.querySelectorAll("*[marker='"+marker.getAttribute('marker')+"']");for(var s=0;s<submarkers.length;s++){var submarker=submarkers[s];submarker.removeAttribute("marker");submarker.removeAttribute("marker_type");submarker.style.backgroundColor='';submarker.style.borderBottom='';submarker.style.borderRight='';}}
var markers=document.querySelectorAll("*[marker='15']");for(var m=0;m<markers.length;m++){var marker=markers[m];var submarkers=marker.querySelectorAll("*[marker]");for(var s=0;s<submarkers.length;s++){var submarker=submarkers[s];submarker.removeAttribute("marker");submarker.removeAttribute("marker_type");submarker.style.backgroundColor='';submarker.style.borderBottom='';submarker.style.borderRight='';}
marker.removeAttribute("marker");marker.removeAttribute("marker_type");marker.style.backgroundColor='';marker.style.borderBottom='';marker.style.borderRight='';}}
var cAddAreas;var cMarkers;function GetAddAreaCount(){cAddAreas=document.getElementsByClassName("addarea");return cAddAreas.length;}
function GetAddAreaItem(nIndex){if(cAddAreas&&cAddAreas.length&&0<=nIndex&&nIndex<cAddAreas.length){return cAddAreas[nIndex];}return null;}
function GetMarkerCount(){cMarkers=document.querySelectorAll("*[marker]");return cMarkers.length;}
function GetMarkerItem(nIndex){if(cMarkers&&cMarkers.length&&0<=nIndex&&nIndex<cMarkers.length){return cMarkers[nIndex];}return null;}
function GetCurrentFont(){var item=document.querySelector('.read');if(item==null){item=document.getElementById('sh5content');}
if(item&&item.currentStyle){return item.currentStyle.fontFamily;}return null;}
function FontChange(varFontFace,bMathSvgSize){if(window.cssSvgMath!=null&&bMathSvgSize!=undefined&&bMathSvgSize!=null){window.cssSvgMath.style.fontSize=bMathSvgSize ? '90%':'115%';}
if(varFontFace!=undefined&&varFontFace!=null){var fontName=varFontFace;if(fontName.indexOf(' ')!=-1){fontName="'"+fontName+"'";}
document.getElementById('sh5content').style.fontFamily=indexArea.style.fontFamily=fontName;var sections=document.querySelectorAll("section.html_page");for(var s=0;s<sections.length;s++){sections[s].style.fontFamily=indexArea.style.fontFamily=fontName;}}else{document.getElementById('sh5content').style.fontFamily=indexArea.style.fontFamily='';var sections=document.querySelectorAll("section.html_page");for(var s=0;s<sections.length;s++){sections[s].style.fontFamily=indexArea.style.fontFamily='';}}
if(window._DEBUG&&window.cssSvgMath!=null&&bMathSvgSize!=undefined&&bMathSvgSize!=null){dump_event("cssSvgMath="+window.cssSvgMath.style.fontSize,"#A0A");}return true;}
function MathSvgSizeChange(bMathSvgSize){if(window.cssSvgMath!=null&&bMathSvgSize!=undefined&&bMathSvgSize!=null){window.cssSvgMath.style.fontSize=bMathSvgSize ? '90%':'115%';}}
function GetResumePosition(){if(bResumeSupport&&bResumeMode){var contentID=GetUUID();if(contentID==null||contentID.length==0){contentID=document.title;}
if(saudio!=null&&saudio.cActiveItem!=null&&saudio.cActiveItem.element){return contentID+"\t"+saudio.cActiveItem.element.id;}else{return contentID;}}return null;}
function SetActiveItem(strSmilID){var item=document.getElementById(strSmilID);if(item!=null){saudio.SetActiveItem(item);return true;}else{return false;}}
function GetPlayIntervalTimer(){return window.nPlayIntervalTimer;}
function AutomaticTest(bStatus){if(bStatus!=undefined&&bStatus==false){if(window.nAutomaticTest!==undefined){clearInterval(window.nAutomaticTest);window.nAutomaticTest=undefined;}return;}
var iPos=1;var items=[];for(var name in cAudioItems){var sid=parseInt(name.substr(1,3));var rid=parseInt(name.substr(5,5));items[sid]=rid;}
window.nAutomaticTest=setInterval(function(items){var sid=iPos;var rid=parseInt(items[sid]/2);var id="s"+String(1000+sid).substr(1,3)+"_"+String(100000+rid).substr(1,5);var item=document.getElementById(id);saudio.SetActiveItem(item);iPos++;if(items.length<=iPos){iPos=1;}},1000,items,iPos);return window.nAutomaticTest;}
function SetAddAreaBorderColor(id,color){var item=document.getElementById(id);if(item!=null){item.style.borderColor=color;item.style.borderLeftColor=color;item.style.borderTopColor=color;item.style.borderRightColor=color;item.style.borderBottomColor=color;return true;}else{return false;}}
function TableCellEffectInitalize(){var cTables=document.querySelectorAll('#sh5content table:not(.infty_itemize_list):not(.matharray):not(.hissan):not(.eqnarray)');var nTables=cTables.length;for(var t=0;t<nTables;t++){var cTable=cTables[t]
var cTableStyle=(window.getComputedStyle!=undefined)? window.getComputedStyle(cTable):null;var cTableRows=cTable.querySelectorAll('tr');var nTableRows=cTableRows.length;var nTableCols=0;var grid=[];var cFirstCell=cTable.querySelector("td,th");if(cFirstCell!=null){var cFirstCellStyle=(window.getComputedStyle!=undefined)? window.getComputedStyle(cFirstCell):null;var borderStyle=cFirstCellStyle.borderTopStyle.replace('none','')+
cFirstCellStyle.borderBottomStyle.replace('none','')+
cFirstCellStyle.borderLeftStyle.replace('none','')+
cFirstCellStyle.borderRightStyle.replace('none','');if(borderStyle==''){continue;}}
if(cTable.querySelector("table")!=null){continue;}
cTable.tableId=t;for(var r=0;r<nTableRows;r++){var cTableRow=cTableRows[r];var cCells=cTableRow.querySelectorAll('th,td');var nCells=cCells.length;for(var c=0;c<nCells;c++){var cCell=cCells[c];var cReads=cCell.querySelectorAll("*.read");var nRowSpan=cCell.rowSpan;var nColSpan=cCell.colSpan;var nColPos=c;var nRowPos=r;nTableCols=Math.max(c+1,nTableCols);cCell.parentTable=cTable;for(var read=0;read<cReads.length;read++){cReads[read].parentCell=cCell;}{cCell.onmouseover=TableCellEffectMouseOver;cCell.onmouseleave=TableCellEffectMouseLeave;}
cCell.gridRows=[];cCell.gridCols=[];if(grid[r]==undefined){grid[r]=[];}
for(var r2=0,r3=nRowPos;r2<nRowSpan;r2++,r3++){cCell.gridRows.push(r3);for(var c2=0,c3=nColPos;c2<nColSpan;c2++,c3++){if(grid[r3]==undefined){grid[r3]=[];}
while(r2==0&&c2==0&&grid[r3][c3]!=undefined){nColPos++;c3++;}
if(r2==0){cCell.gridCols.push(c3);}
grid[r3][c3]=cCell;}}
var strClass=cCell.className;for(var mc=0;mc<cCell.gridCols.length;mc++){strClass+=" sh5table_"+t+"_c"+cCell.gridCols[mc];}
for(var mr=0;mr<cCell.gridRows.length;mr++){strClass+=" sh5table_"+t+"_r"+cCell.gridRows[mr];}
if(cCell.gridRows.length==0||cCell.gridCols.length==0){window.console.log("Table Grid Matrix Create Error");}
cCell.className=strClass.trim();cCell.gridRows=undefined;cCell.gridCols=undefined;}}
cTable.cellMatrix=grid;for(var r=0;r<nTableRows;r++){for(var c=0;grid[r]!=undefined&&c<nTableCols&&c<grid[r].length;c++){var cCell=grid[r][c];if(cCell.rowPos==undefined){cCell.rowPos=r;}
if(cCell.colPos==undefined){cCell.colPos=c;}
if(cCell.cellPos==undefined){cCell.cellPos="col="+c+":row="+r;}}}
var cellMatrixHorz=[];var cellMatrixVert=[];for(var r=0,n=0;r<nTableRows;r++){for(var c=0;grid[r]&&c<grid[r].length;c++,n++){cellMatrixHorz[n]=grid[r][c];cellMatrixVert[n]=grid[r][c];}}
cellMatrixHorz.sort(function(cell1,cell2){if(cell1.rowPos==cell2.rowPos){return(cell1.colPos-cell2.colPos)}else{return cell1.rowPos-cell2.rowPos;}});cellMatrixVert.sort(function(cell1,cell2){if(cell1.colPos==cell2.colPos){return(cell1.rowPos-cell2.rowPos)}else{return cell1.colPos-cell2.colPos;}});for(var h=cellMatrixHorz.length-1;h>0;h--){var h0=cellMatrixHorz[h-1];var h1=cellMatrixHorz[h];if(h0.colPos==h1.colPos&&h0.rowPos==h1.rowPos){cellMatrixHorz.splice(h,1);}}
for(var v=cellMatrixVert.length-1;v>0;v--){var h0=cellMatrixVert[v-1];var h1=cellMatrixVert[v];if(h0.colPos==h1.colPos&&h0.rowPos==h1.rowPos){cellMatrixVert.splice(v,1);}}
for(var h=0;h<cellMatrixHorz.length-1;h++){cellMatrixHorz[h+1].prevHorzCell=cellMatrixHorz[h];cellMatrixHorz[h].nextHorzCell=cellMatrixHorz[h+1];}
for(var v=0;v<cellMatrixVert.length-1;v++){cellMatrixVert[v+1].prevVertCell=cellMatrixVert[v];cellMatrixVert[v].nextVertCell=cellMatrixVert[v+1];}
var cCells=cTable.querySelectorAll('td');var nCells=cCells.length;for(var c=0;c<nCells;c++){var cCell=cCells[c];var cRead=cCell.querySelector("*.read");var cSmil=cRead ? cRead.cSmilItem:null;if(cSmil!=null){var cThCols=cTable.querySelectorAll("th.sh5table_"+cTable.tableId+"_c"+cCell.colPos);var cThRows=cTable.querySelectorAll("th.sh5table_"+cTable.tableId+"_r"+cCell.rowPos);var nThCols=cThCols.length;var nThRows=cThRows.length;cCell.cSmilItem=cSmil;if(0<nThCols||0<nThRows){cSmil.cSubSmils=[];var nn=0;for(var th=0;th<nThCols;th++){var cTh=cThCols[th];var cReads=cTh.querySelectorAll("*.read");var nReads=cReads.length;for(var r=0;r<nReads;r++){if(cReads[r].cSmilItem){cSmil.cSubSmils[nn++]=cReads[r].cSmilItem;}}}
for(var th=0;th<nThRows;th++){var cTh=cThRows[th];var cReads=cTh.querySelectorAll("*.read");var nReads=cReads.length;for(var r=0;r<nReads;r++){if(cReads[r].cSmilItem){cSmil.cSubSmils[nn++]=cReads[r].cSmilItem;}}}
cSmil.cSubSmils[cSmil.cSubSmils.length]=cSmil;var str='';for(nn=0;nn<cSmil.cSubSmils.length;nn++){str+=cSmil.cSubSmils[nn].element.innerText+"\nn";}
nn=0;}}}
cTable=undefined;}}
function SetActiveCellEffect(item){if(cssCellStyle==null){cssCellStyle=document.createElement("style");cssCellStyle.id="infty_cell_effect";cssCellStyle.type="text/css";{document.head.appendChild(cssCellStyle);}}
if(item!=undefined&&item!=null){var cColor=cColors[cUserSetting.color];if(cColor.th_a==undefined||cColor.td_a==undefined){return;}
while(item!=null&&item.tagName!='TH'&&item.tagName!='TD'){item=item.parentElement;}
if(item==null){return;}
var cClasses=item.className.split(' ');var strNewThClass='';var strNewTdClass='';var strCssText='';for(var c=0;c<cClasses.length;c++){if(cClasses[c].match(/^sh5table_/)){strNewThClass+=", th."+cClasses[c];strNewTdClass+=", td."+cClasses[c];}}
strNewThClass=strNewThClass.replace(/^[\s|,]+/g,'');strNewTdClass=strNewTdClass.replace(/^[\s|,]+/g,'');if(0<strNewThClass.length&&0<strNewTdClass.length){strCssText+="#sh5content *.sh5table_"+item.parentTable.tableId+"_r"+item.rowPos+".sh5table_"+item.parentTable.tableId+"_c"+item.colPos+"\n";strCssText+="{ box-shadow:1px 1px 1px "+cColor.tb_a+" inset, -1px -1px 1px "+cColor.tb_a+" inset;}\n";strCssText+=strNewThClass+"{ background-color:"+ColorToRgbAlpha(cColor.th_a,0.25)+" !important;box-shadow:1px 1px 1px "+cColor.th_a+" inset,-1px -1px 1px "+cColor.th_a+" inset;}";strCssText+=strNewTdClass+"{ background-color:"+ColorToRgbAlpha(cColor.td_a,0.25)+" !important;box-shadow:1px 1px 1px "+cColor.td_a+" inset,-1px -1px 1px "+cColor.td_a+" inset;}";cssCellStyle.textContent=strCssText;}}else if(cssCellStyle!=null){cssCellStyle.textContent='';}}
function SetReadCellEffect(elem,subelem){if(elem!=undefined&&elem!=null&&elem.parentCell){if(cssCellStyle==null){cssCellStyle=document.createElement("style");cssCellStyle.id="infty_cell_effect";cssCellStyle.type="text/css";document.head.appendChild(cssCellStyle);}
var cColor=cColors[cUserSetting.color];var cCell=elem.parentCell;var cTable=cCell.parentTable;var strCssText='';strCssText+="#sh5content *.sh5table_"+cTable.tableId+"_r"+cCell.rowPos+".sh5table_"+cTable.tableId+"_c"+cCell.colPos+"\n";strCssText+="{ box-shadow:1px 1px 1px "+cColor.tb_a+" inset, -1px -1px 1px "+cColor.tb_a+" inset;}\n";if(subelem&&subelem.parentCell){cCell=subelem.parentCell;cTable=cCell.parentTable;strCssText+="#sh5content *.sh5table_"+cTable.tableId+"_r"+cCell.rowPos+".sh5table_"+cTable.tableId+"_c"+cCell.colPos+"\n";strCssText+="{ background-color:"+ColorToRgbAlpha(cColor.back_h,0.15)+" !important;}\n";}
cssCellStyle.textContent=strCssText;}else if(cssCellStyle!=null){cssCellStyle.textContent='';}}
var lastCellClick=0;function TableCellClick(event){var now=new Date().getTime();window.bCellClick=true;if(window.nCellClickTimerId){clearTimeout(window.nCellClickTimerId);}
var item=event.target;SetActiveCellEffect(event.target);if(item&&(item.className.indexOf('read')!=-1||(item=item.querySelector('*.read'))!=null)){if((now-window.lastCellClick)<350){window.bControlKey=true;}
window.nCellClickTimerId=setTimeout(function(item){saudio.SetActiveItem(item);},500,item);}
window.lastCellClick=now;ClearEvent();}
function TableCellEffectMouseOver(event){SetActiveCellEffect(event.target);}
function TableCellEffectMouseLeave(event){SetActiveCellEffect();}
function ColorToRgbAlpha(color,alpha){if(color.match(/^#/)){var hexCode=color.replace(/^#/,'');if(hexCode.length==3){hexCode=hexCode.substr(0,1)+hexCode.substr(0,1)+hexCode.substr(1,1)+hexCode.substr(1,1)+hexCode.substr(2,1)+hexCode.substr(2,1);}
if(hexCode.length==6){var r=parseInt(hexCode.substr(0,2),16);var g=parseInt(hexCode.substr(2,2),16);var b=parseInt(hexCode.substr(4,2),16);return 'rgba('+r+','+g+','+b+','+alpha+')';}}else if(color.match(/^RGB/i)){var rgb=color.replace(/^rgb/i,'');rgb=rgb.replace(/[\(|\)]/g,'');rgb=rgb.split(',');var r=parseInt(rgb[0],16);var g=parseInt(rgb[1],16);var b=parseInt(rgb[2],16);return 'rgba('+r+','+g+','+b+','+alpha+')';}return color;}
function IsEqualTable(item1,item2){var c1=item1 ? item1.parentCell:null;var c2=item2 ? item2.parentCell:null;if(c1&&c2){if(c1.parentTable&&c2.parentTable){if(c1.parentTable.tableId==c2.parentTable.tableId){return true;}}}return false;}
function IsEqualCell(item1,item2){if(item1.nodeType===undefined&&item1.element){item1=item1.element;}
if(item2.nodeType===undefined&&item2.element){item2=item2.element;}
var c1=item1 ? item1.parentCell:null;var c2=item2 ? item2.parentCell:null;if(c1&&c2){if(c1.parentTable&&c2.parentTable){if(c1.parentTable.tableId==c2.parentTable.tableId){if(c1.rowPos==c2.rowPos){if(c1.colPos==c2.colPos){return true;}}}}}return false;}
function IsDisableEdit(){if(bHideOverlapAreaTimer){return true;}else if(saudio&&saudio.cActiveItem&&saudio.cActiveItem.element&&saudio.cActiveItem.element.parentCell){return true;}return false;}
function IsNextLayerGtoupItem(item){if(item){if(item.element){var firstChild=item.element.firstElementChild;if(firstChild){if(firstChild.className){var className=firstChild.className;try{var t=typeof className;if(firstChild.tagName=='svg'&&className.baseVal){className=className.baseVal;}
if(className.indexOf("layer_group_item")!=-1){return true;}}catch(e){console.log(e);}}}}}return false;}
function ClearStorage(){if(typeof window.localStorage!=='undefined'){if(window.confirm("Do you want to reset all settings?")){for(var name in window.localStorage){if(name.substr(0,16)=='SH5_SettingValue'){window.localStorage.removeItem(name);}}}}}
function SetVerticalSectionMode(){if(window.cActiveSection){var btnPrev=document.getElementById('button_prev');var btnNext=document.getElementById('button_next');if(window.bSwapArrowKeysInVerticalSection===true&&IsClassName(window.cActiveSection,'vertical_section')){if(!IsClassName(controlArea,'vertical_mode')){AppendClassName(controlArea,'vertical_mode');btnPrev.title=btnPrev.title.replace(/前/g,'次');btnNext.title=btnNext.title.replace(/次/g,'前');}}else{RemoveClassName(controlArea,'vertical_mode');btnPrev.title=btnPrev.title.replace(/次/g,'前');btnNext.title=btnNext.title.replace(/前/g,'次');}}}
function CreateWaitingArea(){if(window.waitingArea!=null){return;}
window.waitingArea=document.createElement('div');window.waitingArea.id='waitingArea';window.waitingArea.innerHTML='<svg id="waiting_circle" viewBox="0 0 256 256" height="256px" width="256px"><g><path class="wcpt wc01" d="m 132,0.0625 v 32.021484 a 96,96 0 0 1 29.00977,5.771485 L 173.26367,8.2714844 A 128,128 0 0 0 132,0.0625 Z" /><path class="wcpt wc02" d="m 180.6543,11.332031 -12.25391,29.583985 a 96,96 0 0 1 24.59375,16.433593 l 22.64258,-22.642578 a 128,128 0 0 0 -34.98242,-23.375 z" /><path class="wcpt wc03" d="m 221.29297,40.363281 -22.64258,22.642578 a 96,96 0 0 1 16.43359,24.59375 l 29.58399,-12.253906 a 128,128 0 0 0 -23.375,-34.982422 z" /><path class="wcpt wc04" d="M 247.72852,82.736328 218.14648,94.990234 A 96,96 0 0 1 223.91602,124 h 32.02148 a 128,128 0 0 0 -8.20898,-41.263672 z" /><path class="wcpt wc05" d="m 223.91602,132 a 96,96 0 0 1 -5.77149,29.00977 l 29.58399,12.2539 A 128,128 0 0 0 255.9375,132 Z" /><path class="wcpt wc06" d="m 215.08398,168.40039 a 96,96 0 0 1 -16.43359,24.59375 l 22.64258,22.64258 a 128,128 0 0 0 23.375,-34.98242 z" /><path class="wcpt wc07" d="m 192.99414,198.65039 a 96,96 0 0 1 -24.59375,16.43359 l 12.25391,29.58399 a 128,128 0 0 0 34.98242,-23.375 z" /><path class="wcpt wc08" d="M 161.00977,218.14653 A 96,96 0 0 1 132,223.91602 v 32.02148 a 128,128 0 0 0 41.26367,-8.20898 z" /><path class="wcpt wc01" d="M 94.990234,218.14453 82.736328,247.72852 A 128,128 0 0 0 124,255.9375 v -32.02148 a 96,96 0 0 1 -29.009766,-5.77149 z" /><path class="wcpt wc02" d="m 63.005859,198.65039 -22.642578,22.64258 a 128,128 0 0 0 34.982422,23.375 l 12.253906,-29.58399 a 96,96 0 0 1 -24.59375,-16.43359 z" /><path class="wcpt wc03" d="M 40.916016,168.40039 11.332031,180.6543 a 128,128 0 0 0 23.375,34.98242 L 57.349609,192.99414 A 96,96 0 0 1 40.916016,168.40039 Z" /><path class="wcpt wc04" d="m 0.0625,132 a 128,128 0 0 0 8.2089844,41.26367 L 37.853516,161.00977 A 96,96 0 0 1 32.083984,132 Z" /><path class="wcpt wc05" d="M 8.2714844,82.736328 A 128,128 0 0 0 0.0625,124 h 32.021484 a 96,96 0 0 1 5.771485,-29.009766 z" /><path class="wcpt wc06" d="m 34.707031,40.363281 a 128,128 0 0 0 -23.375,34.982422 l 29.583985,12.253906 a 96,96 0 0 1 16.433593,-24.59375 z" /><path class="wcpt wc07" d="m 75.345703,11.332031 a 128,128 0 0 0 -34.982422,23.375 l 22.642578,22.642578 a 96,96 0 0 1 24.59375,-16.433593 z" /><path class="wcpt wc08" d="M 124,0.0625 A 128,128 0 0 0 82.736328,8.2714844 L 94.990234,37.853516 A 96,96 0 0 1 124,32.083984 Z" /></g></svg><div id="loading_rate"> </div>';window.waitingRate=window.waitingArea.querySelector('#loading_rate');document.body.appendChild(window.waitingArea);}
function AppendElememnt(parent,tagName,attributes,text){var elem=document.createElement(tagName);if(attributes){var s=null;for(var c=0;c<attributes.length;c++){if(s==null&&(attributes[c].match(/[\"\']/))){s=attributes[c];}else if(s==attributes[c]){s=null;}else if(s==null&&(attributes[c].match(/[\ ,;,\,]/))){attributes=attributes.substr(0,c)+"\n"+attributes.substr(c+1);}else if(s==null&&(attributes[c].match(/[=]/))){attributes=attributes.substr(0,c)+"\t"+attributes.substr(c+1);}};attributes=attributes.split("\n");for(var a=0;a<attributes.length;a++){var attr=attributes[a];var data=attr.split("\t");if(data.length==1){continue;}
var name=data[0];var valu=data[1].replace(/^[\"']|[\"']$/g,"");if(name=='class'){name='className';}else if(name=='for'){name='htmlFor';}else if(name=='tabindex'){name='tabIndex';}
elem[name]=valu;}
if(text&&text.indexOf('&')!=-1){elem.innerHTML=text;}else if(text){elem.textContent=text;}}
if(parent!=null){parent.appendChild(elem);}else{return;}return elem;}
function IsClassName(elem,name){if(elem.className&&0<elem.className.length){var classNames=elem.className.split(' ');for(var c=0;c<classNames.length;c++){if(classNames[c]==name){return true;}}}return false;}
function AppendClassName(elem,name){if(elem&&elem.className&&0<elem.className.length){var classNames=elem.className.split(' ');var newClassName='';for(var c=0;c<classNames.length;c++){if(classNames[c]==name){return true;}
newClassName+=classNames[c]+' ';}
elem.className=(newClassName+name).trim();return true;}else if(elem&&elem.className.length==0){elem.className=name;return true;}return false;}
function RemoveClassName(elem,name){if(elem&&elem.className&&0<elem.className.length){var classNames=elem.className.split(' ');var newClassName='';for(var c=0;c<classNames.length;c++){if(classNames[c]==name){continue;}
newClassName+=classNames[c]+' ';}
elem.className=newClassName.trim();return true;}return false;}
function ShowVisibleItem(item){var rc=item.getBoundingClientRect();if(rc.left==0&&rc.top==0&&rc.width==0&&rc.height==0){for(var parent=item.parentElement;parent&&parent.tagName!='SECTION';parent=parent.parentElement){rc=parent.getBoundingClientRect();if((rc.left!=0||rc.top!=0)){parent.scrollIntoView({behavior:'auto',block:'center',inline:'center'});return true;}}
if(item.cSmilItem&&item.cSmilItem.prevItem){for(var prev=item.cSmilItem.prevItem.element;prev;prev=(prev.cSmilItem&&prev.cSmilItem.prevItem)? prev.cSmilItem.prevItem.element:null){rc=prev.getBoundingClientRect();if((rc.left!=0||rc.top!=0)){prev.scrollIntoView({behavior:'auto',block:'center',inline:'center'});return true;}}}
if(item.cSmilItem&&item.cSmilItem.nextItem){for(var next=item.cSmilItem.nextItem.element;next;next=(next.cSmilItem&&next.cSmilItem.nextItem)? next.cSmilItem.nextItem.element:null){rc=next.getBoundingClientRect();if((rc.left!=0||rc.top!=0)){next.scrollIntoView({behavior:'auto',block:'center',inline:'center'});return true;}}}}return false;}