function InClassName(Element, Name)
{
	var ClassNames = Element.className.split(' ');
	for (var i in ClassNames)
	{
		if (ClassNames[i] == Name)
		{
			return true;
			break;
		}
	}
	return false;
}

// Courtesy of quirksmode.org
// Gets the current text selection.
function getSel(obj)
{
	if (window.getSelection)
	{
		return window.getSelection();
	}
	else if (document.getSelection)
	{
		return document.getSelection();
	}
	else if (document.selection)
	{
		return document.selection.createRange().text;
	}
}

function GoTo(Href)
{
	window.location = Href;
}

/* The following functions are a courtesy of quirksmode.org */
// Finds object's absolute position on X axis.
function findPosX(obj)
{
	var curleft = 0;

	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
	{
		curleft += obj.x;
	}

	return curleft;
}

// Finds object's absolute position on Y axis.
function findPosY(obj)
{
	var curtop = 0;

	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
	{
		curtop += obj.y;
	}

	return curtop;
}

// Here we deal with the window sizes and box sizes and such.
function windowInnerSize()
{
	var myWidth = 0, myHeight = 0;
	if (typeof(window.innerWidth) == 'number')
	{
		//Non-IE
		return [window.innerWidth, window.innerHeight];
	}
	else if (document.documentElement &&
		(document.documentElement.clientWidth || document.documentElement.clientHeight))
	{
		//IE 6+ in 'standards compliant mode'
		return [document.documentElement.clientWidth, document.documentElement.clientHeight];
	}
	else if (document.body &&
		(document.body.clientWidth || document.body.clientHeight))
	{
		//IE 4 compatible
		return [document.body.clientWidth, document.body.clientHeight];
	}
	return false;
}

String.prototype.trim = function()
{
    return this.replace(/^\s*|\s*$/g, '');
}
String.prototype.ltrim = function()
{
    return this.replace(/^\s*/g, '');
}
String.prototype.rtrim = function()
{
    return this.replace(/\s*$/g, '');
}

String.prototype.repeat = function(times)
{
	var str = new String;
	for (var i = 0; i < times; i++)
	{
		str += this;
	}
	return str;
}