// JavaScript Document

var imgLen = 52; // 画像最大枚数
var setLen = 4; // 画像設置枚数
var numList = new Array();
for(i = 0; i < setLen; i++) {
	if(numList.length == 0) {
		numList.push(getRandom(imgLen));
	} else {
		rNum = getRandom(imgLen);
		numListLen = numList.length;
		for(j = 0; j < numListLen; j++) {
			if(numList[j] == rNum) {
				i--;
				break;
			} else if(j == numList.length - 1) {
				numList.push(rNum);
			}
		}
	}
}

$(document).ready(function() {
	$("div#hsLinkList ul li").each(function() {
		setTxt = $(this).html();
		if(jQuery.browser.msie && parseInt(jQuery.browser.version) == 6){
			$("a", this).bind("mouseover", function() {
				$(this).css("opacity", "0")
			}).bind("mouseout", function() {
				$(this).animate({
					opacity: 1.0
				});
			});
		} else {
			$(this).html('<div class="imgBox png_bg"><div></div>' + setTxt + '</div>').find("a").css("background", "none").css("position", "absolute").css("top", "0").css("left", "0").bind("mouseover", function() {
				$(this).parent().find("div").css("opacity", "0");
			}).bind("mouseout", function() {
				$(this).parent().find("div:not(:animated)").animate({
					opacity: 1
				}, "slow");
			});
		}
	});

	setNum = 0;
	$("ul#hsImgList li").each(function() {
		$("img", this).attr("src", $("img", this).attr("src").replace(/topImage\_(.+)\.(gif|jpg|png)/, "topImage_" + numList[setNum] + ".$2"));
		setNum++;
	});
});

function getRandom(maxNum) {
	rNum = Math.ceil(maxNum * Math.random());
	return rNum
}
