window.onload = function(){
	add_chimg("product_btn");
	add_chimg("blog_btn");
	add_chimg("bbs_btn");
	add_chimg("link_btn");
	add_chimg("about_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*9/10-1);
	if(y>0){setTimeout("ease_scroll()", 5);}
}
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 popupWindow(url){
	window.open(
		url,
		null,
		"width=600,height=450,menubar=no,location=no,status=no,toolbar=no,scrollbars=no");
}

function email(account,host){
	mailAddress=account+'@'+host;
	document.write("<a href=\"mailto:"+mailAddress+"\">"+mailAddress+"</a>");
}