// --------------------------------------------------------------------------------------------
// General utilities
// Copyright (c) 2002 Gene M. Angelo
// Note: This file requires String.js
// --------------------------------------------------------------------------------------------

// --------------------------------------------------------------------------------------------
// Image class - created and used for future expansion
// --------------------------------------------------------------------------------------------
function CImage(url)
	{
	this.image = new Image(0, 0);

	this.image.src = String.trimAll(url);	// preloads the image

	// Returns the url of the image
	this.image.getURL = function()
		{
		return this.src;
		}

	return this.image;
	}

// --------------------------------------------------------------------------------------------
// DOM class - this class determines what version of DOM is being used by the browser
// --------------------------------------------------------------------------------------------
function CDOM()
	{
	function isLevel1()
		{
		return (document.implementation && document.implementation.hasFeature && document.hasFeature("html", "1.0"));
		}
	}

// --------------------------------------------------------------------------------------------
// Character validation class - this class expects a one byte char only
// --------------------------------------------------------------------------------------------
function CChar(character)
	{
	// Properties...
	this.character = character;

	CChar.prototype.getChar = function()
		{		
		return this.character;
		}

	CChar.prototype.setChar = function(character)
		{		
		this.character = character;
		}

	// Is the character numberic eg. 0 - 9
	CChar.prototype.isNumeric = function()
		{		
		return ! (isNaN(parseInt(this.character)));
		}

	// Is the character aplha eg. a - z or A - Z?
	CChar.prototype.isAlpha = function()
		{
		return ((this.character >= 'a' && this.character <= 'z') || (this.character >= 'A' && this.character <= 'Z'));
		}

	// Is the character alpha-numeric eg. 0 - 9, a - z or A - Z?
	CChar.prototype.isAlphaNumeric = function()
		{
		return (this.isAlpha() || this.isNumeric());
		}

	// Is the character within the ascii range provided. asciiStart and asciiEnd must be
	// consecuative ascii values passed in the format '\xHH' where HH = hex value.
	CChar.prototype.isAsciiRange = function(asciiStart, asciiEnd)
		{
		return (this.character >= asciiStart && this.character <= asciiEnd);
		}
	}



