Need help for capturing error in jquery reusable function
<p>here i will paste my complete function. i have checked that function is getting called but i am not getting output. for long time i am trying to capture the bug in function but found nothing. so please some one help me to capture the error in function.</p>

<pre><code>        jQuery.fn.exists = function () { return this.length &gt; 0; }

    $.busyToggle = function (selector, ImgLoadSrc, marginBottom, opacity, speed, easing, callback) {
        var oDiv = $("&lt;div id='" + selector + "'&gt;&lt;img src='" + ImgLoadSrc + "'  alt='Loading...'/&gt;&lt;div&gt;&lt;em&gt;Loading Wait...&lt;/em&gt;&lt;/div&gt;&lt;/div&gt;");
        if ($("#BusyBox").exists() == false) {
            //alert('div not exist');
            oDiv.css("background", "-moz-linear-gradient(center top , #F1F2F2 0%, #F1F2F2 100%) repeat scroll 0 0 transparent");
            oDiv.css("border-top-left-radius", "5px");
            oDiv.css("border-top-right-radius", "5px");
            oDiv.css("bottom", "0px");
            oDiv.css("font-size", "0.8em");
            oDiv.css("font-style", "normal");
            oDiv.css("font-weight", "normal");
            oDiv.css("left", "50%");
            oDiv.css("margin-left", "-45px");
            oDiv.css("padding-top", "20px");
            oDiv.css("position", "fixed");
            oDiv.css("text-align", "center");
            oDiv.css("width", "90px");
            oDiv.css("height", "50px");
            oDiv.css("margin-bottom", "-70px");
            oDiv.css("background-repeat", "no-repeat");
            oDiv.css("background-position", "center center");
            oDiv.data('IsUp', 1)
            oDiv.appendTo('body');
        }

        if (oDiv.data('IsUp') == 1) {
            oDiv.data('IsUp', 0);
            return $("#BusyBox").stop(true).animate({ marginBottom: marginBottom, opacity: opacity }, { queue: false, duration: speed, complete: callback });
        }
        else {
            oDiv.data('IsUp', 1);
            return $("#BusyBox").stop(true).animate({ marginBottom: marginBottom, opacity: opacity }, { queue: false, duration: speed, complete: callback });
        }
    };
</code></pre>

<p><strong>this way i am calling the function.</strong></p>

<pre><code>        $(document).ready(function () {
        var flag = 1;
        $("#Process").click(function () {
            if (flag == 1) {
                $.busyToggle('#BusyBox','images/loader.gif', 0, 1, 500, 0, function () {
                    alert('div visible'); 
                });
                flag = 0;
            }
            else {
                $.busyToggle('#BusyBox', 'images/loader.gif', -70, 0, 500, 0, function () {
                    alert('div hide') 
                });
                flag = 1;
            }
            return false;
        });
    });
</code></pre>
