/* image.js : imageの操作をするスクリプト */

<!-- rollover //-->
function rolloverOn(imageName){
	if (document.images){
	   	document.images[imageName].src="./image/btn/" + imageName + "2.gif";
   }
}

function rolloverOff(imageName){
	if (document.images){
		document.images[imageName].src="./image/btn/" + imageName + "1.gif";
	}
}
<!-- rollover ここまで //-->

<!-- 左に移動 //-->
var s;  //-- 移動ステップ
var t;  //-- 割り込み間隔
var pw1, p;  // imageの幅,image番号
var count, timer;
var maxX; //表示ウィンドウの幅
var offset;
var i, ie;  // 繰り返しカウント、回数

function move(){
	if (document.getElementById) {
		poto = document.getElementById("img0");
	}
	i=0;
	count=0;
	timer = setTimeout("moveL()",3000);
}

function moveL(){

   getWinSize();
   getPsize();
    s = 1;
    t = 30;
   ie = 10;
   offset = (maxX-pw1)/2;
   count -= s;

	if (offset>=0) {
   		if (count < -(offset+pw1)) {
			changImg();
        		count= pw1+offset;  //-- image start position
			i++;
   		}
   	}

   	if (offset<0) {
   		if (count < -(-offset+pw1)) {
			changImg();
        		count= pw1-offset;  //-- image start position
			i++;
   		}	
   	}

   	poto.style.left = count;
   	timer = setTimeout("moveL()",t);
// 指定繰り返し回数で止める
   	if ( i>= ie ) {
		p=10;
		document.images["photo1"].src= "./icon/img" + p + ".gif";
		count=0;
   		poto.style.left = count;
		stopTimer();
	}
}

function stopTimer() {
	clearTimeout(timer);
}


//--Imageの入れ替え
function changImg() {

	if ( p <= 5 ) {
		p=10;
	} else {
		p=parseInt(Math.random() * 10);
		while (p >=6 ) {  p=parseInt(Math.random() * 10) }
	}
    	document.images["photo1"].src= "./icon/img" + p + ".gif";
}

function getPsize(){
    	pw1 = document.images["photo1"].width;
}

function getWinSize(){
   	if (document.documentElement.clientWidth)  {
	  	maxX = document.documentElement.clientWidth;
   	} else if (document.body.clientWidth) {
	  	maxX = document.body.clientWidth;
   	} else if (window.innerWidth) {
	  	maxX = window.innerWidth;
   	}
}
<!-- 左に移動 end //-->

<!-- 曜日によって画像と名前を入れ替える //-->
var now = new Date();
var day = now.getDay();
var txt1;

function changeImgA(){
  var pn;
	if (document.getElementById) {
		txt1 = document.getElementById("sp1");
		txt2 = document.getElementById("sp2");
	}

	if ( (Math.round(day/2)-day/2) == 0){
    		pn=1;
		txt1="中の滝";
	} else{ pn=3;
		txt1="西の滝";
	}
	if (document.images){
    		document.images["photo2"].src= "../2003/photo/takimi/taki-" + pn + ".jpg";
	}
	changetxt();
}

function changeImgB(){
//--  var dayPhot = new Array("1","2","3","4","5","6","7");
  var dayTxt = new Array("群生","シャクナゲ","原始の森","アケボノツツジ","幽谷を彩る","バイケイソウ","ブナの新緑");

	if (document.images){
    		document.images["photo2"].src= "http://oodai.net/H-essay/gallery" + (day+1) + ".jpg";
	}
	txt1 = dayTxt[day];
	changetxt();
}

function changeImgC(){

  var dayTxt = new Array("群生","シャクナゲ","原始の森","アケボノツツジ","幽谷を彩る","バイケイソウ","ブナの新緑");

	if (document.images){
    		document.images["photo2"].src= "http://oodai.net/H-essay/foto" + (day+20) + "s.jpg";
	}
}
function changetxt(){
	if (document.getElementById){
		table = document.getElementById("div1");
		txt = document.getElementById("text");
		txt.style.fontSize= 10 + "px" ;
		txt.style.color="#008080";
		txt.innerHTML = txt1;
	}
}
<!-- 曜日によって画像を入れ替える end //-->
