/* window open
----------------------------------------------- */
function subwindow(url) {
	var w = window.open(url,"infowindow","resizable=yes,toolbar=yes,scrollbars=yes,width=600,top=0,left=0");
	w.focus();
}

/* ホームへ戻る
----------------------------------------------- */
function home(url) {
	page = url;
	move(30,page);
}


/* 飛行士飛翔
----------------------------------------------- */
function move(y,url) {

	var nv = navigator.userAgent;
	var astronaut = document.getElementById("astronaut");

	if (nv.match(new RegExp("MSIE 7", "i"))) {
		var screenW = document.documentElement.clientWidth;
		var screenH = document.documentElement.clientHeight;
	}
	else if (document.all) {
		var screenW = document.body.offsetWidth;
		var screenH = document.body.offsetHeight;
	}
	else {
		var screenW = window.innerWidth;
		var screenH = window.innerHeight;
	}

	page = url;
	yp = y;

	yp = y + ((-130 - y) / 5);
	astronaut.style.top = yp + "px";
	
	if (yp < -129) {
		window.location.href = url;
		clearTimeout();
	}
	else {
		setTimeout("move(yp,page)",50);
	}
}


/* 表示位置固定
----------------------------------------------- */
window.onload = function() { window.onresize(); }
window.onunload = function() { window.onresize(); }
window.onresize = function() {
	var nv = navigator.userAgent;
	var ob1 = document.getElementById("astronaut");
	var ob2 = document.getElementById("shuttle");

	if (nv.match(new RegExp("MSIE 6", "i"))) { floatbt(); return false; }
	else if (nv.match(new RegExp("Netscape", "i"))) {
		astro_x = (document.documentElement.offsetWidth / 2) - 482;
		shutt_x = document.documentElement.offsetWidth / 2 + 390;
	}
	else if (nv.match(new RegExp("Firefox", "i"))) {
		astro_x = (document.documentElement.offsetWidth / 2) - 482;
		shutt_x = document.documentElement.offsetWidth / 2 + 390;
	}
	else if (nv.match(new RegExp("MSIE 7", "i"))) {
		astro_x = (document.documentElement.offsetWidth / 2) - 480;
		shutt_x = document.documentElement.offsetWidth / 2 + 391;
	}
	else {
		astro_x = (document.documentElement.offsetWidth / 2) - 481;
		shutt_x = document.documentElement.offsetWidth / 2 + 390;
	}

	ob1.style.position = "fixed";
	ob1.style.left = astro_x + "px"
	ob1.style.top = "30px";

	ob2.style.position = "fixed";
	ob2.style.left = shutt_x + "px"
	ob2.style.bottom = "10px";

}
function floatbt() {
	var ob1 = document.getElementById("astronaut");
	var ob2 = document.getElementById("shuttle");

	ob1.style.position = "absolute";
	ob1.style.left = (document.body.offsetWidth / 2) - 491 + "px"
	ob1.style.top = document.body.scrollTop + 30 + "px";

	ob2.style.position = "absolute";
	ob2.style.left = (document.body.offsetWidth / 2) + 390 + "px"
	ob2.style.top = document.body.offsetHeight + document.body.scrollTop - 122 + "px";

	setTimeout("floatbt()", 5);
}


/* page up
----------------------------------------------- */
function pageup() {
	var nv = navigator.userAgent;
	if (nv.match(new RegExp("MSIE 7", "i"))) { posi = document.documentElement.scrollTop; }
else if (document.all) { posi = document.body.scrollTop; }
	else { posi = window.pageYOffset; }
	moveObje(posi);
}
function moveObje(position) {
	move = position / 10;
	point = parseInt(position - move);
	scrollTo(0,point);
	if (point > 0) { setTimeout("moveObje(point)",10); }
}
