	scrollbar = {
		image_uri_scroll_arrow_up			: '../images/scrollbar/scroll_arrow_up.png',
		image_uri_scroll_arrow_up_push		: '../images/scrollbar/scroll_arrow_up_push.png',
		image_uri_track						: '../images/scrollbar/track.png',
		image_uri_scrollbox_top				: '../images/scrollbar/scrollbox_top.png',
		image_uri_scrollbox_body			: '../images/scrollbar/scrollbox_body.png',
		image_uri_scrollbox_bottom			: '../images/scrollbar/scrollbox_bottom.png',
		image_uri_scroll_arrow_down			: '../images/scrollbar/scroll_arrow_down.png',
		image_uri_scroll_arrow_down_push	: '../images/scrollbar/scroll_arrow_down_push.png',
	
		_cst_defilement_pas					: 2,
		compteur_scrollbar					: 1,
		scrollbar_width						: undefined,
	
		image_scroll_arrow_up				: new Image(),
		image_scroll_arrow_up_push			: new Image(),
		image_track							: new Image(),
		image_scrollbox_top					: new Image(),
		image_scrollbox_body				: new Image(),
		image_scrollbox_bottom				: new Image(),
		image_scroll_arrow_down				: new Image(),
		image_scroll_arrow_down_push		: new Image(),

		init : function () {
			scrollbar.image_scroll_arrow_up.src = scrollbar.image_uri_scroll_arrow_up;
			scrollbar.image_scroll_arrow_up_push.src = scrollbar.image_uri_scroll_arrow_up_push;
			scrollbar.image_track.src = scrollbar.image_uri_track;
			scrollbar.image_scrollbox_top.src = scrollbar.image_uri_scrollbox_top;
			scrollbar.image_scrollbox_body.src = scrollbar.image_uri_scrollbox_body;
			scrollbar.image_scrollbox_bottom.src = scrollbar.image_uri_scrollbox_bottom;
			scrollbar.image_scroll_arrow_down.src = scrollbar.image_uri_scroll_arrow_down;
			scrollbar.image_scroll_arrow_down_push.src = scrollbar.image_uri_scroll_arrow_down_push;
			scrollbar.scrollbar_width = 15;
		},
		
		initDiv : function (elt) {
			elt.style.fontSize = '0px';
			elt.style.lineHeight = '0px';
		},

		addVerticalScrollbar : function (area_id) {
			elt_conteneur = document.createElement('div');
			elt_conteneur.elt_area = document.getElementById(area_id);
			elt_conteneur.elt_area.style.styleFloat = 'left'; // IE
			elt_conteneur.elt_area.style.cssFloat = 'left'; // rest of the World
			elt_conteneur.id = 'scroll_conteneur_' + scrollbar.compteur_scrollbar;
			elt_conteneur.elt_area.style.overflow = "hidden";
			elt_conteneur.style.width = elt_conteneur.elt_area.offsetWidth + 'px';
			elt_conteneur.style.height = elt_conteneur.elt_area.offsetHeight + 'px';
			elt_conteneur.elt_area.style.styleFloat = 'left'; // IE
			elt_conteneur.elt_area.style.cssFloat = 'left'; // rest of the World
			elt_conteneur.elt_area.parentNode.insertBefore(elt_conteneur, elt_conteneur.elt_area);
			elt_conteneur.appendChild(elt_conteneur.elt_area);

//			elt_conteneur.style.border = elt_conteneur.elt_area.style.border;
//			elt_conteneur.elt_area.style.border = '';
			
			
			elt_conteneur.elt_scrollbar = document.createElement('div');
			scrollbar.initDiv(elt_conteneur.elt_scrollbar);
			elt_conteneur.elt_scrollbar.style.styleFloat = 'left'; // IE
			elt_conteneur.elt_scrollbar.style.cssFloat = 'left'; // rest of the World
			elt_conteneur.elt_scrollbar.style.height = elt_conteneur.elt_area.offsetHeight + 'px';
			elt_conteneur.elt_scroll_arrow_up = document.createElement('div');
			scrollbar.initDiv(elt_conteneur.elt_scroll_arrow_up);
			elt_conteneur.elt_scroll_arrow_up.id = 'scroll_arrow_up_' + scrollbar.compteur_scrollbar;
			elt_conteneur.elt_scroll_arrow_up.style.width = scrollbar.image_scroll_arrow_up.width + 'px';
			elt_conteneur.elt_scroll_arrow_up.style.height = scrollbar.image_scroll_arrow_up.height + 'px';
			elt_conteneur.elt_scroll_arrow_up.style.backgroundImage = "url(" + scrollbar.image_uri_scroll_arrow_up + ")";
			elt_conteneur.elt_scrollbar.appendChild(elt_conteneur.elt_scroll_arrow_up);

			elt_conteneur.elt_track = document.createElement('div');
			scrollbar.initDiv(elt_conteneur.elt_track);
			elt_conteneur.elt_track.style.width = scrollbar.image_track.width + 'px';
			elt_conteneur.elt_track.style.backgroundImage = "url(" + scrollbar.image_uri_track + ")";
			elt_conteneur.elt_scrollbar.style.width = scrollbar.scrollbar_width + 'px';
			elt_conteneur.elt_scrollbar.appendChild(elt_conteneur.elt_track);

			elt_conteneur.elt_spacerTop = document.createElement('div');
			scrollbar.initDiv(elt_conteneur.elt_spacerTop);
			elt_conteneur.elt_spacerTop.style.height = '0px';
			elt_conteneur.elt_spacerTop.id = 'scroll_spacerTop_' + scrollbar.compteur_scrollbar;
			elt_conteneur.elt_track.appendChild(elt_conteneur.elt_spacerTop);

			elt_conteneur.elt_scrollbox = document.createElement('div');
			scrollbar.initDiv(elt_conteneur.elt_scrollbox);
		
			if (elt_conteneur.elt_scrollbox.addEventListener) {
				elt_conteneur.elt_scrollbox.addEventListener('mousedown', scrollbar.scrollbox_mousedown, false);
			} else {
				elt_conteneur.elt_scrollbox.onmousedown = scrollbar.scrollbox_mousedown;
			}

			elt_conteneur.elt_track.appendChild(elt_conteneur.elt_scrollbox);

			elt_conteneur.elt_scrollbox_top = document.createElement('div');
			scrollbar.initDiv(elt_conteneur.elt_scrollbox_top);
			elt_conteneur.elt_scrollbox_top.style.width = scrollbar.image_scrollbox_top.width + 'px';
			elt_conteneur.elt_scrollbox_top.style.height = scrollbar.image_scrollbox_top.height + 'px';
			elt_conteneur.elt_scrollbox_top.style.backgroundImage = "url(" + scrollbar.image_uri_scrollbox_top + ")";
			elt_conteneur.elt_scrollbox.appendChild(elt_conteneur.elt_scrollbox_top);

			elt_conteneur.elt_scrollbox_body = document.createElement('div');
			scrollbar.initDiv(elt_conteneur.elt_scrollbox_body);
			elt_conteneur.elt_scrollbox_body.style.width = scrollbar.image_scrollbox_body.width + 'px';
			elt_conteneur.elt_scrollbox_body.style.height = scrollbar.image_scrollbox_body.height + 'px';
			elt_conteneur.elt_scrollbox_body.style.backgroundImage = "url(" + scrollbar.image_uri_scrollbox_body + ")";
			elt_conteneur.elt_scrollbox.appendChild(elt_conteneur.elt_scrollbox_body);

			elt_conteneur.elt_scrollbox_bottom = document.createElement('div');
			scrollbar.initDiv(elt_conteneur.elt_scrollbox_bottom);
			elt_conteneur.elt_scrollbox_bottom.style.width = scrollbar.image_scrollbox_bottom.width + 'px';
			elt_conteneur.elt_scrollbox_bottom.style.height = scrollbar.image_scrollbox_bottom.height + 'px';
			elt_conteneur.elt_scrollbox_bottom.style.backgroundImage = "url(" + scrollbar.image_uri_scrollbox_bottom + ")";
			elt_conteneur.elt_scrollbox.appendChild(elt_conteneur.elt_scrollbox_bottom);

			elt_conteneur.elt_spacerBottom = document.createElement('div');
			scrollbar.initDiv(elt_conteneur.elt_spacerBottom);
			elt_conteneur.elt_spacerBottom.id = 'scroll_spacerBottom_' + scrollbar.compteur_scrollbar;
			elt_conteneur.elt_track.appendChild(elt_conteneur.elt_spacerBottom);

			elt_conteneur.elt_scroll_arrow_down = document.createElement('div');
			scrollbar.initDiv(elt_conteneur.elt_scroll_arrow_down);
			elt_conteneur.elt_scroll_arrow_down.id = 'scroll_arrow_down_' + scrollbar.compteur_scrollbar;
			elt_conteneur.elt_scroll_arrow_down.style.width = scrollbar.image_scroll_arrow_down.width + 'px';
			elt_conteneur.elt_scroll_arrow_down.style.height = scrollbar.image_scroll_arrow_down.height + 'px';
			elt_conteneur.elt_scroll_arrow_down.style.backgroundImage = "url(" + scrollbar.image_uri_scroll_arrow_down + ")";
			elt_conteneur.elt_scrollbar.appendChild(elt_conteneur.elt_scroll_arrow_down);
		
			area_width = elt_conteneur.offsetWidth - scrollbar.scrollbar_width;
			elt_conteneur.elt_area.style.width = area_width + 'px';
			track_height = elt_conteneur.elt_area.offsetHeight - scrollbar.image_scroll_arrow_up.height - scrollbar.image_scroll_arrow_down.height;
			elt_conteneur.elt_track.style.height = (track_height < 0 ? 0 : track_height) + 'px';
			elt_conteneur.appendChild(elt_conteneur.elt_scrollbar);
			elt_conteneur.defilement_timer = null;
			
			elt_conteneur.elt_area.onchange = function() {
				this.parentNode.area_scrollHeight = this.scrollHeight < this.clientHeight ? this.clientHeight : this.scrollHeight;
				this.parentNode.scrollbox_height = ((this.clientHeight * this.parentNode.elt_track.clientHeight) / this.parentNode.area_scrollHeight);
				scrollbox_height_min = scrollbar.image_scrollbox_top.height + scrollbar.image_scrollbox_bottom.height;
				if (this.parentNode.scrollbox_height < scrollbox_height_min) {
					this.parentNode.elt_track.scrollableHeight = this.parentNode.elt_track.clientHeight - scrollbox_height_min + this.parentNode.scrollbox_height;
					this.parentNode.scrollbox_height = scrollbox_height_min;
				} else {
					this.parentNode.elt_track.scrollableHeight = this.parentNode.elt_track.clientHeight;
				}
				this.parentNode.elt_scrollbox_body.style.height = (this.parentNode.scrollbox_height - scrollbox_height_min) + 'px';
				this.parentNode.elt_spacerBottom.style.height = (this.parentNode.elt_track.clientHeight - this.parentNode.elt_scrollbox.offsetHeight) + 'px';
			}	

			elt_conteneur.elt_area.onchange();

			elt_conteneur.elt_spacerTop.onmousedown = function() {
				with (this.parentNode.parentNode.parentNode) {
					scrollbar.scroll_move(id, - elt_area.clientHeight, 200);
				}
			}
		
			elt_conteneur.elt_spacerTop.onmouseup = function() {
				clearTimeout(this.parentNode.parentNode.parentNode.defilement_timer);
			}
		
			elt_conteneur.elt_spacerTop.onmouseout = function() {
				clearTimeout(this.parentNode.parentNode.parentNode.defilement_timer);
			}

			elt_conteneur.elt_spacerBottom.onmousedown = function() {
				with (this.parentNode.parentNode.parentNode) {
					scrollbar.scroll_move(id, elt_area.clientHeight, 200);
				}
			}
		
			elt_conteneur.elt_spacerBottom.onmouseup = function() {
				clearTimeout(this.parentNode.parentNode.parentNode.defilement_timer);
			}
			
			elt_conteneur.elt_spacerBottom.onmouseout = function() {
				clearTimeout(this.parentNode.parentNode.parentNode.defilement_timer);
			}
	
			elt_conteneur.elt_scroll_arrow_up.onmouseover = function() {
				if (this.style.backgroundImage != "url(" + scrollbar.image_uri_scroll_arrow_up_push + ")")
					this.style.backgroundImage = "url(" + scrollbar.image_uri_scroll_arrow_up_push + ")";
				scrollbar.scroll_move(this.parentNode.parentNode.id, - scrollbar._cst_defilement_pas, 10);
			}
	
			elt_conteneur.elt_scroll_arrow_up.onmouseout = function() {
				this.style.backgroundImage = "url(" + scrollbar.image_uri_scroll_arrow_up + ")";
				clearTimeout(this.parentNode.parentNode.defilement_timer);
			}
	
			elt_conteneur.elt_scroll_arrow_down.onmouseover = function() {
				if (this.style.backgroundImage != "url(" + scrollbar.image_uri_scroll_arrow_down_push + ")")
					this.style.backgroundImage = "url(" + scrollbar.image_uri_scroll_arrow_down_push + ")";
				scrollbar.scroll_move(this.parentNode.parentNode.id, scrollbar._cst_defilement_pas, 10);
			}
	
			elt_conteneur.elt_scroll_arrow_down.onmouseout = function() {
				this.style.backgroundImage = "url(" + scrollbar.image_uri_scroll_arrow_down + ")";
				clearTimeout(this.parentNode.parentNode.defilement_timer);
			}
	
			scrollbar.compteur_scrollbar++;
		},
	
		scrollbox_mousedown : function (event) {
			if (!event)
				event = window.event;
			document.drag_elt_conteneur =  this.parentNode.parentNode.parentNode;
			document.drag_start_y = event.clientY;
			document.drag_start_height = document.drag_elt_conteneur.elt_spacerTop.offsetHeight;
	
			if (document.addEventListener) {
				document.addEventListener('mousemove', scrollbar.drag_move, false);
				document.addEventListener('mouseup', scrollbar.drag_stop, false);
			} else {
				document.onmousemove = scrollbar.drag_move;
				document.onmouseup = scrollbar.drag_stop;
			}
		},

		drag_move : function  (event) {
			if (!event)
				event = window.event;
			newPos = Math.round(((document.drag_start_height + event.clientY - document.drag_start_y) * document.drag_elt_conteneur.area_scrollHeight) / document.drag_elt_conteneur.elt_track.scrollableHeight); // clientHeight
			scrollbar.scroll_moveRel(document.drag_elt_conteneur, newPos);
			event.cancelBubble = true;
			if (event.stopPropagation)
				event.stopPropagation();
			return false;
		},
	
		drag_stop : function (event) {
			if (document.removeEventListener) {
				document.removeEventListener('mouseup', scrollbar.drag_stop, false);
				document.removeEventListener('mousemove', scrollbar.drag_move, false);
			} else {
				document.onmouseup = null;
				document.onmousemove = null;
			}
		},

		scroll_move : function (conteneur_id, pas, intervalle_temp) {
			elt_conteneur = document.getElementById(conteneur_id);
			scrollbar.scroll_moveRel(elt_conteneur, elt_conteneur.elt_area.scrollTop + pas);
			elt_conteneur.defilement_timer = setTimeout('scrollbar.scroll_move("' + conteneur_id + '", ' + pas + ', ' + intervalle_temp + ')', intervalle_temp);
		},

		scroll_moveRel : function (elt_conteneur, newPos) {
			if (newPos < 0)
				elt_conteneur.elt_area.scrollTop = 0;
			else if (newPos > elt_conteneur.elt_area.scrollHeight - elt_conteneur.elt_area.clientHeight)
				elt_conteneur.elt_area.scrollTop = elt_conteneur.elt_area.scrollHeight - elt_conteneur.elt_area.clientHeight;
			else
				elt_conteneur.elt_area.scrollTop = newPos;
			spacerTop_height = Math.round((elt_conteneur.elt_area.scrollTop * elt_conteneur.elt_track.scrollableHeight) / elt_conteneur.area_scrollHeight); //clientHeight
			spacerBottom_height = elt_conteneur.elt_track.clientHeight - elt_conteneur.elt_scrollbox.offsetHeight - spacerTop_height;
			elt_conteneur.elt_spacerBottom.style.height = spacerBottom_height + 'px';
			elt_conteneur.elt_spacerTop.style.height = spacerTop_height + 'px';
		}
	}
