Index: trunk/admin/themes/default/template/admin.tpl
===================================================================
--- trunk/admin/themes/default/template/admin.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/admin.tpl	(revision 7995)
@@ -1,16 +1,14 @@
-{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.core.packed.js" }
-{known_script id="jquery.ui.accordion" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.accordion.packed.js" }
-{known_script id="jquery.tipTip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.tipTip.minified.js" }
-
-<script type="text/javascript">
-jQuery().ready(function(){ldelim}
-  jQuery('#menubar').accordion({ldelim}
-    header: "dt.rdion",
-    event: "click",
-    autoHeight: false,
-    active: {$ACTIVE_MENU}
-  });
+{combine_script id='jquery.ui' load='header' require='jquery' path='themes/default/js/ui/packed/ui.core.packed.js' }
+{combine_script id='jquery.ui.accordion' load='header' require='jquery.ui' path='themes/default/js/ui/packed/ui.accordion.packed.js' }
+{footer_script require='jquery.ui.accordion'}
+jQuery(document).ready(function(){ldelim}
+	jQuery('#menubar').accordion({ldelim}
+		header: "dt.rdion",
+		event: "click",
+		autoHeight: false,
+		active: {$ACTIVE_MENU}
+	});
 });
-</script>
+{/footer_script}
 
 <div id="menubar">
@@ -105,4 +103,5 @@
   {/if}
   {if isset($U_HELP)}
+	{combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'}
   <ul class="HelpActions">
     <li><a href="{$U_HELP}" onclick="popuphelp(this.href); return false;" title="{'Help'|@translate}"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/help.png" class="button" alt="(?)"></a></li>
Index: trunk/admin/themes/default/template/cat_list.tpl
===================================================================
--- trunk/admin/themes/default/template/cat_list.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/cat_list.tpl	(revision 7995)
@@ -1,31 +1,29 @@
-{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
-{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.core.packed.js" }
-{known_script id="jquery.ui.sortable" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.sortable.packed.js" }
+{combine_script id='jquery.ui' load='async' require='jquery' path='themes/default/js/ui/packed/ui.core.packed.js' }
+{combine_script id='jquery.ui.sortable' load='async' require='jquery.ui' path='themes/default/js/ui/packed/ui.sortable.packed.js' }
+{footer_script require='jquery.ui.sortable'}
+jQuery(document).ready(function(){ldelim}
+	jQuery(".catPos").hide();
+	jQuery(".drag_button").show();
+	jQuery(".categoryLi").css("cursor","move");
+	jQuery(".categoryUl").sortable({ldelim}
+		axis: "y",
+		opacity: 0.8
+	});
+	jQuery("#categoryOrdering").submit(function(){ldelim}
+		ar = jQuery('.categoryUl').sortable('toArray');
+		for(i=0;i<ar.length;i++) {ldelim}
+			cat = ar[i].split('cat_');
+			document.getElementsByName('catOrd[' + cat[1] + ']')[0].value = i;
+		}
+	});
 
-<script type="text/javascript">
-  jQuery().ready(function(){ldelim}
-    jQuery(".catPos").hide();
-    jQuery(".drag_button").show();
-    jQuery(".categoryLi").css("cursor","move");
-    jQuery(".categoryUl").sortable({ldelim}
-      axis: "y",
-      opacity: 0.8
-    });
-    jQuery("#categoryOrdering").submit(function(){ldelim}
-      ar = jQuery('.categoryUl').sortable('toArray');
-      for(i=0;i<ar.length;i++) {ldelim}
-        cat = ar[i].split('cat_');
-        document.getElementsByName('catOrd[' + cat[1] + ']')[0].value = i;
-      }
-    });
-
-    jQuery("input[name=order_type]").click(function () {ldelim}
-      jQuery("#automatic_order_params").hide();
-      if (jQuery("input[name=order_type]:checked").val() == "automatic") {ldelim}
-        jQuery("#automatic_order_params").show();
-      }
-    });
-  });
-</script>
+	jQuery("input[name=order_type]").click(function () {ldelim}
+		jQuery("#automatic_order_params").hide();
+		if (jQuery("input[name=order_type]:checked").val() == "automatic") {ldelim}
+			jQuery("#automatic_order_params").show();
+		}
+	});
+});
+{/footer_script}
 
 <h2>{'Album list management'|@translate}</h2>
Index: trunk/admin/themes/default/template/element_set_global.tpl
===================================================================
--- trunk/admin/themes/default/template/element_set_global.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/element_set_global.tpl	(revision 7995)
@@ -2,27 +2,24 @@
 {include file='include/datepicker.inc.tpl'}
 
-{literal}
-<script type="text/javascript">
-  pwg_initialization_datepicker("#date_creation_day", "#date_creation_month", "#date_creation_year", "#date_creation_linked_date", "#date_creation_action_set");
+{footer_script}{literal}
+	pwg_initialization_datepicker("#date_creation_day", "#date_creation_month", "#date_creation_year", "#date_creation_linked_date", "#date_creation_action_set");
 </script>
-{/literal}
-
-{known_script id="jquery.fcbkcomplete" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.fcbkcomplete.js"}
-{literal}
-<script type="text/javascript">
-  $(document).ready(function() {
-    $("#tags").fcbkcomplete({
-      json_url: "admin.php?fckb_tags=1",
-      cache: false,
-      filter_case: false,
-      filter_hide: true,
-      firstselected: true,
-      filter_selected: true,
-      maxitems: 100,
-      newel: true
-    });
-  });
-</script>
-{/literal}
+{/literal}{/footer_script}
+
+{combine_script id='jquery.fcbkcomplete' load='async' require='jquery' path='themes/default/js/plugins/jquery.fcbkcomplete.js'}
+{footer_script require='jquery.fcbkcomplete'}{literal}
+jQuery(document).ready(function() {
+	jQuery("#tags").fcbkcomplete({
+		json_url: "admin.php?fckb_tags=1",
+		cache: false,
+		filter_case: false,
+		filter_hide: true,
+		firstselected: true,
+		filter_selected: true,
+		maxitems: 100,
+		newel: true
+	});
+});
+{/literal}{/footer_script}
 
 <h2>{'Batch management'|@translate}</h2>
Index: trunk/admin/themes/default/template/element_set_ranks.tpl
===================================================================
--- trunk/admin/themes/default/template/element_set_ranks.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/element_set_ranks.tpl	(revision 7995)
@@ -1,27 +1,19 @@
-{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
-{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.core.packed.js" }
-{known_script id="jquery.ui.sortable" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.sortable.packed.js" }
-{html_head}
-{literal}
-<script type="text/javascript">
-  $(function() {
-  $('ul.thumbnails')
-  .sortable(
-  { revert: true,
-  opacity: 0.7,
-  handle: $('.rank-of-image').add('.rank-of-image img'),
-  update: function() {
-  $(this).find('li').each(function(i) { 
-  $(this).find("input[name^=rank_of_image]")
-  .each(function() { $(this).attr('value', (i+1)*10)});
-  });
-  $('#image_order_rank').attr('checked', true);
-  }
-  });
-  });
-
-</script>
-{/literal}
-{/html_head}
+{combine_script id='jquery.ui' load='async' require='jquery' path='themes/default/js/ui/packed/ui.core.packed.js' }
+{combine_script id='jquery.ui.sortable' load='async' require='jquery.ui' path='themes/default/js/ui/packed/ui.sortable.packed.js' }
+{footer_script require='jquery.ui.sortable'}{literal}
+jQuery(document).ready(function() {
+	jQuery('ul.thumbnails').sortable( { 
+		revert: true,	opacity: 0.7,
+		handle: $('.rank-of-image').add('.rank-of-image img'),
+		update: function() {
+			$(this).find('li').each(function(i) { 
+			$(this).find("input[name^=rank_of_image]")
+			.each(function() { $(this).attr('value', (i+1)*10)});
+			});
+			$('#image_order_rank').attr('checked', true);
+			}
+	});
+});
+{/literal}{/footer_script}
 
 <h2>{'Manage image ranks'|@translate}</h2>
Index: trunk/admin/themes/default/template/element_set_unit.tpl
===================================================================
--- trunk/admin/themes/default/template/element_set_unit.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/element_set_unit.tpl	(revision 7995)
@@ -3,32 +3,29 @@
 {include file='include/datepicker.inc.tpl'}
 
-{known_script id="jquery.fcbkcomplete" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.fcbkcomplete.js"}
-{html_head}
-<script type="text/javascript">
-  var tag_boxes_selector = "";
+{combine_script id='jquery.fcbkcomplete' load='async' require='jquery' path='themes/default/js/plugins/jquery.fcbkcomplete.js'}
+{footer_script require='jquery.fcbkcomplete'}
+var tag_boxes_selector = "";
 {foreach from=$elements item=element name=element}
-  {if $smarty.foreach.element.first}
-  var prefix = "";
-  {else}
-  prefix = ", ";
-  {/if}
-  tag_boxes_selector = tag_boxes_selector + prefix + "#tags-" + {$element.ID};
+{if $smarty.foreach.element.first}
+var prefix = "";
+{else}
+prefix = ", ";
+{/if}
+	tag_boxes_selector = tag_boxes_selector + prefix + "#tags-" + {$element.ID};
 {/foreach}
 {literal}
-  $(document).ready(function() {
-    $(tag_boxes_selector).fcbkcomplete({
-      json_url: "admin.php?fckb_tags=1",
-      cache: false,
-      filter_case: false,
-      filter_hide: true,
-      firstselected: true,
-      filter_selected: true,
-      maxitems: 100,
-      newel: true
-    });
-  });
-</script>
-{/literal}
-{/html_head}
+jQuery(document).ready(function() {
+	$(tag_boxes_selector).fcbkcomplete({
+		json_url: "admin.php?fckb_tags=1",
+		cache: false,
+		filter_case: false,
+		filter_hide: true,
+		firstselected: true,
+		filter_selected: true,
+		maxitems: 100,
+		newel: true
+	});
+});
+{/literal}{/footer_script}
 
 <h2>{'Batch management'|@translate}</h2>
@@ -97,7 +94,7 @@
                value="{$element.DATE_CREATION_YEAR}">
         <input id="date_creation_linked_date-{$element.ID}" name="date_creation_linked_date-{$element.ID}" type="hidden" size="10" disabled="disabled">
-        <script type="text/javascript">
+        {footer_script}
           pwg_initialization_datepicker("#date_creation_day-{$element.ID}", "#date_creation_month-{$element.ID}", "#date_creation_year-{$element.ID}", "#date_creation_linked_date-{$element.ID}", "#date_creation_action_set-{$element.ID}");
-        </script>
+        {/footer_script}
       </td>
     </tr>
Index: trunk/admin/themes/default/template/footer.tpl
===================================================================
--- trunk/admin/themes/default/template/footer.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/footer.tpl	(revision 7995)
@@ -43,15 +43,23 @@
 </div> <!-- the_page -->
 
+
+{combine_script id='jquery.tipTip' load='async' path='themes/default/js/plugins/jquery.tipTip.minified.js'}
+{footer_script require='jquery.tipTip'}
+jQuery(document).ready(function() {ldelim}
+	jQuery('#pwgHead A, #footer A, .themeActions A, .themeActions SPAN, .languageActions A, .languageActions SPAN').tipTip({ldelim}
+			'delay' : 0,
+			'fadeIn' : 200,
+			'fadeOut' : 200,
+	});
+});
+{/footer_script}
+
+<!-- BEGIN get_combined_scripts -->
+{get_combined_scripts load='footer'}
+<!-- END get_combined_scripts -->
+
 {literal}
 <script type='text/javascript'>
-  $(function() {
-    $('#pwgHead A, #footer A, .themeActions A, .themeActions SPAN, .languageActions A, .languageActions SPAN').tipTip({
-        'delay' : 0,
-        'fadeIn' : 200,
-        'fadeOut' : 200,
-    });
-  });
-
-  $(document).ready(function() {
+  jQuery(document).ready(function() {
     $("a.externalLink").click(function() {
       window.open($(this).attr("href"));
Index: trunk/admin/themes/default/template/header.tpl
===================================================================
--- trunk/admin/themes/default/template/header.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/header.tpl	(revision 7995)
@@ -22,7 +22,10 @@
 {/foreach}
 
-{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js" now=1} {*jQuery is always available by default*}
+<!-- BEGIN get_combined_scripts -->
+{get_combined_scripts load='header'}
+<!-- END get_combined_scripts -->
 
-<script type="text/javascript" src="{$ROOT_URL}themes/default/js/scripts.js"></script>
+{combine_script id='jquery' path='themes/default/js/jquery.packed.js}
+
 <!--[if lt IE 7]>
 <script type="text/javascript" src="{$ROOT_URL}themes/default/js/pngfix.js"></script>
Index: trunk/admin/themes/default/template/history.tpl
===================================================================
--- trunk/admin/themes/default/template/history.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/history.tpl	(revision 7995)
@@ -2,10 +2,8 @@
 {include file='include/datepicker.inc.tpl'}
 
-{literal}
-<script type="text/javascript">
-  pwg_initialization_datepicker("#start_day", "#start_month", "#start_year", "#start_linked_date", null, null, "#end_linked_date");
-  pwg_initialization_datepicker("#end_day", "#end_month", "#end_year", "#end_linked_date", null, "#start_linked_date", null);
-</script>
-{/literal}
+{footer_script}{literal}
+	pwg_initialization_datepicker("#start_day", "#start_month", "#start_year", "#start_linked_date", null, null, "#end_linked_date");
+	pwg_initialization_datepicker("#end_day", "#end_month", "#end_year", "#end_linked_date", null, "#start_linked_date", null);
+{/literal}{/footer_script}
 
 <div class="titrePage">
Index: trunk/admin/themes/default/template/include/autosize.inc.tpl
===================================================================
--- trunk/admin/themes/default/template/include/autosize.inc.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/include/autosize.inc.tpl	(revision 7995)
@@ -1,13 +1,10 @@
-{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
-{known_script id="jquery.autogrow" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.autogrow-textarea.js"}
-
+{combine_script id='jquery' load='async' path='themes/default/js/jquery.packed.js'}
+{combine_script id='jquery.autogrow' load='async' require='jquery' path='themes/default/js/plugins/jquery.autogrow-textarea.js'}
 {* Auto size and auto grow textarea *}
-{literal}
-<script type="text/javascript">
-  jQuery().ready(function(){
-    jQuery('textarea').css('overflow-y', 'hidden');
-    // Auto size and auto grow for all text area
-    jQuery('textarea').autogrow();
-  });
-</script>
-{/literal}
+{footer_script require='jquery.autogrow'}{literal}
+jQuery(document).ready(function(){
+	jQuery('textarea').css('overflow-y', 'hidden');
+	// Auto size and auto grow for all text area
+	jQuery('textarea').autogrow();
+});
+{/literal}{/footer_script}
Index: trunk/admin/themes/default/template/include/datepicker.inc.tpl
===================================================================
--- trunk/admin/themes/default/template/include/datepicker.inc.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/include/datepicker.inc.tpl	(revision 7995)
@@ -1,12 +1,11 @@
-
-{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
-{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.core.packed.js"}
-{known_script id="jquery.ui.datepicker" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.datepicker.packed.js"}
-{known_script id="datepicker.js" src=$ROOT_URL|@cat:"themes/default/js/datepicker.js"}
+{combine_script id='jquery' load='footer' path='themes/default/js/jquery.packed.js'}
+{combine_script id='jquery.ui' load='footer' require='jquery' path='themes/default/js/ui/packed/ui.core.packed.js'}
+{combine_script id='jquery.ui.datepicker' load='footer' require='jquery.ui' path='themes/default/js/ui/packed/ui.datepicker.packed.js'}
+{combine_script id='datepicker.js' load='footer' require='jquery.ui.datepicker' path='themes/default/js/datepicker.js'}
 
 {assign var="datepicker_language" value="themes/default/js/ui/i18n/ui.datepicker-"|@cat:$lang_info.code|@cat:".js"}
 
 {if "PHPWG_ROOT_PATH"|@constant|@cat:$datepicker_language|@file_exists}
-{known_script id="jquery.ui.datepicker-$lang_info.code" src=$ROOT_URL|@cat:$datepicker_language}
+{combine_script id="jquery.ui.datepicker-$lang_info.code" path=$datepicker_language}
 {/if}
 
@@ -15,5 +14,5 @@
 {/html_head}
 
-<script type="text/javascript">
+{footer_script}
 function pwg_initialization_datepicker(day, month, year, linked_date, checked_on_change, min_linked_date, max_linked_date)
 {ldelim}
@@ -21,4 +20,4 @@
     "{$ROOT_URL}{$themeconf.admin_icon_dir}/datepicker.png",
     day, month, year, linked_date, checked_on_change, min_linked_date, max_linked_date);
-}
-</script>
+};
+{/footer_script}
Index: trunk/admin/themes/default/template/include/dbselect.inc.tpl
===================================================================
--- trunk/admin/themes/default/template/include/dbselect.inc.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/include/dbselect.inc.tpl	(revision 7995)
@@ -1,22 +1,18 @@
-{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
-{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.core.packed.js"}
-{known_script id="jquery.ui.resizable" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.resizable.packed.js"}
-
-{* Resize possible *}
-{literal}
-<script type="text/javascript">
-  jQuery().ready(function(){
-    // Resize possible for double select list
-    jQuery(".doubleSelect select.categoryList").resizable({
-      handles: "w,e",
-      animate: true,
-      animateDuration: "slow",
-      animateEasing: "swing",
-      preventDefault: true,
-      preserveCursor: true,
-      autoHide: true,
-      ghost: true
-    });
-  });
-</script>
-{/literal}
+{combine_script id='jquery' load='async' path='themes/default/js/jquery.packed.js'}
+{combine_script id='jquery.ui' load='async' require='jquery' path='themes/default/js/ui/packed/ui.core.packed.js' }
+{combine_script id='jquery.ui.resizable' load='async' require='jquery.ui' path='themes/default/js/ui/packed/ui.resizable.packed.js' }
+{footer_script require='jquery.ui.resizable'}{literal}
+jQuery(document).ready(function(){
+	// Resize possible for double select list
+	jQuery(".doubleSelect select.categoryList").resizable({
+		handles: "w,e",
+		animate: true,
+		animateDuration: "slow",
+		animateEasing: "swing",
+		preventDefault: true,
+		preserveCursor: true,
+		autoHide: true,
+		ghost: true
+	});
+});
+{/literal}{/footer_script}
Index: trunk/admin/themes/default/template/include/resize.inc.tpl
===================================================================
--- trunk/admin/themes/default/template/include/resize.inc.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/include/resize.inc.tpl	(revision 7995)
@@ -1,9 +1,8 @@
-{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
-{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.core.packed.js"}
-{known_script id="jquery.ui.resizable" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.resizable.packed.js"}
+{combine_script id='jquery' load='async' path='themes/default/js/jquery.packed.js'}
+{combine_script id='jquery.ui' load='async' require='jquery' path='themes/default/js/ui/packed/ui.core.packed.js'}
+{combine_script id='jquery.ui.resizable' load='async' require='jquery.ui' path='themes/default/js/ui/packed/ui.resizable.packed.js'}
 
 {* Resize possible *}
-{literal}
-<script type="text/javascript">
+{footer_script require='jquery.ui.resizable'}{literal}
   jQuery().ready(function(){
     // Resize possible for list
@@ -19,4 +18,3 @@
     });
   });
-</script>
-{/literal}
+{/literal}{/footer_script}
Index: trunk/admin/themes/default/template/intro.tpl
===================================================================
--- trunk/admin/themes/default/template/intro.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/intro.tpl	(revision 7995)
@@ -1,14 +1,13 @@
-{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
-{known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.packed.js"}
+{combine_script id='jquery.cluetip' load='async' require='jquery' path='themes/default/js/plugins/jquery.cluetip.packed.js'}
 
-<script type="text/javascript">
+{footer_script require='jquery.cluetip'}
 jQuery().ready(function(){ldelim}
-  jQuery('.cluetip').cluetip({ldelim}
-    width: 300,
-    splitTitle: '|',
-    positionBy: 'bottomTop'
-  });
+	jQuery('.cluetip').cluetip({ldelim}
+		width: 300,
+		splitTitle: '|',
+		positionBy: 'bottomTop'
+	});
 });
-</script>
+{/footer_script}
 
 <h2>{'Piwigo administration'|@translate}</h2>
Index: trunk/admin/themes/default/template/languages_new.tpl
===================================================================
--- trunk/admin/themes/default/template/languages_new.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/languages_new.tpl	(revision 7995)
@@ -1,13 +1,12 @@
-{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
-{known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.packed.js"}
+{combine_script id='jquery.cluetip' load='async' require='jquery' path='themes/default/js/plugins/jquery.cluetip.packed.js'}
 
-<script type="text/javascript">
+{footer_script require='jquery.cluetip'}
 jQuery().ready(function(){ldelim}
-  jQuery('.cluetip').cluetip({ldelim}
-    width: 300,
-    splitTitle: '|'
-  });
+	jQuery('.cluetip').cluetip({ldelim}
+		width: 300,
+		splitTitle: '|'
+	});
 });
-</script>
+{/footer_script}
 
 <div class="titrePage">
Index: trunk/admin/themes/default/template/menubar.tpl
===================================================================
--- trunk/admin/themes/default/template/menubar.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/menubar.tpl	(revision 7995)
@@ -1,32 +1,30 @@
-{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
-{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.core.packed.js" }
-{known_script id="jquery.ui.sortable" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.sortable.packed.js" }
-
-<script type="text/javascript">
-  jQuery().ready(function(){ldelim}
-    jQuery(".menuPos").hide();
-    jQuery(".drag_button").show();
-    jQuery(".menuLi").css("cursor","move");
-    jQuery(".menuUl").sortable({ldelim}
-      axis: "y",
-      opacity: 0.8
-    });
-    jQuery("input[name^='hide_']").click(function() {ldelim}
-      men = this.name.split('hide_');
-      if (this.checked) {ldelim}
-        jQuery("#menu_"+men[1]).addClass('menuLi_hidden');
-      } else {ldelim}
-        jQuery("#menu_"+men[1]).removeClass('menuLi_hidden');
-      }
-    });
-    jQuery("#menuOrdering").submit(function(){ldelim}
-      ar = jQuery('.menuUl').sortable('toArray');
-      for(i=0;i<ar.length;i++) {ldelim}
-        men = ar[i].split('menu_');
-        document.getElementsByName('pos_' + men[1])[0].value = i+1;
-      }
-    });
-  });
-</script>
+{combine_script id='jquery.ui' load='async' require='jquery' path='themes/default/js/ui/packed/ui.core.packed.js' }
+{combine_script id='jquery.ui.sortable' load='async' require='jquery.ui' path='themes/default/js/ui/packed/ui.sortable.packed.js' }
+{footer_script require='jquery.ui.sortable'}
+jQuery(document).ready(function(){ldelim}
+	jQuery(".menuPos").hide();
+	jQuery(".drag_button").show();
+	jQuery(".menuLi").css("cursor","move");
+	jQuery(".menuUl").sortable({ldelim}
+		axis: "y",
+		opacity: 0.8
+	});
+	jQuery("input[name^='hide_']").click(function() {ldelim}
+		men = this.name.split('hide_');
+		if (this.checked) {ldelim}
+			jQuery("#menu_"+men[1]).addClass('menuLi_hidden');
+		} else {ldelim}
+			jQuery("#menu_"+men[1]).removeClass('menuLi_hidden');
+		}
+	});
+	jQuery("#menuOrdering").submit(function(){ldelim}
+		ar = jQuery('.menuUl').sortable('toArray');
+		for(i=0;i<ar.length;i++) {ldelim}
+			men = ar[i].split('menu_');
+			document.getElementsByName('pos_' + men[1])[0].value = i+1;
+		}
+	});
+});
+{/footer_script}
 
 <div class="titrePage">
Index: trunk/admin/themes/default/template/photos_add_direct.tpl
===================================================================
--- trunk/admin/themes/default/template/photos_add_direct.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/photos_add_direct.tpl	(revision 7995)
@@ -1,8 +1,7 @@
-{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
-{known_script id="jquery.jgrowl" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.jgrowl_minimized.js"}
+{combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js' }
 
 {if $upload_mode eq 'multiple'}
 <script type="text/javascript" src="{$uploadify_path}/swfobject.js"></script>
-<script type="text/javascript" src="{$uploadify_path}/jquery.uploadify.v2.1.0.min.js"></script>
+{combine_script id='jquery.uploadify' load='footer' require='jquery' path='admin/include/uploadify/jquery.uploadify.v2.1.0.min.js' }
 {/if}
 {html_head}
@@ -10,6 +9,5 @@
 {/html_head}
 
-{literal}
-<script type="text/javascript">
+{footer_script}{literal}
 jQuery(document).ready(function(){
   function checkUploadStart() {
@@ -226,5 +224,5 @@
 {/if}
 });
-</script>
+{/footer_script}
 
 <div class="titrePage">
Index: trunk/admin/themes/default/template/picture_modify.tpl
===================================================================
--- trunk/admin/themes/default/template/picture_modify.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/picture_modify.tpl	(revision 7995)
@@ -3,27 +3,23 @@
 {include file='include/datepicker.inc.tpl'}
 
-{known_script id="jquery.fcbkcomplete" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.fcbkcomplete.js"}
-{literal}
-<script type="text/javascript">
-  $(document).ready(function() {
-    $("#tags").fcbkcomplete({
-      json_url: "admin.php?fckb_tags=1",
-      cache: false,
-      filter_case: false,
-      filter_hide: true,
-      firstselected: true,
-      filter_selected: true,
-      maxitems: 100,
-      newel: true
-    });
-  });
-</script>
-{/literal}
-
-{literal}
-<script type="text/javascript">
-  pwg_initialization_datepicker("#date_creation_day", "#date_creation_month", "#date_creation_year", "#date_creation_linked_date", "#date_creation_action_set");
-</script>
-{/literal}
+{combine_script id='jquery.fcbkcomplete' load='async' require='jquery' path='themes/default/js/plugins/jquery.fcbkcomplete.js'}
+{footer_script require='jquery.fcbkcomplete'}{literal}
+jQuery(document).ready(function() {
+	jQuery("#tags").fcbkcomplete({
+		json_url: "admin.php?fckb_tags=1",
+		cache: false,
+		filter_case: false,
+		filter_hide: true,
+		firstselected: true,
+		filter_selected: true,
+		maxitems: 100,
+		newel: true
+	});
+});
+{/literal}{/footer_script}
+
+{footer_script}
+pwg_initialization_datepicker("#date_creation_day", "#date_creation_month", "#date_creation_year", "#date_creation_linked_date", "#date_creation_action_set");
+{/footer_script}
 
 <h2>{'Modify informations about a picture'|@translate}</h2>
Index: trunk/admin/themes/default/template/plugins_new.tpl
===================================================================
--- trunk/admin/themes/default/template/plugins_new.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/plugins_new.tpl	(revision 7995)
@@ -1,24 +1,23 @@
-{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.core.packed.js" }
-{known_script id="jquery.ui.effects" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/effects.core.packed.js" }
-{known_script id="jquery.ui.blind" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/effects.blind.packed.js" }
+{combine_script id='jquery.ui' load='async' require='jquery' path='themes/default/js/ui/packed/ui.core.packed.js' }
+{combine_script id='jquery.ui.effects' load='async' require='jquery.ui' path='themes/default/js/ui/packed/effects.core.packed.js' }
+{combine_script id='jquery.ui.effects.blind' load='async' require='jquery.ui.effects' path='themes/default/js/ui/packed/effects.blind.packed.js' }
 
-<script type="text/javascript">
-jQuery().ready(function(){ldelim}
-  jQuery("td[id^='desc_']").click(function() {ldelim}
-    id = this.id.split('_');
-    nb_lines = jQuery("#bigdesc_"+id[1]).html().split('<br>').length;
+{footer_script require='jquery.ui.effects.blind'}
+jQuery(document).ready(function(){ldelim}
+	jQuery("td[id^='desc_']").click(function() {ldelim}
+		id = this.id.split('_');
+		nb_lines = jQuery("#bigdesc_"+id[1]).html().split('<br>').length;
 
-    $("#smalldesc_"+id[1]).toggle('blind', 1);
-    if ($(this).hasClass('bigdesc')) {ldelim}
-      $("#bigdesc_"+id[1]).toggle('blind', 1);
-      $(this).removeClass('bigdesc');
-    } else {ldelim}
-      $("#bigdesc_"+id[1]).toggle('blind', 50 + (nb_lines * 30));
-      $(this).addClass('bigdesc');
-    }
-    return false;
-  });
+		jQuery("#smalldesc_"+id[1]).toggle('blind', 1);
+		if (jQuery(this).hasClass('bigdesc')) {ldelim}
+			jQuery("#bigdesc_"+id[1]).toggle('blind', 1);
+		} else {ldelim}
+			jQuery("#bigdesc_"+id[1]).toggle('blind', 50 + (nb_lines * 30));
+		}
+		jQuery(this).toggleClass('bigdesc');
+		return false;
+	});
 });
-</script>
+{/footer_script}
 
 <div class="titrePage">
Index: trunk/admin/themes/default/template/plugins_update.tpl
===================================================================
--- trunk/admin/themes/default/template/plugins_update.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/plugins_update.tpl	(revision 7995)
@@ -1,13 +1,11 @@
-{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
-{known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.packed.js"}
-
-<script type="text/javascript">
+{combine_script id='jquery.cluetip' load='async' require='jquery' path='themes/default/js/plugins/jquery.cluetip.packed.js'}
+{footer_script require='jquery.cluetip'}
 jQuery().ready(function(){ldelim}
-  jQuery('.cluetip').cluetip({ldelim}
-    width: 300,
-    splitTitle: '|'
-  });
+	jQuery('.cluetip').cluetip({ldelim}
+		width: 300,
+		splitTitle: '|'
+	});
 });
-</script>
+{/footer_script}
 
 <div class="titrePage">
Index: trunk/admin/themes/default/template/popuphelp.tpl
===================================================================
--- trunk/admin/themes/default/template/popuphelp.tpl	(revision 7990)
+++ trunk/admin/themes/default/template/popuphelp.tpl	(revision 7995)
@@ -1,4 +1,2 @@
-{known_script id="jquery.tipTip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.tipTip.minified.js" }
-
 <div id="content" class="content">
 {$HELP_CONTENT}
