var Rico={Version:"2.0 rc2",loadRequested:1,loadComplete:2,init:function(){
try{
document.execCommand("BackgroundImageCache",false,true);
}
catch(err){
}
this.preloadMsgs="";
var _1=document.getElementsByTagName("script");
this.baseHref=location.protocol+"//"+location.host;
this.loadedFiles={};
this.windowIsLoaded=false;
this.onLoadCallbacks=[];
for(var i=0;i<_1.length;i++){
if(!_1[i].src){
continue;
}
var _3=_1[i].src;
var _4=_3.lastIndexOf("/");
var _5=_3.substring(0,_4+1);
var _6=_3.substring(_4+1);
this.loadedFiles[_6]=this.loadComplete;
var _7=_6.indexOf("?");
if(_7>0){
_6=_6.substring(0,_7);
}
if(_6=="rico.js"){
var _8=(_5.indexOf("/javascripts")>0);
if(_8){
this.jsDir="/javascripts/";
this.cssDir="/stylesheets/";
this.imgDir="/images/";
this.htmDir="/";
this.xslDir="/";
}else{
this.jsDir=_5;
this.cssDir=_5+"css/";
this.imgDir=_5+"images/";
this.htmDir=_5;
this.xslDir=_5;
}
}
}
if(typeof Prototype=="undefined"){
this.include("prototype.js");
}
this.include("ricoCommon.js");
this.languageInclude("en");
this.acceptLanguage(navigator.language||navigator.userLanguage);
var _9=function(){
Rico.windowLoaded();
};
if(window.addEventListener){
window.addEventListener("load",_9,false);
}else{
if(window.attachEvent){
window.attachEvent("onload",_9);
}
}
this.onLoad(function(){
Rico.writeDebugMsg("Pre-load messages:\n"+Rico.preloadMsgs);
});
},moduleDependencies:{Accordion:["ricoBehaviors.js","ricoEffects.js","ricoComponents.js"],Color:["ricoColor.js","ricoStyles.js"],Corner:["ricoStyles.js"],DragAndDrop:["ricoStyles.js","ricoEffects.js","ricoDragDrop.js"],Effect:["ricoEffects.js"],Calendar:["ricoCalendar.js","ricoCalendar.css"],Tree:["ricoTree.js","ricoTree.css"],ColorPicker:["ricoColorPicker.js","ricoStyles.js","ricoColorPicker.css"],CustomMenu:["ricoMenu.js","ricoMenu.css"],SimpleGrid:["+Effect","ricoGridCommon.js","ricoGrid.css","ricoSimpleGrid.js"],LiveGridBasic:["ricoGridCommon.js","ricoGrid.css","ricoBehaviors.js","ricoLiveGrid.js"],LiveGrid:["+Effect","+LiveGridBasic","ricoLiveGridControls.js"],LiveGridMenu:["+CustomMenu","ricoLiveGridMenu.js"],LiveGridAjax:["+LiveGrid","ricoLiveGridAjax.js"],LiveGridJSON:["+LiveGridAjax","ricoLiveGridJSON.js"],LiveGridForms:["+LiveGridAjax","+LiveGridMenu","+Accordion","+Corner","ricoLiveGridForms.js","ricoLiveGridForms.css"],SpreadSheet:["+SimpleGrid","ricoSheet.js","ricoSheet.css"]},languages:{en:"translations/ricoLocale_en.js"},languageInclude:function(_a){
var _b=this.languages[_a];
if(_b){
this.include(_b);
}
return !!_b;
},acceptLanguage:function(_c){
var _d=_c.toLowerCase().split(",");
for(var i=0;i<_d.length;i++){
var _f=_d[i].match(/\w\w/);
if(!_f){
continue;
}
if(this.languageInclude(_f)){
return true;
}
}
return false;
},loadModule:function(){
for(var a=0,_11=arguments.length;a<_11;a++){
var _12=arguments[a];
var dep=this.moduleDependencies[_12];
if(dep){
for(var i=0;i<dep.length;i++){
if(dep[i].substring(0,1)=="+"){
this.loadModule(dep[i].slice(1));
}else{
this.include(dep[i]);
}
}
}else{
this.include(_12);
}
}
},include:function(_15){
if(this.loadedFiles[_15]){
return;
}
this.addPreloadMsg("include: "+_15);
var ext=_15.substr(_15.lastIndexOf(".")+1);
switch(ext.toLowerCase()){
case "js":
this.loadedFiles[_15]=_15.substring(0,4)=="rico"?this.loadRequested:this.loadComplete;
document.write("<script type='text/javascript' src='"+this.jsDir+_15+"'></script>");
return;
case "css":
var el=document.createElement("link");
el.type="text/css";
el.rel="stylesheet";
el.href=this.cssDir+_15;
this.loadedFiles[_15]=this.loadComplete;
document.getElementsByTagName("head")[0].appendChild(el);
return;
}
},includeLoaded:function(_18){
this.loadedFiles[_18]=this.loadComplete;
this.checkIfComplete();
},windowLoaded:function(){
this.windowIsLoaded=true;
this.checkIfComplete();
},checkIfComplete:function(){
var _19=this.windowIsLoaded?"":"window";
for(var _1a in this.loadedFiles){
if(this.loadedFiles[_1a]==this.loadRequested){
_19+=" "+_1a;
}
}
this.addPreloadMsg("waitingFor: "+_19);
if(_19.length==0){
this.addPreloadMsg("Processing callbacks");
while(this.onLoadCallbacks.length>0){
var _1b=this.onLoadCallbacks.shift();
if(_1b){
_1b();
}
}
}
},onLoad:function(_1c,_1d){
if(_1d){
this.onLoadCallbacks.unshift(_1c);
}else{
this.onLoadCallbacks.push(_1c);
}
this.checkIfComplete();
},isKonqueror:navigator.userAgent.toLowerCase().indexOf("konqueror")>=0,startTime:new Date(),timeStamp:function(){
var _1e=new Date();
return (_1e.getTime()-this.startTime.getTime())+": ";
},setDebugArea:function(id,_20){
if(!this.debugArea||_20){
var _21=document.getElementById(id);
if(!_21){
return;
}
this.debugArea=_21;
_21.value="";
}
},addPreloadMsg:function(msg){
this.preloadMsgs+=Rico.timeStamp()+msg+"\n";
},writeDebugMsg:function(msg,_24){
if(this.debugArea){
if(_24){
this.debugArea.value="";
}
this.debugArea.value+=this.timeStamp()+msg+"\n";
}else{
if(window.console){
window.console.log(this.timeStamp()+msg);
}else{
if(window.opera){
window.opera.postError(this.timeStamp()+msg);
}
}
}
}};
Rico.init();
