
String.Empty = "";

// Arguments : 
//		string
//		params string[]
String.Format = function()
{
	var str = arguments[0];
	for (var i = 1; i < arguments.length; i++)
	{
		str = str.replace(String("{" + (i-1) + "}"), arguments[i]);
	}
	return str;
}

String.prototype.StartWith = function(str)
{
	if (this.length < str.length)
		return false;
		
	if (this.substring(0, str.length) == str)
		return true;
		
	return false;
}

String.prototype.LTrim = function()
{
	var regExpBeginning = /^\s+/;
	return this.replace(regExpBeginning, "");
}

String.prototype.RTrim = function()
{
	var regExpEnd = /\s+$/;
	return this.replace(regExpEnd, "");
}
String.prototype.Trim = function()
{
	return this.LTrim().RTrim()
}

window.location.indexOf = function(char)
{
	return this.toString().indexOf(char);
}

window.location.split = function(char)
{
	return this.toString().split(char);
}

Object.getParentNodeByTagName = function(CurrentNode, tagName)
{
	var Current = CurrentNode;
	tagName = tagName.toLowerCase();
	while (Current.parentNode != null)
	{
		Current = Current.parentNode;
		if (Current.tagName.toLowerCase() == tagName)
			return Current;
	}
	
	return null;
}


