/*
gets all label elements and adds a colon to the end,
if there is a required class on that element it will add the asterisk as well
*/

function setInputs(container)
{
	var LabelSeparator = ':';
	var RequiredSymbol = '*';

	if (container == 'undefined' || container == null)
	{
		container = '';
	}
	else
	{
		container += ' ';
	}

	$$(container + 'label').each(function(label) {
		if (!label.hasClass('nocolon') && !label.innerHTML.contains(LabelSeparator))
		{
			label.innerHTML += LabelSeparator + '&nbsp;';
		}

		if (label.hasClass('required') && !label.innerHTML.contains(RequiredSymbol))
		{
			if (label.innerHTML.substring(label.innerHTML.length - 6) == '&nbsp;')
			{
				label.innerHTML += reqWrapper(RequiredSymbol) + '&nbsp;';
			}
			else
			{
				/*
				** if specific css rules need to apply only to the asterisk pass it through the
				** reqWrapper function with the css class to be applied
				**
				** ex. label.innerHTML += '&nbsp;' + reqWrapper(RequiredSymbol,'reqasterisk') + '&nbsp; ';
				*/
				label.innerHTML += '&nbsp;' + RequiredSymbol + '&nbsp; ';
			}
		}
	});
}

function reqWrapper(input,cssClass)
{
	return '<span class="'+cssClass+'">'+input+'</span>';
}

setInputs();