
/* 文字サイズ変更スクリプト */

function setActiveStyleSheet(title) {

  if(title == null || title == "null"){
    var defaultTitle = getPreferredStyleSheet();
    if(defaultTitle == null || defaultTitle == "null") {
      return false;
    } else {
      title = defaultTitle;
    }
  }

  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title){
        a.disabled = false;
        createCookie("style", title, 365);
      }
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}


// <![CDATA[

var tab = {
	init: function(){
		var tabs = this.setup.tabs;
		var pages = this.setup.pages;
		
		for(i=0; i<pages.length; i++) {
			if(i !== 0) pages[i].style.display = 'none';
			tabs[i].onclick = function(){ tab.showpage(this); return false; };
		}
	},
	
	showpage: function(obj){
		var tabs = this.setup.tabs;
		var pages = this.setup.pages;
		var num;
		
		for(num=0; num<tabs.length; num++) {
			if(tabs[num] === obj) break;
		}
		
		for(var i=0; i<pages.length; i++) {
			if(i == num) {
				pages[num].style.display = 'block';
				tabs[num].className = 'present';
			}
			else{
				pages[i].style.display = 'none';
				tabs[i].className = null;
			}
		}
	}
}

// ]]>


<!--
function dd(id){
if(document.all)OBJ = document.all(id).style; else if(document.getElementById)OBJ = document.getElementById(id).style; if(OBJ) OBJ.display=='none'?OBJ.display='':OBJ.display='none';
}
//-->

function initRollOvers() {
    if (!document.getElementById){
        return;
    }
   
    var preLoads = new Array();
    var allImages = document.getElementsByTagName('img');
 
    for (var i = 0; i < allImages.length; i++) {       
        if (allImages[i].className == 'rollover') {
            var src = allImages[i].getAttribute('src');
            var ftype = src.substring(src.lastIndexOf('.'), src.length);
            var oSrc = src.replace(ftype, '_on'+ftype);
 
            //-- スワップ元、スワップ先画像の登録
            allImages[i].setAttribute('pSrc', src);
            allImages[i].setAttribute('oSrc', oSrc);
 
            //-- イメージのプリロード
            preLoads[i] = new Image();
            preLoads[i].src = oSrc;
 
            //-- イベントの設定
            allImages[i].onmouseover = function() {
                this.setAttribute('src', this.getAttribute('oSrc'));
            }
            allImages[i].onmouseout = function() {
                this.setAttribute('src', this.getAttribute('pSrc'));
            }
        }
    }
}
 
function addOnload(func){
    if ( typeof window.addEventListener != "undefined" ){
        window.addEventListener( "load", func, false );
    }else if ( typeof window.attachEvent != "undefined" ) {
        window.attachEvent( "onload", func );
    }else{
        if ( window.onload != null ){
            var oldOnload = window.onload;
            window.onload = function ( e ) {
            oldOnload( e );
            window[func]();
        };
    }else
        window.onload = func;
    }
}
addOnload(initRollOvers);