function $(s){return document.getElementById(s);}
function dw(s){document.write(s);}
function dwn(s){document.writeln(s);}

Array.prototype.remove = function(x)
{
    if(isNaN(x)||x>this.length)
		return false;
    for(var i=0, n=0; i<this.length; i++){
	if(this[i] != this[x]){
	    this[n++] = this[i];
	}
    }
    this.length -= 1;
}
Array.prototype.indexOf = function(e){
	for(var i=0; i<this.length; i++){
		if (this[i] == e)
			return i;
	}
	return -1;
}
Array.prototype.appendItem = function(e){
	this[this.length] = e;
}
Array.prototype.removeItem = function(e){
	var i = this.indexOf(e);
	this.remove(i);
}

String.prototype.trim = function(){
	return this.replace(/(^\s*)|(\s*$)/g, "");
}

String.prototype.findfirst = function(arr){
	for(var i = 0; i < this.length; i++){
		for(var j = 0; j < arr.length; j++){
			if(this.charAt(i) == arr[j])
				return i;
		}
	}
	return -1;
}

