// 画像の入れ換えとフェードインアウト



window.onload = function(){
	setInterval("album.swapImage()", 11000);
				setTimeout("fadeIn1()",500); 
				setTimeout("fadeOut1()",7000);
				
				setTimeout("fadeIn2()",500); 
				setTimeout("fadeOut2()",7000);

}

//albumは連想配列を使っている。imageURL1からcount2までが配列なので区切りが，となっている

var album = {
	imageURL1 : [
							"img/before_kiji.gif",
							"img/before_kuro.gif",
							"img/before_taro.gif",
							"img/before_atom.gif",
							"img/before_mike.gif",
							"img/before_tail.gif"
							],
	
	imageURL2 : [
							"img/after_kiji.gif",
							"img/after_kuro.gif",
							"img/after_taro.gif",
							"img/after_atom.gif",
							"img/after_mike.gif",
							"img/after_tail.gif"
							],

	
	swapImage : function(){
		this.count1++;
		this.count2++;
		if (this.count1 >= this.imageURL1.length) this.count1 = 0;
		if (this.count2 >= this.imageURL2.length) this.count2 = 0;
		
		document.getElementById("before").src = this.imageURL1[this.count1];
		document.getElementById("after").src = this.imageURL2[this.count2];
			setTimeout("fadeIn1()",500); 
			setTimeout("fadeOut1()",7000);
			setTimeout("fadeIn2()",500); 
			setTimeout("fadeOut2()",7000);
	},
	count1 : 0,
	count2 : 0

};




function fadeIn1(){
	new Spry.Effect.DoFade("before",{ duration:4000,from:0,to:100 });
	}

function fadeOut1(){
		new Spry.Effect.DoFade("before",{ duration:4000,from:100,to:0 });

	}
	


function fadeIn2(){
	new Spry.Effect.DoFade("after",{ duration:4000,from:0,to:100 });
	}

function fadeOut2(){
	new Spry.Effect.DoFade("after",{ duration:4000,from:100,to:0 });

	}