
function form_modify_file(fieldId)
{
	document.getElementById(fieldId).style.display = 'inline';
	document.getElementById(fieldId + '_name').value = '';
	document.getElementById(fieldId + '_url').value = '';
	document.getElementById(fieldId + '_infos').style.display = 'none';
}

function form_filter_phone(f)
{
	if (f.value.charAt(0) == '0')
		f.value = implode(f.value, ' ', 2);
}

function implode(s, c, n)
{
	var ns = '';
	var x = 0;
	for (var i = 0; i < s.length; i++)
	{
		if (s.charAt(i) != c)
		{
			if (x > 0 && x % n == 0)
				ns += c;
			ns += s.charAt(i);
			x++;
		}
	}
	return ns;
}

function form_filter_url(f)
{
	if (f.value.length > 0 && f.value.substring(0, 7) != 'http://')
		f.value = 'http://' + f.value;
}