
// __________________________________  <  FORMATTAGE >   ________________________________________

String.prototype.trim    = function() { return this.replace(/^\s+|\s+$/, ''); }
String.prototype.trimAll = function() { return this.replace(/\s/g, ''); }
String.prototype.trimR   = function() { return this.replace(/\s+$/, ''); }
String.prototype.trimL   = function() { return this.replace(/^\s+/, ''); }

Number.prototype.trim    = function() { return this.toString().trim(); }
Number.prototype.trimAll = function() { return this.toString().trimAll(); }
Number.prototype.trimR   = function() { return this.toString().trimR; }
Number.prototype.trimL   = function() { return this.toString().trimL; }

  function toURL( s )
  {
             s = s.toString();
             s = s.replace(/&/g,'%26');
             s = s.replace(/\+/g,'%2B');
             s = s.replace(/=/g,'%3D');
             s = s.replace(/#/g,'%23');
            // s = s.replace(/%/g,'%25');
      return s;
  }
  function dcURL( s )
  {
           s = s.toString();
           s = s.replace(/%26/g,'&');
           s = s.replace(/%2B/g,'+');
           s = s.replace(/%3D/g,'=');
           s = s.replace(/%23/g,'#');
           //s = s.replace(/%25/g,'%');
    return s;
  }

String.prototype.toURL = function() { return toURL(this); }
String.prototype.dcURL = function() { return dcURL(this); }

// __________________________________  < / FORMATTAGE >   ________________________________________


function opacity_enabled()
{
         if( ! navigator.appVersion.match(/MSIE/i) ) return true;
         try{ var ok = document.body.filters; return true; } catch(e) { return false; }
}

window.allowOpacity = opacity_enabled();

function ErreurObj(txt)
{
	this.txt = txt;
	this.caller = getCaller(ErreurObj.caller);
	this.toString = function ()
	{
		return "Erreur : " + this.txt + " Fonction : " + this.caller;
	}
}

function isset(toTest)
{
	return (typeof toTest != "undefined");
}

//function inArray(text)
//{
//	for (a=0;a<this.length;a++)
//		if(this[a] == text)
//			return true;
//}

function addEvent(o,e,f)
{
	if (o.addEventListener)
	{
		o.addEventListener(e,f,true);
		return true;
	}
	else if (o.attachEvent)
	{
		return o.attachEvent("on"+e,f);
	}
	else
	{
		return false;
	}
}
//Array.prototype.inArray = inArray;

function delEvent(elm, evType, func)
{
         if(elm.addEventListener) elm.removeEventListener(evType, func, true);
         else if(elm.attachEvent) elm.detachEvent("on"+evType, func);
}

// srcElement
   function evt_Elt(e)
   {
         return e.target || e.srcElement;
   }

   function evt_Ctrl(e)
   {
            return e.Ctrl || e.ctrlKey;
   }


// Cursor
   function evt_Cursor(e)
   {                     var c = new Object();

                if (e.pageX !== undefined) { c.x = e.pageX ; c.y = e.pageY; }
                else                       { c.x = e.x ; c.y = e.y; }
       return c;
   }
// Clavier
   function evt_KeyCode(e)
   {
            return e.charCode || e.keyCode || e.which ;
   }

