	$ = function() {

		return {

		/* Accepts any number of arguments. Each can be an id or actual element object reference. Or will accept array of these. */

			id: function() {
		
				/* 
				Makes new array
				Checks to see if array has been passed and sets args variable accordingly
				*/
			
				var el = new Array();
				var args = (arguments[0] instanceof Array)? arguments[0]: arguments;
	
				for(var i = 0; i < arguments.length; i++) {
			
					/* Checks to see if argument is string and if not assumes object passed and simply adds it to the array */
			
					el[i] = (typeof args[i] == 'string')?
						document.getElementById(args[i]):
						args[i];
				}	
			
				/* Returns only first item of the array if only one non-array argument was passed. Else returns array */
		
				return (args.length == 1)? el[0]: el;
			},

			attribute: function(method, string, parent) {

				var els = ($.id(parent) || document).getElementsByTagName('*');
				var matched = new Array;
				var re = new RegExp("(^|\\s)" + string + "(\\s|$)");
	
				for (var i = 0, n = els.length; i < n; i++) {
					if (els[i][method].match(re))
						matched.push(els[i])
				}
			
				return (matched.length == 1)? matched[0]: matched;
			},

			className: function(className, parent) {
				
				return $.attribute('className', className, parent);
			}

		}

	}();
			

