/*
 * The list of items in adBlocks matches up with the list of items in adCode. For instance, the adCode that goes in the block ad03, is the first item in adCode, and ad03 is the first item in the adBlocks variable. The names in the adBlocks varialbe match up with the ids on the page for the ads. 
 * 
 * Also, the code that goes in the adCode is the HTML version of the ad, or rather, what's in between the <noscript> tags. 
 * 
 * Currently, these ad tags have a line in each one that says "INSERT_RANDOM_NUMBER_HERE". That random number is used for cache busting, and is taken care of in the refresh function. Typically, the cache busting is handled on the ad server side, but in this case, we'll take care of it in the code.
 */

var adBlocks = [
	"ad03"
	];

var adCode = [
	"<a href='http://65.61.166.81/openads/www/delivery/ck.php?n=a82e3246&amp;cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'><img src='http://65.61.166.81/openads/www/delivery/avw.php?zoneid=88&amp;cb=INSERT_RANDOM_NUMBER_HERE&amp;n=a82e3246' border='0' alt='' /></a>"
	];

function mediaReady()
{
	refresh(adBlocks);
	var adFrame = document.getElementById('ad01');
    adFrame.src = adFrame.src;
}

function refresh(pAds)
{
	for (var i = 0; i < pAds.length; i++) 
	{
		var timestamp = new Date().getTime();
		document.getElementById(pAds[i]).innerHTML = "";
		document.getElementById(pAds[i]).innerHTML = adCode[i].replace(/INSERT_RANDOM_NUMBER_HERE/g, timestamp);
	}
}