/*=============================================================================

			 	 TITLE:		NetMediaOne - Core Library
		  MODIFIED:		2008.04.09
		 AUTHOR(S): 	Graham Wheeler - NetMediaOne - www.netmediaone.com
		  REQUIRES:		jQuery 1.2

=============================================================================*/

/* jQMinMax | v0.1 | (c) 2006 | Dave Cardwell (http://davecardwell.co.uk/) | MIT */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('y n(){$.9={D:B,v:B};$(w).10(n(){8 k=w.Q(\'O\');$(k).g({\'3\':\'16\',\'6-3\':\'Z\'});$(\'Y\').W(k);$.9.v=(k.t&&k.t==2);$(k).S();b($.9.v)m;$.9.D=N;$.9.E();$(\':9\').9()});$.9.E=n(){8 p=y C(\'6-3\',\'6-5\',\'7-3\',\'7-5\');8 9=y C();15(8 i=0;i<p.12;i++){8 o="$.g(a,\'"+p[i]+"\')!=\'X\'&&"+"$.g(a,\'"+p[i]+"\')!=\'F\'&&"+"$.g(a,\'"+p[i]+"\')!=e.c";b(p[i].V(2)==\'x\')o+="&&$.g(a,\'"+p[i]+"\')!=\'U\'";$.o[\':\'][p[i]]=o;9[i]=\'(\'+o+\')\'}$.o[\':\'][\'9\']=9.T(\'||\')};$.R.9=n(){m $(f).P(n(){8 4={\'6-3\':r(f,\'6-3\'),\'7-3\':r(f,\'7-3\'),\'6-5\':r(f,\'6-5\'),\'7-5\':r(f,\'7-5\')};8 3=f.t;8 5=f.A;8 h=3;8 l=5;8 u=w.M.L-K;b(4[\'6-3\']!=e.c&&4[\'7-3\']!=e.c&&u>4[\'6-3\']&&u<4[\'7-3\']){h=u}J{b(4[\'7-3\']!=e.c&&h>4[\'7-3\']){h=4[\'7-3\']}b(4[\'6-3\']!=e.c&&h<4[\'6-3\']){h=4[\'6-3\']}}b(4[\'7-5\']!=e.c&&l>4[\'7-5\']){l=4[\'7-5\']}b(4[\'6-5\']!=e.c&&l<4[\'6-5\']){l=4[\'6-5\']}b(h!=3){$(f).g(\'3\',h)}b(l!=5){$(f).g(\'5\',l)}})};n r(s,p){8 q=$(s).g(p);b(q==e.c||q==\'F\')m e.c;8 j;j=q.z(/^\\+?(\\d*(?:\\.\\d+)?)%$/);b(j){m 14.13(I((/3$/.k(p)?$(s).H().G(0).t:$(s).H().G(0).A)*j[1]/11))}j=q.z(/^\\+?(\\d*(?:\\.\\d+)?)(?:17)?$/);b(j){m I(j[1])}m e.c}}();',62,70,'|||width|constraint|height|min|max|var|minmax||if|undefined||window|this|css|newWidth||result|test|newHeight|return|function|expr||raw|calculate|obj|offsetWidth|winWidth|native|document||new|match|offsetHeight|false|Array|active|expressions|auto|get|parent|Number|else|20|clientWidth|documentElement|true|div|each|createElement|fn|remove|join|none|charAt|append|0px|body|2px|ready|100|length|round|Math|for|1px|px'.split('|'),0,{}));

var NMO = {
	
	version: "1.5.0",
	rootPath: "",
	resizeTimer: null,
	documentMouseX: 0,
	documentMouseY: 0,
	windowMouseX: 0,
	windowMouseY: 0,
 
	newInstance: function(obj) {
		function F() {};
		F.prototype = obj;
		return new F();
	},
	
	// Inter-Context Communicator - Holds objects addressable across IFRAME boundaries
	ICC: (parent.NMO != null)?parent.NMO.ICC:{},

	stripeTable: function(selector) {
		$(selector + " tr:visible:even").addClass("Even");
		$(selector + " tr:visible:odd").removeClass("Odd");
	},
	
		
	init: function() {

		$("body").addClass("HasJS");

		$("body *:first-child").addClass("FirstChild");
		$("body *:last-child").addClass("LastChild");

		NMO.stripeTable(".Striped tbody");
		
		$(document).mousemove( function(e) {
			NMO.documentMouseX = e.pageX;
			NMO.documentMouseY = e.pageY;
			NMO.windowMouseX = e.clientX;
			NMO.windowMouseY = e.clientY;
		} );
		
		if ( jQuery.browser.msie && jQuery.browser.version < 7 ) {
			jQuery(document).resize( function() {
				jQuery("#layoutWrapper, #contentSection").minmax();
			} );
			jQuery("#layoutWrapper, #contentSection").minmax();
		}

	}
	
};


// 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("");
	}

};


function AlertBox(elementRef) {
	this.container = $(elementRef);
	return this;
};
AlertBox.prototype = {
	
	Clear: function() {
		this.container.html("");
	},
	
	Add: function( msg, css, err ) {
		
		var message = new StringBuffer('<div class="StatusMessage ').append(css).append('">\n');
		message.append('  <a onclick="jQuery(this.parentNode).fadeOut(\'slow\');" class="CloseLink">X</a>\n');
		message.append(msg).append('\n');
		message.append('<!-- ').append(err).append(' -->\n');
		message.append('</div>\n');
		this.container.append( message.toString() );
		this.Show();
		
	},
	
	Show: function() {
		
		this.container.find(".StatusMessage").show().fadeTo( "fast", 0.8, function() {
			var el = this;																																				
			setTimeout( function() { 
				$(el).not(".Sticky").fadeOut( 4000, function() {
					$(el).remove();
				}	);
			}, 1000 );
		} );
		
	}

};


$( function() { NMO.init(); } );

