function imposeMaxLength(obj, max)
{
	if(obj.getAttribute && obj.value.length > max)
	{
		obj.value = obj.value.substring(0,max);
	}
}

function inputFocus(id, text, which, height)
{
	var myInput = document.getElementById(id);
	if(myInput == null)
		return;
	
	if(which == 1)
	{
		if(myInput.style.color = '#888' && myInput.value == text)
		{
			myInput.style.color = '#000';
			myInput.value = '';
		}
	}
	else if(which == 0)
	{
		if(myInput.value == '' || myInput.value == null)
		{
			myInput.style.color = '#888';
			myInput.value = text;
			myInput.style.height = height + 'px';
		}
	}
}

function red_field(field)
{
	field.style.backgroundColor = '#fcc';
	field.style.borderColor = '#d00';
}

function normal_field(field)
{
	field.style.backgroundColor = '#fff';
	field.style.borderColor = '#06c';
}

function show_error(code)
{
	var errBox = document.getElementById('errorBox');
	if(errBox != null)
	{
		errBox.innerHTML = "<div class='error'>" + code + "</div>";
	}
}

function clear_error()
{
	var errBox = document.getElementById('errorBox');
	if(errBox != null)
	{
		errBox.innerHTML = "";
	}
}
