QueryLoader isn´t working-Collection of common programming errors

I downloaded the QueryLoader plugin from http://www.gayadesign.com/diy/queryloader-preload-your-website-in-style/ to preload the site before showing the content. However, the Chrome console shows the following message when I access to:

Uncaught TypeError: Cannot call method ‘toLowerCase’ of undefined

Here’s the code:

The problem is in the .toLowerCase() line:

getImages: function(selector) {
    var everything = $(selector).find("*:not(script)").each(function() {
        var url = "";

        if ($(this).css("background-image") != "none") {
            var url = $(this).css("background-image");
        } else if (typeof($(this).attr("src")) != "undefined" && $(this).attr("tagName").toLowerCase() == "img") {
            var url = $(this).attr("src");
        }

        url = url.replace("url(\"", "");
        url = url.replace("url(", "");
        url = url.replace("\")", "");
        url = url.replace(")", "");

        if (url.length > 0) {
            QueryLoader.items.push(url);
        }
    });
},

Anybody knows the reason why this message appears and what it means?

Thanks.