var lb = {};
lb.loader = new function()
{
	this.path = '/_scripts/';
	this.head = null;
	this.classes = {'Lb_Loader':true};
	
	this.includeFile = function(path, onLoad)
	{
		return; // Disabling all file loading capabilities until I can work out the Issues with load order and completion
		if('.' != path.charAt(0) && '/' != path.charAt(0))
			path = this.path + path;
		
		
		if(null == this.head)
		{
			var head_tags = window.document.getElementsByTagName('head');
			if(head_tags.length < 1)
			{
				alert('no head element');
				return false;
			}
			this.head = head_tags[0];
		}
		
		var script = window.document.createElement('script');
		script.setAttribute('type','text/javascript');
		script.setAttribute('src',path);
		if(false && defined(onLoad))
		{
			if(defined(script.addEventListener)) script.addEventListener('load', onLoad, false);
			else if(defined(script.attachEvent)) script.attachEvent('onload', onLoad);
			else script.onload = onLoad;
		}
		//script.onload = 
		this.head.appendChild(script);
	}
	this.loadClass = function(className, onLoad)
	{// TODO: Make this a bit faster (I think) by removing the string to array to string converstion jsut for a search and replace
		if(defined(this.classes[className])) return;
		this.classes[className] = true;
		this.includeFile(className.split('_').join('/')+'.js',onLoad);
	}
	
	this.classLoaded = function(className)
	{
		return defined(this.classes[className]) && this.classes[className];
	}
}

// Most of the Lb (Leftbrained) Javascript requires one or more of these functions
function $(sElementID)
{
	return window.document.getElementById(sElementID);
}

function defined(mVar)
{
	return 'undefined' != typeof mVar;
}

function if_undef(mValue,mDefaultValue,aPossibleValues)
{
	if(!defined(mValue)) return mDefaultValue;
	if(!defined(aPossibleValues)) return mValue;
	for(var i in aPossibleValues)
	{
		if(aPossibleValues[i] == mValue) return aPossibleValues[i];
	}
	return mDefaultValue;
}

function is_numeric(value)
{
	if(!defined(value)) return false;
	if('number' == typeof value) return true;
	if('string' == typeof value)
	{
		var numRegEx = /^-?([0-9]|[1-9][0-9]+)\.[0-9]+$/
		///^(-?[0-9.]+)(in|cm|mm|em|ex|pt|pc|px)$/i
	}
	return false;
}