// Remove leading and trailing whitespace

function trim(a)

{

	return a.replace(/^\s+/,'').replace(/\s+$/,'');

}





// Toggle textbox and teaxtarea values

function toggleValue(obj, type)

{

	if (type == 'focus' && trim(obj.value) == obj.defaultValue) obj.value='';

	else if (type == 'blur' && trim(obj.value) == '') obj.value = obj.defaultValue;

}





// Toggle textbox and teaxtarea styles

function toggleStyle(obj, type, style)

{

	if (type == 'focus') obj.className=style;

	else if (type == 'blur' && (trim(obj.value) == obj.defaultValue || trim(obj.value) == '')) obj.className = style;

}



