// -------------------------------------------------------- //
// general functions										//
// -------------------------------------------------------- //
// removes leading whitespaces
function ltrim(value)
{
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
}

// removes ending whitespaces
function rtrim(value)
{
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
}

// Removes leading and ending whitespaces
function trim(value)
{
	return ltrim(rtrim(value));
}

// gets the selected radio list item
function radio_get_selected_item(list)
{
	var selected_value = null;

	for(i = 0; i < list.length; i++)
	{
		if (list[i].checked)
		{
			selected_value = list[i].value;
			return selected_value;
		}
	}

	return null;
}

