/*
 * @require jade.js
 */
jade.Log=function(){};jade.Log.FACILITY_ALERT=0;jade.Log.FACILITY_CONSOLE=1;
jade.Log.FACILITY_LOG4JS=2;jade.Log.FACILITY_BROKEN_CONSOLE=3;jade.Log.DEBUG=0;jade.Log.INFO=1;
jade.Log.WARN=2;jade.Log.ERROR=3;jade.Log.level=-1;jade.Log.facility=null;jade.Log.logger=null;
jade.Log.print=function(a,e){var c,d,f,b,g,h,j;if(!e.length){return}switch(jade.Log.facility){case jade.Log.FACILITY_ALERT:if(a!=jade.Log.ERROR){return
}j="";h=0;if(typeof(e[0])=="string"){g=(e[0]);h++;b=0;d=0;f=g.length;while(d<f){if(g.charAt(d)=="%"&&"fidos".indexOf(g.charAt(d+1))>=0){j+=g.substring(b,d);
j+=""+e[h++];d++;b=d+1}d++}j+=g.substring(b,f)}for(d=h;d<e.length;d++){if(j){j+=" "
}j+=""+e[d]}alert(j);break;case jade.Log.FACILITY_LOG4JS:c=[];h=0;if(typeof(e[0])=="string"){g=(e[0]);
h++;b=0;d=0;f=g.length;while(d<f){if(g.charAt(d)=="%"&&"fidos".indexOf(g.charAt(d+1))>=0){c.push(g.substring(b,d-1));
c.push(e[h++]);d++;b=d+1}d++}c.push(g.substring(b,f))}for(d=h;d<e.length;d++){c.push(e[d])
}if(a==jade.Log.DEBUG){jade.Log.logger.debug.apply(jade.Log.logger,c)}else{if(a==jade.Log.INFO){jade.Log.logger.info.apply(jade.Log.logger,c)
}else{if(a==jade.Log.WARN){jade.Log.logger.warn.apply(jade.Log.logger,c)}else{jade.Log.logger.error.apply(jade.Log.logger,c)
}}}break}};jade.Log.log=function(a){jade.Log.print(jade.Log.DEBUG,(arguments))};jade.Log.debug=function(a){jade.Log.print(jade.Log.DEBUG,(arguments))
};jade.Log.info=function(a){jade.Log.print(jade.Log.INFO,(arguments))};jade.Log.warn=function(a){jade.Log.print(jade.Log.WARN,(arguments))
};jade.Log.error=function(a){jade.Log.print(jade.Log.ERROR,(arguments))};jade.Log.init=function(){var b;
if(("console" in window)&&("warn" in window.console)&&("debug" in window.console||"log" in window.console)&&("error" in window.console)&&("info" in window.console)){try{b=(window.console.log);
b();jade.Log.facility=jade.Log.FACILITY_CONSOLE;jade.Log.error=window.console.error
}catch(c){jade.Log.facility=jade.Log.FACILITY_BROKEN_CONSOLE;jade.Log.error=jade.bind(window.console.error,window.console)
}}else{if("log4javascript" in window){jade.Log.facility=jade.Log.FACILITY_LOG4JS;
jade.Log.logger=log4javascript.getDefaultLogger()}else{jade.Log.facility=jade.Log.FACILITY_ALERT
}}jade.Log.setLevel(jade.Log.ERROR)};jade.Log.setLevel=function(a){if(jade.Log.level!=a){jade.Log.level=a;
switch(jade.Log.facility){case jade.Log.FACILITY_CONSOLE:jade.Log.debug=jade.Log.isDebugLevel()?window.console.debug:jade.Log.noOp;
if(!jade.Log.debug){jade.Log.debug=jade.Log.isDebugLevel()?window.console.log:jade.Log.noOp
}jade.Log.info=jade.Log.isInfoLevel()?window.console.info:jade.Log.noOp;jade.Log.warn=jade.Log.isWarnLevel()?window.console.warn:jade.Log.noOp;
break;case jade.Log.FACILITY_BROKEN_CONSOLE:jade.Log.debug=jade.Log.isDebugLevel()?jade.bind(window.console.debug,window.console):jade.Log.noOp;
jade.Log.info=jade.Log.isInfoLevel()?jade.bind(window.console.info,window.console):jade.Log.noOp;
jade.Log.warn=jade.Log.isWarnLevel()?jade.bind(window.console.warn,window.console):jade.Log.noOp;
break;case jade.Log.FACILITY_LOG4JS:if(jade.Log.isDebugLevel()){jade.Log.logger.setLevel(log4javascript.Level.DEBUG)
}else{if(jade.Log.isInfoLevel()){jade.Log.logger.setLevel(log4javascript.Level.INFO)
}else{if(jade.Log.isWarnLevel()){jade.Log.logger.setLevel(log4javascript.Level.WARN)
}else{jade.Log.logger.setLevel(log4javascript.Level.ERROR)}}}}}if(a==jade.Log.DEBUG){jade.Log.info("Debug logging enabled")
}};jade.Log.noOp=function(){};jade.Log.getLevel=function(){return jade.Log.level};
jade.Log.isDebugLevel=function(){return jade.Log.level==jade.Log.DEBUG};jade.Log.isInfoLevel=function(){return jade.Log.level<=jade.Log.INFO
};jade.Log.isWarnLevel=function(){return jade.Log.level<=jade.Log.WARN};jade.Log.init();
