// Banner Refresh Object
// (C) Copyright 2009, AMR Systems, LLC

var BannerRefresh = {
	_refresh_ads: false,
//Initialization function for the Banner Refresh Object
	init: function() {
		this._refresh_ads = true;
		BannerRefresh.AdsRefresh();
	},
//Checks to refresh ads
	SetRefresh: function() {
		if(this._refresh_ads){
			BannerRefresh.AdsRefresh();
		}
	},
//Sets the Refresh Ads Boolean to True	
	SetTimeoutRefresh: function() {
		this._refresh_ads = true;
	},
//Checks to see if the refresh ads boolean is set to true. 
//If True, create random cb numbers for openx and reset the ad iframes on the site	
//Set boolean back to false and function recalls itself in 60 seconds
	AdsRefresh: function() {

			//Top Banner Ad
			//var m3_r = Math.floor(Math.random()*99999999999);
			//$('topad').src = 'http://www.supercook.com/openx/www/delivery/afr.php?n=a00884f7&zoneid=1&cb='+m3_r;
			//Right Side Banner Ad
			if($('rightad')){
				m3_r = Math.floor(Math.random()*99999999999);
				$('rightad').src = 'http://www.supercook.com/ads/right.html?x='+m3_r;
			}
			//Bottom Banner Ad
			if($('ad_content')){
				m3_r = Math.floor(Math.random()*99999999999);
				$('ad_content').src = 'http://www.supercook.com/ads/square.html?x='+m3_r;
			}
			this._refresh_ads = false;
			t=setTimeout('BannerRefresh.SetTimeoutRefresh()',60000); //60 Seconds
	}
}
