//=============================================================================
//	OS & Browser Check関数
//=============================================================================
function osCheck(obj) {
	var Agent = navigator.userAgent;
	
	if (Agent.indexOf("Safari") != -1) {
		document.write("<link rel=\"stylesheet\" href=\"css/safari.css\" type=\"text/css\" media=\"all\" />");
		return;
	}
	else if (Agent.indexOf("Opera") != -1) {
		document.write("<link rel=\"stylesheet\" href=\"css/opera.css\" type=\"text/css\" media=\"all\" />");
		return;
	}
	else if (Agent.indexOf("Firefox") != -1) {
		if (Agent.indexOf("Windows NT 5.1") != -1) {
			document.write("<link rel=\"stylesheet\" href=\"css/xp_ff.css\" type=\"text/css\" media=\"all\" />");
			return;
		}
		else if (Agent.indexOf("Windows NT 6.0") != -1) {
			document.write("<link rel=\"stylesheet\" href=\"css/vista_ff.css\" type=\"text/css\" media=\"all\" />");
			return;
		}
	}
	else if (Agent.indexOf("MSIE 7") != -1) {
		document.write("<link rel=\"stylesheet\" href=\"css/ie7.css\" type=\"text/css\" media=\"all\" />");
		return;
	}
	else if (Agent.indexOf("MSIE 6.0") != -1) {
		document.write("<link rel=\"stylesheet\" href=\"css/ie6.css\" type=\"text/css\" media=\"all\" />");
		return;
	}
}



//=============================================================================
//	Move to Page Top Function
//=============================================================================
var movePageTop = function() {
	var agent = navigator.appName;
	var posY = document.getElementById("pagetop").offsetTop;
	var x1 = x2 = x3 = 0;
	var y1 = y2 = y3 = 0;
	
	//Select Browser
	if(agent = "Microsoft Internet Explorer") {
		posY+=50;
	}
	
	if (document.documentElement) {
		x1 = document.documentElement.scrollLeft || 0;
		y1 = document.documentElement.scrollTop || 0;
	}
	if (document.body) {
		x2 = document.body.scrollLeft || 0;
		y2 = document.body.scrollTop || 0;
	}
	
	x3 = window.scrollX || 0;
	y3 = window.scrollY || 0;
	
	var x = Math.max(x1, Math.max(x2, x3));
	var y = Math.max(y1, Math.max(y2, y3));
	
	if(y <= posY) {
		window.scrollTo(Math.floor(x / 2 * 1.6), Math.floor(y / 2 * 1.6));
	}
	else {
		window.scrollTo(x, posY);
	}

	if (x > 0 || y > 0) {
		window.setTimeout("movePageTop()", 25);
	}
}
