{*
 * $Revision: 1.8 $
 * If you want to customize this file, do not edit it directly since future upgrades
 * may overwrite it.  Instead, copy it into a new directory called "local" and edit that
 * version.  Gallery will look for that file first and use it if it exists.
 *}


{*<h2>{$theme.item.title|markup}</h2>*}

{if !count($theme.children)}
  <div class="gallery-empty">
    <p><strong>{g->text text="This album is empty."}</strong></p>
    {if isset($theme.permissions.core_addDataItem)}
    <p><a href="{g->url arg1="view=core.ItemAdmin" arg2="subView=core.ItemAdd"
			arg3="itemId=`$theme.item.id`"}">{g->text text="Add a photo!"}</a></p>
    {/if}
  </div>
{else}

{*
 *			<div id="myGallery">
 *				<div class="imageElement">
 *					<h3>Item 1 Title</h3>
 *					<p>Item 1 Description</p>
 *					<a href="#" title="open image" class="open"></a>
 *					<img src="images/prueba/1.jpg" class="full" />
 *					<img src="images/prueba/1-mini.jpg" class="thumbnail" />
 *				</div>
 *} 
{literal}
	<script src='/themes/cnj/scripts/mootools.js' type="text/javascript"></script>
	<script src='/themes/cnj/scripts/jd.gallery.js' type="text/javascript"></script>

	<script type="text/javascript">
		function startGallery() {
			var myGallery = new gallery($('myGallery'), {
				timed: true,
				delay: 6000,
				fadeDuration: 2000,
				useThumbGenerator: true,
				showCarousel: true,
				preloader: true,
				imageSelector: "img.gallery-photo"
			});
		}
		window.onDomReady(startGallery);
	</script>	
{/literal}  


  {assign var="firstItem" value=true}

  {foreach from=$theme.children item=child}
 
  	{if !$child.canContainChildren}
      {if $firstItem}
        <div id="myGallery" class="gallery-items">
        {assign var="firstItem" value=false}
      {/if}
		<div class="imageElement">
			<h3>{$child.summary}</h3>
			<p>{$child.description}</p>

               {if ($child.canContainChildren || $child.entityType == 'GalleryLinkItem')}
                 {assign var=frameType value="albumFrame"}
                 {capture assign=linkUrl}
					  		{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}
					  {/capture}
               {else}
                 {assign var=frameType value="itemFrame"}
                 {* !!!! Change Starts Here *}

                 {*{if isset($theme.guestPreviewMode) && $user.isAdmin}*}
                   {if isset($child.linkId) && $theme.guestPreviewMode == 0}					 						 
						   
						 	{capture assign=linkId}
								{g->url params=$theme.pageUrl arg1="itemId=`$child.linkId`"}
							{/capture}

						 	{capture assign=linkUrl}
								{$linkId|replace:"`$child.pathComponent`.html":""}
							{/capture}

							<a class='open' title="{$child.summary}" href="{g->text text="$linkUrl"}"></a>
						 {else}
						 	<a class='open' title="{$child.summary}" href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}">a</a>
                   {/if}
                 {*/if*}
					{/if}

	 	  {if isset($child.thumbnail)}	
			 {g->image item=$child image=$child.thumbnail class='gallery-photo'}
		  {else}
		    {g->text text="no thumbnail"}
		  {/if}
      </div>

  	{/if}
  {/foreach}
  
  {if !$firstItem}
      <div class="clear"></div>
    </div>
  {/if}
{/if}

{* Navigator *}
{if $theme.totalPages > 1}
{g->block type="core.Navigator" navigator=$theme.navigator prefix="&laquo; " suffix=" &raquo;"
	  currentPage=$theme.currentPage totalPages=$theme.totalPages}
{/if}

{* Description *}
{if !empty($theme.item.description)}
  <hr />
  <p>{$theme.item.description|markup}</p>
{/if}


{if $user.isRegisteredUser}
	{* Show any other album blocks (comments, etc) *}
	{foreach from=$theme.params.albumBlocks item=block}
	  {g->block type=$block.0 params=$block.1}
	{/foreach}
{/if}


{* Guest preview mode *}
{g->block type="core.GuestPreview" class="gbBlock"}

{* Our emergency edit link, if the user removes all blocks containing edit links *}
{g->block type="core.EmergencyEditItemLink" class="gbBlock" checkBlocks="album"}



