﻿/* JsLib.Debug */
Debug = {
	EnumProperties: function(obj){
		var arr=new Array();
		var i;
		for(i in obj)
			arr.push(i);
		arr.sort();
		var div=document.createElement("div")
		div.innerHTML=arr.join("<br>");
		div.style.position='absolute';
		div.style.zIndex=1000;
		div.style.top=50+'px';
		div.style.left=50+'px';
		div.style.backgroundColor='#cecece';
		div.style.border='solid 1px black';
		div.style.overflow='scroll';
		div.style.width=300+'px';
		div.style.height=500+'px';
		document.body.appendChild(div);
	},
	GetHtmlFragment: function(find,charBefore,charAfter){
		var html=document.body.innerHTML;
		if(null!=find)
			html=html.substr(html.indexOf(find,0)-charBefore,html.indexOf(find,0)+charAfter);
		else
			html=html.substr(charBefore,charAfter);
		var textarea=document.getElementById("textareadebug");
		if(null==textarea){
			textarea=document.createElement("textarea");
			textarea.id='textareadebug';
			textarea.style.position='absolute';
			textarea.style.width="600px";
			textarea.style.height="300px";
			textarea.style.left="100px";
			textarea.style.top="100px";
			textarea.style.backgroundColor='#cecece';
			textarea.style.border='solid 1px black';
			textarea.style.zIndex=100;
			document.body.appendChild(textarea);
		}
		textarea.value=html;
	},
	ViewStateSize: function(){
		alert(document.getElementById('__VIEWSTATE').value.length);
	},
	ViewSource: function(){
		var textarea=document.getElementById("textareadebug");
		if(null==textarea){
			textarea=document.createElement("textarea");
			textarea.id='textareadebug';
			textarea.style.position='absolute';
			textarea.style.width="600px";
			textarea.style.height="300px";
			textarea.style.left="100px";
			textarea.style.top="100px";
			textarea.style.zIndex=100000;
			textarea.style.backgroundColor='#cecece';
			textarea.style.border='solid 1px black';
			textarea.style.zIndex=100;
			document.body.appendChild(textarea);
		}
		textarea.value=document.body.innerHTML;
	}
}
