/* Author: Oliver Steele Copyright: Copyright 2006 Oliver Steele.  All rights reserved. Homepage: http://osteele.com/sources/javascript */
var InlineConsole={};InlineConsole.bindings={};InlineConsole.bindings.properties=function(object){var ar=[];for(var i in object)
ar.push(i);ar.sort();return ar;};InlineConsole.utils={};InlineConsole.utils.shallowCopy=function(object){var copy=new Object;InlineConsole.utils.update(copy,object);return copy;};InlineConsole.utils.update=function(target,source){for(var p in source)
target[p]=source[p];};InlineConsole.parseOptions=function(input){var options={};var m=input.match(/\/\/\s*(.*)\s*$/);if(!m)return options;var lines=m[1].split(/\s*,\s*/);for(var i=0;i<lines.length;i++){var pair=lines[i].split('=',2);if(!pair)continue;var key=pair[0],value=pair[1];options[key]=Number(value);}
return options;};InlineConsole.readEvalPrint=function(input){var value;try{with(InlineConsole.bindings)
value=eval(input);}
catch(e){error(e.message);return}
var options=InlineConsole.parseOptions(input);InlineConsole.display(value,options);};InlineConsole.display=function(value,options){var defaults=null;try{defaults=ReadableLogger.defaults}catch(e){}
try{if(defaults){var newOptions=InlineConsole.utils.shallowCopy(defaults);InlineConsole.utils.update(newOptions,options);ReadableLogger.defaults=newOptions;}
info(value);}finally{if(defaults)ReadableLogger.defaults=defaults;}};InlineConsole.evalField=function(id){InlineConsole.readEvalPrint(document.getElementById(id).value);};InlineConsole.addConsole=function(){var e=document.getElementById('inline-console');var fv=document.getElementById('fvlogger');if(!e){e=document.createElement('div');(fv||document.body).appendChild(e);}
e.innerHTML=InlineConsole.CONSOLE_HTML;if(!fv)
{InlineConsole.log_element=document.getElementById('inline-console-output');}};InlineConsole.CONSOLE_HTML='<form id="debugger" action="#" method="get" onsubmit="InlineConsole.evalField(\'eval\'); return false"><textarea id="eval" value="" onkeyup="/*event.preventDefault(); */return false;"></textarea></form>';InlineConsole.log_element=null;InlineConsole.initializeLoggingFunctions=function(){try{var logging_functions=[info,warn,error,message];for(var i in logging_functions)
if(typeof logging_functions[i]!='function')
throw"break";}catch(e){var f=function(msg){var span=document.createElement('div');span.innerHTML=String(msg).replace(/&/g,'&amp;').replace(/</g,'&lt;');InlineConsole.log_element.appendChild(span);};try{if(typeof debug!='function')throw 0}catch(e){debug=f}
try{if(typeof error!='function')throw 0}catch(e){error=f}
try{if(typeof info!='function')throw 0}catch(e){info=f}
try{if(typeof warn!='function')throw 0}catch(e){warn=f}}};InlineConsole.initializeLoggingFunctions();if(window.addEventListener){window.addEventListener('load',InlineConsole.addConsole,false);}else if(window.attachEvent){window.attachEvent('onload',InlineConsole.addConsole);}else{window.onload=(function(){var nextfn=window.onload||function(){};return function(){addConsole();nextfn();}})();}
