<?php
	require_once("./cms/PhotoBlogEntry.class.php");
	require_once("./cms/PhotoBlog.class.php");
	require_once("./common/utils.func.php");
	
	$pbs = new PhotoBlog($_blogID);
	$pb = new PhotoBlogEntry($_blogID,$_photoBlogID);
	
	/**
	 * Album Title
	 */	
	print('<div class="albumTitle">'.$pbs->getPhotoBlogText($_photoBlogID).'</div>');
	/**
	 * Album Comment
	 */
	print('<div class="albumComment">'.$pbs->getPhotoBlogComment($_photoBlogID).'</div>');

	/**
	 * Columns Number, 1 is the defautl value
	 */
	$colNumba = $pbs->getPhotoBlogColNumba($_photoBlogID);
	if (strcasecmp(trim($colNumba),'')==0)
		$colNumba = 1;
	
	/**
	 * ThumbSize, 100px is the default value
	 */
	$thumbSize = $pbs->getPhotoBlogThumbSize($_photoBlogID);
	if (strcasecmp(trim($thumbSize),'')==0)
		$thumbSize = 100;
		 
	$files = $pb->getAllEntries();
	print '<table cellpadding="2" cellspacing="2" border="0" width="98%">';
	print '<tr>';
	$width = bcdiv(100,$colNumba,0);
	$count = count($files[0]); 
	$i = 0;
	for($j=0;$j<$count;$j++){
	//foreach($files as $key=>$val){

		$thumb 	= $files[1][$j];
		$full	= $files[0][$j];
		
		if (strcasecmp(bcmod($i,$colNumba),"0")==0)
			$tr = true;
		else 
			$tr = false;
		
		if ($tr) print '</tr><tr>';
		
		print '<td width="'.$width.'">';
			$comment = file_get_contents($files[0][$j].".comment");	
			print '<div class="photoEntry">';
			print show_thumbnail($thumb,$full,$thumbSize,1,$comment);
			print '<br>'.$comment; 
			print '</div>';
		print '</td>';			
		$i++;
	}
	print '</tr></table>';
?>