Prototype.needFunction = function(){
	alert('need a function');
}
Prototype.True = function(){return true};
Prototype.False = function(){return false};
 
Array.prototype.withoutAll=function(values){
	return this.select(function(value) {
	  return !values.include(value);
	});
}
Array.prototype.intersect=function(values){
	return this.select(function(value) {
	  return values.include(value);
	});
} 

// Remplace toutes les occurences d'une chaine
String.prototype.replaceAll = function(search, repl) {
	var str = this;
	while (str.indexOf(search) != -1)
	str = str.replace(search, repl);
	return str;
} 
  
Position.pageClone = function(source, target) {
  source = $(source);
  target = $(target);
  target.style.position = 'absolute';
  var offsets = this.page(source);
  target.style.top    = offsets[1] + 'px';
  target.style.left   = offsets[0] + 'px';
  target.style.width  = source.offsetWidth + 'px';
  target.style.height = source.offsetHeight + 'px';
}
/*var $A = Array.from = function(iterable) {
  if (!iterable) return [];
  if (iterable.toArray) {
    return iterable.toArray();
  } 
  if(iterable.length) {
    var results = [];
    for (var i = 0; i < iterable.length; i++)
      results.push(iterable[i]);
    return results;
  }
  return [iterable];
}*/

Function.prototype.bindAsDelegateEventListener = function(object, subObject) {
  var __method = this;
  return function(event) {
    return __method.call(object, event || window.event, subObject);
  }
}
ImageUtil = {
	setPath :function(img,path){
		var src = img.src.substring(0,img.src.lastIndexOf('/'));
		img.src = src+'/'+path;
	}
}
function $A$(){
  var list = $A(arguments).flatten();
  var elements = new Array();
  for(var i=0;i<list.length;i++){
    elements.push($(list[i]));
  }
  return elements;
}
function $enum(obj){
  if(obj==null) return [];
  if(obj.length) return obj;
  return [obj];
}

/* Cookie managment */
Date.prototype.increase = function(ms){
  this.setTime(this.getTime()+ms);
  return this;
}
Cookie = {
  DIR:new Object(),
  DOMAIN:new Object(),
  set: function(name, value, path, daysToExpire) {
    daysToExpire = (daysToExpire||1000);
    path  = (path || this.DOMAIN);
    var expire = '; expires=' + (new Date()).increase(86400000 * daysToExpire).toGMTString();
    switch(path){
      case this.DIR:{
        path = window.location.pathname;
        path = path.substring(0,path.lastIndexOf('/')+1);
        break;
      }
      case this.DOMAIN:{
        path = '/';
        break;
      }
    }
    document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value || '') + expire+';path='+path;
  },
  get: function(name) {
    var cookie = document.cookie.match(new RegExp('(^|;)\\s*' + encodeURIComponent(name) + '=([^;\\s]*)'));
    return (cookie ? decodeURIComponent(cookie[2]) : null);
  },
  erase: function(name) {
    var cookie = Cookie.get(name) || true;
    Cookie.set(name, '', -1);
    return cookie;
  },
  accept: function() {
    if (typeof navigator.cookieEnabled == 'boolean') {
      return navigator.cookieEnabled;
    }
    Cookie.set('_#$test', '1');
    return (Cookie.erase('_#$test') == '1');
  }
};