addLoadEvent(setupMap);
addLoadEvent(connectRadio);

function setupMap()
{
	var map, product, sel, checked;
	map = $('usamap');
	
	checked = false;
	for (i = 0; i < $('frmSpec').productR.length; i++)		//handle initialization conditions
	{
		if ($('frmSpec').productR[i].checked)
		{
			sel = $('frmSpec').productR[i];
			checked = true;
			break;
		}
	}

	for (i = 0; i < map.childNodes.length; i++)
	{
		if (!checked)
		{
			setNodeAttribute(map.childNodes[i], 'href', 'javascript: noState()');
		}else{
			product = sel.value;
			setNodeAttribute(map.childNodes[i], 'href', base_url + 'assets/snippets/locator/spec/specdoc.php?stateAbbr=' + getNodeAttribute(map.childNodes[i], 'alt') + '&product=' + product);
		}
	}
}

function connectRadio()
{
	for (i = 0; i < $('frmSpec').productR.length; i++)
	{
		connect($('frmSpec').productR[i], 'onclick', setupMap);
	}
}

function noState()
{
}
