function trackLoadedAd(Advertisement_ID) {

	var sPath = window.location.pathname;

	var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);

	if(document.images){
		(new Image()).src="http://www.ourmainbeach.com.au/AdDirector?cmd=TrackLoad&Page="+sPage+"&Advertisement_ID="+Advertisement_ID+"&loc="+document.location;
	}
	return true;
}


var refreshTime = 15000;

var numAds = 1;

function makeAd() {

	this.object_code = ''

}

var ads = new Array()
for(var i = 1; i <= numAds; i++) { ads[i] = new makeAd() }

i = 1;

//Ad3

ads[i].object_code += ('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash.swf?ClickTAG=http://www.ourmainbeach.com.au/AdDirector?Advertisement_ID=3lash.cab#version=5,0,0,0" width="120" height="600" id="wilson" align="middle">\n')
ads[i].object_code += ('<param name="allowScriptAccess" value="sameDomain" />\n')
ads[i].object_code += ('<param name="movie" value="../../main-beach/videos/wilson.swf?ClickTAG=http://www.ourmainbeach.com.au/AdDirector?Advertisement_ID=3" /><param name="quality" value="high" /><param name="bgcolor" value="#075138" /><embed src="../../main-beach/videos/wilson.swf?ClickTAG=http://www.ourmainbeach.com.au/AdDirector?Advertisement_ID=3" quality="high" bgcolor="#075138" width="120" height="600" name="wilson" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n')

ads[i].Advertisement_ID = '3'
i++

var myCode = '';
do {
var n= Math.floor(Math.random() * (numAds + 1) + 1);
} while(n > numAds);
var current_ad = n;
myCode = getCode(n);

function getCode(adNumber){
	trackLoadedAd(ads[adNumber].Advertisement_ID);
	var tempCode = ""

	tempCode += ads[adNumber].object_code 

	return tempCode;
	}

function newAd(){
	current_ad++;
	if (current_ad > numAds)
		current_ad = 1;
	if (document.all){
		write(getCode(current_ad));
		}
}

function write(text){
	if (document.layers) {
		document.bannerAd.document.write(text)
		document.bannerAd.document.close();
		}
	else
	if (document.all)
	document.all.bannerAd.innerHTML = text

}
