//*******************************************************
// Victoria Headache Clinic Form Generator
//*******************************************************

function toggleLayers(grpName, required, showElement)
{
	var radioGrp = document.getElementsByName(grpName);
	for (var i = 0; i < radioGrp.length; i++) {
		if (radioGrp[i].checked) {
			if (radioGrp[i].value == required) {
				if (document.getElementById) {
					// this is the way the standards work
					var style2 = document.getElementById(showElement).style;
					style2.display = "block";
				} else if (document.all) {
					// this is the way old msie versions work
					var style2 = document.all[showElement].style;
					style2.display = "block";
				} else if (document.layers)	{
					// this is the way nn4 works
					var style2 = document.layers[showElement].style;
					style2.display = "block";
				}
			} else {
				if (document.getElementById) {
					// this is the way the standards work
					var style2 = document.getElementById(showElement).style;
					style2.display = "none";
				} else if (document.all) {
					// this is the way old msie versions work
					var style2 = document.all[showElement].style;
					style2.display = "none";
				} else if (document.layers)	{
					// this is the way nn4 works
					var style2 = document.layers[showElement].style;
					style2.display = "none";
				}
			}
		}
	} 
}

function populateYearSelect(objName)
{
	var myDate = new Date();
	var startYear = myDate.getFullYear();
	var endYear = startYear - 80;
	var myObj = document.getElementById(objName);
	for (var i = startYear; i >= endYear; i--) {
		var optObj = document.createElement('option');
		optObj.text = i;
		optObj.value = i;
		try {
			myObj.add(optObj, null); // standards compliant; doesn't work in IE
		}
		catch(ex) {
			myObj.add(optObj); // IE only
		}
	}
}