// FontChanger
// Copyright (c) 2007 Hirotaka Ogawa
// REQUIRES: prototype.js, cookiemanager.js
FontChanger = Class.create();
FontChanger.prototype = {
  id: null,
  cookieManager: null,
  cookieName: 'body.style.fontSize',
  initialize: function(id) {
    this.id = id || 'fontChanger';
    this.cookieManager = new CookieManager();
    var fontSize = this.cookieManager.getCookie(this.cookieName);
    if (fontSize) document.getElementById("ID").style.fontSize = fontSize;
  },
  setCookieShelfLife: function(days) {
    this.cookieManager.cookieShelfLife = days;
  },
  change: function(fontSize) {
    document.getElementById("ID").style.fontSize = fontSize;
    this.cookieManager.setCookie(this.cookieName, fontSize);
  },
  reset: function() {
    document.getElementById("ID").style.fontSize = '';
    this.cookieManager.clearCookie(this.cookieName);
  },
  show: function() {
    var id = this.id;
    document.writeln([
'<div id="' + id + '">',
'<div align="center"><IMG SRC="http://www.paradisearmy.com/doujin/img/moji_size.gif" ALT="" WIDTH="72" HEIGHT="14" BORDER="0"> ',
'<span style="cursor: pointer; font-size: 80% ;" id="' + id + '-small" ><IMG SRC="http://www.paradisearmy.com/doujin/img/moji_s.gif" ALT="" WIDTH="20" HEIGHT="20" BORDER="0"></span>',
'<span style="cursor: pointer; font-size: 100%;" id="' + id + '-medium"><IMG SRC="http://www.paradisearmy.com/doujin/img/moji_m.gif" ALT="" WIDTH="20" HEIGHT="20" BORDER="0"></span>',
'<span style="cursor: pointer; font-size: 120%;" id="' + id + '-large" ><IMG SRC="http://www.paradisearmy.com/doujin/img/moji_l.gif" ALT="" WIDTH="20" HEIGHT="20" BORDER="0"></span>			<IMG SRC=img/sp.gif ALT="" WIDTH="180" HEIGHT="4" BORDER="0"><br><A HREF="http://www.paradisearmy.com/rss/rss10.xml" TARGET="_BLANK"><IMG SRC="img/rss.png" ALT="RSS" WIDTH="32" HEIGHT="32" BORDER="0"></A>　<A HREF="http://www.facebook.com/doujinyougo" TARGET="_BLANK"><IMG SRC="img/fb.png" ALT="Facebook" WIDTH="32" HEIGHT="32" BORDER="0"></A>　<A HREF="http://twitter.com/#!/doujinyougo" TARGET="_BLANK"><IMG SRC="img/tw.png" ALT="Twitter" WIDTH="32" HEIGHT="32" BORDER="0"></A>　<A HREF="http://p.mixi.jp/doujinyougo" TARGET="_BLANK"><IMG SRC="img/mixi.gif" ALT="mixi" WIDTH="32" HEIGHT="32" BORDER="0"></A>　<A HREF="https://plus.google.com/112659611123079560141" TARGET="_BLANK"><IMG SRC="img/g+.png" ALT="Google +" WIDTH="32" HEIGHT="32" BORDER="0"></A>　<A HREF="http://doujinyougo.tumblr.com/" TARGET="_BLANK"><IMG SRC="img/tu.gif" ALT="tumblr" WIDTH="32" HEIGHT="32" BORDER="0"></A>　<A HREF="http://www.youtube.com/user/doujinyougo" TARGET="_BLANK"><IMG SRC="img/yt.png" ALT="YouTube" WIDTH="32" HEIGHT="32" BORDER="0"></A></div>			<IMG SRC=img/sp.gif ALT="" WIDTH="180" HEIGHT="2" BORDER="0"><br><TABLE WIDTH="300" HEIGHT="52" BORDER="0" CELLSPACING="0" CELLPADDING="7"><TR><TD class="search" Nowrap></TD></TR></TABLE><TABLE WIDTH="300" BORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD><IMG SRC="img/menu_waku_01a.jpg" ALT="" WIDTH="300" HEIGHT="7" BORDER="0"></TD></TR><TR><TD class="menu_2a" id=""><CENTER><TABLE WIDTH="290" BORDER="0" CELLSPACING="1" CELLPADDING="2" class="menu_3" id=""><TR><TD class="TD_3_1a">あ行</TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11.htm">あ</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11.htm#I">い</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11.htm#U">う</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11.htm#E">え</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11.htm#O">お</A></TD></TD></TR><TR><TD class="TD_3_1a">か行</TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_2.htm">か</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_2.htm#KI">き</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_2.htm#KU">く</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_2.htm#KE">け</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_2.htm#KO">こ</A></TD></TR><TR><TD class="TD_3_1a">さ行</TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_3.htm">さ</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_3.htm#SI">し</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_3.htm#SU">す</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_3.htm#SE">せ</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_3.htm#SO">そ</A></TD></TR><TR><TD class="TD_3_1a">た行</TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_4.htm">た</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_4.htm#TI">ち</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_4.htm#TU">つ</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_4.htm#TE">て</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_4.htm#TO">と</A></TD></TR><TR><TD class="TD_3_1a">な行</TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_5.htm">な</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_5.htm#NI">に</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_5.htm#NU">ぬ</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_5.htm#NE">ね</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_5.htm#NO">の</A></TD></TR><TR><TD class="TD_3_1a">は行</TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_6.htm">は</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_6.htm#HI">ひ</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_6.htm#HU">ふ</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_6.htm#HE">へ</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_6.htm#HO">ほ</A></TD></TR><TR><TD class="TD_3_1a">ま行</TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_7.htm">ま</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_7.htm#MI">み</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_7.htm#MU">む</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_7.htm#ME">め</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_7.htm#MO">も</A></TD></TR><TR><TD class="TD_3_1a">や行</TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_8.htm">や</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_8.htm#YU">ゆ</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_8.htm#YO">よ</A></TD></TR><TR><TD class="TD_3_1a">ら行</TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_9.htm">ら</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_9.htm#RI">り</TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_9.htm#RI">る</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_9.htm#RE">れ</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_9.htm#RO">ろ</A></TD></TR><TR><TD class="TD_3_1a">わ行</TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_10.htm">わ</A></TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_10.htm#WA">を</TD><TD class="TD_1"><A HREF="http://www.paradisearmy.com/doujin/pasok11_10.htm#WA">ん</A></TD></TR></TABLE></CENTER></TD></TR><TR VALIGN=TOP><TD><IMG SRC="img/menu_waku_23a.jpg" ALT="" WIDTH="300" HEIGHT="7" BORDER="0"></TD></TR></TABLE>',
'</div>'
    ].join("\n"));
    Event.observe($(id + '-small' ), 'click', this.onClickSmall.bind(this));
    Event.observe($(id + '-medium'), 'click', this.onClickMedium.bind(this));
    Event.observe($(id + '-large' ), 'click', this.onClickLarge.bind(this));
  },
  onClickSmall:  function(e) { this.change('80%' ); },
  onClickMedium: function(e) { this.change('100%'); },
  onClickLarge:  function(e) { this.change('120%'); }
};
// Bootstrap
FontChanger.start = function(id) {
  var fontChanger = new FontChanger(id);
  fontChanger.show();
};


