var astalanumerator = function() {
	var id, jsBuiltInProps, delay = 25;
	function close() {
		astalanumerator.executeCode=astalanumerator.filter=astalanumerator.lastObj=astalanumerator.parent=astalanumerator.current=null;
		document.getElementById('inspectionResult').style.display = 'none';
		document.getElementById('inspectionResult').innerHTML = '';
	}
	function init(disableBuiltIn) {
		astalanumerator.compact = false;
		var html = '<h2>Inspector</h2>';
		html += '<input type="button" value="Close" onclick="astalanumerator.close();" class="mainbtns" />';
		html += '<table>';
		html += '<tr>';
		html += '<td>Filter:</td><td><input type="text" id="filterName" onkeyup="document.getElementById(\'inspectionContents\').innerHTML=\'\';astalanumerator.filter=this.value;astalanumerator.inspect(astalanumerator.current,astalanumerator.lastObj,document.getElementById(\'inspectionContents\'), true);" /></td>';
		html += '<td></td>';
		html += '</tr>';
		html += '<tr>';
		html += '<td>Execute this on every prop:</td><td><input type="text" id="codeToExecute" value="executingObj(1,2,3)"></td>';
		html += '<td><input type="button" value="Execute" class="mainbtns" onclick="astalanumerator.executeCode=document.getElementById(\'codeToExecute\').value;document.getElementById(\'inspectionContents\').innerHTML=\'\';astalanumerator.inspect(astalanumerator.current,astalanumerator.lastObj,document.getElementById(\'inspectionContents\'), true);"></td>';
		html += '</tr>';
		html += '</table>';
		html += '<table class="objectKey"><tr><td class="object">Object</td><td class="function">Function</td><td class="string">String</td><td class="number">Number</td><td class="boolean">Boolean</td></tr></table>';
		html += '<div id="inspectionContents"></div>';
		document.getElementById('inspectionResult').innerHTML = html;
		id = 0;
		if(!disableBuiltIn) {
			jsBuiltInProps = ['isGenerator','Proxy','WeakMap','oSetImmediate','webkitSetImmediate','mozSetImmediate','msSetImmediate','setImmediate','oRequestAnimationFrame','requestAnimationFrame','msRequestAnimationFrame','mozRequestAnimationFrame','webkitRequestAnimationFrame','addNamespace','appendChild','attribute','attributes','child','childIndex','children','contains','copy','elements','hasOwnProperty','hasComplexContent','hasSimpleContent','isScopeNamespaces','insertChildAfter','insertChildBefore','length','localName','name','namespace','namespaceDeclarations','nodeKind','normalize','parent','processingInstructions','prependChild','propertyIsEnumerable','removeNamespaces','replace','setChildren','setLocalName','setName','setNamespace','text','toString','toXMLString','valueOf','uri','localName','prefix','ignoreComments','ignoreProcessingInstructions','ignoreWhiteSpace','prettyIndent','prettyPrinting','isXMLName','function','enumerable','configurable','set','get','writable','$','$&','$\'','$*','$+','$1','$2','$3','$4','$5','$6','$7','$8','$9','$`','APPLICATION','ATOMICSELECTION','AddChannel','AddDesktopComponent','AddFavorite','Anchor','Applet','Area','Array','Attr','AutoCompleteSaveForm','AutoScan','BGCOLOR','BaseHref','BehaviorUrnsCollection','BookmarkCollection','Boolean','Button','CSSCurrentStyleDeclaration','CSSRuleList','CSSRuleStyleDeclaration','CSSStyleDeclaration','CSSStyleRule','CSSStyleSheet','Checkbox','ChooseColorDlg','CompatibleInfo','CompatibleInfoCollection','ControlRangeCollection','Count','DOMImplementation','DataTransfer','Date','Dialog','E','Element','Event','FieldDelim','FileUpload','Form','Frame','Function','GetObject','HTCElementBehaviorDefaults','HTMLAnchorElement','HTMLAreaElement','HTMLAreasCollection','HTMLBGSoundElement','HTMLBRElement','HTMLBaseElement','HTMLBaseFontElement','HTMLBlockElement','HTMLBodyElement','HTMLButtonElement','HTMLCollection','HTMLCommentElement','HTMLDDElement','HTMLDListElement','HTMLDTElement','HTMLDivElement','HTMLDocument','HTMLEmbedElement','HTMLFieldSetElement','HTMLFontElement','HTMLFormElement','HTMLFrameElement','HTMLFrameSetElement','HTMLGenericElement','HTMLHRElement','HTMLHeadElement','HTMLHeadingElement',1,'HTMLHtmlElement','HTMLIFrameElement','HTMLImageElement','HTMLInputElement','HTMLIsIndexElement','HTMLLIElement','HTMLLabelElement','HTMLLegendElement','HTMLLinkElement','HTMLMapElement','HTMLMarqueeElement','HTMLMetaElement','HTMLModelessDialog','HTMLNamespaceInfo','HTMLNamespaceInfoCollection','HTMLNextIdElement','HTMLNoShowElement','HTMLOListElement','HTMLObjectElement','HTMLOptionElement','HTMLParagraphElement','HTMLParamElement','HTMLPhraseElement','HTMLPluginsCollection','HTMLPopup','HTMLScriptElement','HTMLSelectElement','HTMLSpanElement','HTMLStyleElement','HTMLTableCaptionElement','HTMLTableCellElement','HTMLTableColElement','HTMLTableElement','HTMLTableRowElement','HTMLTableSectionElement','HTMLTextAreaElement','HTMLTextElement','HTMLTitleElement','HTMLUListElement','HTMLUnknownElement','Helper','Hidden','History','Image','ImportExportFavorites','Infinity','isArray','IsSubscribed','JSON','JavaArray','JavaClass','JavaObject','JavaPackage','LN10','LN2','LOG10E','LOG2E','Layer','Link','Location','MAX_VALUE','MIN_VALUE','Math','Methods','MimeType','NEGATIVE_INFINITY','NaN','NamedNodeMap','NavigateAndFind','Navigator','NodeList','Number','Object','Option','PI','POSITIVE_INFINITY','Packages','Password','Plugin','Radio','RegExp','Reset','SECURITY','SQRT1_2','SQRT2','STYLE','Screen','ScriptEngine','ScriptEngineBuildVersion','ScriptEngineMajorVersion','ScriptEngineMinorVersion','Select','Selection','ShowBrowserUI','StaticNodeList','Storage','String','Style','StyleSheetList','StyleSheetPage','StyleSheetPageList','Submit','Text','TextNode','TextRange','TextRangeCollection','TextRectangle','TextRectangleList','Textarea','UNSELECTABLE','URL','URLUnencoded','UTC','Window','XDomainRequest','XMLDocument','XMLHttpRequest','XMLNS','XSLDocument','__caller__','__count__','__defineGetter__','__defineSetter__','__iterator__','__lookupGetter__','__lookupSetter__','__noSuchMethod__','__parent__','__proto__','_content','aLink','aLinkcolor','abbr','abort','above','abs','accelerator','accept','acceptCharset','accessKey','acos','action','activeElement','add','addBehavior','addElement','addImport','addListener','addPageRule','addProperty','addReadRequest','addRule','addheader','additive','alert','align','alinkColor','all','allowDomain','allowTransparency','alt','altHTML','altKey','altLeft','anchor','anchors','and','appCodeName','appCore','appMinorVersion','appName','appVersion','appendChild','appendData','applets','applicationName','apply','applyElement','archive','areas','arguments','arguments.callee','arguments.caller','arguments.length','aria-activedescendant','aria-busy','aria-checked','aria-controls','aria-describedby','aria-disabled','aria-expanded','aria-flowto','aria-haspopup','aria-hidden','aria-invalid','aria-labelledby','aria-level','aria-live','aria-multiselectable','aria-owns','aria-posinset','aria-pressed','aria-readonly','aria-relevant','aria-required','aria-secret','aria-selected','aria-setsize','aria-valuemax','aria-valuemin','aria-valuenow','arity','asin','assign','atEnd','atan','atan2','atob','attachAudio','attachEvent','attachMovie','attachSound','attachVideo','attribute','attributes','autoSize','autocomplete','availHeight','availLeft','availTop','availWidth','axis','back','background','backgroundAttachment','backgroundColor','backgroundImage','backgroundPosition','backgroundPositionX','backgroundPositionY','backgroundRepeat','balance','banner','bannerAbstract','beginFill','beginGradientFill','behavior','behaviorUrns','below','bgColor','bgProperties','bind','big','blink','blockDirection','blockFormats','blockIndent','blur','body','bold','boolean','border','borderBottom','borderBottomColor','borderBottomStyle','borderBottomWidth','borderCollapse','borderColor','borderColorDark','borderColorLight','borderLeft','borderLeftColor','borderLeftStyle','borderLeftWidth','borderRight','borderRightColor','borderRightStyle','borderRightWidth','borderSpacing','borderStyle','borderTop','borderTopColor','borderTopStyle','borderTopWidth','borderWidth','borderWidths','bottom','bottomMargin','bottomScroll','boundElements','boundingHeight','boundingLeft','boundingTop','boundingWidth','boxSizing','break','broadcastMessage','browserLanguage','btoa','bufferDepth','bullet','button','byte','call','callee','caller','canHaveChildren','canHaveHTML','cancelBubble','capabilities','caption','captionSide','captureEvents','case','catch','ceil','cellIndex','cellPadding','cellSpacing','cells','ch','chOff','char','charAt','charCodeAt','characterSet','charset','checked','childNodes','children','chr','cite','class','className','classes','classid','clear','clearAttributes','clearData','clearInterval','clearRequest','clearTimeout','click','clientHeight','clientInformation','clientLeft','clientTop','clientWidth','clientX','clientY','clip','clipBottom','clipLeft','clipRight','clipTop','clipboardData','cloneNode','close','closed','code','codeBase','codeType','colSpan','collapse','color','colorDepth','cols','compact','compareEndPoints','compatMode','compatible','compile','complete','componentFromPoint','components','concat','condenseWhite','confirm','connect','const','constructor','contains','content','contentDocument','contentEditable','contentOverflow','contentType','contentWindow','contextual','continue','control','controlRange','controllers','cookie','cookieEnabled','coords','cos','counterIncrement','counterReset','cpuClass','create','createAttribute','createCaption','createComment','createControlRange','createDocumentFragment','createElement','createEmptyMovieClip','createEventObject','createPopup','createRange','createStyleSheet','createTFoot','createTHead','createTextField','createTextNode','createTextRange','crypto','cssText','ctrlKey','ctrlLeft','current','currentStyle','cursor','curveTo','data','dataFld','dataFormatAs','dataPageSize','dataSrc','dataTransfer','dateTime','debugger','declare','decode','decodeURI','decodeURIComponent','default','defaultCharset','defaultChecked','defaultSelected','defaultStatus','defaultValue','defaultView','defaults','defer','defineProperty','defineProperties','delete','deleteCaption','deleteCell','deleteData','deleteRow','deleteTFoot','deleteTHead','description','designMode','detachEvent','deviceXDPI','deviceYDPI','dialogArguments','dialogHeight','dialogLeft','dialogTop','dialogWidth','dimensions','dir','direction','directories','disableExternalCapture','disabled','display','do','doImport','doReadRequest','doScroll','docTypeDecl','doctype','document','documentElement','documentMode','domain','double','dragDrop','dragOut','dragOver','dropEffect','dump','duplicate','duplicateMovieClip','duration','dynsrc','effectAllowed','elementFromPoint','elements','else','embedFonts','embeds','empty','emptyCells','enableExternalCapture','enabled','enabledPlugin','encodeURI','encodeURIComponent','encoding','enctype','endFill','enterFrame','enum','eq','escape','eval','evaluate','event','every','exec','execCommand','execScript','exp','expando','export','extends','external','face','fgColor','fileCreatedDate','fileModifiedDate','fileName','fileSize','fileUpdatedDate','filename','filter','filters','final','finally','find','findText','fireEvent','firstChild','firstPage','fixed','float','floor','flush','focus','focusEnabled','font','fontColor','fontFamily','fontSize','fontSmoothingEnabled','fontStyle','fontVariant','fontWeight','fontcolor','fonts','fontsize','for','forEach','form','formName','forms','forward','frame','frameBorder','frameElement','frameSpacing','frames','fromCharCode','fromElement','freeze','frozen','fscommand','function','galleryImg','ge','get','getAdjacentText','getAllResponseHeaders','getAscii','getAttention','getAttribute','getAttributeNode','getBeginIndex','getBookmark','getBounds','getBytesLoaded','getBytesTotal','getCaretIndex','getCharset','getClientRects','getCode','getCookie','getData','getDate','getDay','getDepth','getDuration','getElementById','getElementsByName','getElementsByTagName','getEndIndex','getExpression','getFocus','getFontList','getFullYear','getHours','getItem','getMilliseconds','getMinutes','getMonth','getNamedItem','getNewTextFormat','getOwnPropertyDescriptor','getOwnPropertyNames','getPan','getPosition','getProperty','getPrototypeOf','getRGB','getResponseHeader','getSeconds','getSelection','getSize','getTextExtent','getTextFormat','getTime','getTimer','getTimezoneOffset','getTransform','getURL','getUTCDate','getUTCDay','getUTCFullYear','getUTCHours','getUTCMilliseconds','getUTCMinutes','getUTCMonth','getUTCSeconds','getUTCYear','getVarDate','getVersion','getVolume','getYear','global','globalToLocal','go','goto','gotoAndPlay','gotoAndStop','gt','handleEvent','hasAccessibility','hasAudio','hasAudioEncoder','hasChildNodes','hasFeature','hasFocus','hasLayout','hasMP3','hasOwnProperty','hasVideoEncoder','hash','headers','height','hidden','hide','hideFocus','history','hitArea','hitTest','home','host','hostname','href','hreflang','hscroll','hspace','html','htmlFor','htmlText','httpEquiv','id','ids','if','ifFrameLoaded','ignoreCase','ignoreWhite','images','imeMode','implementation','implements','import','imports','in','inRange','include','indent','indeterminate','index','indexOf','innerHTML','innerHeight','innerText','innerWidth','input','insertAdjacentElement','insertAdjacentText','insertBefore','insertCell','insertData','insertRow','install','instanceof','int','interface','isActive','isAlternate','isContentEditable','isDebugger','isDisabled','isDown','isEqual','isFinite','isMap','isMultiLine','isNaN','isOpen','isPrefAlternate','isPropertyEnumerable','isPrototypeOf','isTextEdit','isToggled','italic','italics','item','java','javaEnabled','join','keys','keyCode','keyDown','keyPress','keyUp','label','lang','language','lastChild','lastIndex','lastIndexOf','lastMatch','lastModified','lastPage','lastParen','layerX','layers','layoutFlow','layoutGrid','layoutGridChar','layoutGridLine','layoutGridMode','layoutGridType','lbound','le','leading','left','leftContext','leftMargin','length','letterSpacing','lineBreak','lineHeight','lineNumber','lineStyle','lineTo','link','linkColor','links','list','listStyle','listStyleImage','listStylePosition','listStyleType','load','loadMovie','loadMovieNum','loadSound','loadVariables','loadVariablesNum','loaded','localName','localStorage','localToGlobal','localeCompare','location','locationbar','log','logicalXDPI','logicalYDPI','long','longDesc','loop','lowsrc','lt','manufacturer','map','margin','marginBottom','marginHeight','marginLeft','marginRight','marginTop','marginWidth','margins','match','max','maxChars','maxConnectionsPerServer','maxHeight','maxLength','maxWidth','maxhscroll','maxscroll','mbchr','mblength','mbord','mbsubstring','media','menuArguments','menubar','mergeAttributes','message','metaInfo','meth','method','mimeType','mimeTypes','min','minHeight','minWidth','mouseDown','mouseMove','mouseUp','move','moveAbove','moveBelow','moveBy','moveEnd','moveFirst','moveNext','moveRow','moveStart','moveTo','moveToAbsolute','moveToBookmark','moveToElementText','moveToPoint','msBlockProgression','msInterpolationMode','multiline','multiple','name','nameProp','namedItem','namedRecordset','namespace','namespaceURI','namespaces','native','navigate','navigator','ne','netscape','new','newline','next','nextFrame','nextPage','nextScene','nextSibling','noHref','noResize','noShade','now','noWrap','nodeName','nodeType','nodeValue','normalize','not','null','number','object','offscreenBuffering','offsetHeight','offsetLeft','offsetParent','offsetTop','offsetWidth','offsetX','offsetY','on','onAbort','onActivate','onAfterprint','onAfterupdate','onBeforeactivate','onBeforecut','onBeforedeactivate','onBeforeeditfocus','onBeforepaste','onBeforeprint','onBeforeunload','onBeforeupdate','onBlur','onCellchange','onChange','onChanged','onClick','onClipEvent','onClose','onConnect','onContextmenu','onControlselect','onCut','onData','onDataavailable','onDatasetchanged','onDatasetcomplete','onDblclick','onDeactivate','onDrag','onDragOut','onDragOver','onDragdrop','onDragend','onDragenter','onDragleave','onDragover','onDragstart','onDrop','onEnterFrame','onError','onErrorupdate','onFocus','onHelp','onKeyDown','onKeyUp','onKeydown','onKeypress','onKeyup','onKillFocus','onLine','onLoad','onMouseDown','onMouseMove','onMouseUp','onMousedown','onMousemove','onMouseout','onMouseover','onMouseup','onPaste','onPress','onPropertychange','onReadystatechange','onRelease','onReleaseOutside','onReset','onResize','onResizeend','onResizestart','onRollOut','onRollOver','onRowenter','onRowexit','onRowsdelete','onRowsinserted','onScroll','onScroller','onSelect','onSelectionchange','onSelectstart','onSetFocus','onSoundComplete','onStop','onSubmit','onUnload','onXML','onpropertychange','onreadystatechange','onvisibilitychange','open','opener','opsProfile','options','or','ord','origin','orphans','os','oscpu','outerHTML','outerHeight','outerText','outerWidth','outline','outlineColor','outlineStyle','outlineWidth','overflow','overflowX','overflowY','ownerDocument','ownerElement','owningElement','package','padding','paddingBottom','paddingLeft','paddingRight','paddingTop','paddings','page','pageBreakAfter','pageBreakBefore','pageBreakInside','pageX','pageXOffset','pageY','pageYOffset','pages','palette','parent','parentElement','parentLayer','parentNode','parentStyleSheet','parentTextEdit','parentWindow','parse','parseFloat','parseInt','parseXML','password','pasteHTML','pathname','pause','personalbar','pixelAspectRatio','pixelBottom','pixelDepth','pixelHeight','pixelLeft','pixelRight','pixelTop','pixelWidth','pkcs11','platform','play','plugin','plugins','plugins.refresh','pluginspage','pop','popup','port','posBottom','posHeight','posLeft','posRight','posTop','posWidth','position','pow','preference','prefix','press','prevFrame','prevScene','previous','previousPage','previousSibling','print','printAsBitmap','printAsBitmapNum','printNum','private','product','productSub','profile','prompt','prompter','propertyIsEnumerable','propertyName','protected','protocol','prototype','pseudoClass','public','publish','push','qualifier','queryCommandEnabled','queryCommandIndeterm','queryCommandState','queryCommandValue','quote','quotes','random','readOnly','readyState','reason','recalc','receiveAudio','receiveVideo','recordNumber','recordset','reduce','reduceRight','referrer','refresh','registerClass','rel','release','releaseCapture','releaseEvents','releaseOutside','reload','remainingSpace','remove','removeAttribute','removeAttributeNode','removeBehavior','removeChild','removeExpression','removeListener','removeMovieClip','removeNamedItem','removeNode','removeRule','removeTextField','repeat','replace','replaceChild','replaceData','replaceNode','replaceSel','reset','resizeBy','resizeTo','responseBody','responseText','responseXML','restrict','return','returnValue','rev','reverse','right','rightContext','rightMargin','role','rollOut','rollOver','round','routeEvents','rowIndex','rowSpan','rows','rubyAlign','rubyOverhang','rubyPosition','rule','rules','runtimeStyle','seal','savePreferences','saveType','scaleMode','scheme','scope','scopeName','screen','screenColor','screenDPI','screenLeft','screenResolutionX','screenResolutionY','screenTop','screenX','screenY','scripts','scroll','scrollAmount','scrollBy','scrollByLines','scrollByPages','scrollDelay','scrollHeight','scrollIntoView','scrollLeft','scrollString','scrollTo','scrollTop','scrollWidth','scrollX','scrollY','scrollbar','scrollbar3dLightColor','scrollbarArrowColor','scrollbarBaseColor','scrollbarDarkShadowColor','scrollbarFaceColor','scrollbarHighlightColor','scrollbarShadowColor','scrollbarTrackColor','scrollbars','scrolling','search','sectionRowIndex','security','securityPolicy','seek','select','selectable','selectableContent','selected','selectedIndex','selection','selector','selectorText','self','send','sendAndLoad','serverString','sessionStorage','set','setActive','setAttribute','setAttributeNode','setBufferTime','setCapture','setCookie','setCursor','setDate','setDuration','setExpression','setFocus','setFps','setFullYear','setGain','setHotKeys','setHours','setInterval','setKeyFrameInterval','setLoopback','setMask','setMilliseconds','setMinutes','setMode','setMonth','setMotionLevel','setNamedItem','setNewTextFormat','setPan','setPosition','setProperty','setQuality','setRGB','setRate','setRequestHeader','setResizable','setSeconds','setSelection','setSilenceLevel','setTextFormat','setTime','setTimeout','setTransform','setUTCDate','setUTCFullYear','setUTCHours','setUTCMilliseconds','setUTCMinutes','setUTCMonth','setUTCSeconds','setUseEchoSuppression','setVolume','setYear','setZOptions','shape','shift','shiftKey','shiftLeft','short','show','showHelp','showMenu','showModalDialog','showModelessDialog','siblingAbove','siblingBelow','sidebar','signText','sin','size','sizeToContent','slice','small','some','sort','sortOn','source','sourceIndex','span','specified','splice','split','splitText','sqrt','src','srcElement','srcFilter','srcUrn','stack','standby','start','startDrag','static','status','statusText','statusbar','stop','stopAllSounds','stopDrag','strike','stringify','style','styleFloat','styleSheet','styleSheets','sub','submit','substr','substring','substringData','suffixes','summary','sun','sup','super','swapDepths','swapNode','switch','synchronized','systemLanguage','systemXDPI','systemYDPI','tBodies','tFoot','tHead','tabChildren','tabEnabled','tabIndex','tabStop','tabStops','table','tableLayout','tagName','tagUrn','tags','taint','taintEnabled','tan','target','targetPath','tellTarget','test','text','textAlign','textAlignLast','textAutospace','textColor','textDecoration','textDecorationBlink','textDecorationLineThrough','textDecorationNone','textDecorationOverline','textDecorationUnderline','textHeight','textIndent','textJustify','textKashidaSpace','textOverflow','textTransform','textUnderlinePosition','textWidth','textarea','this','throw','throws','timeout','title','toArray','toISOString','toDateString','toElement','toExponential','toFixed','toGMTString','toJSON','toLocaleDateString','toLocaleLowerCase','toLocaleString','toLocaleTimeString','toLocaleUpperCase','toLowerCase','toPrecision','toSource','toString','toTimeString','toUTCString','toUpperCase','toggleHighQuality','toolbar','top','topMargin','trace','trackAsMenu','transient','trim','trimLeft','trimRight','trueSpeed','try','type','typeDetail','typeof','ubound','undefined','underline','unescape','unicodeBidi','uninstall','uniqueID','units','unload','unloadMovie','unloadMovieNum','unshift','untaint','unwatch','updateAfterEvent','updateCommands','updateInterval','url','urn','urns','useHandCursor','useMap','userAgent','userLanguage','userProfile','vAlign','vLink','vLinkcolor','value','valueOf','valueType','var','variable','vcard_name','vendor','vendorSub','version','verticalAlign','viewInheritStyle','viewLink','viewLinkContent','viewMasterTab','visibility','vlinkColor','void','volatile','volume','vrml','vspace','watch','wheelDelta','while','whiteSpace','widows','width','window','with','wordBreak','wordSpacing','wordWrap','wrap','write','writeln','writingMode','x','xmlDecl','y','zIndex','zoom'];
			for(var i=0;i<1000;i++) {
				jsBuiltInProps.push(i);
				jsBuiltInProps.push(i*-1);			
				jsBuiltInProps.push(String.fromCharCode(i));			
			}		
		} else {
			jsBuiltInProps = [];
		}
	}	
	function getChilds(obj) {
		var numOfChilds = 0;
		while(obj.parentNode) {
			if(obj.tagName == 'LI') {
				numOfChilds++;	
			}
			obj = obj.parentNode;
		}
		obj = null;
		return numOfChilds;
	}
	function toHex(str) {
		str = str + '';
		str = str.split("");
		for(var i=0;i<str.length;i++) {
			str[i] = '\\x' + str[i].charCodeAt(0).toString(16);
		}
		return str.join("");
	}
	function escapeHTML(str) {
			str = str+'';
			str = str.replace(/&/gi,'&amp;');
			str = str.replace(/</gi,'&lt;');
			str = str.replace(/>/gi,'&gt;');
			str = str.replace(/"/gi,'&quot;');
			str = str.replace(/'/gi,'&#39;');
			str = str.replace(/\\/gi,'&#92;');
			return str;
	}		
	function delayHTML() {
		var args = arguments;
		setTimeout(function(){
			if (document.getElementById(args[0])) {
				document.getElementById(args[0]).innerHTML = args[1];				
			} else {
				delayHTML(args);
			}
		},2000);
	}
	function inspect(obj, objName, target, topLevel) {				
		astalanumerator.current = obj;				
		var html = '<ul class="tree">', 
			prop, 
			count = 0,
			traversedProps = {},
			props = [];

		try {
			for(var i in obj) {
				props.push(i);
			}
		} catch(e){}
		
		props = props.concat(jsBuiltInProps);
		
		var str = '', iObj;
		try {
			for (var i = new Enumerator(obj); !i.atEnd(); i.moveNext()){
				try {
					iObj = i.item();			
					str = (iObj.nodeName ? iObj.nodeName : iObj.tagName ? iObj.tagName : 'Unknown');
					if(str != 'Unknown') {
						props.push(str);
					}									
				} catch(e) {}
			}
		} catch(e){}
		
		try {
			var ownProps = Object.getOwnPropertyNames(obj);
			if(ownProps.length) {
				props = props.concat(ownProps);
			}
		} catch(e){}
		
		props = props.sort();
		
		for(var i=0;i<props.length;i++) {			
			try {						
				prop = props[i];

				if(traversedProps[props[i]] == true) {
					continue;
				}	
				
				if(astalanumerator.filter && topLevel) {					
					try {
					if(!new RegExp('^'+astalanumerator.filter).test(props[i])) {
						continue;
					}
					} catch(e) { alert('Invalid regex'); }
				}
				
				try {
					if(astalanumerator.executeCode) {							
						Function('executingObj',astalanumerator.executeCode)(obj[props[i]]);						
					}
				} catch(e){}
				
				if(obj[props[i]] !== undefined) {														
					html += '<li class="closed">';
					html += '<table class="propTable">';					
					html += '<tr>';
					if(!astalanumerator.compact) {
						html += '<td class="first">';
					} else {
						html += '<td class="first" style="width:150px;">';
					}
					try {
						if (obj[props[i]] !== undefined && obj[props[i]] !== null) {															
							html += '<a href="#obj'+(+id)+'" onclick="'+(topLevel ? 'astalanumerator.current=astalanumerator.parent' : '')+';if(!this.obj){this.obj=astalanumerator.current}else{astalanumerator.current=this.obj};node=this.parentNode.parentNode.parentNode.parentNode.parentNode;node.className==\'closed\'?(node.className=\'open\',astalanumerator.inspect(astalanumerator.current[this.innerHTML], this.innerHTML, \'obj\'+'+(+id)+')):(node.className=\'closed\',node.firstChild.nextSibling.innerHTML=\'\');if(node.className==\'closed\')return false;">';																				
						} else {
							html += '<a href="#notinspectable">';
						}
					} catch(e){html += '<a href="#notinspectable">';}				
					html += prop;
					html += '</a>';
					html += '</td>';
					if(!astalanumerator.compact) {
						var t = '';
						try {
							t = typeof obj[props[i]];
						} catch(e){}
						
						html += '<td class="second '+t+'">';
						try {
							html += '<div><pre>' + escapeHTML(obj[props[i]]) + '</pre></div>';
						} catch(e) {html+='<div><pre></pre></div>';}
						html += '</td>';
					}
					html += '<td valign="top">';
						
						html += '<table>';
					if(Object.getOwnPropertyDescriptor) {
						try {
							var desc = Object.getOwnPropertyDescriptor(obj, props[i]);
							
							html += '<tr>';
							html += '<td>Writable</td><td>'+desc.writable+'</td>';
							html += '</tr>';
							html += '<tr>';
							html += '<td>Configurable</td><td>'+desc.configurable+'</td>';
							html += '</tr>';
							html += '<tr>';
							html += '<td>Enumerable</td><td>'+desc.enumerable+'</td>';						
							html += '</tr>';
						} catch(e){}
					}
						html += '<tr><td>Type</td><td>'+typeof obj[props[i]]+'</td></tr>';												
						
						html += '</table>';
						
					html += '</td>'
						
					html += '</tr>';	
					html += '</table>';	
					if(!astalanumerator.compact) {
						html += '<div id="obj'+id+'"></div>';	
					} else {
						html += '<div id="obj'+id+'" style="width:100px;"></div>';
					}
					html += '</li>';
					traversedProps[props[i]] = true;
					id++;
					count++;					
				}
			} catch(e) {}
			
		}
					
		html += '</ul>';
		if (typeof target == 'object') {
			target.innerHTML += html;
		} else {
			if (document.getElementById(target)) {
				document.getElementById(target).innerHTML += html;
			} else {
				delayHTML(target, html);		
			}	
		}
	}
	function run(objName) {
		astalanumerator.init();
		astalanumerator.current = new Function('return '+objName)();
		astalanumerator.parent = astalanumerator.current; 
		astalanumerator.lastObj = objName;
		astalanumerator.inspect(astalanumerator.current,objName, document.getElementById('inspectionContents'), true);						
	}				
	return {			
		inspect:function() {
			document.getElementById('inspectionResult').style.display = 'block';
			var args = arguments;
			setTimeout(function() {
				inspect.apply(null,args);
			},delay);
		},
		init:init, 
		run:run,
		close:close
	}		
}();
