Array.prototype.remove=function(s){
  for(i=0;i<this.length;i++){
    if(s==this[i]) this.splice(i, 1);
  }
}
Array.prototype.findById=function(id){
  for(var i=0;i<this.length;i++){
    var e =this[i];
    if(e!=null && e.id==id)return e;
  }
}
Array.prototype.findIndexById=function(id){
  for(var i=0;i<this.length;i++){
    var e =this[i];
    if(e!=null && e.id==id)return i;
  }
  return -1;
}
Array.prototype.removeById=function(id){
  for(var i=0;i<this.length;i++){
    var e =this[i];
    if(e!=null && e.id==id){
      this.removeIndex(i);
      break;
    }
  }
}

Array.prototype.removeIndex=function(i){
  this.splice(i, 1);
}

var $ = {
  isString:function(el){
    return "string"==typeof(el);
  },
  isUndefined:function(el){
    return "undefined"==typeof(el);
  },
  isDefined:function(el){
    return "undefined"!=typeof(el);
  },
  $:function(name){
    return document.getElementById(name);
  },
  call:function(f, param){
    if("string"==typeof(f)){
      f = window[f];
    }
    return f(param);
  },
  isArray:function (obj) {
    return obj!=null && obj.constructor.toString().indexOf("Array") != -1;
  },
  el:function(el){
    if(this.isString(el)) el = $.$(el);
    return el;
  },
  setValue:function(form,name,val){
    form = this.el(form);
    form[name].value=val;
  },
  setValue:function(form,name){
    form = this.el(form);
    return form[name].value;
  }
}
