
function colorRows() {
       var myTR = document.getElementsByTagName('tr');
       for (var i=0;i<myTR.length;i++) {
               if (i%2) {
                       myTR[i].className = 'color';
               }
       }
}



//scroll

Event.observe(window, 'load', function() {
	$$('a[href^=#]:not([href=#])').each(function(element) {
		element.observe('click', function(event) {
		new Effect.ScrollTo(this.hash.substr(1));
		Event.stop(event);
		}.bindAsEventListener(element))
	})
})


//subwin
function SubWin(URL,Name,Scroll,Width,Height){
	var Option =""
		+"left=" +0
		+"screenX=" +0
		+",top=" +0
		+",screenY=" +0
		+",toolbar=" +0
		+",location=" +0
		+",status=" +0
		+",menubar=" +0
		+",scrollbars=" +Scroll
		+",resizable=" +1
		+",width=" +Width
		+",height=" +Height;

win=window.open(URL, Name, Option);
win.focus();
}



// 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.body.style.fontSize = fontSize;
  },
  setCookieShelfLife: function(days) {
    this.cookieManager.cookieShelfLife = days;
  },
  change: function(fontSize) {
    document.body.style.fontSize = fontSize;
    this.cookieManager.setCookie(this.cookieName, fontSize);
  },
  reset: function() {
    document.body.style.fontSize = '';
    this.cookieManager.clearCookie(this.cookieName);
  },
  show: function() {
    var id = this.id;
    document.writeln([
'<div id="' + id + '">',
'<div>',
'文字の大きさ: ',
'<span style="cursor: pointer; font-size: 80% ;" id="' + id + '-small" >小</span>',
'<span style="cursor: pointer; font-size: 100%;" id="' + id + '-medium">中</span>',
'<span style="cursor: pointer; font-size: 120%;" id="' + id + '-large" >大</span>',
'</div>',
'</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('.8em' ); },
  onClickMedium: function(e) { this.change('.9em'); },
  onClickLarge:  function(e) { this.change('1.1em'); }
};
// Bootstrap
FontChanger.start = function(id) {
  var fontChanger = new FontChanger(id);
  fontChanger.setCookieShelfLife(90);
  fontChanger.show();
};



/*フロートするdtの幅を設定*/
Event.observe(window, 'load', function(){
	setHangDl();
});
function setHangDl(){
	var hangDls = $$('dl.hang');   //クラス名がhangのdlを取得 
	var maxes = Array();   //各dlごとのdtの最大幅を入れる配列
	
	//各dlごとにdtとdlを取得
	var getDts = function(e,i){ return e.getElementsByTagName('dt'); }
	var elDts = hangDls.collect(getDts);
	var getDds = function(e,i){ return e.getElementsByTagName('dd'); }
	var elDds = hangDls.collect(getDds);
	
	//dtの幅を取得
	var getW = function(e,i){
		var tmpW = Array(); 
		for(var j = 0; j < e.length; j++){
			var w_h = Element.getDimensions(e[j]);
			tmpW.push(w_h.width); 
		}
		maxes[i] = tmpW.max();
	}
	//ddのpadding-leftを設定
	var setPad = function(e,i){
		for(var j = 0; j < e.length; j++){
			e[j].style.paddingLeft = maxes[i] +15+ 'px';
		}
	}
	
	//各dt、ddに適用
	elDts.each(getW);
	elDds.each(setPad);
}
