function rotate_ads(loc, ad_set, i) {
	if (i == null) i = 0;
	
	if (adArray[ad_set].length > 0) {
		var x = adArray[ad_set][i].split('|');
		set_ad_output(loc, x[0], x[1], x[2]);
		i++;
		if (i >= adArray[ad_set].length) i = 0;
		setTimeout("rotate_ads('" + loc + "', '" + ad_set + "', '" + i + "')", x[3]);
	}	
}
function set_ad_output(loc, ximg, xlink, xtarget) {
	var output = (xlink == '' ? '' : '<a target="' + xtarget + '" href="' + xlink + '">');
	output += '<img src="' + ximg + '" />';
	output += (xlink == '' ? '' : '</a>');
	document.getElementById(loc).innerHTML = output;
}
