// Cross-browser implementation of element.addEventListener()
function addListener(element, type, expression, bubbling)
{
	bubbling = bubbling || false;

	if(window.addEventListener)
	{
		// Standard
		element.addEventListener(type, expression, bubbling);
		return true;
	}
	else if(window.attachEvent)
	{
		// IE
		element.attachEvent('on' + type, expression);
		return true;
	}
	else
	{
		return false;
	}
}

/**
 * Debugs the current array, showing all elements.
 */
Array.prototype.debug = function()
{
	if (this.length == 0)
	{
		alert('Empty array');
		return;
	}

	var text = '';
	for(i = 0; i < this.length; i++)
	{
		text += i + '  ' + this[i] + "\n";
	}
	
	alert(text);
}

String.prototype.contains = function(str)
{
	return this.indexOf(str) != -1;
};
