/**
 * @projectDescription 	asolib.js / a tiny lightweight javascript library
 * @author		Amin Ladhani / amin@as-o.ch / 2010
 * @version		beta 0.2
 * certaines methodes de cette librairie sont reprises 
 * ou inspirees des travaux de Brian Kirchoff, de Robert Penner
 * et de diverses methodes utilisees dans la librairie Mootools
 */
(function(){
	/**
	 * Object litteral principal, contient les methodes generales
	 */
	var _lib = {
		/**
		 * implementation des methodes de l'objet passe en argument dans le DOM standard
		 * @param {Object} obj
		 */
		_domExtend : function(obj){
			for(method in obj){
				if(window._browser().isIE6 || window._browser().isIE7) 	
					document[method] = obj[method];
				if(!window._browser().isIE) 	
					HTMLDocument.prototype[method] = obj[method];
				if(!window._browser().isIE || window._browser().isIE9) 		
					HTMLElement.prototype[method] = obj[method];
			}
		},
		/**
		 * implementation des methodes des objets passes en arguments dans le DOM Internet Explorer 6,7,8
		 * concernant Internet Explorer 9, il semblerait que les ingenieurs de Seattle aient finalement decide
		 * de respecter les standards W3C, j'attends une future version beta pour confirmer les rumeurs ... a.l.
		 * @param {Object} el
		 * @param {Object} extend
		 */
		_ieDomExtend : function(el,extend){
			if(!window._browser().isIE || window._browser().isIE9 || !el) return false;
			if(el.length) for(var i=0;i<el.length;i++) for(method in extend) el[i][method] = extend[method];	
			else for(method in extend) el[method] = extend[method];
		},
		/**
		 * detection navigateur
		 */
		_browser : function(){
			var 	toString	= Object.prototype.toString,
				ua 		= navigator.userAgent.toLowerCase(),
				check		= function(r){ return r.test(ua);},
				isOpera 	= check(/opera/),
				isChrome 	= check(/\bchrome\b/),
				isWebKit 	= check(/webkit/),
				isSafari 	= !isChrome && check(/safari/),
				isSafari2 	= isSafari && check(/applewebkit\/4/),
				isSafari3 	= isSafari && check(/version\/3/),
				isSafari4 	= isSafari && check(/version\/4/),
				isIE 		= !isOpera && check(/msie/),
				isIE7 		= isIE && check(/msie 7/),
				isIE8 		= isIE && check(/msie 8/),
				isIE9 		= isIE && check(/msie 9/),
				isIE6 		= isIE && !isIE7 && !isIE8 && !isIE9,
				isGecko 	= !isWebKit && check(/gecko/),
				isGecko2 	= isGecko && check(/rv:1\.8/),
				isGecko3 	= isGecko && check(/rv:1\.9/),
				isWindows 	= check(/windows|win32/),
				isMac 		= check(/macintosh|mac os x/),
				isLinux 	= check(/linux/);
			return {
				isOpera:isOpera,isChrome:isChrome,isWebKit:isWebKit,
				isSafari:isSafari,isSafari2:isSafari2,isSafari3:isSafari3,isSafari4:isSafari4,
				isIE:isIE,isIE6:isIE6,isIE7:isIE7,isIE8:isIE8,isIE9:isIE9,
				isGecko:isGecko,isGecko2:isGecko2,isGecko3:isGecko3,
				isWindows:isWindows,isMac:isMac,isLinux:isLinux
			};
		},
		/**
		 * evenement DOM
		 * @param {Object} obj
		 * @param {String} type
		 * @param {Function} fn
		 */
		_addEvent : function(obj,type,fn){
			(obj.addEventListener)
				? obj.addEventListener(type,fn,false ) 
				: obj.attachEvent("on"+type,fn);
		},
		/**
		 * annulation evenement DOM
		 * @param {Object} obj
		 * @param {String} type
		 * @param {Object} fn
		 */
		_removeEvent : function(obj,type,fn){
			(obj.removeEventListener)
				? obj.removeEventListener(type,fn,false ) 
				: obj.detachEvent("on"+type,fn);
		},
		/**
		 * annule evenement par defaut
		 * @param {event} event
		 */
		_cancelDefaultEvent : function(e){
			e = e || window.event;
			if(e.preventDefault && e.stopPropagation){
				e.preventDefault();
				e.stopPropagation();
			}
			return false;
		},
		/**
		 * interdit la selection de texte dans l'element envoye en argument ainsi que ses elements enfants
		 * @param {Object} element
		 */
		_noSelect : function(element){
			if(element.setAttribute && element.nodeName.toLowerCase() != 'input' 
			&& element.nodeName.toLowerCase() != 'textarea')
				element.setAttribute('unselectable','on');
			for(var i=0;i<element.childNodes.length;i++)
				_lib._noSelect(element.childNodes[i]);
		},
		/**
		 * conversion de notation css standard avec tiret en notation camelCase
		 * @param {String} regle css
		 * @return {String} regle de style js
		 */
		_camelize : function(s){
			return s.replace(/\-(.)/g,function(j,k){return k.toUpperCase()});
		},
		/**
		 * renvoie la position de la souris
		 * @param {Object} event
		 * @return {Object}[.x|.y]
		 */
		_getMousePos : function(e){
			e = window.event ? window.event : e ;
			var pos = {};
			pos.x = e.clientX;
			pos.y = e.clientY;
			return pos;
		},
		/**
		 * revoie la taille de la fenetre du navigateur
		 * @return {Object}[.x|.y]
		 */
		_getSize : function(){
			var s = {};
			s.x = document.documentElement.clientWidth;
			s.y = document.documentElement.clientHeight;
			return s;
		},
		/**
		 * renvoie le temps courant
		 */
		_getTime : function(){
			return new Date().getTime();
		},
		/**
		 * methode de parcours des elements d'un objet
		 * @param {Function} fn
		 * @param {Object} bind
		 */
		_each : function(fn,bind){
			for (var key in this) if(key!='_each') fn.call(bind,this[key],key,this);
		},
		/**
		 * methode de parcours des elements d'un objet
		 * @param {Function} fn
		 * @param {Object} bind
		 */
		_walk : function(fn,bind){
			for(var i=0;i<this.length;i++) fn.call(bind,this[i],i,this);
		},
		/**
		 * implementation des methodes/proprietes de l'objet o dans l'ojbet trg
		 * @param {Object} trg
		 * @param {Object} o
		 * @param {Bool} proto
		 */
		_implement : function(trg,o,proto){
			if(proto) for(var i in o) trg.prototype[i] = o[i];
			else for(var i in o) trg[i] = o[i];
		},
		/**
		 * renvoie entier depuis chaine en supprimant tous les caracteres non numeriques
		 * @param {String}
		 * @return {Num}
		 */
		_strToInt : function(str){
			return parseInt(str.toString().replace(/[^0-9]/g,''));
		},
		/**
		 * execution au chargement du DOM
		 * @param {Function} callback
		 */
		_domReady : function(callback){
			if(document.addEventListener) try{ document.addEventListener("DOMContentLoaded",callback, false); }catch(e){}
			else{
				(function (){
					if (!document.uniqueID && document.expando) return;
					var tempNode = document.createElement('document:ready'); 
					try { tempNode.doScroll('left'); callback(); tempNode = null; }
					catch(err){ setTimeout(arguments.callee, 0); }
				})();
			}
		}
	};
	/**
	 * GLOBAL VAR window._browser
	 */
	window._browser = _lib._browser;
	/**
	 * GLOBAL VAR window._getMousePos
	 */
	window._getMousePos = _lib._getMousePos;
	/**
	 * GLOBAL VAR window._getWindowSize
	 */
	window._getWindowSize = _lib._getSize;
	/**
	 * GLOBAL VAR window._onDomReady
	 */
	window._onDomReady = _lib._domReady;
	/**
	 * GLOBAL VAR _main
	 */
	_main = _lib;
	/**
	 * GLOBAL VAR _DOMExtend
	 */
	_DOMExtend = _lib._domExtend;

	/**
	 * _framework : methodes custom destinees a etre implementees dans le DOM
	 */
	var _framework = {
		/**
		 * nouvel element DOM
		 * @param {String} Tag
		 * @return {Object} HTMLElement
		 */
		_element : function(el,d){
			if(typeof el === "string") el = (d || document).createElement(el);
			_lib._ieDomExtend(el,_framework);
			return el;
		},
		_implement : function(o){
			_lib._implement(this,o);
			return this;
		},
		/**
		 * retourne l'element dont l'id est passe en arguments
		 * @param {String} Id
		 * @return {Object} HTMLElement
		 */
		_getById : function(id){
			if(typeof id === 'string'){
				var el = document.getElementById(id);
				//if(!el) return false;
				_lib._ieDomExtend(el,_framework);
				return el;
			}
		},
		/**
		 * retourne la collection d'elements dont le nom de balise est passee en arguments
		 * la methode _each est implementee a la collection
		 * @param {String} Tag
		 * @return {Object} HTMLCollection
		 */
		_getByTagName : function(tag){
			if(typeof tag === 'string'){
				var els = this.getElementsByTagName(tag);
				_lib._ieDomExtend(els,_framework);
				els._each = _lib._walk;
				return els;
			}
		},
		/**
		 * retourne la collection d'elements dont le nom de classe css est passe en arguments
		 * @param {String} Tag
		 * @return {Array} Tableau
		 */
		_getByClassName : function(name){
			if(typeof name === 'string'){
				var e = this._getByTagName('*'), arr = [];
				for(var i=0;i<e.length;i++){
					if(e[i].className == name){
						_lib._ieDomExtend(e[i],_framework);
						arr.push(e[i]);
					}
				}
				return arr;
			}
		},
		/**
		 * insere l'element courant comme dernier object dans l'element passe en argument
		 * @param {Object} HTMLElement
		 * @return {Object} HTMLElement
		 */
		_appendTo : function(el){
			el.appendChild(this);	
			return this;
		},
		/**
		 * insere l'element courant avant l'element passe en argument
		 * @param {Object} HTMLElement
		 * @return {Object} HTMLElement
		 */
		_appendBefore : function(el){
			el.parentNode.insertBefore(this,el);	
			return this;
		},
		/**
		 * supprime l'element courant
		 */
		_removeElement : function(){
			this.parentNode.removeChild(this);
		},
		/**
		 * insert une chaine HTML dans l'object courant
		 * @param {String} Chaine HTML
		 * @return {Object} HTMLElement, element courant
		 */
		_setHtml : function(h){
			this.innerHTML = h ;
			return this;
		},
		/**
		 * retourne le contenu de l'element courant en tant chaine
		 * @return {String}
		 */
		_getHtml : function(){
			return this.innerHTML;
		},
		/**
		 * affecte  un observateur d'evenements a l'objet courant
		 * @param {String} Evenement type
		 * @param {Function} Function a executer
		 * @return {Object} HTMLElement, element courant
		 */
		_addEvent : function(type,fn){
			_lib._addEvent(this,type,fn);
			return this;
		},
		/**
		 * supprime un observateur d'evenements de l'objet courant
		 * @param {String} Evenement type
		 * @param {Function} Function a executer
		 * @return {Object} HTMLElement, element courant
		 */
		_removeEvent : function(type,fn){
			_lib._removeEvent(this,type,fn);
			return this;
		},
		/**
		 * retourne la position de l'element courant
		 * @return {Object} position .x, position .y
		 */
		_getPosition: function(){
			var curleft = curtop = 0;
			var o = obj = this;
			var pos = {};
			if (obj.offsetParent){
				do{
					curleft += obj.offsetLeft;
					curtop += obj.offsetTop;
				}while (obj = obj.offsetParent);
			}
			var b = (!window.opera) 
				?  _lib._strToInt(this._getStyle('border-width')) 
				|| _lib._strToInt(this.style.border) || 0 
				: 0 ;
			pos.x = curleft+b;				
			pos.y = curtop+b;
			return pos;
		},
		/**
		 * retourne la taille de l'element courant
		 * @return {Object} largeur .width, hauteur .height
		 */
		_getSize : function(){
			var w = this.offsetWidth;
			var h = this.offsetHeight;
			return {'width':w,'height':h};
		},
		/**
		 * desactive la selection texte de l'element courant ainsi que tous ses elements enfants
		 * @return {Object} HTMLElement, element courant
		 */
		_noSelect : function(){
			_lib._noSelect(this);
			return this;
		},
		/**
		 * desactive la selection texte de l'element courant ainsi que tous ses elements enfants
		 * @return {Object} HTMLElement, element courant
		 */
		_selectOff : function(cursor){
			if(cursor) this.style.cursor = cursor;
			this.onselectstart = function(){ return false; };
			this.onmousedown = function(){ return false; };
		},
		/**
		 * active la selection texte de l'element courant ainsi que tous ses elements enfants
		 * @return {Object} HTMLElement, element courant
		 */
		_selectOn : function(){
			this.style.cursor = '';
			this.onselectstart = function(){ return; };
			this.onmousedown = function(){ return; };
		},
		/**
		 * retourne le premier parent trouve passe en arguments
		 * @return {Object} HTMLElement
		 */
		_getParent : function(tag){
			var el = this;
			do{
				if(el && el.nodeName && el.nodeName.toUpperCase() == tag){
					return el;
				}
				el = el.parentNode;
			}while(el);
			return false;
		},
		/**
		 * affecte la classe css passee en arguments
		 * @param {String} Classe css
		 * @return {Object} HTMLElement, element courant
		 */
		_setClass : function(cls){
			this.className = cls;
			return this;
		},
		/**
		 * ajoute la classe css passee en arguments
		 * @param {String} Classe css
		 * @return {Object} HTMLElement, element courant
		 */
		_addClass : function(cls){
			this.className = this.className+' '+cls;
			return this;
		},
		/**
		 * supprime la classe css passee en arguments
		 * @param {String} Classe css
		 * @return {Object} HTMLElement, element courant
		 */
		_removeClass : function(cls){
			this.className = this.className.replace(cls,'');
			return this;
		},
		/**
		 * affecte le style passe en argument
		 * @param {String} Regle css
		 * @param {String} Valeur css
		 * @return {Object} HTMLElement, element courant
		 */
		_style : function(r,v){
			var 	elStyle = this.style,
				v = v.toString().replace(/px/,''),
				e = !r.match(/opacity|color/) ? 'px' : '' ;
			switch(r){
				case 'float':
					elStyle['cssFloat'] = elStyle['styleFloat'] = v;
				break;
				case 'opacity':
					elStyle['opacity'] = v/100;
					elStyle.filter = "alpha(opacity=" + Math.round(v) + ")"; 
				break;
				default:
					try{ elStyle[_lib._camelize(r)] = v+e; }catch(e){};
			}
			return this;
		},
		/**
		 * affecte les style present dans l'object passe en argument
		 * @param {Object} {'regle css':'valeur css'}
		 * @return {Object} HTMLElement, element courant
		 */
		_setStyle : function(st){
			var elStyle = this.style;
			for(var itm in st){
				switch(itm){
					case 'float':
						elStyle['cssFloat'] = elStyle['styleFloat'] = st[itm];
					break;
					case 'opacity':
						elStyle.opacity = st[itm];
						elStyle.filter = "alpha(opacity=" + Math.round(st[itm]*100) + ")"; 
					break;
					case 'className':
						this.className = st[itm];
					break;
					default:
						elStyle[_lib._camelize(itm)] = st[itm];	
				}
			}
			return this;
		},
		/**
		 * retourne la valeur de la regle css passee en arguments
		 * @param {String} Regle css
		 * @return {String} Valeur css
		 */
		_getStyle : function(cssRule,d){
			var doc = (!d) ? document.defaultView : d; 
			if(this.nodeType == 1){
				return (doc && doc.getComputedStyle) 
					? doc.getComputedStyle( this, null ).getPropertyValue(cssRule) 
					: this.currentStyle[ _lib._camelize(cssRule) ];
			}
		},
		/**
		 * supprime les valeurs des regles css passees en arguments
		 * @param {Strings} (Regle css,Regle css...)
		 * @return {Object} HTMLElement, element courant
		 */
		_removeStyle : function(){
			for(var i=0;i<arguments.length;i++) this.style[_lib._camelize(arguments[i])] = '';
			return this;
		},
		/**
		 * affecte les attribut presents dans l'object passe en argument
		 * @param {Object} {'attribut':'valeur'}
		 * @return {Object} HTMLElement, element courant
		 */
		_setAttributes : function(at){
			for(var item in at) this[item] = at[item];
			return this;
		},
		/**
		 * supprime les attributs passes en arguments
		 * @param {Strings} ('attribut','attribut'...)
		 * @return {Object} HTMLElement, element courant
		 */
		_removeAttributes : function(){
			for(var i=0;i<arguments.length;i++) this[arguments[i]] = '';
			return this;
		}
	};
	/**
	 * Implementation des methodes du document
	 */
	document._getById = document.getElementById;
	document._getByClassName = _framework._getByClassName;
	document._getByTagName = _framework._getByTagName;
	/**
	 * Implementation des methodes de _framework dans la DOM
	 */
	_DOMExtend(_framework);
	/**
	 * GLOBAL VAR _element
	 */
	_element = _framework._element;

	/**
	 * Implementation des methodes custom dans l'objet natif Array
	 */
	_lib._implement(Array,{
		_each : function(fn,bind){
			for (var i = 0, l = this.length; i < l; i++) 
				fn.call(bind, this[i], i, this);
		},
		_inArray : function(array,item){
			for(var i=0; i < array.length; i++){
				if(array[i] == item)
					return i;
			}
		},
		_replace : function(){},
		_move : function(){}
	},true);

	/**
	 * _server : methodes utilisees pour les actions serveur
	 */
	var _server = {
		/**
		 * XMLHTTPRequest[.get | .post]
		 * @param {Object}
		 *	- file {String}
		 *	- param {String}
		 *	- onSend {Function}
		 *	- onReceive {Function}
		 * @return {Object} Objet courant
		 */
		_httpRequest : {
			get : function(o){
				this.req = _server._httpRequest.request;
				this.req(o);
				this.xhr.open("get",this.file+this.param);
				this.xhr.send(null);
				return this;
			},
			post : function(o){
				this.req = _server._httpRequest.request;
				this.req(o);
				this.xhr.open("post",this.file, true); 
				this.xhr.setRequestHeader(
					"Content-Type", 
					"application/x-www-form-urlencoded; charset=UTF-8");
				this.xhr.send(this.param);
				return this;
			},
			request : function(o){
				if(!o['file']) return false;
				var self = this;
				_lib._implement(this,o);
				this.responseText = null;
				this.xhr = window._browser().isIE6
					? new ActiveXObject("Microsoft.xmlhttp") 
					: new XMLHttpRequest();
				if(this.onSend) this.onSend();
				this.xhr.onreadystatechange = function(){
					if(self.xhr.readyState == 4){
						if (self.xhr.status == 200){
							self.responseText = self.xhr.responseText;
							if(self.onReceive!=null) self.onReceive();
						}
					}
				};
			}
		},
		_form : function(){}
	};
	/**
	 * GLOBAL VAR _httpRequest, _request, _ajax
	 */
	_httpRequest = _request = _ajax = _server._httpRequest;
	/**
	 * GLOBAL VAR _createForm
	 */
	_createForm = _server._form

	/**
	 * _json
	 */
	var _json = {
		/**
		 * converti un objet Javascript en chaine Json
		 * @param {Object}
		 * @return {String}
		 */
		encode : function(o){
			if(typeof o != 'object') return false;
			var walk = function(o){
				var string = '',l,j;
				for(var j in o) l = j;
				for(i in o){
					if(typeof o[i] == 'object'){
						if(o[i] instanceof Array){
							for (j=0, string += '"'+i+'":['; j<o[i].length; j++)
								string += (j>0 ? ',' : '') + '"'+o[i][j]+'"';
							string += i==l ? ']' : '],' ;
						}else{
							var c = i==l ? '}': '},';
							string += '"'+i+'":{'; 
							string += walk (o[i]);							
							string += c;
						}
					}else{
						string += '"'+i+'":"'+o[i]+
						( i==l ? '"' : '",' );
					}
				}
				return string;
			};
			string = walk(o);
			return '{'+string+'}';
		},
		/**
		 * converti une chaine Json en objet Javascript
		 * @param {String}
		 * @return {Object}
		 */
		parse : function(s){ try{ return eval('('+s+')');}catch(ex){} }
	};
	/**
	 * GLOBAL VAR _jsonEncode
	 */
	_jsonEncode = _json.encode;
	/**
	 * GLOBAL VAR _jsonParse
	 */
	_jsonParse = _json.parse;

	/**
	 * _cook : creation, lecture et suppression de cookie javascript
	 */
	var _cook = {
		/**
		 * ecrit un cookie
		 * @param {String} Nom
		 * @param {String} Valeur
		 * @param {Int} duree OPTIONNEL
		 */
		writeCookie : function(name,value,days){
			if (days) {
				var date = new Date();
				date.setTime(date.getTime()+(days*24*60*60*1000));
				var expires = "; expires="+date.toGMTString();
			}
			else var expires = "";
			document.cookie = name+"="+value+expires+"; path=/";
		},
		/**
		 * lit un cookie
		 * @param {String} Nom
		 */
		readCookie : function(name){
			var nameEQ = name + "=";
			var ca = document.cookie.split(';');
			for(var i=0;i < ca.length;i++) {
				var c = ca[i];
				while (c.charAt(0)==' ') c = c.substring(1,c.length);
				if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
			}
			return null;
		},
		/**
		 * supprime un cookie
		 * @param {String} Nom
		 */
		delCookie : function(name){
			createCookie(name,"",-1);
		}
	};
	/**
	 * _cook.manager : gestionnaire de cookie
	 * @param {String} Valeur
	 * @param {Int} duree OPTIONNEL
	 */
	_cook.manager = function(cookie,days){
		this.cookie = cookie;
		if(!_cook.readCookie(this.cookie)){
			_cook.writeCookie(this.cookie,days);
		}
	};
	/**
	 * methode privee
	 */
	_cook.manager.prototype.load = function(){
		var ck;
		this.ck = {};
		try{
			this.ck_loaded = _cook.readCookie(this.cookie).split(';');
			if(this.ck_loaded){
				for(ck in this.ck_loaded){
					if(typeof this.ck_loaded[ck]!='string') continue;
					var _ck = this.ck_loaded[ck].split('=');
					this.ck[_ck[0]]=_ck[1];
				}
			}
		}catch(e){}
	};
	/**
	 * retourne le nom du cookie
	 * @return {String} valeur du fragment
	 */
	_cook.manager.prototype.getname = function(){
		return this.cookie;
	};
	/**
	 * retourne la valeur du fragment d cookie
	 * @param {String} cle du fragment
	 * @return {String} valeur du fragment
	 */
	_cook.manager.prototype.get = function(ck_fragment){
		this.load();
		return this.ck[ck_fragment];
	};
	/**
	 * enregistre un fragment de cookie
	 * @param {String} cle du fragment
	 * @param {String} valeur du fragment
	 */
	_cook.manager.prototype.set = function(ck_fragment,ck_value){
		this.load();
		this.ck[ck_fragment]=ck_value;
		this.save();
	};
	/**
	 * supprime un fragment de cookie
	 * @param {String} cle du fragment
	 */
	_cook.manager.prototype.remove = function(ck_fragment){
		this.load();
		this.ck[ck_fragment]='';
		this.save();
	};
	/**
	 * Compte le nombre de fragment present dans le cookie
	 * @return {Int} Nombre de fragments
	 */
	_cook.manager.prototype.count = function(){
		var j = 0;
		for(i in this.ck) j++;
		return j;
	};
	/**
	 * affiche le cookie dans son ensemble
	 */
	_cook.manager.prototype.show = function(){
		this.load();
		var i,str_ck='';
		for(i in this.ck) if(i) str_ck += i+" : "+this.ck[i]+"\n";
		alert(str_ck);
	};
	/**
	 * methode privee
	 */
	_cook.manager.prototype.save = function(){
		var str_ck = '',pr,i = 1, sep = '', num = this.count();
		for(pr in this.ck){
			if(!this.ck[pr]) continue;
			str_ck += pr+"="+this.ck[pr];
			str_ck += i == num ? '' : ';';
			i++;
		}
		_cook.writeCookie(this.cookie,str_ck);
	};
	/**
	 * supprime le cookie
	 */
	_cook.manager.prototype.deletecookie = function(){
		_cook.delCookie(this.cookie);
	};
	/**
	 * GLOBAL VAR _cookie
	 */
	_cookie = _cook;
	/**
	 * GLOBAL VAR _cookieManager
	 */
	_cookieManager = _cook.manager;

	/**
	 * Implementation de methodes supplementaires dans l'objet _framework
	 */
	_lib._implement(_framework,{
		/**
		 * selectionne l'element dans une liste deroulant dont la valeur correspond e la la valeur passee en argument
		 * @param {String} Valeur
		 */
		_setSelectedIndex : function(value){
			if(this.tagName != 'SELECT') return false;
			var opt = this.getElementsByTagName('option');
			for(var i=0;i<opt.length;i++) 
				if(opt[i].value == value ) 
					opt[i].selected = 'selected';
		},
		/**
		 * pour un menu deroulant, retourne la valeur de l'attribut passe en arguments
		 * difficile de retrouver l'utilite de cette methode, mais bon...
		 * @param {String} Attribut
		 * @return {String} Valeur
		 */
		_getSelectedValue : function(type){
			if(this.tagName != 'SELECT') return false;
			var opt = this.getElementsByTagName('option');
			for(var i=0;i<opt.length;i++) 
				if(opt[i].selected) 
					var selectedValue = opt[i].getAttribute(type);
			return selectedValue;
		},
		/**
		 * enregistre la position du scroll de l'element dans un fragment de cookie
		 * @param {String} Nom de l'instance du cookie
		 * @param {String} Nom de la cle du fragment e enregistrer
		 */
		_saveScrollPos : function(cookie,ckName){
			// RALENTISSEMENT SUR IE : REFAIRE !!
			var _this = this;
			if(cookie._get(ckName)){
				this.scrollTop = parseInt(cookie._get(ckName));
			}
			this.onscroll = function(){ 
				cookie.set(ckName,_this.scrollTop);
			};
			if(!document.all){
				this.addEventListener('DOMMouseScroll', function(){ 
					cookie.set(ckName,_this.scrollTop); 
				}, false);
			}
		},
		/**
		 * test
		 */
		_getType : function(){
			alert(typeof this);
		}
	});
})();
