function uncheckRadios(name)
{
	var inputs = document.getElementsByName(name);
	for (var i = 0; i < inputs.length; i++)
	{
		if (inputs[i].type == 'radio' && inputs[i].id.indexOf('radio_') == 0)
		{
			var img = inputs[i].nextSibling;
			img.alt = 'off';
			img.src = './img/common/radio_off.png';
		}
	}
}

function renderRadio(id, name, value, label, isChecked, onclick)
{
	document.write('<input type="radio" value="' + value + '" style="display:none" name="' + name + '" id="radio_' + id + '" ');
	if (isChecked)
		document.write('checked="checked" ');
	document.write('/><img id="' + id + '" style="margin-left: 5px; margin-right: 5px;" ');
	if (isChecked)
		document.write('alt="on" src="./img/common/radio_on.png" ');
	else
		document.write('alt="off" src="./img/common/radio_off.png" ');
	document.write(' onclick="if (this.alt == \'off\') { uncheckRadios(\'' + name + '\'); document.getElementById(\'radio_' + id + '\').checked = true; this.alt = \'on\'; this.src=\'./img/common/radio_on.png\'; } ' + onclick + '" />');
	document.write('<label for="' + id + '">' + label + '</label>');
}

function renderCheckbox(id, name, label, isChecked)
{
	document.write('<input type="hidden" name="' + name + '" id="hidden_' + id + '" value=""');
	if (isChecked)
		document.write('on');
	document.write('" />');
	document.write('<img style="margin-right: 5px;" alt="');
	if (isChecked)
		document.write('on" src="./img/common/checkbox_on.png"');
	else
		document.write('off" src="./img/common/checkbox_off.png"');
	document.write(' id="img_' + id + '" onclick="if (this.alt == \'on\') { this.alt = \'off\'; this.src = \'./img/common/checkbox_off.png\'; document.getElementById(\'hidden_' + id + '\').value = \'\'; } else { this.alt = \'on\'; this.src = \'./img/common/checkbox_on.png\'; document.getElementById(\'hidden_' + id + '\').value = \'on\'; }" />');
	document.write('<label>' + label + '</label>');
}










