var IsValidBrowser = false;

function InitialiseBannerAdRotator(banneradid,DisplayInterval) {

	DisplayInterval = DisplayInterval * 200;
	//Determine the browser name and version
	//The script will only work on Netscape 3+ and Internet Explorer 4+
	var BrowserType = navigator.appName;
	var BrowserVersion = parseInt(navigator.appVersion);
	
	if (BrowserType == "Netscape" && (BrowserVersion >= 3)) {
		IsValidBrowser = true;
	}
	
	if (BrowserType == "Microsoft Internet Explorer" && (BrowserVersion >= 4)) {
		IsValidBrowser = true;
	}
	
	if (IsValidBrowser) {
		TimerObject = setTimeout("Fillbannerad("+ banneradid + ","+DisplayInterval+")", DisplayInterval);
		eval("BannerAdCode"+ banneradid + " = 0");
		
	}

}
	
function Fillbannerad(banneradid, DisplayInterval){
	if (IsValidBrowser) {
		var currentbanneradcode = eval("BannerAdCode"+ banneradid )
		var currentnumberofimages = eval("NumberOfImages"+ banneradid )
		currentbanneradcode = currentbanneradcode + 1;
		eval("BannerAdCode"+ banneradid + " = BannerAdCode"+ banneradid + " + 1");
		
		if (currentbanneradcode == currentnumberofimages) {
			//BannerAdCode = 0;
			eval("BannerAdCode"+ banneradid + " = 0");
			currentbanneradcode=0;
		}
			var thecontent= eval("imagearray" + banneradid + "[" + currentbanneradcode + "]");
			//alert (currentbanneradcode + "-" + BannerAdCode1);
	
			if (document.getElementById){
				var menuobjstring1 = "document.getElementById(\"bannerad" + banneradid + "\")";
				var menuobj = eval(menuobjstring1);
				menuobj.innerHTML=thecontent
			}
			else if(document.all){
				var menuobjstring2 = "document.all.bannerad" + bannerad + " : \"\"";
				var menuobj = eval(menuobjstring2);
				menuobj.innerHTML=thecontent
			}
			else if (document.layers){
				menuobj.document.write(thecontent)
				menuobj.document.close()
			}
		
		//TimerObject = setTimeout("ChangeImage()", DisplayInterval);
		TimerObject = setTimeout("Fillbannerad("+ banneradid + ","+DisplayInterval+")", DisplayInterval);
	}
}
