TypeError: $.datepicker is undefined
<p>my javascript has code, for one of the pages on my website:</p>

<pre><code>$('#nmdt1').datetimepicker({
        dateFormat: $.datepicker.ATOM,
        minDate: nmsdt,
                  ...
                  ...
</code></pre>

<p>this runs fine, when the page on which id="nmdt1" is loaded.
And I load the related datetimepicker js library (module) only on when i load that page.
so far so good.</p>

<p>but when i load any other pages on my websit i get this error: from the line number where dateformat is defined.</p>

<p>EDIT: here is the correct error for firebug log:</p>

<pre><code>TypeError: $.datepicker is undefined
http://myswbsite/jscript/myjsscript.js
Line 569
</code></pre>

<p>line 569 is:</p>

<pre><code>dateFormat: $.datepicker.ATOM,
</code></pre>

<p>and yes, this error only comes on page where I am not loading the related js code (jquery-ui-timepicker-addon.js). The reason I am not loading this js on every page is, i need it on only one page.</p>

<p>MORE DETAILS:</p>

<p>in HTML header following lib loads (in seq)</p>

<pre><code>&lt;head&gt;
    &lt;script src="/jscript/jquery-1.8.0.min.js" type="text/javascript"&gt;&lt;/script&gt;
    &lt;script src="/jscript/myjsscript.js" type="text/javascript"&gt;&lt;/script&gt;
...
...
    &lt;script type="text/javascript"&gt;
    jQuery(document).ready(function(){
        var mid = "[% mid %]";
        alert('mid='+mid);
        $(".bvmainmenu #"+mid).css({"background":"url(/images/current-bg.gif) top left repeat-x", "color":"#ffffff"});
    });
    &lt;/script&gt;
&lt;/head&gt;
</code></pre>

<p>this last javascript code you see above (bottom of header) does not run each time when the jquery-ui-timepicker-addon.js lib is not loaded (and you see that err in firebug - i can live with error, but why this last code is not running, i am not sure). I am not able to understand why this routine wont run just because i did not load one 'add-on' library</p>

<p>the page which runs everything correctly loads following js scripts in BODY</p>

<pre><code>&lt;script src="/jscript/jquery-ui-1.8.21.custom.min.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="/jscript/jquery-ui-timepicker-addon.js" type="text/javascript"&gt;&lt;/script&gt;
</code></pre>

<p>on this page the last javascript code you see in header also loads and displays the alert!</p>

<p>I am having tough time to figure this.</p>
