/*
--------------------------------------------------
  Scrolling Script (2007.02.21)
  (C)2007 avex network All rights reserved.

  ex :::> onclick="pageTop(); return false;"

--------------------------------------------------*/

// Screen WinIE
var ua = navigator.userAgent.toLowerCase();
var Win = ua.indexOf("windows") != -1 ? true:false;
var IE = ua.indexOf("msie") != -1 ? true:false;
// Preference
var timerID;
var targetX = 0;
var targetY = 0;
if (Win && IE) {
	var deccel = 2;
} else {
	var deccel = 3;
}
var millisec = 33;
var setDist = 0.75;
// Execute
function pageTop() {
	timerID = setInterval("scrolling()", millisec);
}
// Make scrolling progress
function scrolling() {
	var distX = targetX - getLeft();
	var distY = targetY - getTop();
	speedX = distX / deccel;
	speedY = distY / deccel;
	if (Math.abs(speedX) <= setDist && Math.abs(speedY) <= setDist) {
		window.scrollTo(targetX,targetY);
		clearInterval(timerID);
	} else {
		window.scrollBy(speedX,speedY);
	}
}
// Current position form TOP
function getTop() {
	if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
		return document.documentElement.scrollTop;
	} else if (document.body && document.all) { // all other Explorers
		return document.body.scrollTop;
	} else if (window.pageYOffset != undefined) { // all except Explorer
		return window.pageYOffset;
	} else {
		return 0;
	}
}
// Current position form LEFT
function getLeft() {
	if (document.documentElement && document.documentElement.scrollLeft) { // Explorer 6 Strict
		return document.documentElement.scrollLeft;
	} else if (document.body && document.all) { // all other Explorers
		return document.body.scrollLeft;
	} else if (window.pageXOffset != undefined) { // all except Explorer
		return window.pageXOffset;
	} else {
		return 0;
	}
}





var ua = navigator.userAgent.toLowerCase();
var win = ua.indexOf("windows") != -1 ? true:false;
var ie = ua.indexOf("msie") != -1 ? true:false;
var opera = ua.indexOf("opera") != -1 ? true:false;

if (win && ie) {
	if (!opera) {
		document.write('<link rel="stylesheet" type="text/css" media="screen" href="css/screenWinIE.css">');
	}
}


/*window open*/
function openWin(URL,feature) {
	var wo = window.open(URL,"newWin",feature);
	wo.focus();
}

