// time between switching the ad, in milliseconds -\\
var refreshTime = 7000; //- 5000 ms = 5 seconds -\\

// number of ads to rotate -\\
var numAds = 4;

function makeAd() {
	this.width = ''
	this.height = ''
	this.src = ''
	this.href = ''
	this.mouseover = ''
	this.header = ''
}

var ads = new Array()
for(var i = 1; i <= numAds; i++) { ads[i] = new makeAd() }

//Copy and paste the lines between the banner definition for 
//each banner you want to rotate and be sure to change numAds to 
//the number of banners (look about 15 lines up for numAds)
i = 1;

/*------------begin banner definition----------*/
ads[i].width = "180" //width of image
ads[i].height = "93" //height of image
ads[i].src = "http://www.cgswdc.com/images/Ad_CountryOakShepherds.png" //image url
ads[i].href = "http://www.countryoakshepherds.com/" //link url
ads[i].mouseover = "Country Oak Shepherds" //text to display when mouse moves over banner
ads[i].header = "GSD Breeder Advertisement " //text to display for text above banner
ads[i].footer = "Breeder in Hillsborough, NC. &nbsp;" //text to display for text link below banner
i++
/*-------------end banner definition-----------*/

ads[i].width = "180"
ads[i].height = "34"
ads[i].src = "http://www.cgswdc.com/images/AD_Mathausen2.gif"
ads[i].href = "http://www.mathausen.com/"
ads[i].mouseover = "Mathausen German Shepherds"
ads[i].header = "GSD Breeder Advertisement "
ads[i].footer = "Mathausen German Shepherds is a breeder in Old Fort, NC. &nbsp;"
i++

ads[i].width = "180"
ads[i].height = "108"
ads[i].src = "http://www.cgswdc.com/images/AD_BlueRidgeBeef.gif"
ads[i].href = "http://www.countryoakshepherds.com/"
ads[i].mouseover = "Blue Ridge Beef"
ads[i].header = "Pet Food Advertisement "
ads[i].footer = "The Best Natural Raw Food for Pets! &nbsp;"
i++

ads[i].width = "180"
ads[i].height = "111"
ads[i].src = "http://www.cgswdc.com/images/AD_KurtUSA.gif"
ads[i].href = "http://www.kurtusa.com"
ads[i].mouseover = "KURT USA"
ads[i].header = "Training Equipment Advertisement "
ads[i].footer = "Professional Dog Training Equipment. &nbsp;"
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){
	var tempCode = ""
	tempCode += ('<TABLE height=14 cellSpacing=0 cellPadding=0 width=180 bgColor="#DFD4B4" border=0>')
	tempCode += ('<TBODY><TR height=14><TD width=5>')
	tempCode += ('<IMG src="http://www.cgswdc.com/images/pixel.gif" width=5 height=14 border=0></TD>')
	tempCode += ('<TD vAlign=center align=left width=175>')
	tempCode += ('<SPAN class=rsdachzeile>' + ads[adNumber].header + '</SPAN></TD>')
	tempCode += ('</TR></TBODY></TABLE>')

	tempCode += ('<TABLE height=1 cellSpacing=0 cellPadding=0 width=180 bgColor="#ffffff" border=0>')
	tempCode += ('<TBODY><TR height=1><TD width=180>')
	tempCode += ('<IMG src="http://www.cgswdc.com/images/pixel.gif" width=180 height=1 border=0></TD>')
	tempCode += ('</TR></TBODY></TABLE>')

	tempCode += ('<TABLE cellSpacing=0 cellPadding=0 width=180 border=0>')
	tempCode += ('<TBODY><TR><TD vAlign=top align=left>')
	tempCode += ('<a target="_blank" href="'+ ads[adNumber].href +'" \n')
	tempCode += ('onMouseOver="status=\''+ ads[adNumber].mouseover +'\';return true" \n')
	tempCode += ('onMouseOut="status=\'\'"> \n')
	tempCode += ('<img src="' + ads[adNumber].src + '" width=' + ads[adNumber].width)
	tempCode += (' onLoad="setTimeout(\'newAd();\',' + refreshTime + ');"')
	tempCode += ('\n height=' + ads[adNumber].height + ' border=0 >')
	tempCode += ('</a></TD>')
	tempCode += ('</TR></TBODY></TABLE>')

	tempCode += ('<TABLE cellSpacing=0 cellPadding=0 width=180 bgColor="#F3F0E4" border=0>')
	tempCode += ('<TBODY><TR><TD width=1 bgColor="#DFD4B4">')
	tempCode += ('<IMG src="http://www.cgswdc.com/images/pixel.gif" width=1 height=8 border=0></TD>')
	tempCode += ('<TD width=5><IMG src="http://www.cgswdc.com/images/pixel.gif" width=5 height=8 border=0></TD>')
	tempCode += ('<TD vAlign=center align=left width=168>')
	tempCode += ('<SPAN class=teasertext>' + ads[adNumber].footer + '')
	tempCode += ('<A target="_blank" href="' + ads[adNumber].href + '">[more]</A></SPAN></TD>')
	tempCode += ('<TD width=5><IMG height=8 src="http://www.cgswdc.com/images/pixel.gif" width=5 border=0></TD>')
	tempCode += ('<TD width=1 bgColor="#DFD4B4"><IMG height=8 src="http://www.cgswdc.com/images/pixel.gif" width=1 border=0></TD>')
	tempCode += ('</TR></TBODY></TABLE>')

	tempCode += ('<TABLE height=1 cellSpacing=0 cellPadding=0 width=180 bgColor="#DFD4B4" border=0>')
	tempCode += ('<TBODY><TR height=1><TD width=180>')
	tempCode += ('<IMG height=1 src="http://www.cgswdc.com/images/pixel.gif" width=180 border=0></TD>')
	tempCode += ('</TR></TBODY></TABLE>')

	tempCode += ('<TABLE height=10 cellSpacing=0 cellPadding=0 width=180 bgColor="#ffffff" border=0>')
	tempCode += ('<TBODY><TR height=10><TD width=180>');
	tempCode += ('<IMG height=10 src="http://www.cgswdc.com/images/pixel.gif" width=180 border=0></TD>')
	tempCode += ('</TR></TBODY></TABLE>');

	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
	
}