Utilities = {};

Utilities.includeJS = function(_filepaths)
{
	for(var i=0; i<_filepaths.length; i++)
	{
		document.write('<script type="text/javascript" src="'+_filepaths[i]+'"></script>');
	}
}

Utilities.includeCSS = function(_filepaths)
{
	for(var i=0; i<_filepaths.length; i++)
	{
		document.write('<link href="'+_filepaths[i]+'" rel="stylesheet" type="text/css" />');
	}
}

Utilities.getElement = function(_id)
{
    return document.getElementById(_id);
}

Utilities.toggle = function(_id)
{
 	this.getElement(_id).style.display = (this.getElement(_id).style.display == '') ? 'none' : '';
}

Utilities.createElement = function(_e, _obj)
{
	var a = document.createElement(_e);
	for(prop in _obj)
	{
		a[prop] = _obj[prop];
	}
	return a;
}

Utilities.appendChild = function()
{
	if(this.appendChild.arguments.length > 1)
	{
		var a = this.appendChild.arguments[0];
		for(i=1; i<this.appendChild.arguments.length; i++)
		{
			if(arguments[i])
			{
				a.appendChild(this.appendChild.arguments[i]);
			}
		}
		return a;
	}
	else
	{
		return null;
	}
}

Utilities.trimText = function(_text)
{
    return _text.replace(/^\s+|\s+$/g,"");
}

Utilities.ltrimText = function(_text)
{
    return _text.replace(/^\s+/,"");
}

Utilities.rtrimText = function(_text)
{
    return _text.replace(/\s+$/,"");
}





