function showHideSections()
{
	var sale = getState('sale');
	var hire = getState('hire');
	var modification = getState('modification');
	
	var showContainerAttribute = sale || hire;
	showHide('containerAttributes', showContainerAttribute);
	showHide('modificationBlock', modification);
}

function getState(field)
{
	var state = false;
	var checkbox = document.getElementById(field);
	if(field != null)
	{
		state = checkbox.checked; 
	} 
	return state;
}

function showHide(id, show)
{
	var element = document.getElementById(id);
	if(show)
	{
		element.style.display = 'block';
		hideBlock(element, false);
	}  
	else
	{
		element.style.display = 'none';
		hideBlock(element, true);
	}
}

function hideBlock(element, hide)
{
		var children = element.getElementsByTagName('input');
		for(i = 0; i < children.length; i++)
		{
			var child = children[i];
			if(child.getAttribute("type").toLowerCase() == "checkbox")
			{
				child.disabled = hide;
				if(hide)
				{
					child.checked = false;
				}
			}
		}
}

showHideSections();
