/*
  Copyright : tategakibunko
  site : http://tategakibunko.mydns.jp
  blog : http://tategakibunko.blog83.fc2.com

  Software license is now under consideration,

  so DO NOT redistribute this file please.
*/


var Environment={isSafari:(navigator.appVersion.indexOf("KHTML")>-1&&navigator.appVersion.indexOf("Chrome")==-1),isIE:(document.all&&window.ActiveXObject&&navigator.userAgent.toLowerCase().indexOf("msie")>-1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1),getVersionIE:function(){if(this.isIE){if(navigator.userAgent.toLowerCase().match("msie (...)")){return parseFloat(RegExp.$1)}}return -1},isIPhone:(navigator.userAgent.toLowerCase().match("iphone"))};var Filename={concat:function(b,a){b=(b=="")?"":(b.slice(-1)=="/")?b:b+"/";a=(a=="")?"":(a[0]=="/")?a.substring(1,a.length):a;return b+a}};var ImageSizeDb={db:[],getTrueImageSize:function(f){var e,d,a,c,b="actual";if("naturalWidth" in f){return{width:f.naturalWidth,height:f.naturalHeight}}if("src" in f){if(f[b]&&f[b].src===f.src){return f[b]}if(document.uniqueID){e=f.runtimeStyle;d={w:e.width,h:e.height};e.width="auto";e.height="auto";a=f.width;c=f.height;e.width=d.w;e.height=d.h}else{d={w:f.width,h:f.height};f.removeAttribute("width");f.removeAttribute("height");a=f.width;c=f.height;f.width=d.w;f.height=d.h}return f[b]={width:a,height:c,src:f.src}}return{width:f.width,height:f.height}},getImageSizeFromSrc:function(c){var b=300;var d=200;if(typeof this.db[c]!="undefined"){var a=this.db[c];if(a.width==0||a.height==0){return{width:b,height:d}}else{return this.db[c]}}else{for(p in this.db){if(p.match(c)||c.match(p)){return this.getImageSizeFromSrc(p)}}}return{width:b,height:d}},parseNode:function(b){var c=b.getElementsByTagName("img");for(var a=0;a<c.length;a++){if(typeof this.db[c[a].str]=="undefined"){this.db[c[a].src]=this.getTrueImageSize(c[a])}}},parseDocument:function(){this.db=[];var b=document.getElementsByTagName("img");for(var a=0;a<b.length;a++){if(typeof this.db[b[a].str]=="undefined"){this.db[b[a].src]=this.getTrueImageSize(b[a])}}}};function WashiLayout(a){var d=16;var b={width:700,height:480,fontSize:d,lineHeightRate:1.8,letterSpacingRate:0.14,direction:"vertical",layerGroupId:"text-layer",charImgRoot:"/img/char-black",charImgMap:[],isWhiteFont:false,kinsokuCharCount:2};for(var c in b){this[c]=(typeof a[c]=="undefined")?b[c]:a[c]}if(typeof a.fontFamily!="undefined"){this.fontFamily=a.fontFamily}this.initialize()}WashiLayout.prototype.initialize=function(){var c=(this.direction=="vertical");this.baseLineHeight=this.lineHeightRate*this.fontSize;this.baseLetterSpacing=this.letterSpacingRate*this.fontSize;var a=this.baseLineHeight;var b=this.fontSize+this.baseLetterSpacing;this.width=Math.max(a,this.width);this.height=Math.max(b,this.height);this.yohakuHeight=(c)?this.baseLineHeight-this.fontSize:0;this.letterHeight=(c)?this.fontSize+this.baseLetterSpacing:1;this.wrapTag=(c)?"table":"div";this.rubyFontSize=this.fontSize/2;if(c){this.lineCount=Math.floor(this.height/this.letterHeight)-this.kinsokuCharCount}else{this.lineCount=Math.floor(this.width/this.fontSize)-this.kinsokuCharCount}this.wrapCss="";this.wrapCss+="text-align:left;";this.wrapCss+="padding:0;";this.wrapCss+="font-size:"+this.fontSize+"px;";this.wrapCss+="width:"+this.width+"px;";this.wrapCss+="height:"+this.height+"px;";this.wrapCss+="overflow:hidden;";this.wrapCss+="white-space:nowrap;";if(c){this.wrapCss+="border-collapse:collapse;"}else{this.wrapCss+="line-height:1.8em;";this.wrapCss+="letter-spacing:0;"}if(typeof this.fontFamily!="undefined"){this.wrapCss+="font-family:"+this.fontFamily+", monospace;"}};WashiLayout.prototype.setLayoutEngine=function(a){this.engine=a};WashiLayout.prototype.setHeight=function(a){this.height=a};WashiLayout.prototype.setWidth=function(a){this.width=a};WashiLayout.prototype.setDirection=function(a){this.direction=a};WashiLayout.prototype.getDirection=function(){return this.direction};WashiLayout.prototype.setFontColor=function(a){this.fontColor=a};WashiLayout.prototype.setFontFamily=function(a){this.fontFamily=a};WashiLayout.prototype.setFontSize=function(a){this.fontSize=a};WashiLayout.prototype.setLineHeightRate=function(a){this.lineHeightRate=a};WashiLayout.prototype.setLetterSpacingRate=function(a){this.letterSpacingRate=a};function WashiTextStream(a,b,c){this.buffer=a;this.length=b;this.isEOF=c;this.seekPos=0}WashiTextStream.prototype.getchar=function(){if(this.seekPos<this.buffer.length){var a=this.buffer.substring(this.seekPos,this.seekPos+1);this.seekPos++;return a}else{throw"BufferEnd"}};WashiTextStream.prototype.checkNextChar=function(a){if(this.seekPos+1<this.buffer.length){var b=this.buffer.substring(this.seekPos,this.seekPos+1);var d=this.seekPos;if(a(b)){this.seekPos++;return b}}return""};WashiTextStream.prototype.getTag=function(){var a="<";while(true){var b=this.getchar();a+=b;if(b==">"){return a}}return""};WashiTextStream.prototype.skipCRLF=function(){var c=this.seekPos;var b=this.checkNextChar(function(d){return(d=="\r"||d=="\n")});if(b=="\n"){return this.seekPos}else{if(b=="\r"){var a=this.checkNextChar(function(d){return(d=="\n")});if(a=="\n"){return this.seekPos}}}return c};WashiTextStream.prototype.setBuffer=function(b,a){this.buffer=b;this.length=(typeof a!="undefined")?a:b.length;this.isEOF=true};WashiTextStream.prototype.addBuffer=function(a){if(!this.isEOF){this.buffer+=a;if(this.buffer.length>=this.length){this.isEOF=true}}};WashiTextStream.prototype.setEOF=function(a){this.isEOF=a};WashiTextStream.prototype.getEOF=function(){return this.isEOF};function WashiRubyStream(a){this.kanji=a;this.seekPos=0}WashiRubyStream.prototype.getchar=function(){if(this.seekPos<this.kanji.length){var a=this.kanji.substring(this.seekPos,this.seekPos+1);this.seekPos++;return a}else{throw"RubyBufferEnd"}};function WashiStreamParser(a,b){this.layout=a;this.seekCharCount=0;this.seekTable=[{spos:0,cpos:0}];this.seekWidth=0;this.seekHeight=0;this.seekLineCharCount=0;this.lineBuff="";this.blockBuff="";this.tagStack=[];this.rubyStack=[];this.pageCache=[];this.boutenStack=[];this.boutenCount=0;this.bouten=false;this.indentCount=0;this.rubyYomi="";this.rubyKanji="";this.rubyStream=null;this.packStr="";this.textStream=b;this.isResuming=false;this.cacheAble=true;this.fontScale=1;this.lineScale=1;this.bgColor="";this.fontStyle="";this.isImgChar=false;this.isHankaku=false;this.imgBuff=[];this.curImgWidth=0;this.imgIndentCount=0;this.blockIndentCount=0;this.tagFlag=[]}WashiStreamParser.prototype.activateTag=function(a,b){var d=["ruby","rp","rb","rt","pack"];for(var c=0;c<d.length;c++){if(a==d[c]){this[a]=b;return}}};WashiStreamParser.prototype.isActiveTag=function(a){if(typeof this[a]=="undefined"){return false}return this[a]};WashiStreamParser.prototype.getTextStream=function(){return this.textStream};WashiStreamParser.prototype.tagAttr=function(a){var b="";for(prop in a){b+=prop+"='"+a[prop]+"' "}return b};WashiStreamParser.prototype.inlineCss=function(a){var b="";for(prop in a){b+=prop+":"+a[prop]+";"}return b};WashiStreamParser.prototype.tagStart=function(b,a,c){return"<"+b+" "+this.tagAttr(a)+(c?" />":" >")};WashiStreamParser.prototype.makeCharInner=function(b){var c=b;switch(b){case"「":case"｢":c="kakko1.gif";break;case"」":case"｣":c="kakko2.gif";break;case"『":c="kakko3.gif";break;case"』":c="kakko4.gif";break;case"（":case"(":case"{":c="kakko5.gif";break;case"）":case"}":case")":c="kakko6.gif";break;case"＜":case"<":case"〈":c="kakko7.gif";break;case"＞":case">":case"〉":c="kakko8.gif";break;case"《":case"≪":c="kakko9.gif";break;case"》":case"≫":c="kakko10.gif";break;case"［":case"[":case"〔":c="kakko13.gif";break;case"］":case"]":case"〕":c="kakko14.gif";break;case"【":c="kakko17.gif";break;case"】":c="kakko18.gif";break;case"｡":case"。":c="kuten.gif";break;case"．":case".":c="kuten2.gif";break;case"､":case"、":case",":case"，":c="touten.gif";break;case"～":case"〜":c="kara.gif";break;case"…":c="mmm.gif";break;case"：":case":":c="tenten.gif";break;case"‥":c="mm.gif";break;case"＝":case"=":c="equal.gif";break;case"―":c="dash.gif";break;case"ー":case"－":case"━":c="｜";break;case"—":case"-":case"‐":case"─":case"−":case"_":case"ｰ":c="｜";break;case"→":case"⇒":c="↓";break;case"←":c="↑";break;case"!":c="！";break;case"?":c="？";break;case"･":c="・";break;case"+":c="＋";break;case"@":c="＠";break;case"#":c="＃";break;case"\\":c="￥";break;default:break}this.isImgChar=true;if(c.match(/\.gif/)){var a=(this.layout.isWhiteFont)?"w@"+c:c;if(typeof this.layout.charImgMap[a]!="undefined"){return this.makeCharImgTag(this.layout.charImgMap[a])}}if(c==b||c.length==1){this.isImgChar=false;return c}return this.makeCharImgTag(Filename.concat(this.layout.charImgRoot,c))};WashiStreamParser.prototype.makeCharImgTag=function(e){var d=this.layout.fontSize*this.fontScale;var b=d;var c={"vertical-align":"top",width:d+"px",height:b+"px","line-height":b+"px"};var a={src:e,style:this.inlineCss(c)};return this.tagStart("img",a,true)};WashiStreamParser.prototype.getBoutenStr=function(a){switch(a){case"bt-disc":return"・";case"bt-accent":return"ヽ";case"bt-circle":return"。";case"bt-dot":return"・"}return"・"};WashiStreamParser.prototype.parseAttr=function(d){var c=d.split(/[\s\t　]+/);var a={};for(var b=0;b<c.length;b++){(function(e,g){if(e.match(/([^=]+)=(.+)/)){var f=RegExp.$1;var h=RegExp.$2;a[f]=h}})(c[b],b)}return a};WashiStreamParser.prototype.cutQuote=function(a){return a.replace(/\"/g,"").replace(/\'/g,"")};WashiStreamParser.prototype.saniSrc=function(a){return a.replace(/\"/g,"").replace(/\'/g,"").replace(/script/gi,"")};WashiStreamParser.prototype.startBgColor=function(){if(this.layout.direction=="vertical"){var d=this.layout.yohakuHeight*this.lineScale;var c=d/3;var b=this.layout.baseLineHeight*this.lineScale;var a={"text-align":"center",padding:c+"px 0",width:b+"px","background-color":this.bgColor};return this.tagStart("div",{style:this.inlineCss(a)},false)}else{var a={"padding-top":"0.3em","padding-left":"0.3em","vertical-align":"middle","background-color":this.bgColor};return this.tagStart("span",{style:this.inlineCss(a)},false)}};WashiStreamParser.prototype.endBgColor=function(){if(this.layout.direction=="vertical"){return"</div>"}return"</span>"};WashiStreamParser.prototype.makeLineTd=function(){if(this.boutenCount>0){this.boutenStack.push({startPos:this.boutenStartPos,count:this.boutenCount,str:this.boutenStr});this.boutenCount=0;this.boutenStartPos=0}var e=this.layout.fontSize*this.lineScale;var d=this.layout.yohakuHeight*this.lineScale;var a=e+d;var b={"font-size":this.layout.fontSize+"px",margin:"0",padding:"0","text-align":(this.lineScale>1)?"center":"left","line-height":this.layout.letterHeight+"px","vertical-align":"top",width:e+"px"};var c={margin:"0",padding:"0","text-align":"left",width:d+"px","vertical-align":"top"};return(this.tagStart("td",{style:this.inlineCss(b)},false)+this.lineBuff+"</td>"+this.tagStart("td",{style:this.inlineCss(c)},false)+this.makeRubyLine()+this.makeBoutenLine()+"</td>")};WashiStreamParser.prototype.makeRubyLine=function(){var c="";var b=this;var e={position:"absolute","font-size":(this.layout.rubyFontSize*this.lineScale)+"px"};var a=this.inlineCss(e);var f=this.indentCount*this.layout.letterHeight;for(var d=0;d<this.rubyStack.length;d++){(function(j,g){var l=a+";margin-top:"+(f+g.startPos)+"px;";c+=b.tagStart("div",{style:l},false);for(var h=0;h<g.yomi.length;h++){(function(m,n){c+=b.makeCharInner(n)+"<br />"})(h,g.yomi.substring(h,h+1))}c+="</div>"})(d,this.rubyStack[d])}this.rubyStack=[];return c};WashiStreamParser.prototype.makeBoutenLine=function(){var c="";var b=this;var e={position:"absolute","margin-left":"-0.35em"};var a=this.inlineCss(e);for(var d=0;d<this.boutenStack.length;d++){(function(g){while(g.count>0){if(g.str=="・"){var f=b.layout.fontSize}else{if(g.str=="ヽ"){var f=b.layout.fontSize*70/100}}var h=a+"; font-size:"+f+"px; margin-top:"+g.startPos+"px;";c+=b.tagStart("div",{style:h},false);c+=g.str;c+="</div>";g.startPos+=b.layout.letterHeight;g.count--}})(this.boutenStack[d])}this.boutenStack=[];return c};WashiStreamParser.prototype.normalIndent=function(c){this.isHankaku=false;if(this.lineScale<=1){if(c.match(/[a-z0-9]/i)){this.isHankaku=true;var a={"margin-left":"0.2em","line-height":"1em"};var b=this.inlineCss(a);return(this.tagStart("span",{style:b},false)+c+"</span><br />")}}return this.makeCharInner(c)+"<br />"};WashiStreamParser.prototype.toBold=function(a){return("<b>"+a+"</b>")};WashiStreamParser.prototype.toStyle=function(a){return(function(b){return("<span style='"+a+"'>"+b+"</span>")})};WashiStreamParser.prototype.toLink=function(a){return(function(b){return("<a href="+a+">"+b+"</a>")})};WashiStreamParser.prototype.toLink2=function(a){return(function(b){return("<a target='_blank' href="+a+">"+b+"</a>")})};WashiStreamParser.prototype.getDictionaryURL=function(a){return("http://dic.yahoo.co.jp/search?ei=UTF-8&p="+encodeURIComponent(a))};WashiStreamParser.prototype.toRuby=function(b,c){var a=this;return(function(d){return("<a target='_blank' class='ruby' title='"+c+"' href='"+a.getDictionaryURL(b)+"'>"+d+"</a>")})};WashiStreamParser.prototype.isHeadNg=function(b){var a=["？","】","，",",","》","。","、","・","｣","」","』","）","＞","〉","≫","]","〕","]","］","！","!",") ","々","ゝ","ー","－"];for(i=0;i<a.length;i++){if(b==a[i]){return true}}return false};WashiStreamParser.prototype.isTailNg=function(b){var a=["【","《","「","『","（","［","[","〔","＜","≪","(","〈"];for(i=0;i<a.length;i++){if(b==a[i]){return true}}return false};WashiStreamParser.prototype.applyTagStack=function(c){var a=this.normalIndent(c);for(i=this.tagStack.length-1;i>=0;i--){var b=this.tagStack[i];a=b(a)}return a};WashiStreamParser.prototype.isValidPageRange=function(a){return(0<=a&&a<this.seekTable.length)};WashiStreamParser.prototype.setSeekPage=function(a){if(this.isValidPageRange(a)){this.textStream.seekPos=this.seekTable[a].spos;this.seekWidth=0;this.seekHeight=0;this.seekLineCharCount=0;if(a==0){this.tagStack=[]}}};WashiStreamParser.prototype.getPageSeekPos=function(a){if(this.isValidPageRange(a)){return this.seekTable[a]}return 0};WashiStreamParser.prototype.getSeekPercent=function(a){if(a<this.seekTable.length-1){return Math.floor(100*this.seekTable[a+1].spos/this.textStream.length)}return 100};WashiStreamParser.prototype.getPageSourceText=function(a){if(a<this.seekTable.length){var c=this.seekTable[a].spos;if(a+1<this.seekTable.length){var b=this.seekTable[a+1].spos;return this.textStream.buffer.substring(c,b)}}return""};WashiStreamParser.prototype.makeRestSpaceTd=function(){var b=this.layout.width-this.seekWidth;var a="";if(b>0){a="<td style='display:block; width:"+b+"px; height:"+this.layout.height+"'></td>\n"}return a};WashiStreamParser.prototype.getPageSeekPos=function(a){if(this.isValidPageRange(a)){return this.seekTable[a]}return{spos:0,cpos:0}};WashiStreamParser.prototype.saveSeekState=function(a,b){if(this.isValidPageRange(a)){this.seekTable[a]=b}else{this.seekTable.push(b)}};WashiStreamParser.prototype.fixH=function(a){if(a=="―"){return"<span style='margin-top:-0.2em; float:right'>"+a+"</span>"}return a};WashiStreamParser.prototype.fixW=function(a){if(a=="―"||a=="…"){return"<span style='margin-left:-0.24em'>"+a+"</span>"}return a};WashiStreamParser.prototype.hasNextPage=function(){return(this.textStream.seekPos<this.textStream.length)};WashiStreamParser.prototype.addCache=function(b,a){this.pageCache[b]=a};WashiStreamParser.prototype.clearCache=function(){this.pageCache=[];this.tagStack=[]};WashiStreamParser.prototype.reset=function(){this.clearCache();this.textStream.seekPos=0};WashiStreamParser.prototype.getLetterCount=function(a){if(this.layout.direction=="vertical"){return 1}else{if(escape(a).charAt(1)=="u"){return 1}else{return 0.5}}};WashiStreamParser.prototype.addIndent=function(b){var c=(this.layout.direction=="vertical")?"　<br />":"　";for(var a=0;a<b;a++){this.lineBuff+=c}};WashiStreamParser.prototype.getLayout=function(){return this.layout};WashiStreamParser.prototype.setLayout=function(a){this.layout=a;this.layout.initialize()};WashiStreamParser.prototype.getPageLayout=function(c,a){var e="<"+this.layout.wrapTag+" class='"+this.layout.layerGroupId+"' style='"+this.layout.wrapCss+"'>";var d="</"+this.layout.wrapTag+">";var b=(a!="")?e+a+d:"";this.addCache(c,b);return b};WashiStreamParser.prototype.outputPage=function(a){if(this.isResuming){this.isResuming=false;return this.parsePage(a)}else{if(typeof this.pageCache[a]!="undefined"){this.setSeekPage(a+1);return this.pageCache[a]}else{this.setSeekPage(a);return this.parsePage(a)}}};WashiStreamParser.prototype.parsePage=function(M){var s=(this.layout.direction=="vertical");var A="";while(true){try{var c=-1;var v=this.textStream.seekPos;if(!this.pack&&this.packStr!=""){var j=this.packStr;this.packStr=""}else{if(this.rubyStream){var j=this.rubyStream.getchar()}else{var j=this.textStream.getchar()}}if(j=="\r"){}else{if(j=="\n"){if(this.blockBuff!=""||this.lineBuff!=""){if(s){this.blockBuff=this.makeLineTd()+this.blockBuff}else{this.blockBuff+=this.lineBuff+"<br />";if(this.fontStyle!=""){this.lineBuff+="</span>"}if(this.bgColor!=""){this.lineBuff+=this.endBgColor()}}this.lineBuff="";if(this.fontStyle!=""){this.lineBuff+=fontStyle}if(this.bgColor!=""){this.lineBuff=this.startBgColor()}if(s){this.seekWidth+=this.layout.baseLineHeight*this.lineScale;this.seekHeight=0}else{this.seekHeight+=this.layout.baseLineHeight*this.lineScale;this.seekWidth=0}this.seekLineCharCount=0;this.lineScale=this.fontScale}}else{if(j=="<"){A=this.lineBuff;c=v;var u=this.textStream.getTag();var D=u.replace("<","").replace(">","").replace("/>","");var H=this.parseAttr(D);var k=D.split(/[\s\t]+/)[0].toLowerCase();this.activateTag(k.replace("/",""),k.substring(0,1)!="/");switch(k){case"end-page":if(this.blockBuff!=""||this.lineBuff!=""){if(s){if(this.lineBuff!=""){this.blockBuff=this.makeLineTd()+this.blockBuff;this.seekWidth+=this.layout.baseLineHeight*this.lineScale}this.blockBuff=this.makeRestSpaceTd()+this.blockBuff}else{if(this.lineBuff!=""){if(this.fontStyle!=""){this.lineBuff+="</span>"}if(this.bgColor!=""){this.lineBuff+=this.endBgColor()}this.blockBuff+=this.lineBuff+"<br />"}}this.lineBuff="";if(this.fontStyle!=""){this.lineBuff+=this.fontStyle}if(this.bgColor!=""){this.lineBuff+=this.startBgColor()}this.seekWidth=0;this.seekHeight=0;this.seekLineCharCount=0;this.lineScale=this.fontScale;this.saveSeekState(M+1,{spos:this.textStream.seekPos,cpos:this.seekCharCount});var n=(s)?"<tr>"+this.blockBuff+"</tr>":this.blockBuff;this.blockBuff="";return this.getPageLayout(M,n)}break;case"icon":var q=this.saniSrc(H.src);var z=this.layout.fontSize;var G=this.layout.fontSize;var L="<img width="+z+" height="+G+" src='"+q+"' />";this.lineBuff+=this.applyTagStack(L);break;case"img":if(this.lineBuff!=""){if(this.fontStyle!=""){this.lineBuff+="</span>"}if(this.bgColor!=""){this.lineBuff+=this.endBgColor()}if(s){this.blockBuff=this.makeLineTd()+this.blockBuff;this.lineBuff="";if(this.fontStyle!=""){this.lineBuff+=this.fontStyle}if(this.bgColor!=""){this.lineBuff+=this.startBgColor()}this.seekWidth+=this.layout.baseLineHeight*this.lineScale;this.seekHeight=0;this.lineScale=this.fontScale;if(this.seekWidth+this.layout.baseLineHeight*this.lineScale>=this.layout.width){this.textStream.seekPos=c;throw"OverflowPage"}}else{this.blockBuff+=this.lineBuff+"<br />";this.lineBuff="";if(this.bgColor!=""){this.lineBuff=this.startBgColor()}this.seekHeight+=this.layout.baseLineHeight*this.lineScale;this.seekWidth=0;this.lineScale=this.fontScale;if(this.seekHeight+this.layout.baseLineHeight*this.lineScale>=this.layout.height){this.textStream.seekPos=c;throw"OverflowPage"}}}var q=this.saniSrc(H.src);var C=ImageSizeDb.getImageSizeFromSrc(q);var m=this.layout.height;var K=this.layout.width;var t=(typeof H.width!="undefined")?parseInt(this.cutQuote(H.width)):C.width;var I=(typeof H.height!="undefined")?parseInt(this.cutQuote(H.height)):C.height;var g=t;var y=I;if(this.seekWidth+t>K){g=K-this.seekWidth;y-=Math.floor((I/t)*(t-g))}if(this.seekHeight+I>m){y=m-this.seekHeight;g-=Math.floor((t/I)*(I-y))}if(s){if(K>t&&this.seekWidth>0&&(g*2<t||y*2<I)){this.textStream.seekPos=c;throw"OverflowPage"}}else{if(m>I&&this.seekHeight>0&&(y*2<I||g*2<t)){this.textStream.seekPos=c;throw"OverflowPage"}}var E=this.tagStart("img",{src:q,width:g,height:y},true);if(s){var x={"vertical-align":"top","padding-right":this.layout.yohakuHeight+"px"};var F=this.inlineCss(x);this.blockBuff=this.tagStart("td",{style:F},false)+E+"</td>"+this.blockBuff;this.seekWidth+=g+this.layout.yohakuHeight}else{this.blockBuff+=E+"<br />";this.seekHeight+=y+this.layout.yohakuHeight}break;case"a":case"a2":if(k=="a2"||(typeof H.target!="undefined")){var r=true}else{var r=false}if(s){if(r){this.tagStack.push(this.toLink2(H.href))}else{this.tagStack.push(this.toLink(H.href))}}else{if(k=="a"){this.lineBuff+=u}else{this.lineBuff+="<a target='_blank' href="+H.href+">"}}break;case"b":case"strong":if(s){this.tagStack.push(this.toBold)}else{this.lineBuff+=u}break;case"font":var x={};this.fontScale=(typeof H.scale!="undefined")?parseFloat(this.cutQuote(H.scale)):1;if(this.fontScale<1||this.fontScale>1){x["font-size"]=this.fontScale+"em";if(s){x["line-height"]="1.14em"}}if(this.fontScale>this.lineScale){this.lineScale=this.fontScale}if(typeof H.color!="undefined"){x.color=this.cutQuote(H.color)}if(typeof H.fontfamily!="undefined"){x["font-family"]=this.cutQuote(H.fontfamily)}this.bgColor=(typeof H.bgcolor!="undefined")?this.cutQuote(H.bgcolor):"";if(this.bgColor!=""){this.lineBuff+=this.startBgColor()}var F=this.inlineCss(x);if(F!=""){F+="vertical-align:baseline;";if(s){this.tagStack.push(this.toStyle(F))}else{this.fontStyle=this.tagStart("span",{style:F},false);this.lineBuff+=this.fontStyle}}break;case"/font":this.fontScale=1;if(this.seekLineCharCount==0){this.lineScale=1}if(s){if(this.bgColor!=""){this.lineBuff+=this.endBgColor();this.bgColor=""}this.tagStack.pop()}else{this.fontStyle="";this.lineBuff+="</span>";if(this.bgColor!=""){this.lineBuff+=this.endBgColor();this.bgColor=""}}break;case"/a":case"/a2":case"/b":case"/strong":if(s){this.tagStack.pop()}else{if(k=="/a2"){this.lineBuff+="</a>"}else{this.lineBuff+=u}}break;case"bt-disc":case"bt-accent":case"bt-circle":case"bt-dot":this.bouten=true;this.boutenStartPos=this.seekHeight;this.boutenStr=this.getBoutenStr(k);break;case"/bt-disc":case"/bt-accent":case"/bt-circle":case"/bt-dot":this.bouten=false;this.boutenStack.push({startPos:this.boutenStartPos,count:this.boutenCount,str:this.boutenStr});this.boutenCount=0;break;case"pack":if(s){this.packStr=""}break;case"ruby":this.rubyStartPos=this.seekHeight;break;case"/ruby":if(this.rubyKanji!=""){this.rubyStream=new WashiRubyStream(this.rubyKanji);this.rubyStack.push({yomi:this.rubyYomi,startPos:this.rubyStartPos})}else{this.rubyStream=new WashiRubyStream(this.rubyYomi)}if(s){}else{var l=this.getDictionaryURL(this.rubyKanji);this.lineBuff+=this.tagStart("a",{target:"_blank","class":"ruby",title:this.rubyYomi,href:l},false)}this.rubyYomi="";this.rubyKanji="";break;case"blockquote":this.blockIndentCount=(typeof H.indent!="undefined")?parseInt(this.cutQuote(H.indent)):2;this.indentCount+=this.blockIndentCount;if(this.lineCount<=this.indentCount*2){this.activateTag("blockquote",false)}this.layout.lineCount-=this.blockIndentCount*2;break;case"/blockquote":this.indentCount-=this.blockIndentCount;this.layout.lineCount+=this.blockIndentCount*2;this.blockIndentCount=0;break;default:break}}else{if(this.isActiveTag("pack")){this.packStr+=j}else{if(this.isActiveTag("ruby")){if(this.isActiveTag("rt")){this.rubyYomi+=j}else{if(this.isActiveTag("rb")){this.rubyKanji+=j}}}else{var o=this.getLetterCount(j);var b=o*this.fontScale;if(this.seekLineCharCount==0&&this.indentCount>0){this.addIndent(this.indentCount)}if(s){this.lineBuff+=this.applyTagStack(j);if(this.isImgChar||this.isHankaku){this.seekHeight+=b*this.layout.fontSize}else{this.seekHeight+=b*this.layout.letterHeight}}else{this.lineBuff+=this.fixW(j);this.seekWidth+=b*this.layout.letterHeight}this.seekLineCharCount+=b;this.seekCharCount++;if(this.bouten){this.boutenCount++}var a=this.layout.lineCount-this.seekLineCharCount;if(1<=a&&a<=1.5){var f=this.textStream.checkNextChar(this.isTailNg);if(f!=""){this.seekCharCount++;if(this.bgColor!=""){this.lineBuff+=this.endBgColor()}if(s){this.blockBuff=this.makeLineTd()+this.blockBuff;this.lineBuff="";if(this.indentCount>0){this.addIndent(this.indentCount)}if(this.bgColor!=""){this.lineBuff+=this.startBgColor()}var B=this.layout.baseLineHeight*this.lineScale;this.lineBuff+=this.applyTagStack(f);this.seekWidth+=B;this.seekWidth2+=B;this.seekHeight=0;this.seekLineCharCount=this.getLetterCount(f);this.textStream.skipCRLF();this.lineScale=this.fontScale}else{this.blockBuff+=this.lineBuff+"<br />";this.lineBuff="";if(this.indentCount>0){this.addIndent(this.indentCount)}if(this.fontStyle!=""){this.lineBuff+=this.fontStyle}if(this.bgColor!=""){this.lineBuff+=this.startBgColor()}this.lineBuff+=this.fixW(f.str);this.seekHeight+=this.layout.baseLineHeight*this.lineScale;this.seekWidth=0;this.seekLineCharCount=this.getLetterCount(f.str);this.textStream.skipCRLF();this.lineScale=this.fontScale}}}else{if(a<1){var f=this.textStream.checkNextChar(this.isHeadNg);if(f!=""){this.seekCharCount++;if(this.bouten){this.boutenCount++}if(s){this.lineBuff+=this.applyTagStack(f)}else{this.lineBuff+=this.fixW(f)}var d=this.textStream.checkNextChar(this.isHeadNg);if(d!=""){this.seekCharCount++;if(this.bouten){this.boutenCount++}this.lineBuff+=this.applyTagStack(d)}}if(this.fontStyle!=""){this.lineBuff+="</span>"}if(this.bgColor!=""){this.lineBuff+=this.endBgColor()}if(s){this.blockBuff=this.makeLineTd()+this.blockBuff}else{this.blockBuff+=this.lineBuff+"<br />"}this.lineBuff="";if(this.fontStyle!=""){this.lineBuff+=this.fontStyle}if(this.bgColor!=""){this.lineBuff+=this.startBgColor()}if(s){var B=this.layout.baseLineHeight*this.lineScale;this.seekWidth+=B;this.seekWidth2+=B;this.seekHeight=0}else{this.seekHeight+=this.layout.baseLineHeight*this.lineScale;this.seekWidth=0}this.seekLineCharCount=0;this.lineScale=this.fontScale;this.textStream.skipCRLF()}}}}}}}if(this.curImgWidth>0&&this.seekWidth2>=this.curImgWidth){this.endImageWidth()}if(s){if(this.seekWidth+this.layout.baseLineHeight*this.lineScale>=this.layout.width){throw"OverflowPage"}}else{if(this.seekHeight+this.layout.baseLineHeight*this.lineScale>=this.layout.height){throw"OverflowPage"}}}catch(J){if(J=="RubyBufferEnd"){delete this.rubyStream;this.rubyStream=null;if(s){this.tagStack.pop()}else{this.lineBuff+="</a>"}}else{if(J=="OverflowPage"){var n=(s)?"<tr>"+this.blockBuff+"</tr>":this.blockBuff;this.saveSeekState(M+1,{spos:this.textStream.seekPos,cpos:this.seekCharCount});this.blockBuff="";this.lineBuff="";if(this.bgColor!=""){this.lineBuff+=this.startBgColor()}this.lineScale=this.fontScale;if(s){this.seekWidth=0}else{this.seekHeight=0}this.seekLineCharCount=0;return this.getPageLayout(M,n)}else{if(J=="BufferEnd"){if(this.textStream.isEOF){if(this.blockBuff==""&&this.lineBuff==""){this.seekLineCharCount=0;return""}if(this.lineBuff!=""){if(this.fontStyle!=""){this.lineBuff+="</span>"}if(this.bgColor!=""){this.lineBuff+=this.endBgColor()}if(s){this.blockBuff=this.makeLineTd()+this.blockBuff;this.seekWidth+=this.layout.baseLineHeight*this.lineScale;this.seekHeight=0}else{this.blockBuff+=this.lineBuff+"<br />"}}if(s){this.blockBuff=this.makeRestSpaceTd()+this.blockBuff}if(s){this.seekWidth=0}else{this.seekHeight=0}var n=(s)?"<tr>"+this.blockBuff+"</tr>":this.blockBuff;this.saveSeekState(M+1,{spos:this.textStream.seekPos,cpos:this.seekCharCount});this.seekLineCharCount=0;this.blockBuff="";this.lineBuff="";this.lineScale=this.fontScale;return this.getPageLayout(M,n)}else{this.isResuming=true;if(c>=0){this.textStream.seekPos=c;this.lineBuff=A}throw"BufferEnd"}}}}}}};
