var hs_pic="hs_banner";
var divtag2=null;

var imgpath="http://www.stadttheater-bremerhaven.de/web/__sys/spics";
<b><font color=red>Script error in scope 'js_varsHS' at line 40: com.nodevision.cms.kernel.KernelException: APobject.checkKnownAttributes: Attribute(s) 'Typ' unknown for object-id '21470'!</font></b>

function bannerHS(chosen) {
	var tmp_fullname = imgpath+"/"+bannersHS[chosen][0];
	// based on the path to the sponsors folder (previously defined) and the "banners" element refered to by the random number "chosen" a fullname path to a sponsor is created
	if (document.images) {
		if (document.layers && divtag2!=null) {
			// for netscape browsers
			eval('document.'+divtag2+'.document.images["'+hs_pic+'"].src = '+tmp_fullname)
		} else {
			// for other browser - internet explorer
			//document [hs_pic].src = tmp_fullname;
			document.getElementById(hs_pic).src = tmp_fullname;
		}
		// image in webpage is set to relevant sponsor
	}
	url = bannersHS[chosen][1];
	// url is set to respective sponsor url
}

function firstBannerLoopHS(pick) {
	var tmp_fname = imgpath+"/"+totArray2[pick][0];
	if (document.images) {
		if (document.layers && divtag2!=null) {
			// for netscape browsers
			eval('document.'+divtag2+'.document.images["'+hs_pic+'"].src = '+tmp_fname);
		} else {
			// for other browser - internet explorer
			//document [hs_pic].src = tmp_fname;
			document.getElementById(hs_pic).src = tmp_fname;
		}

		// image in webpage is set to relevant sponsor
	}
	url = totArray2[pick][1];
	// url is set to respective sponsor url
}

function jumpHS(){
	// opens a new webpage with the following properties and the url of the respective sponsor
	//if(url != "nopage") new_window=window.open(url,"new_win","toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=740,height=580");
	if(url != "nopage") window.location.href = url;
}

function rotateHS(time){
	// break function if exists just only banner
	if(bannersHS.length < 1) return true;

	if(totArray2.length>0){
		rand=(totArray2.length-1)*Math.random();
		pick=Math.round(rand);
		firstBannerLoopHS(pick);
		totArray2.splice(pick,1);
	}else{

		rand=(bannersHS.length-1)*Math.random();
		chosen=Math.round(rand);
		// based on the length of the "banners" array a mathematically random number is chosen which is between 0 and "banners" length
		// this number is passed to the function bannerHS()
		bannerHS(chosen);
	}
		setTimeout('rotateHS('+time+')',time);
		// rotates banner, by recalling itself after time set in body tag of webpage has elapsed. rotate() is called from body tag
}
