/*=============================================================================

			 	 TITLE:		NetMediaOne - Core Library
		  MODIFIED:		2007.11.06
		 AUTHOR(S): 	Graham Wheeler - NetMediaOne - www.netmediaone.com
		  REQUIRES:		jQuery 1.2

=============================================================================*/

var NMO = {
	
	version: "1.2.0",
	rootPath: "",
	documentMouseX: 0,
	documentMouseY: 0,
	windowMouseX: 0,
	windowMouseY: 0,
 
	newInstance: function(obj) {
		function F() {};
		F.prototype = obj;
		return new F();
	},
	
	stripeTable: function(selector) {
		jQuery(selector + " tr:visible:even").addClass("AltRow");
		jQuery(selector + " tr:visible:odd").removeClass("AltRow");
	},
	
	//
	// getPageScroll()
	// Returns array with x,y page scroll values.
	// Core code from - quirksmode.org
	//
	getPageScroll: function() {
	
		var yScroll;
	
		if (self.pageYOffset) {
			yScroll = self.pageYOffset;
		} else if (document.documentElement && document.documentElement.scrollTop) {
			yScroll = document.documentElement.scrollTop;
		} else if (document.body) {
			yScroll = document.body.scrollTop;
		}
	
		arrayPageScroll = new Array('',yScroll);
		return arrayPageScroll;
	},
	
	
	//
	// init()
	// Fires when the DOM is loaded
	//
	init: function() {

		jQuery("body *:first-child").addClass("FirstChild");
		jQuery("body *:last-child").addClass("LastChild");

		jQuery("#loginName, #loginPass").focus( function(e) {
			this.value = "";
		} ).blur( function(e) {
			if ( this.value == "" ) {
				this.value = this.getAttribute("title");
			}
		} );
		
		$(".PanelMenu ul").after('<div class="Shadow"></div>');

		$(".PanelMenu > li").hover(
			function() {
				var m = $("ul", this);
				var mS = $(".Shadow", this);
				var btn = $("img", this);
				btn.attr( "src", btn.attr("src").replace("_off.","_on.") );
				var h = m.height();
				mS.height(h).show().fadeTo("fast", .25);
				m.fadeIn("fast");
			},
			function() {
				$("ul, .Shadow", this).hide();
				var btn = $("img", this);
				btn.attr( "src", btn.attr("src").replace("_on.","_off.") );
			}
		);
		
		jQuery(document).mousemove( function(e) {
			NMO.documentMouseX = e.pageX;
			NMO.documentMouseY = e.pageY;
			NMO.windowMouseX = e.clientX;
			NMO.windowMouseY = e.clientY;
		} );
		
	}
	
};


// Simple StringBuffer Class
function StringBuffer(str) {
	this.buffer = [];
	this.buffer.push(str);
	return this;
};
StringBuffer.prototype = {

	append: function(str) {
		this.buffer.push(str);
		return this;
	},
	
	clear: function() {
		this.buffer.clear();
		return this;
	},
	
	toString: function() {
		return this.buffer.join("");
	}

};

jQuery( function() { NMO.init(); } );
