var Preloader = {
    load: function() {
        var args = $A(arguments);
        var callback = Object.isFunction(args.last()) ? args.pop() : Prototype.emptyFunction;
        var urls = Object.isArray(args[0]) ? $A(args[0]) : args;
        var loaded = 0;
        var images = $A();

        var onload = function() {
            if (++loaded == urls.length) {
                callback();

                // cleanup
                images.each(function(i) { delete i });
                images = callback = urls = null;
            }
        };

        urls.each(function(url) {
            var image = new Image();
            image.onload = image.onerror = onload;
            image.src = url;
            images.push(image);
        });
    }
};

function domready ()
{
//	document.body.appendChild(preload);	
	imgArray = [	"http://www.sienareno.com/lib/images/buttons/casino_btn_f4.jpg",
					"http://www.sienareno.com/lib/images/buttons/casino_btn_f4.jpg",
					"http://www.sienareno.com/lib/images/buttons/dine_btn_f4.jpg",
					"http://www.sienareno.com/lib/images/buttons/dine_btn_f4.jpg",
					"http://www.sienareno.com/lib/images/buttons/siena_v1_btn_gateway_f4.jpg",
					"http://www.sienareno.com/lib/images/buttons/music_btn_f4.jpg",
					"http://www.sienareno.com/lib/images/buttons/music_btn_f4.jpg",
					"http://www.sienareno.com/lib/images/buttons/spa_btn_f4.jpg",
					"http://www.sienareno.com/lib/images/buttons/spa_btn_f4.jpg" ];
					
					Preloader.load(imgArray);
//					alert('test');
					
}
document.observe("dom:loaded", domready);  // consider good dom load function
/*
preload = new Element('div', {className: 'ga_preloader'} );
imgs = new Array ('https://portal.gamingarts.com/lib/images/ga_portal_v1_bg_dashboard.png','https://portal.gamingarts.com/lib/images/ga_portal_v1_bg_header.png');
imgs.each ( function (imgsrc, index) {
	img = document.createElement('img');
	img.src = imgsrc;
	this.appendChild(img);
}.bind(preload) );
*/
