/**
 * Site class
 * 
 * General site functionality class
 * Handles:
 *     - adding load events with support for passing arguments and binding
 *     - preloading images
 *     
 * NOTE - singleton class - use Site.getInstance to instantiate and get a handle on it
 * 
 * @author alec hill
 */
function Site(){if(!Site.INSTANTIATING){throw new Error("Site::constructor - you must use Site.getInstance() to instatiate a Site object");}this.initialize();}Site.getInstance=function(){if(!Site._instance){Site.INSTANTIATING=true;Site._instance=new Site();Site.INSTANTIATING=false;}return Site._instance;};Site.prototype={_loadEvents:null,_preloadedImages:null,_contentLoaded:false,initialize:function(){this._loadEvents=[];this._preloadedImages=[];if(typeof window.onload=="function"){this.addLoadEvent(window.onload);}var A=this;var B=function(C){A._onWindowLoad(C);};if(window.addEvent){if(Browser.Engine.name=="trident"||Browser.Engine.name=="webkit"){window.onload=B;}else{document.addEvent("DOMContentLoaded",B.bindWithEvent(this));}}else{window.onload=B;}},_onWindowLoad:function(D){for(var B=0,A=this._loadEvents.length;B<A;B++){var C=this._loadEvents[B];C.func.apply(C.bind,C.args);}},addLoadEvent:function(B,A,C){if(typeof B!="function"){throw new Error("Site::addLoadEvent - supplied argument must be a function!");}this._loadEvents.push({func:B,args:A||[],bind:C||window});},preload:function(B){var A=new Image();A.src=B;this._preloadedImages.push(A);},preloadImages:function(C){for(var B=0,A=C.length;B<A;B++){this.preload(C[B]);}}};
