Array.prototype.clear = function () {
  while (this[0]) this.pop();
}

Array.prototype.is_in = function (obj) {
	var i = 0;
	var rep = false;
	while (this[i] != null && !rep) rep = (this[i++]==obj); 
	return rep;
}

Array.prototype.deleteRang = function (rang) {
	var l = this.length;
	for (i = rang;i < l-1;i++) 
		this[i] = this[i+1];
	this.pop();
	return true;
}

Array.prototype.push_isnot = function (elem) {
	var i = 0,rep = -1;
	while (this[i] && rep < 0) {
		if (this[i] === elem) rep = i;
		i++;
	}
	if (rep == -1) {
		rep = i;
		this.push(elem);
	}	
	return rep;
}

String.prototype.is_style = function () {
	var regle = /^([a-zA-Z-]{3,}:[a-zA-Z0-9 -=,:.#%()\/']+[;]?)+$/;
	return regle.test(this);
}

String.prototype.is_class = function () {
	var regle = /^[a-zA-Z_]{1}[a-zA-Z0-9_]*$/;
	return regle.test(this);
}

String.prototype.RLtrim = function () {
	return this.replace(/(^\s*)|(\s*$)/g,"");
}

String.prototype.splitEns = function () {
  var tabReturn = new Array();
  var tab1 = this.split("^");
  var i = 0;
  while (tab1[i]) tabReturn.push(tab1[i++].split("&"));
	return tabReturn;
}

String.prototype.in_born = function (valeur) {
  var tabEns = this.splitEns();
  var nbr = Number(valeur.replace(",","."));
  var borneinf,bornesup;
  var i = 0,rep = false;
  while (tabEns[i] && !rep) {
    if (tabEns[i][0] == "-inf") borneinf = -Infinity;
    else borneinf = tabEns[i][0];
    if (tabEns[i][1] == "+inf") bornesup = Infinity;
    else bornesup = tabEns[i][1];
    rep = rep || (nbr >= borneinf && nbr <= bornesup);
    i++;
  }  
	return rep;
}

String.prototype.getFullYear = function  () {
  var anneenum = Number(this);
  if (anneenum >= 0 &&  anneenum <= 69) return (new String(Math.floor(((new Date).getFullYear())/100)))+this;
  else return (new String(Math.floor(((new Date).getFullYear())/100)-1))+this;
}

String.prototype.getNumMonth = function  () {
  if (this.toLowerCase() == "janvier") return "01"; 
  else if (this == "février" || this == "Février" || this == "FEVRIER") return "02"; 
  else if (this.toLowerCase() == "mars") return "03"; 
  else if (this.toLowerCase() == "avril") return "04"; 
  else if (this.toLowerCase() == "mai") return "05"; 
  else if (this.toLowerCase() == "juin") return "06"; 
  else if (this.toLowerCase() == "juillet") return "07"; 
  else if (this == "août" || this == "Août" || this == "AOUT") return "08"; 
  else if (this.toLowerCase() == "septembre") return "09"; 
  else if (this.toLowerCase() == "octobre") return "10"; 
  else if (this.toLowerCase() == "novembre") return "11"; 
  else if (this == "décembre" || this == "Décembre" || this == "DECEMBRE") return "12"; 
  else return "";
}

String.prototype.fillPrevChar = function  (caract,nbr) {
  return (this.length < nbr)?caract+this.fillPrevChar(caract,nbr-1):this;
}

String.prototype.fillLastChar = function  (caract,nbr) {
  return (this.length < nbr)?this.fillLastChar(caract,nbr-1)+caract:this;
}

String.prototype.transformeHeure = function  () {
  var tmp = this.split(":");
  return tmp[0].fillPrevChar("0",2)+tmp[1].fillPrevChar("0",2)+tmp[2].fillPrevChar("0",2);
}

String.prototype.formatHeure = function  () {
  var tmp = this.splitEns();
  var i = 0;
  var rep = "";
  while (tmp[i]) {
    rep += ((rep=="")?"":"^")+((tmp[i][0]!="-inf")?tmp[i][0].fillLastChar("0",6):tmp[i][0])+"&"+((tmp[i][1]!="+inf")?tmp[i][1].fillLastChar("0",6):tmp[i][1]);
    i++;
  }
  return rep;
}

String.prototype.transformeDate = function  (format_date) {
	var rep = "";
  var annee = "";
  var tmp = new Array();
	switch (format_date) {
		case 'jj/mm/aaaa':	
			tmp = this.split("/");
      rep = tmp[2]+tmp[1]+tmp[0];break;
		case 'mm/jj/aaaa':	
			tmp = this.split("/");
      rep = tmp[2]+tmp[0]+tmp[1];break;
		case 'aaaa/mm/jj':	
			tmp = this.split("/");
      rep = tmp[0]+tmp[1]+tmp[2];break;
		case 'jj mm aaaa':	
			tmp = this.split(" ");
      rep = tmp[2]+tmp[1]+tmp[0];break;
		case 'mm jj aaaa':	
			tmp = this.split(" ");
      rep = tmp[2]+tmp[0]+tmp[1];break;
		case 'aaaa mm jj':	
			tmp = this.split(" ");
      rep = tmp[0]+tmp[1]+tmp[2];break;
		case 'jj-mm-aaaa':	
			tmp = this.split("-");
      rep = tmp[2]+tmp[1]+tmp[0];break;
		case 'mm-jj-aaaa':	
			tmp = this.split("-");
      rep = tmp[2]+tmp[0]+tmp[1];break;
		case 'aaaa-mm-jj':	
			tmp = this.split("-");
      rep = tmp[0]+tmp[1]+tmp[2];break;
		case 'jjmmaaaa':	
      rep = this.slice(4,8)+this.slice(2,4)+this.slice(0,2);break;
		case 'mmjjaaaa':	
      rep = this.slice(4,8)+this.slice(0,2)+this.slice(2,4);break;
		case 'aaaammjj':	
      rep = this.slice(0,4)+this.slice(4,6)+this.slice(6,8);break;
		case 'jj/mm/aa':	
			tmp = this.split("/");
      rep = tmp[2].getFullYear()+tmp[1]+tmp[0];break;
		case 'mm/jj/aa':	
			tmp = this.split("/");
      rep = tmp[2].getFullYear()+tmp[0]+tmp[1];break;
		case 'aa/mm/jj':	
			tmp = this.split("/");
      rep = tmp[0].getFullYear()+tmp[1]+tmp[2];break;
		case 'jj mm aa':	
			tmp = this.split(" ");
      rep = tmp[2].getFullYear()+tmp[1]+tmp[0];break;
		case 'mm jj aa':	
			tmp = this.split(" ");
      rep = tmp[2].getFullYear()+tmp[0]+tmp[1];break;
		case 'aa mm jj':	
			tmp = this.split(" ");
      rep = tmp[0].getFullYear()+tmp[1]+tmp[2];break;
		case 'jj-mm-aa':	
			tmp = this.split("-");
      rep = tmp[2].getFullYear()+tmp[1]+tmp[0];break;
		case 'mm-jj-aa':	
			tmp = this.split("-");
      rep = tmp[2].getFullYear()+tmp[0]+tmp[1];break;
		case 'aa-mm-jj':	
			tmp = this.split("-");
      rep = tmp[0].getFullYear()+tmp[1]+tmp[2];break;
		case 'jjmmaa':	
      rep = this.slice(4,6).getFullYear()+this.slice(2,4)+this.slice(0,2);break;
		case 'mmjjaa':	
      rep = this.slice(4,6).getFullYear()+this.slice(0,2)+this.slice(2,4);break;
		case 'aammjj':	
      rep = this.slice(0,2).getFullYear()+this.slice(2,4)+this.slice(4,6);break;
		case 'jj/mmm/aaaa':	
			tmp = this.split("/");
      rep = tmp[2]+tmp[1].getNumMonth()+tmp[0];break;
		case 'mmm/jj/aaaa':	
			tmp = this.split("/");
      rep = tmp[2]+tmp[0].getNumMonth()+tmp[1];break;
		case 'aaaa/mmm/jj':	
			tmp = this.split("/");
      rep = tmp[0]+tmp[1].getNumMonth()+tmp[2];break;
		case 'jj mmm aaaa':	
			tmp = this.split(" ");
      rep = tmp[2]+tmp[1].getNumMonth()+tmp[0];break;
		case 'mmm jj aaaa':	
			tmp = this.split(" ");
      rep = tmp[2]+tmp[0].getNumMonth()+tmp[1];break;
		case 'aaaa mmm jj':	
			tmp = this.split(" ");
      rep = tmp[0]+tmp[1].getNumMonth()+tmp[2];break;
		case 'jj-mmm-aaaa':	
			tmp = this.split("-");
      rep = tmp[2]+tmp[1].getNumMonth()+tmp[0];break;
		case 'mmm-jj-aaaa':	
			tmp = this.split("-");
      rep = tmp[2]+tmp[0].getNumMonth()+tmp[1];break;
		case 'aaaa-mmm-jj':	
			tmp = this.split("-");
      rep = tmp[0]+tmp[1].getNumMonth()+tmp[2];break;
		case 'jjmmmaaaa':
      rep = this.slice(this.length-4,this.length)+this.slice(2,this.length-4).getNumMonth()+this.slice(0,2);break;
		case 'mmmjjaaaa':	
      rep = this.slice(this.length-4,this.length)+this.slice(0,this.length-6).getNumMonth()+this.slice(this.length-6,this.length-4);break;
		case 'aaaammmjj':	
      rep = this.slice(0,4)+this.slice(4,this.length-2).getNumMonth()+this.slice(this.length-2,this.length);break;
		case 'jj/mmm/aa':	
			tmp = this.split("/");
      rep = tmp[2].getFullYear()+tmp[1].getNumMonth()+tmp[0];break;
		case 'mmm/jj/aa':	
			tmp = this.split("/");
      rep = tmp[2].getFullYear()+tmp[0].getNumMonth()+tmp[1];break;
		case 'aa/mmm/jj':	
			tmp = this.split("/");
      rep = tmp[0].getFullYear()+tmp[1].getNumMonth()+tmp[2];break;
		case 'jj mmm aa':	
			tmp = this.split(" ");
      rep = tmp[2].getFullYear()+tmp[1].getNumMonth()+tmp[0];break;
		case 'mmm jj aa':	
			tmp = this.split(" ");
      rep = tmp[2].getFullYear()+tmp[0].getNumMonth()+tmp[1];break;
		case 'aa mmm jj':	
			tmp = this.split(" ");
      rep = tmp[0].getFullYear()+tmp[1].getNumMonth()+tmp[2];break;
		case 'jj-mmm-aa':	
			tmp = this.split("-");
      rep = tmp[2].getFullYear()+tmp[1].getNumMonth()+tmp[0];break;
		case 'mmm-jj-aa':	
			tmp = this.split("-");
      rep = tmp[2].getFullYear()+tmp[0].getNumMonth()+tmp[1];break;
		case 'aa-mmm-jj':	
			tmp = this.split("-");
      rep = tmp[0].getFullYear()+tmp[1].getNumMonth()+tmp[2];break;
		case 'jjmmmaa':
      rep = this.slice(this.length-2,this.length).getFullYear()+this.slice(2,this.length-2).getNumMonth()+this.slice(0,2);break;
		case 'mmmjjaa':	
      rep = this.slice(this.length-2,this.length).getFullYear()+this.slice(0,this.length-4).getNumMonth()+this.slice(this.length-4,this.length-2);break;
		case 'aammmjj':	
      rep = this.slice(0,2).getFullYear()+this.slice(2,this.length-2).getNumMonth()+this.slice(this.length-2,this.length);break;
		case 'jj/Mmm/aaaa':	
			tmp = this.split("/");
      rep = tmp[2]+tmp[1].getNumMonth()+tmp[0];break;
		case 'Mmm/jj/aaaa':	
			tmp = this.split("/");
      rep = tmp[2]+tmp[0].getNumMonth()+tmp[1];break;
		case 'aaaa/Mmm/jj':	
			tmp = this.split("/");
      rep = tmp[0]+tmp[1].getNumMonth()+tmp[2];break;
		case 'jj Mmm aaaa':	
			tmp = this.split(" ");
      rep = tmp[2]+tmp[1].getNumMonth()+tmp[0];break;
		case 'Mmm jj aaaa':	
			tmp = this.split(" ");
      rep = tmp[2]+tmp[0].getNumMonth()+tmp[1];break;
		case 'aaaa Mmm jj':	
			tmp = this.split(" ");
      rep = tmp[0]+tmp[1].getNumMonth()+tmp[2];break;
		case 'jj-Mmm-aaaa':	
			tmp = this.split("-");
      rep = tmp[2]+tmp[1].getNumMonth()+tmp[0];break;
		case 'Mmm-jj-aaaa':	
			tmp = this.split("-");
      rep = tmp[2]+tmp[0].getNumMonth()+tmp[1];break;
		case 'aaaa-Mmm-jj':	
			tmp = this.split("-");
      rep = tmp[0]+tmp[1].getNumMonth()+tmp[2];break;
		case 'jjMmmaaaa':
      rep = this.slice(this.length-4,this.length)+this.slice(2,this.length-4).getNumMonth()+this.slice(0,2);break;
		case 'Mmmjjaaaa':	
      rep = this.slice(this.length-4,this.length)+this.slice(0,this.length-6).getNumMonth()+this.slice(this.length-6,this.length-4);break;
		case 'aaaaMmmjj':	
      rep = this.slice(0,4)+this.slice(4,this.length-2).getNumMonth()+this.slice(this.length-2,this.length);break;
		case 'jj/Mmm/aa':	
			tmp = this.split("/");
      rep = tmp[2].getFullYear()+tmp[1].getNumMonth()+tmp[0];break;
		case 'Mmm/jj/aa':	
			tmp = this.split("/");
      rep = tmp[2].getFullYear()+tmp[0].getNumMonth()+tmp[1];break;
		case 'aa/Mmm/jj':	
			tmp = this.split("/");
      rep = tmp[0].getFullYear()+tmp[1].getNumMonth()+tmp[2];break;
		case 'jj Mmm aa':	
			tmp = this.split(" ");
      rep = tmp[2].getFullYear()+tmp[1].getNumMonth()+tmp[0];break;
		case 'Mmm jj aa':	
			tmp = this.split(" ");
      rep = tmp[2].getFullYear()+tmp[0].getNumMonth()+tmp[1];break;
		case 'aa Mmm jj':	
			tmp = this.split(" ");
      rep = tmp[0].getFullYear()+tmp[1].getNumMonth()+tmp[2];break;
		case 'jj-Mmm-aa':	
			tmp = this.split("-");
      rep = tmp[2].getFullYear()+tmp[1].getNumMonth()+tmp[0];break;
		case 'Mmm-jj-aa':	
			tmp = this.split("-");
      rep = tmp[2].getFullYear()+tmp[0].getNumMonth()+tmp[1];break;
		case 'aa-Mmm-jj':	
			tmp = this.split("-");
      rep = tmp[0].getFullYear()+tmp[1].getNumMonth()+tmp[2];break;
		case 'jjMmmaa':
      rep = this.slice(this.length-2,this.length).getFullYear()+this.slice(2,this.length-2).getNumMonth()+this.slice(0,2);break;
		case 'Mmmjjaa':	
      rep = this.slice(this.length-2,this.length).getFullYear()+this.slice(0,this.length-4).getNumMonth()+this.slice(this.length-4,this.length-2);break;
		case 'aaMmmjj':	
      rep = this.slice(0,2).getFullYear()+this.slice(2,this.length-2).getNumMonth()+this.slice(this.length-2,this.length);break;
		case 'jj/MMM/aaaa':	
			tmp = this.split("/");
      rep = tmp[2]+tmp[1].getNumMonth()+tmp[0];break;
		case 'MMM/jj/aaaa':	
			tmp = this.split("/");
      rep = tmp[2]+tmp[0].getNumMonth()+tmp[1];break;
		case 'aaaa/MMM/jj':	
			tmp = this.split("/");
      rep = tmp[0]+tmp[1].getNumMonth()+tmp[2];break;
		case 'jj MMM aaaa':	
			tmp = this.split(" ");
      rep = tmp[2]+tmp[1].getNumMonth()+tmp[0];break;
		case 'MMM jj aaaa':	
			tmp = this.split(" ");
      rep = tmp[2]+tmp[0].getNumMonth()+tmp[1];break;
		case 'aaaa MMM jj':	
			tmp = this.split(" ");
      rep = tmp[0]+tmp[1].getNumMonth()+tmp[2];break;
		case 'jj-MMM-aaaa':	
			tmp = this.split("-");
      rep = tmp[2]+tmp[1].getNumMonth()+tmp[0];break;
		case 'MMM-jj-aaaa':	
			tmp = this.split("-");
      rep = tmp[2]+tmp[0].getNumMonth()+tmp[1];break;
		case 'aaaa-MMM-jj':	
			tmp = this.split("-");
      rep = tmp[0]+tmp[1].getNumMonth()+tmp[2];break;
		case 'jjMMMaaaa':
      rep = this.slice(this.length-4,this.length)+this.slice(2,this.length-4).getNumMonth()+this.slice(0,2);break;
		case 'MMMjjaaaa':	
      rep = this.slice(this.length-4,this.length)+this.slice(0,this.length-6).getNumMonth()+this.slice(this.length-6,this.length-4);break;
		case 'aaaaMMMjj':	
      rep = this.slice(0,4)+this.slice(4,this.length-2).getNumMonth()+this.slice(this.length-2,this.length);break;
		case 'jj/MMM/aa':	
			tmp = this.split("/");
      rep = tmp[2].getFullYear()+tmp[1].getNumMonth()+tmp[0];break;
		case 'MMM/jj/aa':	
			tmp = this.split("/");
      rep = tmp[2].getFullYear()+tmp[0].getNumMonth()+tmp[1];break;
		case 'aa/MMM/jj':	
			tmp = this.split("/");
      rep = tmp[0].getFullYear()+tmp[1].getNumMonth()+tmp[2];break;
		case 'jj MMM aa':	
			tmp = this.split(" ");
      rep = tmp[2].getFullYear()+tmp[1].getNumMonth()+tmp[0];break;
		case 'MMM jj aa':	
			tmp = this.split(" ");
      rep = tmp[2].getFullYear()+tmp[0].getNumMonth()+tmp[1];break;
		case 'aa MMM jj':	
			tmp = this.split(" ");
      rep = tmp[0].getFullYear()+tmp[1].getNumMonth()+tmp[2];break;
		case 'jj-MMM-aa':	
			tmp = this.split("-");
      rep = tmp[2].getFullYear()+tmp[1].getNumMonth()+tmp[0];break;
		case 'MMM-jj-aa':	
			tmp = this.split("-");
      rep = tmp[2].getFullYear()+tmp[0].getNumMonth()+tmp[1];break;
		case 'aa-MMM-jj':	
			tmp = this.split("-");
      rep = tmp[0].getFullYear()+tmp[1].getNumMonth()+tmp[2];break;
		case 'jjMMMaa':
      rep = this.slice(this.length-2,this.length).getFullYear()+this.slice(2,this.length-2).getNumMonth()+this.slice(0,2);break;
		case 'MMMjjaa':	
      rep = this.slice(this.length-2,this.length).getFullYear()+this.slice(0,this.length-4).getNumMonth()+this.slice(this.length-4,this.length-2);break;
		case 'aaMMMjj':	
      rep = this.slice(0,2).getFullYear()+this.slice(2,this.length-2).getNumMonth()+this.slice(this.length-2,this.length);break;
	}
	return rep;
}



