var accordion=function(){
	var tm=sp=10;
	function slider(n){this.nm=n; this.arr=[]}
	slider.prototype.init=function(t,c,k){
		var a,h,s,l,i; a=document.getElementById(t); this.sl=k?k:'';
		h=a.getElementsByTagName('dt'); s=a.getElementsByTagName('dd'); this.l=h.length;
		for(i=0;i<this.l;i++){var d=h[i]; this.arr[i]=d; d.onclick=new Function(this.nm+'.pro(this)'); if(c==i){d.className=this.sl}}
		l=s.length;
		for(i=0;i<l;i++){var d=s[i]; d.mh=d.offsetHeight; if(c!=i){d.style.height=0; d.style.display='none'}}
	}
	slider.prototype.pro=function(d){
		for(var i=0;i<this.l;i++){
			var h=this.arr[i], s=h.nextSibling; s=s.nodeType!=1?s.nextSibling:s; clearInterval(s.tm);
			if(h==d&&s.style.display=='none'){s.style.display=''; su(s,1); h.className=this.sl}
			else if(s.style.display==''){su(s,-1); h.className=''}
		}
	}
	function su(c,f){c.tm=setInterval(function(){sl(c,f)},tm)}
	function sl(c,f){
		var h=c.offsetHeight, m=c.mh, d=f==1?m-h:h; c.style.height=h+(Math.ceil(d/sp)*f)+'px';
		c.style.opacity=h/m; c.style.filter='alpha(opacity='+h*100/m+')';
		if(f==1&&h>=m){clearInterval(c.tm)}else if(f!=1&&h==1){c.style.display='none'; clearInterval(c.tm)}
	}
	return{slider:slider}
}();




/*
自動ロールオーバー処理本体
*/

(function(autoRollover){ 

if(window.addEventListener) {
window.addEventListener("load", autoRollover, false);
} else if(window.attachEvent) {
window.attachEvent("onload", autoRollover);
} else {
window.onload = autoRollover;
}

})(function(){
var roArray = getElementsByClassName('rollover');

for(var i=0; i<roArray.length; i++){
var s = roArray[i].src.split('\.');
var ext = s[s.length-1]
var regExp = new RegExp('\.'+ext+'$')

roArray[i].onmouseover = function(){ 
this.src = this.src.replace(regExp, '_on\.'+ext);
}
roArray[i].onmouseout = function(){
this.src = this.src.replace('_on\.', '\.');
}
}
});

/*
class名を元に要素を取得する関数
*/

function getElementsByClassName(class_name, Container){
var container = (Container == 'undefined') ? Container : document;
var descendants = (container.all && !window.opera) ? container.all : container.getElementsByTagName('*');
var elements = [];
var regExp = new RegExp('\s?'+class_name+'\s?');
for(var i=0; i<descendants.length; i++){
if(descendants[i].className == class_name || descendants[i].className.match(regExp))
elements[elements.length] = descendants[i];
}

return elements
}

