Error with jQuery Declaration
<p>I'm having an issue appaently with the jQuery Declaration that I have in a page:</p>

<p><a href="http://www.northernvirginiapaintingcontractor.com" rel="nofollow">http://www.northernvirginiapaintingcontractor.com</a>  Click  "Paint Facts"</p>

<p>Error: '$.fn' is null or not an object</p>

<p>Refers to this line:</p>

<pre><code>$.fn.accordion = function () {
</code></pre>

<p>I'm using this declaration for another website and works fine.</p>

<p>But for this website- this does not work fine.</p>

<p>In a seperate page on the site: GeneralContact
the jQuery Declaration is set-up like this:</p>

<pre><code>jQuery(document).ready(function ($) {
</code></pre>

<p>I don't have enough jQuery experience to debug this, if someone can see the problem, I would be very grateful!</p>

<p>It appears that this script is referencing $ in several places: 
moredetail_click()
hidedetail_click()
according_set()</p>

<p>I'm not sure if there is a work-around for all of the "$" references, or if I should somehow re-write this?</p>

<pre><code>        $.fn.accordion = function () {
        return this.each(function () {
            $container = $('#FactsLeftColumn');
            $container.find("dt").each(function () {
                var $header = $(this);
                var $selected = $header.next();

                $header.click(function () {
                    $('.active').removeClass('active');
                    $(this).addClass('active');
                    if ($selected.is(":visible")) {
                        $selected.animate({
                            height: 0
                        }, {
                            duration: 300,
                            complete: function () {
                                $(this).hide();

                                var id = $(this).attr("id");

                                var num;
                                if (id.length &lt; 3) {
                                    num = id;
                                } else {
                                    num = id.substring(2, id.length);
                                }
                                $('#hidden_' + num).hide();
                                $('#more' + num).show();

                            }
                        });
                    } else {
                        $unselected = $container.find("dd:visible");
                        $selected.show();
                        var newHeight = heights[$selected.attr("id")];
                        var oldHeight = heights[$unselected.attr("id")];

                        $('&lt;div&gt;').animate({
                            height: 1
                        }, {
                            duration: 300,
                            step: function (now) {
                                var stepSelectedHeight = Math.round(newHeight * now);
                                $selected.height(stepSelectedHeight);
                                $unselected.height(oldHeight + Math.round((newHeight - oldHeight) * now) - Math.round(newHeight * now));
                                if ($unselected.attr("id") != null) {
                                    var id = $unselected.attr("id");

                                    var num;
                                    if (id.length &lt; 3) {
                                        num = id;
                                    } else {
                                        num = id.substring(2, id.length);
                                    }
                                    $('#hidden_' + num).hide();
                                    $('#more' + num).show();
                                }
                            },
                            complete: function () {
                                $unselected.hide().css({
                                    height: 0
                                });
                            }
                        });
                    }
                    return false;
                });
            });

            var heights = new Object();

            $container.find("dd").each(function () {
                $this = $(this);
                $this.css("overflow", "hidden");
                heights[$this.attr("id")] = $this.height();

                $this.hide().css({
                    height: 0
                });
            });
        });
    };

    function moredetail_click(ddnum) {
        $('#view_' + ddnum).hide();
        $('#hidden_' + ddnum).show();
        var newHeight = $('#hidden_' + ddnum).height() + 2;
        if (ddnum &lt; 5) {
            $('#' + ddnum).height(newHeight);
        } else {
            $('#Dd' + ddnum).height(newHeight);
        }
    }

    function hidedetail_click(ddnum) {
        $('#hidden_' + ddnum).hide();
        $('#view_' + ddnum).show();

        var newHeight = $('#view_' + ddnum).height() + 1;
        if (ddnum &lt; 5) {
            $('#' + ddnum).height(newHeight);
        } else {
            $('#Dd' + ddnum).height(newHeight);
        }
    }

    function according_set() {
        $("#FactsLeftColumn").accordion();
    }

    $(document).ready(function () {
        $("#featured &gt; ul").tabs({ fx: { opacity: "toggle"} }).tabs("rotate", 5000, true);

        var idnum = 1;
        var ddnum = 1;

        $.getJSON('FaqsJson.ashx?factType=1', function (datas) {
            var str_one = "";
            str_one = "&lt;dl&gt;"

            var array_len = datas.length;
            var each_num = 1;

            var answer = "";
            var split_str;
            var len, i, start_pos;

            $.each(datas, function () {
                if (this['Answer'].length &gt; 200) {
                    split_str = this['Answer'].split(". ");
                    len = split_str.length;

                    answer = "&lt;div id='view_" + ddnum + "'&gt;";
                    if (split_str[0].length &lt; 150) {
                        answer += split_str[0] + ". " + split_str[1] + ".   &lt;a href='javascript:;' id='more" + ddnum + "' onclick='moredetail_click(" + ddnum + ")' class='moredetail'&gt;Read More&lt;/a&gt;";
                        start_pos = 2;
                    }
                    else {
                        answer += split_str[0] + ".   &lt;a href='javascript:;' id='more" + ddnum + "' class='moredetail' onclick='moredetail_click(" + ddnum + ")'&gt;Read More&lt;/a&gt;";
                        start_pos = 1;
                    }
                    answer += "&lt;/div&gt;";
                    answer += "&lt;div id='hidden_" + ddnum + "' style='display:none;width:534px;'&gt;";
                    answer += this['Answer'];
                    answer += "   &lt;a href='javascript:;' id='more" + ddnum + "' class='moredetail' onclick='hidedetail_click(" + ddnum + ")'&gt;Read Less&lt;/a&gt;";
                    answer += "&lt;/div&gt;";
                }
                else {
                    answer = this['Answer'];
                }

                str_one += "&lt;dt class=\"glossquestion\"&gt;&lt;a href=\"javascript://\" class=\"questionLink\"&gt;" + this['Question'] + "&lt;/a&gt;&lt;/dt&gt;";
                if (idnum &lt; 5)
                    str_one += "&lt;dd id=\"" + ddnum + "\" class=\"glossanswer\" style=\"right-margin:5px;width:544px;\"&gt;&lt;div class=\"answerbox\" style=\"width:536px;\"&gt;" + answer + "&lt;/div&gt;&lt;/dd&gt;";
                else
                    str_one += "&lt;dd id=\"Dd" + ddnum + "\" class=\"glossanswer\" style=\"right-margin:5px;width:544px;\"&gt;&lt;div class=\"answerbox\" style=\"width:536px;\"&gt;" + answer + "&lt;/div&gt;&lt;/dd&gt;";
                idnum++;
                ddnum++;
                each_num++;

                str_one += "&lt;/dl&gt;";
            });

            $("#glossary_first").html(str_one);

            window.setTimeout(according_set, 2000);
        });
    });
</code></pre>
