AdWriter = {
	them: 'http://ad.doubleclick.net/',
	us: '/straightdope.creativeloafing/',
	slots: 	{
						'1': { type: 'leaderboard', width: '728', height: '90' },
						'3': { type: 'skyscraper', width: '160', height: '600' },
						'4' : { type: 'rectangle', width: '300', height: '250' }
					},

	randomNumber : Math.round(Math.random() * 20000),

	getAd: function (slot, pageKeyword, zoneKeyword) {
		var size = 'sz=' + this.slots[slot].width + 'x' + this.slots[slot].height + ';';
		var tile = 'tile=' + slot + ';';
		var key = (pageKeyword == '') ? '' : 'pg=' + pageKeyword + ';';
		var zone = zoneKeyword + ';';
		var inter = (slot == 1) ? 'dcopt=ist;' : '';
		var path = this.us + zone + key + size + inter + tile + 'ord=' + this.randomNumber + '?';
		var iframe = '<iframe src="' + this.them + 'adi' + path + '" width="' + this.slots[slot].width + '" height="' + this.slots[slot].height + '" class="' + this.slots[slot].type + '" scrolling="no" frameborder="0">';
		var href = '<a href="' + this.them + 'jump' + path + '">';
		var img = '<img src="' + this.them + 'ad' + path + '" width="' + this.slots[slot].width + '" height="' + this.slots[slot].height + '" alt="">';

		var adHtml = '<div class="advertCaption"></div>' + iframe + href + img + '</a>' + '</iframe>'

		if (slot == 1) {
			adHtml = '<div id="topAdvert">' + adHtml + '</div>';
		}

		return adHtml;
	}
}
