$(document).ready( function(){
	//「a」タグに対して動作を定義する。
	//hoverメソッドでonmouseoverとonmouseoutが一気に指定できる。
	$('.Rbox1').hover(
		//over時の動作指定
		function(){
			//parentでaの一つ上のHTML要素つまり親要素を取得できる。
			//そしてその取得した親要素に対してcssメソッドで背景色を変更
			$(this).parent().css( 'background-position', 'bottom' );
		}
		,
		//out時の動作指定
		function(){
			//over時と同じ。色を元に戻している。
			$(this).parent().css( 'background-position', 'top' );
		}
	);
	$('.Rbox2').hover(
		//over時の動作指定
		function(){
			//parentでaの一つ上のHTML要素つまり親要素を取得できる。
			//そしてその取得した親要素に対してcssメソッドで背景色を変更
			$(this).parent().css( 'background-position', 'center' );
		}
		,
		//out時の動作指定
		function(){
			//over時と同じ。色を元に戻している。
			$(this).parent().css( 'background-position', 'top' );
		}
	);
});
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);
}
