// for using colorbox
$(document).ready(function(){
	//Example of preserving a JavaScript event for inline calls.
	$("#tomail").colorbox({width:"860px", inline:true, href:"#mailform", title:"メール送信"});
	$("#question").colorbox({width:"860px", inline:true, href:"#answer", title:"Q&amp;A"});

	var i = 0;
	var image = new Array();
	//予め画像を読み込む
	$("div#thumb li img").each(function(){
		i++;
		thumbSRC = $(this).attr("src");
		if(thumbSRC == "/img/noimage/80_40.gif"){
			imgSRC = "/img/noimage/800_400.gif";
		}
		else{
			imgSRC = thumbSRC.replace("_s","");
		}
		//大きい画像を読み込み
		image[i] = new Image();
		image[i].imgSRC;
	});
});


// for using clossfade gallery
$(function(){
	$("#thumb img").hover(function(){
		//loadingを削除
		//サムネイルの画像URLを取得   
		thumbURL = $(this).attr("src");
		//サムネイルの画像URLを大きい画像URLに書き換え

		if(thumbURL == "/img/noimage/80_40.gif"){
			imgURL = "/img/noimage/800_400.gif";
		}
		else{
			imgURL = thumbURL.replace("_s","");
		}

		photoURL = $("#photo").attr("src");
		if(photoURL != imgURL){
			//大きい画像を読み込み
//			var image = new Image();
//			image.imgURL;
			//Loading画像を表示
			//画像をフェードアウト
			$("#photo").fadeOut(
				"nomal", 
				function() {
					//大きい画像の入れ替え 
					$("#photo").attr("src", imgURL);
					//画像の読み込みが完了したら…   
//					$("#photo").load(function () {
						//フェードイン   
						$("#photo").fadeIn(2000);
//					});
				}
			);
		}
	});
}); 

