/**
 * Element functions
 */
var $D = document;

function $ (el) {
	if(typeof el == 'string')
		return $D.getElementById(el);
	else
		return el;
};

/**
 * Array functions
 */
if (!Array.forEach) { // mozilla already supports this
	Array.prototype.forEach = function(func){
		for(var i=0;i<this.length;i++) func(this[i], i);
	};
}

function $A(array){
	var nArray = [];
	for (var i=0;i<array.length;i++) nArray.push(array[i]);
	return nArray;
};

/**

 * Event

 */

$event = function(element, tmp, callback){
	if(element != null) {

	var	value = element[tmp];

	element[tmp] = function(evt){

		if(!evt)

		{

			evt = window.event;

			evt.target = evt.target || evt.srcElement;

		}

		if(value)

			value.call(this, evt);

		return callback.call(this, evt);

	};
	};

};