var sw = 0;
//広告表示切り替え時間（秒）
var adv_interval = 5;

function changeBanner() {
	if (image.length > 1) {
		setTimeout("changeBanner()", 1000 * adv_interval);

		// var e = document.adv;
		var e = document.getElementById('adv');
		if (e) {
			e.innerHTML = createElement(image[sw]);
		}

		sw = sw + 1;
		if (sw >= image.length) {
			sw = 0;
			image = shuffleList(image);

		}
	}
}

function createElement(img) {
	var str = "";
	
	str = "<a href='banner/ctrl.jsp?id="
		+ img.id
		+ "' target='_blank'><img alt='"
		+ img.outline
		+ "' src='"
		+ img.img
		+ "' width='150' height='60' class='imgframe'></a>";
	return str;
}

function shuffleList(list) {
	var i = list.length;

	while (--i) {
		var j = Math.floor(Math.random() * (i + 1));
		if (i == j)
			continue;
		var k = list[i];
		list[i] = list[j];
		list[j] = k;
	}

	return list;
}

