if(!window.loadAdvertisement){
	window.loadAdvertisement = function(){
		var thisAd = window.ads.shift();
		var zone = thisAd[0];
		var block = thisAd[1];
		var bind = thisAd[2];
		var blockcampaign = thisAd[3];
		window.currentAd = bind; // use to check to see if the ad is loaded!
		if (!document.phpAds_used) document.phpAds_used = ',';
		phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);

		var adsURL = "http://boards.collectors-society.com/ads/adjs_latebind.php?n=" + phpAds_random;
		adsURL += "&what=zone:" + zone;
		adsURL += "&bind=" + bind;
		adsURL += "&exclude=" + document.phpAds_used;
		if (block) {
			adsURL += "&block=" + block;
		}
		if (blockcampaign) {
			adsURL += "&blockcampaign=" + blockcampaign;
		}
		if (document.referrer) {
			adsURL += "&referer=" + escape(document.referrer);
		}
		
		var scriptblock = document.createElement("script");
		scriptblock.src = adsURL;
		document.getElementsByTagName("head")[0].appendChild(scriptblock);
	};
	//over riding the block and blockcampaign variables to 1 is necessary to prevent duplicate ads showing up.
	window.registerAd = function(zone, block, bind, blockcampaign){
		if(!window.ads){window.ads = new Array();}
		window.ads[window.ads.length] = new Array(zone, "1", bind, "1");
	};
	window.showAds = function() {
		if(loadAd()){
			window.setTimeout(window.showAds, 50); // keep trying until we're out of ads!
		}
	}
	window.loadAd = function(){
		if ( window.ads.length <= 0 ){
			return false; // out of ads, quit trying.
		}
		if (!window.currentAd || document.getElementById(window.currentAd).innerHTML != ""){
			// there's no ad currently processing
			loadAdvertisement();
		} 
		return true; // keep trying to load more ads
	};
}
