function checkNumber(inp)
{
	var sText = inp.value;
	var ValidChars = "0123456789.-";
	var sRet = "";
	var bInvalidChar = false;
	var bDotUsed = false;
	var bDashUsed = false;
	
	for (i = 0; i < sText.length; i++) 
	{ 
		var Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) != -1)
		{
			//check that there is only one dot
			if(bDotUsed && Char == ".")
				bInvalidChar = true;
			//check that there is only one dash
			else if(bDashUsed && Char == "-")
				bInvalidChar = true;
			//check that the dash is the first character
			else if(Char == "-" && i != 0)
				bInvalidChar = true;
			//else add the character to the return string
			else
				sRet = sRet + Char;
			
			//mark the dot or dash as "used"
			if(Char == ".")
				bDotUsed = true;
			if(Char == "-")
				bDashUsed = true;
		}
		else
			bInvalidChar = true;
	}
	
	if(bInvalidChar == true)
		inp.value = sRet;
}

function roleManagerSelectAll(usage,type)
{
	var arrInputs = document.getElementById('RM'+type).getElementsByTagName('INPUT');
	for(i=0; i<arrInputs.length; i++)
	{
		var inputID = arrInputs[i].id;
		var tmp = inputID.split('_');
		if(tmp[1] == usage)
			document.getElementById(inputID).checked = true;
	}
	document.getElementById(type+usage+'IMG').onclick = function() {roleManagerUnselectAll(usage,type)};
}

function roleManagerUnselectAll(usage,type)
{
	var arrInputs = document.getElementById('RM'+type).getElementsByTagName('INPUT');
	for(i=0; i<arrInputs.length; i++)
	{
		var inputID = arrInputs[i].id;
		var tmp = inputID.split('_');
		if(tmp[1] == usage)
			document.getElementById(inputID).checked = false;
	}
	document.getElementById(type+usage+'IMG').onclick = function() {roleManagerSelectAll(usage,type)};
}
