<?php
	// this is to center all images on the top
			if ($show_slideshow) {
				printf("<img src='%sbuttons/1x1.gif' width='31' height='1' alt='' >&nbsp;&nbsp;", $install_dir);
			}
			if ($show_print_icon) {
				printf("<img src='%sbuttons/1x1.gif' width='31' height='1' alt='' >&nbsp;&nbsp;", $install_dir);
			}
			if ($show_first_last_buttons) {
				// 1st button
				$hreffirst = getScriptName() . '?twg_album='.$album_enc.'&amp;twg_show=x' . $twg_standalone;
				printf("<a href='%s'><img class='twg_buttons menu_first_gif' src='%sbuttons/1x1.gif' alt='%s' title='%s' id='topfirst'></a>", $hreffirst, $install_dir, $lang_first, $lang_first);
			}
			if ($default_big_navigation != "DHTML" && $default_big_navigation != "FLASH") {  // || $twg_smallnav == "TRUE"
				if ($last = get_last($twg_album, $image, $current_id)) {
					$hreflast = getScriptName() . '?twg_album='.$album_enc.'&amp;twg_show='. $last . $twg_standalone;
					$hreflastjs = getScriptName() . '?twg_album='.$album_enc.'&twg_show=' . $last . $twg_standalonejs;
					printf("<a href='%s' <img class='twg_buttons menu_left_gif' src='%sbuttons/1x1.gif' alt='%s' title='%s' id='topback'  ></a>", $hreflast, $install_dir, $lang_back, $lang_back);
					echo '<script type="text/javascript">';
					echo 'function key_back()     { location.href="' . $hreflastjs . '" } ';
					echo '</script>';
				} else {
					printf("<img src='%sbuttons/1x1.gif' alt='' width='24' height='1' >", $install_dir);
				}
			} else { // dhtml solution !!
				printf("<span id='backbutton'><a href=\"javascript:key_back();\"><img class='twg_buttons menu_left_gif' src='%sbuttons/1x1.gif' alt='%s' title='%s' id='topback' ></a></span>", $install_dir, $lang_back, $lang_back);
				echo '<script type="text/javascript">';
				echo 'function key_back()    { if ((lastpos >0) && ready) { location.href="javascript:changeContent(lastpos - 1); setPos(thumbstwg_offset[lastpos]);" }} ';
				echo '</script>';
				if (!get_last($twg_album, $image, $current_id)) {
					echo '<script type="text/javascript">';
					echo 'document.getElementById("backbutton").style.visibility = "hidden";';
					echo '</script>';
				} ;
			}
			// the overview
			if ($show_up_button) { // if you want to remove the up button set this to false!
				$twg_offset = get_twg_offset($twg_album, $image, $current_id);
				if ($skip_thumbnail_page) {
					$jump_album = urlencode(getupperdirectory($twg_album));
				} else {
					$jump_album = $album_enc;
				}
				$foffset = $foffsetjs = '';
				if (isset($_SESSION['twg_ses_foffset'])) {
				    if ($_SESSION['twg_ses_foffset'] != '') { //  && $_SESSION['twg_ses_foffset'] != '0' && $_SESSION['twg_ses_foffset'] != '0,0'
					  $foffset = "&amp;twg_foffset=" . $_SESSION['twg_ses_foffset'];
					  $foffsetjs = "&twg_foffset=" . $_SESSION['twg_ses_foffset'];
					}
				} else {
					$foffset = $foffsetjs = "";
				}
                
                
                $twg_offset_str = $twg_offset_str_js = ''; 
                if ($twg_offset != '0') {
                  $twg_offset_str = '&amp;twg_offset=' . $twg_offset;
                  $twg_offset_str_js = '&twg_offset=' . $twg_offset;
                }
                
				printf("<a href='%s?twg_album=%s%s%s%s'><img class='twg_buttons menu_up_gif' src='%sbuttons/1x1.gif' alt='%s' title='%s' id='topthumb' ></a>", getScriptName(), $jump_album, $twg_offset_str, $foffset, $twg_standalone, $install_dir, $lang_overview, $lang_overview);
				printf("<script type='text/javascript'> function key_up() { location.href='%s?twg_album=%s%s%s%s'; } </script>", getScriptName(), $jump_album, $twg_offset_str_js, $foffsetjs, $twg_standalonejs) ;
			}
			if ($default_big_navigation != "DHTML" && $default_big_navigation != "FLASH") {  // || $twg_smallnav == "TRUE"
				if ($next = get_next($twg_album, $image, $current_id)) {
					$hrefnext = getScriptName() . '?twg_album='.$album_enc.'&amp;twg_show='. $next . $twg_standalone;
					$hrefnextjs = getScriptName() . '?twg_album='.$album_enc.'&twg_show=' . $next . $twg_standalonejs;
					printf("<a href='%s'><img class='twg_buttons menu_right_gif' src='%sbuttons/1x1.gif' alt='%s' title='%s' id='topnext' ></a>", $hrefnext, $install_dir, $lang_forward, $lang_forward);
					echo '<script type="text/javascript">';
					echo 'function key_foreward()     { location.href="' . $hrefnextjs . '" } ';
					echo '</script>';
				} else {
					printf("<img src='%sbuttons/1x1.gif' alt='' width='24' height='1' >", $install_dir);
				}
			} else { // dhtml solution!
				printf("<span id='nextbutton'><a href=\"javascript:key_foreward(); \"><img class='twg_buttons menu_right_gif' src='%sbuttons/1x1.gif' alt='%s' title='%s' id='topnext' ></a></span>", $install_dir, $lang_forward, $lang_forward);
				echo '<script type="text/javascript">';
				echo 'function key_foreward()     { if (lastpos <(thumbs.length-1) && ready) { location.href="javascript:changeContent(lastpos + 1); setPos(thumbstwg_offset[lastpos]);" } else if (lastpos <(thumbs.length) && ready) { location.href="javascript:changeContent(lastpos + 1);" } } ';
				echo '</script>';
				if (!get_next($twg_album, $image, $current_id)) {
					echo '<script type="text/javascript">';
					echo 'document.getElementById("nextbutton").style.visibility = "hidden";';
					echo '</script>';
				} ;
			}
			if ($show_first_last_buttons) {
				// last button
				$end = get_end($twg_album);
				$hrefend = getScriptName() . '?twg_album='.$album_enc.'&amp;twg_show=' . $end .$twg_standalone;
				printf("<a href='%s' ><img class='twg_buttons menu_last_gif' src='%sbuttons/1x1.gif' alt='%s' title='%s' id='topend' ></a>", $hrefend,  $install_dir, $lang_last, $lang_last);
			}
			if ($show_slideshow) {
				if ($twg_slideshow) {
					// the slidestop=true is only needed to find this link with javascript and be able to excange this
					// dynamically -> if a user stop the slidtwg_show we can jump to the actual twg_shown picture !!
					printf("&nbsp;&nbsp;<a id='stop_slideshow' href='%s?twg_album=%s&amp;twg_show=%s%s'><img class='twg_buttons menu_stop_gif' src='%sbuttons/1x1.gif' alt='%s' title='%s' id='stop_slideshow_img'></a>", getScriptName(), $album_enc, $image_enc, $twg_standalone, $install_dir, $lang_stop_slideshow, $lang_stop_slideshow);
				} else {
					printf("&nbsp;&nbsp;<a id='start_slideshow' href='%s?twg_album=%s&amp;twg_show=%s&amp;twg_slideshow=true%s'><img class='twg_buttons menu_start_gif' src='%sbuttons/1x1.gif' alt='%s' title='%s' id='slideshow'  ></a>", getScriptName(), $album_enc, $image_enc, $twg_standalone, $install_dir, $lang_start_slideshow, $lang_start_slideshow);
				}
			}
			if ($show_print_icon) {
              	printf("<a  onfocus='blur();' onClick='printme(\"defaultslide\"); return false' href='#print'><img  class='twg_buttons print_gif' src='%sbuttons/1x1.gif' alt='%s' title='%s' id='print' ></a>", $install_dir, $icon_set, $install_dir, $icon_set, $lang_print,$lang_print);
		    }
?>