//  _____________________________________________________________________________________________________________
// |_| InnerHTMLPump |___________________________________________________________________________________________|
//
//	atrauzzi@gmail.com
//	(c) 2007 Alexander Trauzzi
//	Any use, modification or derivative works from this script are strictly prohibited unless authorized in
//	writing by the script author.
//
//	This JavaScript class clears and fills a specific point in the DOM with content when triggered.
//	The content is valid XHTML that will be appended to the innerHTML property of the element domTarget.
//	It's important to remember that the <html>, <head>, <body> and all their children are not allowed.  Only
//	markup that defines content is allowed.
//	As well, a transition is performed with each call to load() for a nice and pretty twist.
//
//	InnerHTMLPump has been tested and confirmed to work on the following platforms:
//		Windows			-	Microsoft Internet Explorer 6 32bit
//						Microsoft Internet Explorer 7 32bit
//						Mozilla Firefox 2.0.0.6 32bit
//						Opera 9.22
//						Apple Safari
//		Linux			-	Mozilla Firefox 2.0.0.6 x86
//						Mozilla Firefox 2.0.0.6 x86_64
//						Opera 9.22
//
//	InnerHTMLPump depends on:
//		XHTML
//		JavaScript 1.6 with DOM
//		Prototype 1.5.1
//		Scriptaculous 1.7.0
//
//	public InnerHTMLPump()		-	Constructor.
//		domTarget		-	The DOM node to fill.
//
//	public load()			-	Loads a new clump of content.
//		filePath		-	The client-visible path to a document containing XHTML markup.
//  _____________________________________________________________________________________________________________
// |_____________________________________________________________________________________________________________|

var InnerHTMLPump = Class.create();
InnerHTMLPump.prototype.initialize = function (domTarget) {

	this.load = function (filePath) {

		// Request the new content.
		new Ajax.Request(filePath, {
			method: "get",
			onSuccess: function (response) {

				// Start to hide the panel to have its content replaced.
				new Effect.Fade(domTarget, {
					afterFinish: function () {
						// Clear domTarget of ALL children.
						domTarget.innerHTML = "";
						domTarget.childElements().each(function(e){domTarget.removeChild(e);});
						domTarget.innerHTML = response.responseText;
						new Effect.Appear(domTarget);
					}
				});

			},
			onFailure: function (result) {
				alert("Section under development, stay tuned!");
			}
		});



	};

};
//  _____________________________________________________________________________________________________________
// |_____________________________________________________________________________________________________________|
