var capslock = {
	oImgWarning : document.createElement('img'),

	init: function( sRacineCharte) {
		$(':password').each(function() {
			$(this).keypress( function(e) {
				if (((e.which >= 65 && e.which <=  90) && !e.shiftKey) ||
					((e.which >= 97 && e.which <= 122) && e.shiftKey)) {
					// majusule, sans shift
					capslock.show_warning(getSrcElement(e));
				} else {
					capslock.hide_warning(getSrcElement(e));
				}
			});
		});

		$(this.oImgWarning).attr({
			src: sRacineCharte + 'image/capslock.png',
			alt: _lg("Attention, la touche de Verr. Maj est activée.")
		}).css({
			position: 'absolute',
			display: 'none',
			zIndex: 999
		}).click( function() { $(this).hide() });
		document.body.appendChild(this.oImgWarning);
	},

	show_warning: function(targ) {
		var offset = $(targ).offset();
		$(this.oImgWarning).css({
			top: (offset.top - 65),
			left: (offset.left + $(targ).outerWidth())
		}).show();
	},
	hide_warning: function(targ) {
		$(this.oImgWarning).hide();
	}
};
