<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'
    'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
#c// ###################################################################
#c// Album Theme by George Hansper
#c// ###################################################################
#c//
<:
# Path setting - this is the path to the images
$PATH = Theme_URL();

@Photo_Border = ('white',5);
#@Album_Border = ('#101080',5);
#@Movie_Border = ( 'black',5);

$INITIAL_ICON_SIZE=150;

$COLS=Option('columns');

# Borders
my %Border = (
  Photo => {
	L  => { url => "$PATH/Photo_Border_L.gif",  x => 25, y => 100 },
	R  => { url => "$PATH/Photo_Border_R.gif",  x => 25, y => 100 },
	TL => { url => "$PATH/Photo_Border_TL.gif", x => 25, y => 25 },
	TR => { url => "$PATH/Photo_Border_TR.gif", x => 25, y => 25 },
	BL => { url => "$PATH/Photo_Border_BL.gif", x => 25, y => 25 },
	BR => { url => "$PATH/Photo_Border_BR.gif", x => 25, y => 25 },
	T  => { url => "$PATH/Photo_Border_T.gif",  x => 125, y => 25 },
	B  => { url => "$PATH/Photo_Border_B.gif",  x => 125, y => 25 }
  },

  Album => {
  	TL => { url => "$PATH/Album_Border_TL.png", x => 6, y => 6 },
	T => { url => "$PATH/Album_Border_TL.png",  x => 300, y => 6 },
	TR => { url => "$PATH/Album_Border_TR.png", x => 25, y => 6 },
	R => { url => "$PATH/Album_Border_R.png",   x => 25, y => 300 },
	BR => { url => "$PATH/Album_Border_BR.png", x => 25, y => 25 },
	B => { url => "$PATH/Album_Border_B.png",   x => 300, y => 25 },
	BL => { url => "$PATH/Album_Border_BL.png", x => 6, y => 25 },
	L => { url => "$PATH/Album_Border_TL.png",  x => 6, y => 300 },
  },
  
   Movie => {
 	TL => { url => "$PATH/Movie_Border_CNR.gif",  x => 15, y => 5 },
 	TR => { url => "$PATH/Movie_Border_CNR.gif",  x => 15, y => 5 },
 	BL => { url => "$PATH/Movie_Border_CNR.gif",  x => 15, y => 5 },
 	BR => { url => "$PATH/Movie_Border_CNR.gif",  x => 15, y => 5 },
 	L => { url => "$PATH/Movie_Border_L.gif",  x => 15, y => 114 },
	R => { url => "$PATH/Movie_Border_R.gif",  x => 15, y => 114 },
	T => { url => "$PATH/Movie_Border_CNR.gif", x => 15, y => 5 },
	B => { url => "$PATH/Movie_Border_CNR.gif", x => 15, y => 5 }
  }
);  # my %Border

sub My_Border {
	my ($tag,$border) = @_;
	my $indent;
	my $html;
	$_ = $tag;
	m/^(\s*)/;
	$indent = $1;
	if ( @{$border} > 0 ) {
		# Simple border - Color+width only
		$html  = $indent . "<table border=0 cellspacing=0  bgcolor='@{$border}[0]' cellpadding='@{$border}[1]'>\n";
		$html .= $indent . "	<tr><td align='center' valign='center'>\n";
		$html .= $tag    . "\n";
		$html .= $indent . "	</td></tr>\n";
 		$html .= $indent . " </table>\n";
	} else {
		# Fancy gif-based vorder 
		$html  = $indent . "<table border=0 cellpadding=0 cellspacing=0 >\n";
		$html .= $indent . "	<tr>\n";
		$html .= $indent . "	<td width=$Border{$border}{TL}{x} height=$Border{$border}{TL}{y} background='$Border{$border}{TL}{url}' ></td>\n";
		$html .= $indent . "	<td height=$Border{$border}{T}{y} background='$Border{$border}{T}{url}' ></td>\n";
		$html .= $indent . "	<td width=$Border{$border}{TR}{x} height=$Border{$border}{TR}{y} background='$Border{$border}{TR}{url}' ></td>\n";
		$html .= $indent . "	</tr>\n";
		$html .= $indent . "	<tr>\n";
		$html .= $indent . "	<td width=$Border{$border}{L}{x} background='$Border{$border}{L}{url}' ></td>\n";
		$html .= $indent . "	<td align='center' valign='bottom'>\n";
		$html .= $tag    . "\n";
		$html .= $indent . "	</td>\n";
		$html .= $indent . "	<td width=$Border{$border}{R}{x} background='$Border{$border}{R}{url}' ></td>\n";
		$html .= $indent . "	</tr>\n";
		$html .= $indent . "	<tr>\n";
		$html .= $indent . "	<td width=$Border{$border}{BL}{x} height=$Border{$border}{BL}{y} background='$Border{$border}{BL}{url}' ></td>\n";
		$html .= $indent . "	<td height=$Border{$border}{B}{y} background='$Border{$border}{B}{url}' ></td>\n";
		$html .= $indent . "	<td width=$Border{$border}{BR}{x} height=$Border{$border}{BR}{y} background='$Border{$border}{BR}{url}' ></td>\n";
		$html .= $indent . "	</tr>\n";
		$html .= $indent . "</table>\n";
	}
	return $html;
}

sub img_with_border {
	my ($img) = @_;
	my $tag;
	my $border;
	my $href;
	if ( Get($img,'type') eq 'dirs' ) {
		if ( @Album_Border == 2 ) {
			$border = \@Album_Border;
		} else {
			$border = 'Album';
		}
		$href = Get($img,'href','dir');
	} elsif ( Get($img,'is_movie') ) {
		if ( @Movie_Border == 2 ) {
			$border = \@Movie_Border;
		} else {
			$border = 'Movie';
		}
		$href = Get($img,'href','image_page');
	} else {
		if ( @Photo_Border == 2 ) {
			$border = \@Photo_Border;
		} else {
			$border = 'Photo';
		}
		$href = Get($img,'href','image_page');
	}
	my $tag;
	$tag  = "$href\n";
	$tag .= "\t\t\t\t<img src=" . Get($img,'URL','image_page','thumb') . " " . get_initial_thumb_size($img);
	$tag .= " alt='" . Name($img) . "' ";
	$tag .= " style='border:0'";
	$tag .= " $img->{intag}";
	$tag .= " >\n";
	$tag .= "\t\t\t</a>\n";
	return My_Border($tag,$border);
}

sub get_initial_thumb_size {
	my ($img) = @_;
	my $thumb_x;
	my $thumb_y;
	my $width;
	my $height;
	$thumb_x = Get($img,'thumb','x');
	$thumb_y = Get($img,'thumb','y');
	if ( $thumb_x+0 > 0 && $thumb_y+0 > 0 ) {
		if ( $thumb_y > $thumb_x ) {
			$height = "height=$INITIAL_ICON_SIZE";
			$width = "width=" . $INITIAL_ICON_SIZE * $thumb_x / $thumb_y;
		} else {
			$width = "width=$INITIAL_ICON_SIZE";
			$height = "height=" . $INITIAL_ICON_SIZE * $thumb_y / $thumb_x;
		}
		return("$width $height");
	} else {
		return("");
	}
}

_:>//
#c// ###################################################################
<head>
	<meta http-equiv="content-type" content="text/html;charset=<:=Option('charset'):>">
	<title> 
	<:=Trans('Image:'):> <:=Name(This_Image) :>
	</title>
	<: Meta() :>
	<style type="text/css">.left {text-align: left}</style>
	<style type="text/css">.center {text-align: center}</style>
	<style type="text/css">.right {text-align: right}</style>
</head>
<body bgcolor='#808080' text=#ffffff link=#000080 vlink=#000000 <:=Body_Tag:>>
#c// #########################
#c// Header/parents
#c// #########################
<table width='100%' border=0>
	<tr>
		<td align='left'>
			<:= Parent_Albums(':') :>
		</td>
		<td align='left'>
#c			# Previous image
			<:=Get( Prev(This_Image, Option('image_loop')) ,'href','image_page'):>
			&lt; Prev</a>
		</td>			
		<td width="70%" align='center'>
			<font size=+1><:=Name(This_Image) :></font>
		</td>
		<td align='left'>
#c			# Next image
			<:=Get( Next(This_Image, Option('image_loop')) ,'href','image_page'):>
			Next &gt;</a>
		</td>			
		<td align='right'>
			<a href=<:=Back():>><:=Trans('Index'):></a>
		</td>
	</tr>
</table>
#c// #########################
#c// The image and caption
#c// #########################
<center>
<: 	if ( Get($img,'is_movie') ) {
		if ( @Movie_Border == 2 ) {
			$border = \@Movie_Border;
		} else {
			$border = 'Movie';
		}
	} else {
		if ( @Photo_Border == 2 ) {
			$border = \@Photo_Border;
		} else {
			$border = 'Photo';
		}
	}
	my $tag;
	$tag  = "\t" . Get(This_Image,'href','image') . "\n";
	$tag .= "\t\t\t\t\t<". Get(This_Image,'full','tag') ." src=" . Get(This_Image,'URL','image_page','image_src');
	$tag .= " alt='" . Name(This_Image) . "' ";
	if ( Get(This_Image,'is_movie') ) {
		$tag .= " width=" . Get(This_Image,'full','x') . " height=" . Get(This_Image,'full','y');
	}
	$tag .= " style='border:0'";
	$tag .= " " . This_Image->{intag};
	$tag .= " >\n";
	$tag .= "\t\t\t\t</a>\n";
	print My_Border($tag,$border);
_:>//
	</a>
	<br />
	<font size=+1><:=Name(This_Image):></font>
	<br /><:=Caption(This_Image) :>
	<br />
	<br /><:=Get(This_Image,'full','x'):> x <:=Get(This_Image,'full','y'):>
	- <:=Get(This_Image,'full','filesize'):>bytes
</center>
<hr />
#c// #########################
#c// Prev/next thumbnails
#c// #########################
<:		my ($img,$Prev_2,$Prev_1,$Next_1,$Next_2);
		$Prev_1 = Prev(This_Image, Option('image_loop'));
		$Prev_2 = Prev($Prev_1, Option('image_loop'));
		$Next_1 = Next(This_Image, Option('image_loop'));
		$Next_2 = Next($Next_1, Option('image_loop'));
_:>
<table cellspacing='5' width='100%'>
	<tr>
		<td valign='bottom' align='left'>
<:		if ($Prev_2) { _:>
			<:=Get($Prev_2,'href','image_page'):>
			&lt;&lt; <:=Trans('Prev'):> -2</a>
<:		} _:>
		</td>
		<td valign='bottom' align='left'>
<:		if ($Prev_1) { _:>
			<:=Get($Prev_1,'href','image_page'):>
			&lt; <:=Trans('Prev'):></a>
<:		} _:>
		</td>
		<td align='center'><:=Trans('This image'):>
		</td>
		<td valign='bottom' align='right'>
<:		if ($Next_1) { _:>
			<:=Get($Next_1,'href','image_page'):>
			<:=Trans('Next'):> &gt;</a>
		
<:		} _:>
		</td>
		<td valign='bottom' align='right'>
<:		if ($Next_2) { _:>
			<:=Get($Next_2,'href','image_page'):>
			<:=Trans('Next'):> +2 &gt;&gt;</a>
<:		} _:>
		</td>
	<tr>
		<td valign='bottom' align='center' width=20%>
<:		if ($Prev_2) { _:>
			<:=img_with_border($Prev_2):>
<:		} _:>
		</td>
		<td valign='bottom' align='center' width=20%>
<:		if ($Prev_1) { _:>
			<:=img_with_border($Prev_1):>
<:		} _:>
		</td>
		<td valign='center' align='center' width=20%>
			<img src=<:=Get(This_Image,'URL','image_page','thumb'):> width=<:=Get(This_Image,'thumb','x')*0.6 :>
				height=<:=Get(This_Image,'thumb','y')*0.6 :>
			>
		</td>
		<td valign='bottom' align='center' width=20%>
<:		if ($Next_1) { _:>
			<:=img_with_border($Next_1):>
<:		} _:>
		</td>
		<td valign='bottom' align='center' width=20%>
<:		if ($Next_2) { _:>
			<:=img_with_border($Next_2):>
<:		} _:>
		</td>
	</tr>
	<tr>
		<td valign='bottom' align='center' width=20%>
<:		if ($Prev_2) { _:>
			<:=Caption($Prev_2):>
			<br><:=Get($Prev_2,'full','x'):> x <:=Get($Prev_2,'full','y'):>
	- <:=Get($Prev_2,'full','filesize'):>bytes
<:		} _:>
		</td>
		<td valign='bottom' align='center' width=20%>
<:		if ($Prev_1) { _:>
			<:=Caption($Prev_1):>
			<br><:=Get($Prev_1,'full','x'):> x <:=Get($Prev_1,'full','y'):>
	- <:=Get($Prev_1,'full','filesize'):>bytes
<:		} _:>
		</td>
		<td width=20%>
		</td>
		<td valign='bottom' align='center' width=20%>
<:		if ($Next_1) { _:>
			<:=Caption($Next_1):>
			<br><:=Get($Next_1,'full','x'):> x <:=Get($Next_1,'full','y'):>
	- <:=Get($Next_1,'full','filesize'):>bytes
<:		} _:>
		</td>
		<td valign='bottom' align='center' width=20%>
<:		if ($Next_2) { _:>
			<:=Caption($Next_2):>
			<br><:=Get($Next_2,'full','x'):> x <:=Get($Next_2,'full','y'):>
	- <:=Get($Next_2,'full','filesize'):>bytes
<:		} _:>
		</td>
	</tr>
	
</table>


#c// #########################
#c// Footer
#c// #########################
<hr />
    <font size='-2'>
      <: Credit() :>
      on <:=scalar localtime:>
    </font>
  </body>
</html>

