function kickMember( steamId, memberName )
{
	bAnswer = confirm( 'You are about to kick ' + memberName + ' from the group.\n\nAre you sure?' );
	if ( bAnswer )
	{
		kickURL = processURL + '?action=kick&memberId=' + steamId;
		location.href = kickURL;
	}
}

function toggleRank( steamId, memberName )
{
	rankIcon = document.getElementById( 'rankIcon_' + steamId );
	if ( !rankIcon )
	{
		return;
	}
	if ( rankIcon.src.indexOf( 'rankIconMember' ) != -1 )
	{
		pText = 'promote ' + memberName + ' to an Officer.';
	}
	else
	{
		pText = 'demote ' + memberName + ' to a Member.';
	}
	bAnswer = confirm( 'You are about to ' + pText + '\n\nAre you sure?' );
	if ( bAnswer )
	{
		toggleURL = processURL + '?action=toggleRank&memberId=' + steamId;
		createQuery( toggleURL, receiveRankToggle );
	}
}

function receiveRankToggle()
{
	if ( req.readyState == 4 )
	{
		if ( req.status == 200 )
		{
			response = req.responseXML.documentElement;
			updateInProgress = false;
			results = response.getElementsByTagName('results')[0].firstChild.nodeValue;
			if(results == "OK")
			{
				steamId = response.getElementsByTagName('steamId')[0].firstChild.nodeValue;
				rankIcon = document.getElementById( 'rankIcon_' + steamId );
				if ( !rankIcon )
				{
					// shouldn't be possible to have queried a steamId we dont have a rankicon for, so this should never be hit
					return;
				}
				newRank = response.getElementsByTagName('newRank')[0].firstChild.nodeValue;
				if ( newRank == 'Officer' )
				{
					rankIcon.src = rankIcon.src.replace(/rankIconMember/, 'rankIconOfficer' );
				}
				else
				{
					rankIcon.src = rankIcon.src.replace(/rankIconOfficer/, 'rankIconMember' );
				}
			}
			else
			{
				alert( 'There was an error promoting/demoting that player. \n' + results + '\nPlease address the error and try again.' );
			}
		}
	}
}

function clearSearchInput()
{
	tbox = document.getElementById( 'searchKey' );
	if ( tbox.value == strSearchPrompt )
	{
		tbox.value = '';
	}
}

function restoreSearchInput()
{
	tbox = document.getElementById( 'searchKey' );
	if ( tbox.value == '' )
	{
		tbox.value = strSearchPrompt;
	}
}

function validateSearchSubmit()
{
	tbox = document.getElementById( 'searchKey' );
	if ( tbox.value == strSearchPrompt || tbox.value == '' )
	{
		return false;
	}
	document.getElementById( 'searchEditForm' ).submit();
}
