ad_img_ids = new Array();
ad_current_index = 0;
function _main_ad_autoswitch ( timeout ) {
	n = ad_img_ids[ad_current_index];
	ad_current_index++;
	if (ad_current_index >= ad_img_ids.length) {
		ad_current_index = 0;
	}
	m = ad_img_ids[ad_current_index];
	Effect.Fade(n, {afterFinish: function () {new Effect.Grow(m)}});
	//Effect.Shrink(n, {afterFinish: function () {new Effect.Grow(m)}});
	setTimeout('_main_ad_autoswitch('+timeout+')', timeout);
}

function main_ad_autoswitch ( timeout ) {
	imgs = document.getElementById('ad_img');
	//
	//javascript hack:
	//		因为如果有多余空字符，FireFox会多出一些Text的ChildNode，
	//		所以干脆都先缩一下，省得出现Text子项！
	//
	imgs.innerHTML = imgs.innerHTML.replace(/\s*</g, '<');
	imgs.innerHTML = imgs.innerHTML.replace(/>\s*/g, '>');
	for (i=0;i<10;i++) {
		img = imgs.childNodes[i];
		if (typeof(img)=='undefined' || img.tagName != 'DIV' || img.id=='') {
			break;
		}
		ad_img_ids[i] = img.id;
	}
	
	setTimeout('_main_ad_autoswitch('+timeout+')', timeout);
}