// JavaScript Document
/*
	Standards Compliant Rollover Script
	Author : Daniel Nolan
	http://www.bleedingego.co.uk/webdev.php
*/

function initRollovers() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'imgover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_o'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

// stripeTable

function setStripeTable() {
 var os = navigator.userAgent;
 var br = navigator.appName;
 if ((os.indexOf("mac") >= 0 && br.charAt(0)=="M") || (os.indexOf("Mac") >= 0 && br.charAt(0)=="M")) {
   } else {
    stripeTableById('tableSt');
   }
}
function stripeTable(t) {
  var i, odd = true;
  for (i=0; i<t.rows.length; i++) {
   t.rows[i].className += odd ? ' odd' : ' even';
   odd = !odd;
  }
}
function stripeTableById(id) {
  var t = document.getElementById(id);
  if (t) stripeTable(t);
}

function stripeAllTables() {
  var t = document.getElementsByTagName('TABLE');
  for (var i=0; i<t.length; i++) stripeTable(t[i])
}


// stripeList

function setStripeList() {
 var os = navigator.userAgent;
 var br = navigator.appName;
 if ((os.indexOf("mac") >= 0 && br.charAt(0)=="M") || (os.indexOf("Mac") >= 0 && br.charAt(0)=="M")) {
   } else {
    stripeListById('listSt');
   }
}
function stripeList(t) {
  var i, odd = true;
  for (i=0; i<t.getElementsByTagName('li').length; i++) {
   t.getElementsByTagName('li')[i].className += odd ? ' odd' : ' even';
   odd = !odd;
  }
}
function stripeListById(id) {
  var t = document.getElementById(id);
  if (t) stripeList(t);
}

// stripeList2

function setStripeList2() {
 var os = navigator.userAgent;
 var br = navigator.appName;
 if ((os.indexOf("mac") >= 0 && br.charAt(0)=="M") || (os.indexOf("Mac") >= 0 && br.charAt(0)=="M")) {
   } else {
    stripeListById2('listSt2');
   }
}
function stripeList2(t) {
  var i, odd = true;
  for (i=0; i<t.getElementsByTagName('li').length; i++) {
   t.getElementsByTagName('li')[i].className += odd ? ' odd' : ' even';
   odd = !odd;
  }
}
function stripeListById2(id) {
  var t = document.getElementById(id);
  if (t) stripeList2(t);
}



function stripeAllTables() {
  var t = document.getElementsByTagName('TABLE');
  for (var i=0; i<t.length; i++) stripeList(t[i])
}

window.onload = function() {
	initRollovers();
	setStripeTable();
	setStripeList();
	setStripeList2();
} 


/*--------------------------------------------------------------------------*
 *  
 *  heightLine JavaScript Library beta4
 *  
 *  MIT-style license. 
 *  
 *  2007 Kazuma Nishihata 
 *  http://www.webcreativepark.net
 *  
 *--------------------------------------------------------------------------*/
new function(){
	
	function heightLine(){
	
		this.className="heightLine";
		this.parentClassName="heightLineParent"
		reg = new RegExp(this.className+"-([a-zA-Z0-9-_]+)", "i");
		objCN =new Array();
		var objAll = document.getElementsByTagName ? document.getElementsByTagName("*") : document.all;
		for(var i = 0; i < objAll.length; i++) {
			var eltClass = objAll[i].className.split(/\s+/);
			for(var j = 0; j < eltClass.length; j++) {
				if(eltClass[j] == this.className) {
					if(!objCN["main CN"]) objCN["main CN"] = new Array();
					objCN["main CN"].push(objAll[i]);
					break;
				}else if(eltClass[j] == this.parentClassName){
					if(!objCN["parent CN"]) objCN["parent CN"] = new Array();
					objCN["parent CN"].push(objAll[i]);
					break;
				}else if(eltClass[j].match(reg)){
					var OCN = eltClass[j].match(reg)
					if(!objCN[OCN]) objCN[OCN]=new Array();
					objCN[OCN].push(objAll[i]);
					break;
				}
			}
		}
		
		//check font size
		var e = document.createElement("div");
		var s = document.createTextNode("S");
		e.appendChild(s);
		e.style.visibility="hidden"
		e.style.position="absolute"
		e.style.top="0"
		document.body.appendChild(e);
		var defHeight = e.offsetHeight;
		
		changeBoxSize = function(){
			for(var key in objCN){
				if (objCN.hasOwnProperty(key)) {
					//parent type
					if(key == "parent CN"){
						for(var i=0 ; i<objCN[key].length ; i++){
							var max_height=0;
							var CCN = objCN[key][i].childNodes;
							for(var j=0 ; j<CCN.length ; j++){
								if(CCN[j] && CCN[j].nodeType == 1){
									CCN[j].style.height="auto";
									max_height = max_height>CCN[j].offsetHeight?max_height:CCN[j].offsetHeight;
								}
							}
							for(var j=0 ; j<CCN.length ; j++){
								if(CCN[j].style){
									var stylea = CCN[j].currentStyle || document.defaultView.getComputedStyle(CCN[j], '');
									var newheight = max_height;
									if(stylea.paddingTop)newheight -= stylea.paddingTop.replace("px","");
									if(stylea.paddingBottom)newheight -= stylea.paddingBottom.replace("px","");
									if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","");
									if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px","");
									CCN[j].style.height =newheight+"px";
								}
							}
						}
					}else{
						var max_height=0;
						for(var i=0 ; i<objCN[key].length ; i++){
							objCN[key][i].style.height="auto";
							max_height = max_height>objCN[key][i].offsetHeight?max_height:objCN[key][i].offsetHeight;
						}
						for(var i=0 ; i<objCN[key].length ; i++){
							if(objCN[key][i].style){
								var stylea = objCN[key][i].currentStyle || document.defaultView.getComputedStyle(objCN[key][i], '');
									var newheight = max_height;
									if(stylea.paddingTop)newheight-= stylea.paddingTop.replace("px","");
									if(stylea.paddingBottom)newheight-= stylea.paddingBottom.replace("px","");
									if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","")
									if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px","");
									objCN[key][i].style.height =newheight+"px";
							}
						}
					}
				}
			}
		}
		
		checkBoxSize = function(){
			if(defHeight != e.offsetHeight){
				changeBoxSize();
				defHeight= e.offsetHeight;
			}
		}
		changeBoxSize();
		setInterval(checkBoxSize,1000)
		window.onresize=changeBoxSize;
	}
	
	function addEvent(elm,listener,fn){
		try{
			elm.addEventListener(listener,fn,false);
		}catch(e){
			elm.attachEvent("on"+listener,fn);
		}
	}
	addEvent(window,"load",heightLine);
}

// to pagetop
function inAnchor (inpage) {
	var	url = location.href ;
	var	sharp = url.indexOf("#") ;
	if ( sharp == -1 ){
		location.href = url + "#" + inpage;
	} else {
		location.href = url.substr(0,sharp+1) + inpage;
	}
}

// ポップアップウィンドウ
function openwin (url,name,w,h) {
w = window.open(url,name,"width="+w+",height="+h+",left=0,top=0,toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,favorites=no,resizable=yes");w.focus();
}