/* 
	A R R A Y
*/
Array.prototype.push = function() 
{
	for( var i = 0, b = this.length, a = arguments, l = a.length; i<l; i++ ) 
	{
		this[b+i] = a[i];
	}
	return this.length;
}

Array.prototype.indexOf = function( v, b, s ) 
{
	for( var i = +b || 0, l = this.length; i < l; i++ ) 
	{
		if( this[i]===v || s && this[i]==v ) return i; 
	}
	return -1;
}

Array.prototype.unique = function( b ) 
{
	var a = [], i, l = this.length;
	for( i=0; i<l; i++ ) 
	{
		if( a.indexOf( this[i], 0, b ) < 0 )  a.push( this[i] ); 
	}
	return a;
}

Array.prototype.clear = function () {
    this.length = 0;
}

Array.prototype.push2 = function (element) {
    this[this.length] = element;
    return this.length;
}


Array.prototype.remove = function (element) {
	var result = false;
	var array = [];
	for (var i = 0; i < this.length; i++) {
		if (this[i] == element) {
			result = true;
		} else {
			array.push2(this[i]);
		}
	}
	this.clear();
	for (var i = 0; i < array.length; i++) {
		this.push(array[i]);
	}
	array = null;
	return result;
}

Array.prototype.removeEmpty = function () {
	var array = [];
	for (var i = 0; i < this.length; i++) {
		if (this[i] != '') {
			array.push2(this[i]);
		}
	}
	this.clear();
	for (var i = 0; i < array.length; i++) {
		this.push(array[i]);
	}
} 
