var _os=null;var OS=Class.create({initialize:function(){this.appVersion="0";this.sources=[];this.scriptsToLoad=[];this.loadedScripts=[];this.completedScripts=[];this.completeCallbacks=[];this.scriptLoadListeners=[];this.pageLoading=true},addScriptLoadListener:function(a,c){var b=new Object();b.callback=a;b.associatedScripts=c;this.scriptLoadListeners.push(b)},requireAll:function(d,a,c){c=c||{};if(c.onComplete){this.scriptsToLoad.push(c.onComplete)}var b=a;if(c.extendedWatchScripts){var f=c.extendedWatchScripts;for(var e=0;e<f.length;e++){b.push(f[e])}}if(c.scriptLoadListener){this.addScriptLoadListener(c.scriptLoadListener,b)}if(typeof a=="string"){this.scriptsToLoad.push(a)}else{$A(a.reverse()).each(function(g){if(!this.sources[g]){this.scriptsToLoad.push(g)}}.bind(this))}this.load()},scriptLoaded:function(b){var a=[];$A(this.scriptsToLoad).each(function(c){if(c!=b){a.push(c)}});this.scriptsToLoad=a;if(this.completeCallbacks[b]){this.completeCallbacks[b]();this.completeCallbacks[b]=false}$A(this.scriptLoadListeners).each(function(d){var f=0;var e=0;$A(d.associatedScripts).each(function(g){if(this.completedScripts[g]){e++}f++}.bind(this));try{d.callback(e,f)}catch(c){}}.bind(this))},loadNext:function(){if(!this.queueLoading){return}this.requireNext();setTimeout(function(){this.loadNext()}.bind(this),50)},load:function(){if(this.queueLoading){return}this.queueLoading=true;this.loadNext()},loadComplete:function(){this.queueLoading=false},requireNext:function(){if(this.scriptLoadListener){this.scriptLoadListener(this.scriptsToLoad.length)}if(this.scriptsToLoad.length==0){this.loadComplete();return}var a=this.scriptsToLoad[this.scriptsToLoad.length-1];if(typeof a=="function"){a();this.scriptsToLoad.pop();this.load();return}this.require(a,function(){this.load()}.bind(this))},require:function(d,c){if(this.sources[d]){if(c){setTimeout(c,10)}return}this.sources[d]=true;if(!OS.Path){_os.showMessage("Error: Unknown JsOS");return}var a=document.getElementsByTagName("head").item(0);var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("src",OS.Path()+d);a.appendChild(b);this.waitForLoadComplete(d,c)},waitForLoadComplete:function(a,b){if(this.isQueueLoading(a)){setTimeout(function(){this.waitForLoadComplete(a,b)}.bind(this),10);return}if(this.completedScripts[a]){return}this.completedScripts[a]=true;if(b){setTimeout(b,10)}},isQueueLoading:function(a){if(!this.loadedScripts[a]){return true}return false},onLoadComplete:function(a){this.loadedScripts[a]=true;this.scriptLoaded(a)}});OS.Path=function(){return runtimeCarouselJsPath+"/"};OS.Load=function(){_os=new OS();OS.OnLoadComplete()};OS.CreateElement=function(c,b,e){if(!$(b)){return}var a=document.createElement(c);var d=$(b).appendChild(a);if(e){d.id=e}return d};OS.CreateDiv=function(b,c){var a=OS.CreateElement("div",b,c);return a};OS.CreateList=function(b,c){var a=OS.CreateElement("ul",b,c);return a};OS.AddListItem=function(b,c){var a=OS.CreateElement("li",b,c);return a};OS.OnLoadComplete=function(){if(!Prototype||!Element){setTimeout(OS.OnLoadComplete,300);return}_os.onLoadComplete("os.js")};OS.PageLoadComplete=function(){_os.pageLoading=false;$A(OS.BehaviourQueue).each(function(a){OS.ApplyBehaviour(a)});OS.BehaviourQueue=[]};Event.observe(document,"dom:loaded",function(){OS.PageLoadComplete()});OS.BehaviourQueue=[];OS.RegisterBehaviour=function(a){if(!_os.pageLoading){OS.ApplyBehaviour(a);return}OS.BehaviourQueue.push(a)};OS.ApplyBehaviour=function(a){$H(a).each(function(b){$$(b.key).each(function(c){b.value(c)})})};OS.Load();