
/* smooze scroll */
function doBackScroll() {
    var pos = getScrollPosition();
    window.scrollTo(Math.max(Math.floor(pos.x / 2),0), Math.max(Math.floor(pos.y - (pos.y / 5)),0));
    if (pos.x > 0 || pos.y > 0) {
        window.setTimeout("doBackScroll()", 35);
        return false;
    }
}
function getScrollPosition() {
    var obj = new Object();
    obj.x = document.body.scrollLeft || document.documentElement.scrollLeft;
    obj.y = document.body.scrollTop || document.documentElement.scrollTop;
    return obj;
}
function addListener(elem, eventType, funcRef, capture) {
    if(!elem) { return false; }
    if(elem.addEventListener) {
        elem.addEventListener(eventType, funcRef, capture);
    } else if(elem.attachEvent) {
        elem.attachEvent('on' + eventType, funcRef);
    } else {
        return false;
    }
    return true;
}
function addLoadListener(e) {
    addListener(document.getElementById('bttlink'), 'click', doBackScroll, false);
}
addListener(window, 'load', addLoadListener, false);


/* print out */
function print_out() {
	if (navigator.userAgent.match(/msie (\d)/i))
		v = (eval(RegExp.$1) >= 5) ? 1 : 0;
	else if (self.innerWidth)
		v = (eval(navigator.appVersion.charAt(0)) >= 4) ? 1 : 0;
	else v = 0;

	if (v) self.print();
	else alert("お使いのブラウザではこの印刷呼び出し機能は利用できません");
}


function newWindow(loc,wnd) {
	if (wnd==null){
		wnd="";
	}
	var myWindow = window.open(loc, wnd, "width=520,height=350,resizable=yes,scrollbars=yes,location=yes");

	if (myWindow.focus!=null) {
	myWindow.focus();
	}
}
