function rotateAd(adContainer, server, adPath, reps, delay) {
	for (i = 0; i < reps; i++) {
		setTimeout("switchAd('" + adContainer + "', '" + server + "', '" + adPath + "')", delay * 1000 * i);
	}
}
	
function switchAd(adContainer, server, adPath) {
	var rotatingAd = server + '/javascripts/RotatingAd' + '?adurl=' + server + adPath + getCoreVars();
	//window.frames[adContainer].window.location.replace(rotatingAd);
	frames[adContainer].location.replace(rotatingAd);
}

function getCoreVars() {
	var coreVars = '';
	
	if (mychip != null) { coreVars += '&mychip=' + mychip; }
	if (a != null) { coreVars += '&a=' + a; }
	if (r != null) { coreVars += '&r=' + r; }
	if (rand != null) { coreVars += '&rand=' + rand; }
	if (sr != null) { coreVars += '&sr=' + sr; }
	if (st != null) { coreVars += '&st=' + st; }
	if (z != null) { coreVars += '&z=' + z; }
	
	return coreVars;
}