function update_img(cp) {
		// läd neues bild und bildunterschrift ins html
		// zuerst wird das bild durch ein shim ersetzt um flackern
		// zu vermeiden, dann die breite neu gesetzt,
		// das nächste Bild geladen usw...

		if ($('teasertextcontainer')) $('teasertextcontainer').hide();
		$('photoshow_caption').innerHTML			= '';
		$('photoshow_caption_beneath').innerHTML	= '';
		$('photo').style.width						= photoshow_images[cp]['width']+'px';
		$('photo').style.height						= photoshow_images[cp]['height']+'px';
		$('photoshow_caption').style.width			= (658-32-photoshow_images[cp]['width'])+'px';

		if( photoshow_images[cp+1] )
		{
			try{
				$('nextBoxImg').src 		= photoshow_images[cp+1]['src'];

				if( photoshow_images[cp+1]['teaserText'].length > 200 )
				{
					$('nextBoxTextLink').innerHTML 	= photoshow_images[cp+1]['teaserText'].substring(0,200) + ' ...';
				}
				else
				{
					$('nextBoxTextLink').innerHTML 	= photoshow_images[cp+1]['teaserText'];
				}
				$('nextBoxTextLink').blur();
				//$('nextBoxText').innerHTML 	= photoshow_images[cp+1]['caption'];
			}
			catch(error){
			}
		}
		else
		{
			try{
				$('nextBoxWrapper').style.display = 'none';
			}
			catch(error){
			}
		}

		// Hoch oder Querformat?
		// Ab einer Breite von X wird die Caption
		// unter statt neben dem Bild ausgeliefert:
		if (photoshow_images[cp]['width'] > 450 )
		{
			$('photoshow_caption_beneath').innerHTML = photoshow_images[cp]['caption'];

			try{
				$('nextBoxWrapper').style.display = 'none';
			}
			catch(error){
			}
		}
		else
		{
			$('photoshow_caption').innerHTML 	= photoshow_images[cp]['caption'];
			try{
				$('nextBoxWrapper').style.width 	= ( 658 -32 -photoshow_images[cp]['width'] -10 ) + 'px';
				$('nextBoxImg').style.width 		= '60px'; // ( 658 -32 -photoshow_images[cp]['width'] -60 ) + 'px';
			}
			catch(error){
			}
			try{
				$('nextBoxWrapper').style.display 	= 'inline';
			}
			catch(error){
			}
		}
		$('credit').innerHTML=photoshow_images[cp]['credit'];
		$('photoshow_current_img_number').innerHTML=(cp+1);

		if ($('votebox')) $('votebox').hide();

		$('photoshow_img').replace('<img id="photoshow_img" src="'+photoshow_images[cp]['src']+'" alt="'+photoshow_images[cp]['alt']+'" width="'+photoshow_images[cp]['width']+'" border="0">','asdf');
		$('link_img_next').setAttribute("title", photoshow_images[cp]['alt']);


		if( photoshow_images[cp+1] )
		{
			try{
				$('nextBoxImg').src 		= photoshow_images[cp+1]['src'];

				if( photoshow_images[cp+1]['teaserText'].length > 200 )
				{
					$('nextBoxTextLink').innerHTML 	= photoshow_images[cp+1]['teaserText'].substring(0,200) + ' ...';
				}
				else
				{
					$('nextBoxTextLink').innerHTML 	= photoshow_images[cp+1]['teaserText'];
				}
				$('nextBoxTextLink').blur();
				//$('nextBoxText').innerHTML 	= photoshow_images[cp+1]['caption'];
			}
			catch(error){
			}
		}
		else
		{
			try{
				$('nextBoxWrapper').style.display = 'none';
			}
			catch(error){
			}
		}

		return true;

	}

	function next_img() {

		// welches wäre das nächste bild?
		cp++;
		//alert('cp: '+cp+' ' +'\nphotoshow_anzahl_bilder: '+photoshow_anzahl_bilder);
		photoshow_ais++;

		// menü erneut aufklappen, wenn menü_ankerpunkt erreicht ist
		// nur beim vorwärts blättern)
		for (jj=0; jj<photoshow_menu.length; jj++) {
			if (photoshow_menu[jj]['cp']==cp) {
				//photoshow_menu.splice(0,jj+1);
				update_menu(photoshow_menu);
				if ($('anker_menue').style.display=="none")
				{
					Effect.toggle('anker_menue','slide');
					$('anker_menue_button').style.background='url(/img/std/button_hide_menue_bilderstrecken.gif) transparent no-repeat';
				}
			}
		}


		if (cp>=photoshow_anzahl_bilder) { // letztes bild? zur übersicht...
			cp=photoshow_anzahl_bilder;
			var go=refresh_ads(photoshow_ais);
			if (go) show_overview();
			count_ivw_hbx(false,(cp+1));
			return true;
		}else{ // ..sonst zum nächsten bild
			var go=refresh_ads(photoshow_ais);
			if (go) update_img(cp);
			count_ivw_hbx(false,(cp+1));
			return true;
		}
	}

	function update_menu(menu_array) {
		var string='<ul>';
		for(i=0; i<menu_array.length; i++) {
			string=string+'<li><a href="'+photoshow_url+'?cp='+menu_array[i]['cp']+'&back_link='+back_link+'">'+menu_array[i]['text']+'</a></li>';
		}
		string=string+'</ul>';
		document.getElementById('anker_menue').innerHTML=string;
		return true;
	}

	function prev_img() {

		// welches wäre das nächste bild?
		cp--;
		//alert('cp: '+cp+' ' +'\nphotoshow_anzahl_bilder: '+photoshow_anzahl_bilder);
		photoshow_ais++;
		if (cp<0) { // erstes bild ? zum letzten bild...
			cp=(photoshow_anzahl_bilder-1);
			update_img(cp);
			refresh_ads(photoshow_ais);
			count_ivw_hbx(false,(cp+1));
			return true;
		}else{ // ...sonst zum vorigen bild
			if (cp<photoshow_anzahl_bilder) { hide_overview(); }
			update_img(cp);
			refresh_ads(photoshow_ais);
			count_ivw_hbx(false,(cp+1));
			return true;
		}
	}

	// Übersicht (drei Photoshows anzeigen) ////////////////
	function show_overview(){
		// die aktuellsten drei strecken des knotens ausgeben
		if (typeof(photoshow_images[0]['score'])!='undefined') {
			//document.location.href=photoshow_url+'?cp='+photoshow_anzahl_bilder;
			document.location.href=photoshow_endpage_url;
		}else{
			$('weitere_bilderstrecken').show();
			$('photobox').hide();
			try {$('dreierteaser_bilderstrecken_sidebar').hide(); }
			catch(error) { }
		}
		return true;
	}

	// von der Übersicht zurück in die Bilderstrecke///////
	function hide_overview(){
		// die aktuellsten drei strecken des knotens ausgeben
		if (typeof(document.getElementById('weitere_bilderstrecken'))!='undefined') $('weitere_bilderstrecken').hide();
		$('photobox').show();
		try {$('dreierteaser_bilderstrecken_sidebar').show(); }
		catch(error) { }

		return true;
	}

	// Blättern mit Pfeiltasten ////////////////////////////
	function onGalleryKeyup(e)
	{
		var request_stop=false;
		if (request_stop==true) return;
		request_stop=true;
		switch (e.keyCode) {
		  case Event.KEY_LEFT:
		   prev_img();
		   Event.stop(e);
		     break;

		  case Event.KEY_RIGHT:
		   next_img()
		   Event.stop(e);
		  break;
		  }

		  if (photoshow_menu.length>0) {
		  switch (e.keyCode) {

		  case Event.KEY_UP:
		   show_hide_menu();
		   Event.stop(e);
		     break;

		      case Event.KEY_DOWN:
		   show_hide_menu();
		   Event.stop(e);
		     break;
			}

		}
		request_stop=false;
	}
	Event.observe(window, 'keyup', onGalleryKeyup);


	function vote_photo(note) {
		var vote_param='?action=dophotovote&photovote='+note+'&vid='+vid+'&cp='+cp+'&fid='+photoshow_images[cp]['id'];
		photoshow_url=photoshow_url+vote_param;
		if (back_link!='') photoshow_url=photoshow_url+'&back_link='+back_link;
		// Bild bewerten
		document.location.href=photoshow_url;

	}

	// sprungmenue ein/ausblenden //////////////////////////
	function show_hide_menu(){
		if ($('anker_menue').style.display=="none")
		{
			Effect.toggle('anker_menue','slide');
			$('anker_menue_button').style.background='url(/img/std/button_hide_menue_bilderstrecken.gif) transparent no-repeat';
		}else{

			Effect.toggle('anker_menue','slide');
			$('anker_menue_button').style.background='url(/img/std/button_show_menue_bilderstrecken.gif) transparent no-repeat';


		}
		return true;
	}

	function refresh_ads (ais) {
		// läd bei jedem x-ten klick die seite und damit die ads neu
		if (ais>photoshow_ad_interval) { //
			if (ais==(photoshow_ad_interval+1)) {
				// diese abfrage vermeiden bei speed-blättern url-fehler
				if (cp>0) {
					//photoshow_url=photoshow_url+append_param;
					if (back_link!='') photoshow_url=photoshow_url+'&back_link='+back_link;
				}else {
					if (back_link!='') photoshow_url=photoshow_url+append_param+'&back_link='+back_link;
				}
				photoshow_ais=1;
				try{
					refreshAds();
				}
				catch (error){
				}
				// weiterklicken unterbinden
/*
				$('link_button_prev').setAttribute('onClick', '');
				$('link_button_prev2').setAttribute('onClick', '');
				$('link_button_next').setAttribute('onClick', '');
				$('arrowkey_left').setAttribute('onClick', '');
				$('arrowkey_right').setAttribute('onClick', '');
				$('link_img_next').setAttribute('onClick', '');
				$('link_button_prev').href=photoshow_url;
				$('link_button_prev2').href=photoshow_url;
				$('link_button_next').href=photoshow_url;
				$('arrowkey_left').href=photoshow_url;
				$('arrowkey_right').href=photoshow_url;
				$('link_img_next').href=photoshow_url;
*/
				//document.location.href=photoshow_url;
				//hier refresh_ad aufrufen
			}

			return true;
		}else{
			// do not refresh Ads

			if (photoshow_menu.length>0) {
				if ($('anker_menue').getStyle('display')=='block') {
					// close menue
					Effect.toggle('anker_menue','slide');
					$('anker_menue_button').style.background='url(/img/std/button_show_menue_bilderstrecken.gif) transparent no-repeat';
				}
			}
			return true;
		}
	}
