Index: /branches/2.4/themes/default/template/comment_list.tpl
===================================================================
--- /branches/2.4/themes/default/template/comment_list.tpl	(revision 16522)
+++ /branches/2.4/themes/default/template/comment_list.tpl	(revision 16523)
@@ -1,4 +1,2 @@
-{combine_script id='jquery.ajaxmanager' path='themes/default/js/plugins/jquery.ajaxmanager.js' load='footer'}
-{combine_script id='thumbnails.loader' path='themes/default/js/thumbnails.loader.js' require='jquery.ajaxmanager' load='footer'}
 {if isset($comment_derivative_params)}
 {strip}{html_style}
@@ -16,9 +14,13 @@
 <li class="commentElement {if $smarty.foreach.comment_loop.index is odd}odd{else}even{/if}">
 	{if isset($comment.src_image)}
-    {if isset($comment_derivative_params)}
-    {assign var=derivative value=$pwg->derivative($comment_derivative_params, $comment.src_image)}
-    {else}
-    {assign var=derivative value=$pwg->derivative($derivative_params, $comment.src_image)}
-    {/if}
+	{if isset($comment_derivative_params)}
+	{assign var=derivative value=$pwg->derivative($comment_derivative_params, $comment.src_image)}
+	{else}
+	{assign var=derivative value=$pwg->derivative($derivative_params, $comment.src_image)}
+	{/if}
+	{if !$derivative->is_cached()}
+	{combine_script id='jquery.ajaxmanager' path='themes/default/js/plugins/jquery.ajaxmanager.js' load='footer'}
+	{combine_script id='thumbnails.loader' path='themes/default/js/thumbnails.loader.js' require='jquery.ajaxmanager' load='footer'}
+	{/if}
 	<div class="illustration">
 		<a href="{$comment.U_PICTURE}">
Index: /branches/2.4/themes/default/template/mainpage_categories.tpl
===================================================================
--- /branches/2.4/themes/default/template/mainpage_categories.tpl	(revision 16522)
+++ /branches/2.4/themes/default/template/mainpage_categories.tpl	(revision 16523)
@@ -1,4 +1,2 @@
-{combine_script id='jquery.ajaxmanager' path='themes/default/js/plugins/jquery.ajaxmanager.js' load='footer'}
-{combine_script id='thumbnails.loader' path='themes/default/js/thumbnails.loader.js' require='jquery.ajaxmanager' load='footer'}
 {strip}{html_style}
 .thumbnailCategory .illustration{ldelim}
@@ -13,4 +11,8 @@
 {foreach from=$category_thumbnails item=cat name=cat_loop}
 {assign var=derivative value=$pwg->derivative($derivative_params, $cat.representative.src_image)}
+{if !$derivative->is_cached()}
+{combine_script id='jquery.ajaxmanager' path='themes/default/js/plugins/jquery.ajaxmanager.js' load='footer'}
+{combine_script id='thumbnails.loader' path='themes/default/js/thumbnails.loader.js' require='jquery.ajaxmanager' load='footer'}
+{/if}
 	<li class="{if $smarty.foreach.comment_loop.index is odd}odd{else}even{/if}">
 		<div class="thumbnailCategory">
Index: /branches/2.4/themes/default/template/picture_content.tpl
===================================================================
--- /branches/2.4/themes/default/template/picture_content.tpl	(revision 16522)
+++ /branches/2.4/themes/default/template/picture_content.tpl	(revision 16523)
@@ -1,4 +1,6 @@
+{if !$current.selected_derivative->is_cached()}
 {combine_script id='jquery.ajaxmanager' path='themes/default/js/plugins/jquery.ajaxmanager.js' load='footer'}
 {combine_script id='thumbnails.loader' path='themes/default/js/thumbnails.loader.js' require='jquery.ajaxmanager' load='footer'}
+{/if}
 
 <img {if $current.selected_derivative->is_cached()}src="{$current.selected_derivative->get_url()}" {$current.selected_derivative->get_size_htm()} {else}src="{$ROOT_URL}{$themeconf.img_dir}/ajax-loader-big.gif" data-src="{$current.selected_derivative->get_url()}"{/if} alt="{$ALT_IMG}" id="theMainImage" usemap="#map{$current.selected_derivative->get_type()}" title="{if isset($COMMENT_IMG)}{$COMMENT_IMG|@strip_tags:false|@replace:'"':' '}{else}{$current.TITLE|@replace:'"':' '} - {$ALT_IMG}{/if}">
Index: /branches/2.4/themes/default/template/thumbnails.tpl
===================================================================
--- /branches/2.4/themes/default/template/thumbnails.tpl	(revision 16522)
+++ /branches/2.4/themes/default/template/thumbnails.tpl	(revision 16523)
@@ -1,5 +1,3 @@
 {if !empty($thumbnails)}{strip}
-{combine_script id='jquery.ajaxmanager' path='themes/default/js/plugins/jquery.ajaxmanager.js' load='footer'}
-{combine_script id='thumbnails.loader' path='themes/default/js/thumbnails.loader.js' require='jquery.ajaxmanager' load='footer'}
 {*define_derivative name='derivative_params' width=160 height=90 crop=true*}
 {html_style}
@@ -26,5 +24,9 @@
 {foreach from=$thumbnails item=thumbnail}
 {assign var=derivative value=$pwg->derivative($derivative_params, $thumbnail.src_image)}
-	<li>
+{if !$derivative->is_cached()}
+{combine_script id='jquery.ajaxmanager' path='themes/default/js/plugins/jquery.ajaxmanager.js' load='footer'}
+{combine_script id='thumbnails.loader' path='themes/default/js/thumbnails.loader.js' require='jquery.ajaxmanager' load='footer'}
+{/if}
+<li>
 	<span class="wrap1">
 		<span class="wrap2">
