	var bild;
	var divtag=null;
        var index=0;
	var urlArray = new Array();
	var counter=0;

	var imgpath="http://www.kabarett-rohrstock.de/web/__sys/spics";
var imgpath_mo="http://www.kabarett-rohrstock.de/web/__sys/spics_on";
var totArray=[['11_DHT.jpg', 'http://www.dht-spedition.de', '11_DHT_on.jpg'], ['12_rostockPort.jpg', 'http://www.rostock-port.de', '12_rostockPort_on.jpg'], ['13_Warnowquerung.gif', 'http://www.warnowtunnel.de', '13_Warnowquerung_on.gif'], ['14_freundUndPartnerGmbH.gif', 'http://www.etl.de/fp-rostock', '14_freundUndPartnerGmbH_on.gif'], ['15_EEW.gif', 'http://www.eewspc.de', '15_EEW_on.gif'], ['17_WarnemuenderBau.gif', 'http://www.warbau.de', '17_WarnemuenderBau_on.gif'], ['20_KarpackGmbH.gif', 'http://www.karpack.de', '20_KarpackGmbH_on.gif'], ['21_IWS.gif', 'http://www.iwselektro.de', '21_IWS_on.gif'], ['22_Kloska-Group.gif', 'http://www.dmr-kloska.de', '22_Kloska-Group_on.gif'], ['28_straFischGmbH.gif', 'http://www.strafisch.de', '28_straFischGmbH_on.gif'], ['30_SchraubenIndustriebedarf.gif', 'http://www.schrauben-rostock.de', '30_SchraubenIndustriebedarf_on.gif'], ['31_drDiestel.jpg', 'http://www.dr-diestel.de/', '31_drDiestel_on.jpg'], ['33_HEPA.gif', 'http://www.hepa-waelzlager.de', '33_HEPA_on.gif'], ['34_PersonalbasisNord.jpg', 'http://www.personalbasis-nord.de', '34_PersonalbasisNord_on.jpg'], ['6_IPB.gif', 'http://www.dr-blum.de', '6_IPB_on.gif'], ['Kitchenking24a.jpg', 'http://www.kitchenking.de', 'Kitchenking24a_on.jpg'], ['Kitchenking24b.jpg', 'http://www.kitchenking.de', 'Kitchenking24b_on.jpg'], ['Kitchenking24c.jpg', 'http://www.kitchenking.de', 'Kitchenking24c_on.jpg']];
var banners=[['11_DHT.jpg', 'http://www.dht-spedition.de', '11_DHT_on.jpg'], ['12_rostockPort.jpg', 'http://www.rostock-port.de', '12_rostockPort_on.jpg'], ['13_Warnowquerung.gif', 'http://www.warnowtunnel.de', '13_Warnowquerung_on.gif'], ['14_freundUndPartnerGmbH.gif', 'http://www.etl.de/fp-rostock', '14_freundUndPartnerGmbH_on.gif'], ['15_EEW.gif', 'http://www.eewspc.de', '15_EEW_on.gif'], ['17_WarnemuenderBau.gif', 'http://www.warbau.de', '17_WarnemuenderBau_on.gif'], ['20_KarpackGmbH.gif', 'http://www.karpack.de', '20_KarpackGmbH_on.gif'], ['21_IWS.gif', 'http://www.iwselektro.de', '21_IWS_on.gif'], ['22_Kloska-Group.gif', 'http://www.dmr-kloska.de', '22_Kloska-Group_on.gif'], ['28_straFischGmbH.gif', 'http://www.strafisch.de', '28_straFischGmbH_on.gif'], ['30_SchraubenIndustriebedarf.gif', 'http://www.schrauben-rostock.de', '30_SchraubenIndustriebedarf_on.gif'], ['31_drDiestel.jpg', 'http://www.dr-diestel.de/', '31_drDiestel_on.jpg'], ['33_HEPA.gif', 'http://www.hepa-waelzlager.de', '33_HEPA_on.gif'], ['34_PersonalbasisNord.jpg', 'http://www.personalbasis-nord.de', '34_PersonalbasisNord_on.jpg'], ['6_IPB.gif', 'http://www.dr-blum.de', '6_IPB_on.gif'], ['Kitchenking24a.jpg', 'http://www.kitchenking.de', 'Kitchenking24a_on.jpg'], ['Kitchenking24b.jpg', 'http://www.kitchenking.de', 'Kitchenking24b_on.jpg'], ['Kitchenking24c.jpg', 'http://www.kitchenking.de', 'Kitchenking24c_on.jpg']];
var konzArray=['x_20100709_2000_P21741_L12710', 'x_20100715_2000_P21741_L12709', 'x_20100721_2000_P21741_L12709', 'x_20100724_2030_P21741_L13191', 'x_20100725_2030_P21741_L13191', 'x_20100729_2000_P21741_L12709', 'x_20100731_2030_P21741_L12710', 'x_20100804_2000_P21741_L12709', 'x_20100812_2030_P21741_L13191', 'x_20100814_2000_P21741_L12709', 'x_20100820_2030_P21741_L12710', 'x_20100826_2030_P21741_L13191', 'x_20100828_2000_P21741_L12709', 'x_20100903_2000_P21741_L12709', 'x_20100904_2000_P21741_L12709'];


	function firstBannerLoop(pick,konzChoice) {
		var tmp_fname = imgpath+"/"+totArray[pick][0];
		bild = konzArray[konzChoice];

		url = totArray[pick][1]; // url is set to respective sponsor url					
		pic_on = imgpath_mo+"/"+totArray[pick][2];
		pic_off = tmp_fname;
		totArray.splice(pick,1);
		
		//filling new 2d array with 'a href' reference filename and sponsor url. in effect linking sponsors to their urls as more than on  a href exists for konzert list pages 
		urlArray[counter] = new Array(4);
		urlArray[counter][0] = bild;
		urlArray[counter][1] = url;
		urlArray[counter][2] = pic_on;
		urlArray[counter][3] = pic_off;
		counter++;

		if (document.images) {
			if (document.layers && divtag!=null) {	
				try{
					// for netscape browsers
					eval('document.'+divtag+'.document.images["'+bild+'"].src = '+tmp_fname);
					
				}catch(er){  }
			} else {
				try{
					document [bild].src = tmp_fname;
				}catch(er){  }
			}
		}
	}

	function jump(fname){
		fname = "x_" + fname;
		for(p=0;p<urlArray.length;p++){
			if(urlArray[p][0]==fname){
				url=urlArray[p][1];
			}
		}

		// 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 rotate(){
		if(totArray.length>0){
			rand=(totArray.length-1)*Math.random();
			pick=Math.round(rand);
			firstBannerLoop(pick,index);
		}else if(totArray.length==0){
			for(q=0;q<banners.length;q++){
				totArray[q] = banners[q];
			}
			rand=(totArray.length-1)*Math.random();
			pick=Math.round(rand);
			firstBannerLoop(pick,index);
		}

		if(index<konzArray.length){
			index++;
			rotate();
			// fills in all sponsors, by recalling itself 
		}
	}

	function switch_img_on(fname) {
 	    if (document.images) {
		var pic_on = new Image();
		var pic_off = new Image();
		fname = "x_" + fname;
		for(p=0;p<urlArray.length;p++){
			if(urlArray[p][0]==fname){
				pic_on.src=urlArray[p][2];
				//alert(urlArray[p][0] + " " + urlArray[p][1] + " " + urlArray[p][2] + " " + urlArray[p][3])
			}
		}
		eval("document.images[fname].src = pic_on.src");
	    }
	  	
	}
	function switch_img_off(fname) {
		var pic_on = new Image();
		var pic_off = new Image();
		fname = "x_" + fname;
		for(p=0;p<urlArray.length;p++){
			if(urlArray[p][0]==fname){
				pic_off.src=urlArray[p][3];
			}
		}
		eval("document.images[fname].src = pic_off.src");
	}
	
	
