/* ロールオーバー
_____________________________________________________*/
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);
			}
		}
	}
}

window.onload = initRollovers;




/*  スライドショー  */
/************************************************************************************************************
	(C) www.dhtmlgoodies.com, November 2005
	
	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission. 
	
	Thank you!
	
	www.dhtmlgoodies.com
	Alf Magne Kalleland
	
	************************************************************************************************************/	
	var slideshow2_noFading = false;
	var slideshow2_timeBetweenSlides = 2500;
	var slideshow2_fadingSpeed = 12;
	
	var slideshow2_galleryContainer;
	var slideshow2_galleryWidth;
	var slideshow2_galleryHeight;
	var slideshow2_slideIndex = -1;
	var slideshow2_slideIndexNext = false;
	var slideshow2_imageDivs = new Array();	
	var slideshow2_currentOpacity = 100;
	var slideshow2_imagesInGallery = false;
	var Opera = navigator.userAgent.indexOf('Opera')>=0?true:false;
	function createParentDivs(imageIndex)
	{
		if(imageIndex==slideshow2_imagesInGallery){			
			showGallery();
		}else{
			var imgObj = document.getElementById('galleryImage' + imageIndex);	
			if(Opera)imgObj.style.position = 'static';
			slideshow2_imageDivs[slideshow2_imageDivs.length] =  imgObj;
			imgObj.style.visibility = 'hidden';	
			imageIndex++;
			createParentDivs(imageIndex);	
		}		
	}
	
	function showGallery()
	{
		if(slideshow2_slideIndex==-1)slideshow2_slideIndex=0; else slideshow2_slideIndex++;
		if(slideshow2_slideIndex==slideshow2_imageDivs.length)slideshow2_slideIndex=0;
		slideshow2_slideIndexNext = slideshow2_slideIndex+1;
		if(slideshow2_slideIndexNext==slideshow2_imageDivs.length)slideshow2_slideIndexNext = 0;
		
		slideshow2_currentOpacity=100;

		
		slideshow2_imageDivs[slideshow2_slideIndex].style.visibility = 'visible';
		if(Opera)slideshow2_imageDivs[slideshow2_slideIndex].style.display = 'inline';
		if(navigator.userAgent.indexOf('Opera')<0){
			slideshow2_imageDivs[slideshow2_slideIndexNext].style.visibility = 'visible';
		}
		
		if(document.all){
			slideshow2_imageDivs[slideshow2_slideIndex].style.filter = 'alpha(opacity=100)';
			slideshow2_imageDivs[slideshow2_slideIndexNext].style.filter = 'alpha(opacity=1)';
		}else{
			slideshow2_imageDivs[slideshow2_slideIndex].style.opacity = 0.99;
			slideshow2_imageDivs[slideshow2_slideIndexNext].style.opacity = 0.01;
		}		
		

		setTimeout('revealImage()',slideshow2_timeBetweenSlides);		
	}
	
	function revealImage()
	{
		if(slideshow2_noFading){
			slideshow2_imageDivs[slideshow2_slideIndex].style.visibility = 'hidden';
			if(Opera)slideshow2_imageDivs[slideshow2_slideIndex].style.display = 'none';
			showGallery();
			return;
		}
		slideshow2_currentOpacity--;
		if(document.all){
			slideshow2_imageDivs[slideshow2_slideIndex].style.filter = 'alpha(opacity='+slideshow2_currentOpacity+')';
			slideshow2_imageDivs[slideshow2_slideIndexNext].style.filter = 'alpha(opacity='+(100-slideshow2_currentOpacity)+')';
		}else{
			slideshow2_imageDivs[slideshow2_slideIndex].style.opacity = Math.max(0.01,slideshow2_currentOpacity/100);
			slideshow2_imageDivs[slideshow2_slideIndexNext].style.opacity = Math.min(0.99,(1 - (slideshow2_currentOpacity/100)));
		}
		if(slideshow2_currentOpacity>0){
			setTimeout('revealImage()',slideshow2_fadingSpeed);
		}else{
			slideshow2_imageDivs[slideshow2_slideIndex].style.visibility = 'hidden';	
			if(Opera)slideshow2_imageDivs[slideshow2_slideIndex].style.display = 'none';		
			showGallery();
		}
	}
	
	function initImageGallery()
	{
		slideshow2_galleryContainer = document.getElementById('imageSlideshowHolder');
		slideshow2_galleryWidth = slideshow2_galleryContainer.clientWidth;
		slideshow2_galleryHeight = slideshow2_galleryContainer.clientHeight;
		galleryImgArray = slideshow2_galleryContainer.getElementsByTagName('IMG');
		for(var no=0;no<galleryImgArray.length;no++){
			galleryImgArray[no].id = 'galleryImage' + no;
		}
		slideshow2_imagesInGallery = galleryImgArray.length;
		createParentDivs(0);		
		
	}












/* ページUP
_____________________________________________________*/

function getScroll(){
	var x, y ;
	if( document.all !== void 0 ){
		x = document.body.scrollLeft ;
		y = document.body.scrollTop ;
	}else if( document.layers !== void 0 ){
		x = window.pageXOffset ;
		y = window.pageYOffset ;
	}else{
		x = window.scrollX ;
		y = window.scrollY ;
	}
	return { x : x, y : y };
}
var SCROLL ;
var divCountScroller = 25 ;
function scroller( x, y, edging, count ){
	if( count === void 0 ){
		count = 0;
		SCROLL = getScroll();
	}
	if( count++ < divCountScroller ){
		var c = count/divCountScroller ;
		var nx = SCROLL.x+( x-SCROLL.x )*( c+edging/(100*Math.PI)*Math.sin( Math.PI*c ) );
		var ny = SCROLL.y+( y-SCROLL.y )*( c+edging/(100*Math.PI)*Math.sin( Math.PI*c ) );
		window.scrollTo( nx, ny );
		setTimeout( "scroller("+x+","+y+","+edging+","+count+");", 30); //数字が小さいほど早い。
	}
}


function pageScroll() {
	var scroll = 1;
	getScroll();
	if(scroll < 50 && pageY && pageY != null) {
		pageY = (pageY > 3) ? Math.ceil(pageY * 0.2) : 1;
		scroll++;
		scrollBy(0,-pageY);
		setTimeout("pageScroll()", 20);
	} else {
		scrollTo(0, 0);
		scroll = 1;
	}
}


/* オープンウィンドウ　複数・単数
_____________________________________________________*/
function page(n){
		window.open(n+".html","page","width=700,height=640,scrollbars")
	}
function openwin(){
	window.open("○○.html","","width=450,height=450")
}



/* ポップアップウインドウ
_____________________________________________________
function openNewWindow(URLtoOpen, windowName, windowFeatures) { 
	newWindow=window.open(URLtoOpen, windowName, windowFeatures);
	}
*/
	

