I've got a custom developed WordPress wordpress plugin that's using jQuery 1.4 and for whatever reason it's conflicting using the core from the WordPress js code... unsure, however i think it is also jQuery, no?

Anyway, I believed it had been this datepicker script I had been using known as "anytime.js" however, after debugging it works out the conflict was still being happening after getting rid of the hyperlink inside the wordpress plugin to "anytime.js" but finally resolved after i eliminated the hyperlink to jquery.1.4.min.js ...

So, Any suggestions for how to prevent the conflict? Is WordPress jQuery-based and that is the reason or perhaps is it another thing?

Here's the appropriate code within the wordpress plugin:

function datepicker_header(){
    $theme_dir = get_bloginfo('wpurl').'/wp-content/plugins/postevents/js/';?>

    <link rel="stylesheet" type="text/css" href="<?=$theme_dir?>anytime.css" />
    <link rel="stylesheet" type="text/css" href="<?=$theme_dir?>ui.css" />

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type='text/javascript'></script>
    <script src="<?=$theme_dir?>anytime.js" type='text/javascript'></script>

    <script type="text/javascript">
        $(function(){
            AnyTime.picker( "startdate", { format: "%m-%d-%Y", firstDOW: 1, baseYear: '<?=date('Y')?>', earliest: '<?=date('m-d-Y')?>' } );
            AnyTime.picker( "enddate", { format: "%m-%d-%Y", firstDOW: 1, baseYear: '<?=date('Y')?>', earliest: '<?=date('m-d-Y')?>'  } );
        });
    </script>

EDIT

I believe I might have triggered some confusion. I ought to explain functionality. There's a wordpress plugin known as "Publish Occasions" which has a jQuery based datepicker. The datepicker depends on jQuery to operate. The particular and unusual issue is that although the wordpress plugin is active, it causes the brand new WordPress 3. draggable menus to fail in the Wordpress admin panel. Other functionality is working, however, crippling the datepicker doesn't increase the risk for menus becoming draggable. Rather, only removing the hyperlink to "/libs/jquery/1.4.2..." within the code above causes the menus being draggable again.

EDIT #2

As I are only able to indicate one correct answer, both @Matthew in addition to @polarblau's corrections below were needed to repair the problem!

Try:

jQuery(function(){
    AnyTime.picker( "startdate", { format: "%m-%d-%Y", firstDOW: 1, baseYear: '<?=date('Y')?>', earliest: '<?=date('m-d-Y')?>' } );
    AnyTime.picker( "enddate", { format: "%m-%d-%Y", firstDOW: 1, baseYear: '<?=date('Y')?>', earliest: '<?=date('m-d-Y')?>'  } );
});

Generally it is a good practice to wrap your scripts and plug ins that are using jQuery to their own scope:

(function($){
    //... your plugin, etc. here
})(jQuery);

Check this out link about correctly adding scripts to Wordpress: http://weblogtoolscollection.com/archives/2010/05/06/adding-scripts-properly-to-wordpress-part-1-wp_enqueue_script/

Company, Wordpress uses JQuery for many of it's functionality...

This code will determine if jQuery has already been loaded... then loads it when not already (this code loads from Google code - you are able to update the Hyperlink to a nearby file if you want).

if(typeof(jQuery)=='undefined'){
    var loadjQuery = document.createElement("script");
    loadjQuery.setAttribute("type","text/javascript");
    loadjQuery.setAttribute("src","http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js");
    document.getElementsByTagName("head")[0].appendChild(loadjQuery);
}

I do need to note, however, this is only going to work if loaded To another potential demonstration of jQuery (there is no guarantee that a clear case of jQuery will not be loaded later, unless of course it works this same check).

This really is helpful in situations where jQuery is loaded SOMETIMES and you really need it to be loaded, regardless of what. For the reason that situation, place this code sooner or later following the original might have loaded, but prior to using any jQuery functionality.

Yet another factor: I sometimes WordPress will get picky using the $ in jQuery code. You will get for this simply by typing out 'jQuery' (or carrying out a find/replace) rather than $ anywhere the $ is required.