    var xpos = 0;
    var ypos = 0;

    $().mousemove(function(e){
        xpos = e.pageX;
        ypos = e.pageY;
    });

    $().ready(
        function()
        {
            var loader = $('<div id="loader"><img src="images/loading.gif" alt="loading..." /></div>')
                .css({position: "absolute", top: "1em", left: "1em", zIndex: "100"})
                .hide()
                .appendTo("body");
            $().ajaxStart(function() {
                loader.show();
            }).ajaxStop(function() {
                loader.hide();
            });
        }
    );
    
    function doPosition(idname) {
        wBody = $("#idBody").width();
        hBody = $("#idBody").height();
        w = $(idname).width();
        h = $(idname).height();
        xpos = (xpos+w > wBody) ? xpos-w : xpos;
        xpos = (xpos < 0) ? 0 : xpos;
        $(idname).css({ top: ypos, left: xpos });
    }

