Estate.Develop = ( function() {
	/* START PUBLIC */
	return {
		/*
		 * Summary:
		 * It works like 'trace' in Flash. Each time it is called it prints
		 * the argument in a box in the web page. This is an alternative for
		 * debugging javascript with alert(), especially when working with loops
		 * 
		 * Dependencies:
		 * - develop.css
		 *
		 * Usage:
		 * Estate.Develop.Trace( 'Showthis' )
		 */
		Trace: function( string ) {
			Estate.Develop.TraceBox.Create();
			var traceID = Estate.Develop.TraceBox.GetTraceID()
			document.getElementById( traceID ).innerHTML = '<span><em>&#8226;</em> '+ string +'</span>' + document.getElementById( traceID ).innerHTML;
		},
		
		TraceAttr: function( element ) {
			Estate.Develop.TraceBox.TraceAttributesElement( element );
		}
	}
	/* END PUBLIC */
})();





/*
 * Summary:
 * Timer is a stopwatch. With Timer you can check how long some operation costs in the browser.
 * 
 * Dependencies:
 * - Estate.Core
 * 
 * Usage:
 *		var oTimer1 = new Estate.Develop.Timer()
 *		oTimer1.SetID( 'Random' )
 *		oTimer1.Start()
 *		oTime1.End()
 *
 *		var oTimer2 = new Estate.Develop.Timer()
 *		oTimer2.SetID( 'Random' )
 *		oTimer2.Start()
 *		oTime2.End()
 */
Estate.Develop.Timer = ( function() {
	var Timer = function() {
		this.TimerID = "";
		this.TimeStart;
		this.TimeEnd;
		this.TracerID = Estate.Develop.TraceBox.GetTraceID();
	}

	Timer.prototype = {	
		SetID: function( newTimerID ) {
			this.TimerID = newTimerID;
		},

		Start: function() {
			var TimeNow = new Date();
			this.TimeStart = TimeNow.getTime();
		},
		
		End: function() {
			var TimeNow = new Date();
			this.TimeEnd = TimeNow.getTime();
			
			Estate.Develop.TraceBox.Create();
			document.getElementById( this.TracerID ).innerHTML = '<span>"'+ this.TimerID +'" runs in <strong>'+ (this.TimeEnd - this.TimeStart) +'</strong> milliseconds</span>' + document.getElementById( this.TracerID ).innerHTML;
		}
	}

	return Timer;
})();






/*
 * Summary:
 * Creates a placeholder in the top left corner of the web page show debug information
 * 
 * Dependencies:
 * - develop.css
 *
 * Usage:
 * Estate.Develop.TraceBox.Create()
 */
Estate.Develop.TraceBox = ( function() {
	/* START PRIVATE */
	var TraceBoxID = 'TraceBox';
	/* END PRIVATE */



	/* START PUBLIC */
	return {
		Create: function() {
			if ( !document.getElementById(TraceBoxID) ) {
				var Feedback = document.createElement("div");
				Feedback.id = TraceBoxID;
				document.body.appendChild(Feedback);
			}
		},
		
		GetTraceID: function() {
			return TraceBoxID
		},
		
		TraceAttributesElement: function(element) {
			var error;
			error = Estate.Check.ArgumentsCount( arguments.length, 1 );
			if ( error != "" ) throw new Error( error );
			error = Estate.Check.Element( element );
			if ( error != "" ) throw new Error( error );

			var trace = ""

			trace = "<strong>&lt;" + element.tagName + "&gt;</strong>"
			for (var i = 0; i < element.attributes.length; i++) {
				var attr = element.attributes[i];
				trace += "&emsp;<strong>"+ attr.name +"</strong>: '"+ attr.value +"'"
			}

			Estate.Trace(trace)
		}
		
	}
	/* END PUBLIC */
})();




/* Shared function. It creates a placeholder in the top right corner of the web page to put buttons in it. */
Estate.Develop.TesterButtonHolder = ( function() {
	/* START PRIVATE */
	var TesterButtonHolderID = 'TesterButtonHolder';
	/* END PRIVATE */



	/* START PUBLIC */
	return {
		Add: function() {
			if ( !document.getElementById( TesterButtonHolderID ) ) {
				var TesterButtonHolder = document.createElement("div");
				TesterButtonHolder.id = TesterButtonHolderID;
				document.body.appendChild(TesterButtonHolder);
			}
		},

		GetTesterButtonHolderElement: function() {
			return document.getElementById( TesterButtonHolderID );
		}
	}
	/* END PUBLIC */
})();
