// Timelog period replace script
// version 1.0
// 2007-12-25
// Copyright (c) 2007, Arjan Snaterse
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script.
//
// To install, you need Greasemonkey: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select "Google Traffic Estimator Extended", and click Uninstall.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name			Timelog period replacer
// @namespace		http://netters.nl/timelog
// @identifier		http://netters.nl/greasemonkey/timelog.user.js
// @data			2007-12-25
// @version			1.0
// @description		Replaces all types periods with comma's
// @include			http://tl.timelog.com/otm/matrix_ugeseddel*
// ==/UserScript==


(function() {
	var inputs = document.getElementsByTagName("input");

	for(var i=0; i<inputs.length; i++) {
		inputs[i].addEventListener("keyup", replacePeriods, false);
	}
})();

function replacePeriods(e) {
	if (!e) e = window.event;

	var k = document.getElementById("key");
	var keyCode = e.keyCode;
	var src = e.target;

	if(keyCode == 190 || keyCode == 110) { // period (190) or decimal point (110)
		src.value = (src.value).replace(/\./g, ",");
	}
}