function Utils()
{
	this.DELIM = ',';
	this.COMMA = ',';
	this.SPACE = ' ';
	this.CR = '/r';
	this.LF = '/n'
	this.TAB = '/t';
	// convert object into comma delimited list
	this.arrayToString = function(obj,delimiter)
	{
		if (delimiter == null) delimiter = this.DELIM;
		var result = "";
		if(obj == null || obj.length <= 0) return result;
		for(var i = 0; i < obj.length; i++)
		{
			result += ((result == '')?'':delimiter)+obj[i].toString();
		}
		return result;
	}
	this.arrayToBoundedString = function(obj,delimiter)
	{
		if (delimiter == null) delimiter = this.DELIM;
		var list = this.arrayToString(obj,delimiter);
		list = delimiter + list + delimiter;
		return list;
	}
	this.isArray = function(obj)
	{
		return(typeof(obj.length)=="undefined")?false:true;
	}
	this.indexOf = function(obj, item)
	{
		if (!this.isArray(obj)) return -1;
		for (var i = 0; i < obj.length; i++)
		{
			if (obj[i] == item) return i;
		}
		return -1;
	}
	this.deleteAt = function(obj,index)
	{
		if (!this.isArray(obj)) return obj;
		if(index < obj.length)
		{
			var newarray = new Array();
			for (i = 0; i < obj.length; i++)
				if(i!=index)
					newarray[newarray.length] = obj[i];
			return newarray;
		}
		else return obj;
	}
	this.getStyleObject = function(objectId) 
	{
  	 	// cross-browser function to get an object's style object given its id
    	if(document.getElementById && document.getElementById(objectId)) 
			// W3C DOM
			return document.getElementById(objectId).style;
		else if (document.all && document.all(objectId)) 
			// MSIE 4 DOM
			return document.all(objectId).style;
		else if (document.layers && document.layers[objectId]) 
			// NN 4 DOM.. note: this won't find nested layers
			return document.layers[objectId].style;
		else 
			return false;
	}
	this.getObject = function(objectId) 
	{
  	 	// cross-browser function to get an object's style object given its id
    	if(document.getElementById && document.getElementById(objectId)) 
			// W3C DOM
			return document.getElementById(objectId);
		else if (document.all && document.all(objectId)) 
			// MSIE 4 DOM
			return document.all(objectId);
		else if (document.layers && document.layers[objectId]) 
			// NN 4 DOM.. note: this won't find nested layers
			return document.layers[objectId];
		else 
			return false;
	}
	this.changeObjectVisibility = function(objectId, newVisibility) 
	{
    	// get a reference to the cross-browser style object and make sure the object exists
    	var styleObject = this.getStyleObject(objectId);
    	if(styleObject) 
		{
			styleObject.visibility = newVisibility;
			return true;
    	} 
		else 
		{
			// we couldn't find the object, so we can't change its visibility
			return false;
    	}
	}
	this.moveObject = function(objectId, newXCoordinate, newYCoordinate) 
	{
    	// get a reference to the cross-browser style object and make sure the object exists
    	var styleObject = this.getStyleObject(objectId);
    	if(styleObject) 
		{
			styleObject.left = newXCoordinate;
			styleObject.top = newYCoordinate;
			return true;
    	} 
		else 
		{
			// we couldn't find the object, so we can't very well move it
			return false;
    	}
	}
	this.findXY = function(obj)
	{
	    //***Find the x,y location in pixels for a relatively positioned object
	    //***returns an object with .x and .y properties.
	    if ( document.layers ) 
		{ // this is Netscape 4.?
	         return { x:obj.x, y:obj.y };
	    }
		var res = { x:0, y:0 };     // IE or DOM browsers
	    while ( obj ) 
		{        // iteration ensures no stack overflow
			res.x += parseInt( obj.offsetLeft, 10 );    // parseInt ignores denominator
			res.y += parseInt( obj.offsetTop, 10 );
			obj = obj.offsetParent;
	    }
	    return res;
	}
	this.getElementsByClassName = function(oElm, strTagName, strClassName)
	{
    	var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
    	var arrReturnElements = new Array();
    	strClassName = strClassName.replace(/\-/g, "\\-");
    	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    	var oElement;
    	for(var i=0; i<arrElements.length; i++)
		{
        	oElement = arrElements[i];      
        	if(oRegExp.test(oElement.className))
            	arrReturnElements.push(oElement);
    	}
    	return (arrReturnElements)
	}
}
var utils = new Utils();
