﻿// JScript File
// Gets an input field whose name ends in [baseID].
function GetInputControl(baseID)
{
	return GetControlByID("input", baseID);
}

// Gets a field whose name ends in [baseID].
// i.e. This function brings back a control by ID, regardless of
//      nesting level of the control (within user controls).
function GetControlByID(tagType, baseID)
{
	var fields = document.getElementsByTagName(tagType);
	
	for (var i = 0; i < fields.length; i++)
	{
		var tag = fields[i];
		var id = tag.id;
		if (id.substr(id.lastIndexOf("_") + 1) == baseID)
		{
			return tag;
		}
	}
	
	return null;
}


function renderMemberType(obj)
{
    if (obj.selectedIndex == 1)
    {
        GetControlByID("div","divOrg").style.display = "block";
        GetControlByID("div","divMem").style.display = "none";        
    }
    else
    {
        GetControlByID("div","divOrg").style.display = "none";
        GetControlByID("div","divMem").style.display = "block";   
    }
}

function renderLocationType(obj)
{
    if (obj.selectedIndex == 0)
    {
        GetControlByID("div","divUK").style.display = "block";
        GetControlByID("div","divInt").style.display = "none";   
    }
    else
    {
        GetControlByID("div","divUK").style.display = "none";
        GetControlByID("div","divInt").style.display = "block";   
    }
}