var Utility = new function()
{
	this.toInteger = function(obj)
	{
		if (obj == null)
			return 0;
	
		obj = obj.toString();
	
		if (obj == "")
			return 0;
	
		return parseInt(obj);
	}

	this.toDouble = function(obj)
	{
		if (obj == null)
			return 0;
	
		obj = obj.toString();
	
		if (obj == "")
			return 0;
	
		var allowed = "0123456789.";
		var result = "";	
	
		for (var i = 0; i < obj.length; i++)
		{
			var c = obj.charAt(i);
			if (allowed.indexOf(c) >= 0)
				result += c;
			else if (result != "")
				return result;
		}
	
		return result;
	}

	this.html_quote = function(str)
	{
		str = str.replace(/&/g, "&amp;");
		str = str.replace(/"/g, "&quot;");
		str = str.replace(/</g, "&lt;");
		str = str.replace(/>/g, "&gt;");
		return str;
	}
}