

function writeAds(dartAd) 
{

	var ord = Math.floor(Math.random() * 1000000000000000000);
	
	var numberOfSeconds = 60;


	{
		var elementList = [document.getElementById('adi_top'),

							document.getElementById('adi_right'),

							document.getElementById('adi_bottom')];

		var i = 0;

		while (i<3) {

			e = elementList[i];

			if(e != null && e != undefined) {

				var div = e.parentNode;

				if(navigator.appName=="Netscape") {

					div = e.parentNode.parentNode;

				}

				div.removeChild(div.firstChild);

			}

			i++;

		}
	}
	
	/*var strDart = '';
	strDart += s.channel + ';';
	strDart += 'sub=' + s.prop3 + ';';
	strDart += 'prod=' + s.prop3 + ';';
	strDart += 'n=' + s.pageName + ';';
	*/
	
	//writeReloadingIFad('topAd', 'top', 728, 90, 1, 'community;sub=chat;prod=chat;n=chat', ord);

	//writeReloadingIFad('rightAd', 'right', 160, 600, 2, 'community;sub=chat;prod=chat;n=chat;p=r', ord);

	//writeReloadingIFad('bottomAd', 'bottom', 728, 90, 3, 'community;sub=chat;prod=chat;n=chat;p=r', ord);
	
	
	writeReloadingIFad('topAd', 'top', 728, 90, 1, dartAd, ord);
	writeReloadingIFad('rightAd', 'right', 160, 600, 2, dartAd, ord);
	writeReloadingIFad('bottomAd', 'bottom', 728, 90, 3, dartAd, ord);


	setTimeout("writeAds('"+dartAd+"')", numberOfSeconds * 1000);

}


function writeReloadingIFad(parent, id, width, height, tile, adSrc, ord) 
{	
	//alert("This is working");
	var p = document.getElementById(parent);

	if (jsDartVars != "") {
		adSrc = adSrc + jsDartVars;
	}
	var adString='<nolayer>';
	adString +=	'<iframe id="adi_' + id + '" src="http://ad.doubleclick.net/adi/www.bet.com/' + adSrc +';sz=' + width + 'x' + height + ';tile=' + tile + ';ord=' + ord + '?" width="' + width + '" height="' + height + '" frameborder="0" border="0" marginwidth="0" marginheight="0"  scrolling="no" style="height: ' + height + '; width: ' + width + '>';
	//adString +=	'<a href="http://ad.doubleclick.net/jump/www.bet.com/' + adSrc + ';abr=!ie;target=_blank;sz=' + width + 'x' + height + ';tile=' + tile + ';ord=' + ord + '?"><img src="http://ad.doubleclick.net/ad/www.bet.com/' + adSrc + ';abr=!ie;sz=' + width + 'x' + height + ';tile=' + tile + ';ord=' + ord + '?" border=0 height="' + height + '" width="' + width + '" target="_blank"></a>';
	adString +=	'</iframe>';
	adString += '</nolayer>';
	adString += '<ilayer id="ad_' + id + '" visibility="hidden" width=' + width + ' height=' + height + '></ilayer>';

	//alert("This is working before");
	
	p.innerHTML = adString;

	id="adi_"+id;
	//alert("This is working after");

}
