//================================================
//  ロールオーバー
//================================================

function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_off."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
				}
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}



//================================================
//  スクロールページトップ
//================================================

function Scrolling(pFrom, pTo) {
	this.pFrom = pFrom;
	this.pTo   = pTo;
	this.step  = 0;
}
Scrolling.prototype.MAXSTEPS = 100;
Scrolling.prototype.CURVE = 0.9;
Scrolling.prototype.run = function() {
	++this.step;
	var x = this.pTo.x - Math.pow(this.CURVE, this.step) * (this.pTo.x - this.pFrom.x);
	var y = this.pTo.y - Math.pow(this.CURVE, this.step) * (this.pTo.y - this.pFrom.y);
	window.scrollTo(x, y);
	return this.step >= this.MAXSTEPS;
};

function beginScroll(hash) {
	var cpos = new CurPoint(); location = hash;
	var dpos = new CurPoint(); window.scrollTo(cpos.x, cpos.y);
	var scr = new Scrolling(cpos, dpos);
	scr.iid = setInterval(function() { if (scr.run()) clearInterval(scr.iid); }, 10);
}

if (document.all) {
	if (document.compatMode == "CSS1Compat") {
		CurPoint = function () {
			this.x = document.documentElement.scrollLeft;
			this.y = document.documentElement.scrollTop;
		};
	} else {
		CurPoint = function () {
			this.x = document.body.scrollLeft;
			this.y = document.body.scrollTop;
		};
	}
} else if (window.pageXOffset !== undefined) {
	CurPoint = function () {
		this.x = window.pageXOffset;
		this.y = window.pageYOffset;
	};
} else {
	CurPoint = function () {
		this.x = window.scrollX;
		this.y = window.scrollY;
	};
}



//================================================
//  メールマガジンリンク
//================================================
function MailMagazine() {
	window.open("mailmaga.html", "mailmagazine", "width=340, height=715");
}





