/*
	Site Name: BS-hana
	Version: 1.0
	Author: m.yamaki
*/

var selectId;

function bestboxopen(targetId) { 
	selectId = targetId;
	var pagesize = getPageSize();
	$("overlay").style.width = pagesize[0]+"px";
	$("overlay").style.height = pagesize[1]+"px";

	new Effect.Appear(targetId, { 
		from:0.1, // 開始時透明度 
		to:1.0, // 終了時透明度 
		delay:0, // 開始までの秒数 
		fps:60, // フレームレート 
		duration: 1 // アニメーションする時間(秒)
	}); 
	new Effect.Appear("overlay", { 
		from:0.1, // 開始時透明度 
		to:0.6, // 終了時透明度 
		delay:0, // 開始までの秒数 
		fps:60, // フレームレート 
		duration: 1 // アニメーションする時間(秒)
	}); 
}
function bestboxclose() { 
	new Effect.Fade(selectId, { 
		from:1.0, // 開始時透明度 
		to:0, // 終了時透明度 
		delay:0, // 開始までの秒数 
		fps:60, // フレームレート 
		duration: 1 // アニメーションする時間(秒)
	}); 
	new Effect.Fade("overlay", { 
		from:0.6, // 開始時透明度 
		to:0, // 終了時透明度 
		delay:0, // 開始までの秒数 
		fps:60, // フレームレート 
		duration: 1 // アニメーションする時間(秒)
	}); 
}

function getPageSize() {
		
	     var xScroll, yScroll;
		
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		
		var windowWidth, windowHeight;
		
		if (self.innerHeight) {	// all except Explorer
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
	
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = xScroll;		
		} else {
			pageWidth = windowWidth;
		}

		return [pageWidth,pageHeight];
	}


 function changeImg(imgSrc) {
	document.getElementById('changephoto').src = imgSrc;
}
 function changeImg2(imgSrc) {
	document.getElementById('changephoto2').src = imgSrc;
}
 function changeImg3(imgSrc) {
	document.getElementById('changephoto3').src = imgSrc;
}
 function changeImg4(imgSrc) {
	document.getElementById('changephoto4').src = imgSrc;
}
 function changeImg5(imgSrc) {
	document.getElementById('changephoto5').src = imgSrc;
}
 function changeImg6(imgSrc) {
	document.getElementById('changephoto6').src = imgSrc;
}
