diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index b20c8c9474a..b9b579cca49 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -845,7 +845,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
else print "
".$appli."";
print "\n";
- if (! defined('DISABLE_JQUERY'))
+ if (! defined('DISABLE_JQUERY') && ! $disablejs && $conf->use_javascript_ajax)
{
print ''."\n";
$jquerytheme = 'smoothness';
@@ -976,32 +976,33 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
print ''."\n";
print ''."\n";
}
+
// Global js function
print ''."\n";
print ''."\n";
+
+ // Add datepicker default options
+ print ''."\n";
+
+ // Output module javascript
+ if (is_array($arrayofjs))
+ {
+ print ''."\n";
+ foreach($arrayofjs as $jsfile)
+ {
+ if (preg_match('/^http/i',$jsfile))
+ {
+ print ''."\n";
+ }
+ else
+ {
+ if (! preg_match('/^\//',$jsfile)) $jsfile='/'.$jsfile; // For backward compatibility
+ print ''."\n";
+ }
+ }
+ }
}
- // Output module javascript
- if (is_array($arrayofjs))
- {
- print ''."\n";
- foreach($arrayofjs as $jsfile)
- {
- if (preg_match('/^http/i',$jsfile))
- {
- print ''."\n";
- }
- else
- {
- if (! preg_match('/^\//',$jsfile)) $jsfile='/'.$jsfile; // For backward compatibility
- print ''."\n";
- }
- }
- }
-
- // Add datepicker default options
- print ''."\n";
-
if (! empty($head)) print $head."\n";
if (! empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER."\n";