window.onload = function(){
	add_chimg("home_btn");
	add_chimg("game_btn");
	add_chimg("illust_btn");
	add_chimg("pict_btn");
	add_chimg("cg_btn");
	add_chimg("blog_btn");
	add_chimg("bbs_btn");
	add_chimg("link_btn");
	add_esscrll("totop");
};

function add_chimg(id){
	if(document.getElementById(id)!=null){
		new RollOverImage(document.getElementById(id));
	}
}
function add_esscrll(id){
	if(document.getElementById(id)!=null){
		new esscrller(document.getElementById(id));
	}
}


function RollOverImage(img){
	this.img = img;
	this.originalPath = this.img.src;
	this.setMouseOverImage();
}
RollOverImage.prototype.setMouseOverImage = function(){
	var originalPath = this.originalPath;
	/* 第2の画像に置き換える場合 */
	this.mouseoverImg = new Image();
	this.mouseoverImg.src = originalPath.replace(".gif","_on.gif");
	this.img.onmouseover = RollOverImage.createHandler(this.img, this.mouseoverImg.src);
	/* 元の画像に戻す場合
	this.img.onmouseout = RollOverImage.createHandler(this.img, this.originalPath);
	*/
	/* 第3の画像に置き換える場合 */
	this.mouseoutImg = new Image();
	this.mouseoutImg.src = originalPath.replace(".gif","_out.gif");
	this.img.onmouseout = RollOverImage.createHandler(this.img, this.mouseoutImg.src);
}
RollOverImage.createHandler = function(img, path){
	return function(){
		img.src = path;
	}
}


function ease_scroll(){
	y=document.documentElement.scrollTop;
	window.scroll(0,y*2/3-1);
	if(y>0){setTimeout("ease_scroll()", 20);}
}
function esscrller(obj){
	this.obj = obj;
	this.setOnClickScroll();
}
esscrller.prototype.setOnClickScroll = function(){
	this.obj.onclick = esscrller.createHandler();
}
esscrller.createHandler = function(){
	return function(){
		ease_scroll();
		return false;
	}
}

/* アクセス解析 */

function access_analyze() {
document.write("<img src='http://xilab.org/cgi/analyzer/log.cgi?mode=rec" + "&swh=" + screen.width +
     " x " + screen.height + " pixel" + "&scd=" + screen.colorDepth +
     "&ref=" + document.referrer + "' " + "width=1 height=1 />");
}



