// this function is called when the grid on the Events page is clicked
// 'updated column names in tblCalendar, updating grid columns to match  PBB 03/07/08
function uwgEventsClicked(gridID, cellID)
{
	// declare and set a row object to the row selected from the grid
	var row = igtbl_getActiveRow('uwgEvents');

	// load the labels on the page using the values from the grid
	document.all.lblEvent.innerText = row.getCellFromKey('EventName').getValue();
	// if the end time WAS set...
	if (row.getCellFromKey('EndTime').getValue() != "12:00 AM")
	{
        // set the date/time label WITH the end time
		document.all.lblDateTime.innerText = row.getCellFromKey('StartDateTime').getValue() + ' - ' +  row.getCellFromKey('EndDateTime').getValue();
	}
	// if the end time was NOT set...
	else
	{
        // set the date/time label WITHOUT the end time
		document.all.lblDateTime.innerText = row.getCellFromKey('StartDateTime').getValue() + ' - ' +  row.getCellFromKey('EndDate').getValue();
	}
	// if the description is NOT null...
	if (row.getCellFromKey('Description').getValue() != null) 
	{
		// load the description field
		document.all.lblDescription.innerText = row.getCellFromKey('Description').getValue();
	}
	// if the description IS null...
	else
	{
		// clear the description field
		document.all.lblDescription.innerText = "";
	}
	// if the event link is NOT null...
	if (row.getCellFromKey('WebEventLink').getValue() != null) 
	{
		// load the hidden event link textbox, and the text of the hyperlink
		document.all.txtWebLink.value = 'http://' + row.getCellFromKey('WebEventLink').getValue();
		document.all.hlWebLink.innerText = 'http://' + row.getCellFromKey('WebEventLink').getValue();
	}
	// if the event link IS null...
	else
	{
		// clear the hidden event link textbox, and the text of the hyperlink
		document.all.txtWebLink.innerText = "";
		document.all.hlWebLink.innerText = "";
	}
	document.all.lblLocation.innerText = row.getCellFromKey('LocationAddress').getValue();
	// if the map link is NOT null...
	if (row.getCellFromKey('WebMapLink').getValue() != null) 
	{
		// load the hidden map link textbox, and the text of the hyperlink
		document.all.txtMap.value = 'http://' + row.getCellFromKey('WebMapLink').getValue();
		document.all.hlMapLink.innerText = 'http://' + row.getCellFromKey('WebMapLink').getValue();
	}
	// if the map link IS null...
	else
	{
		// clear the hidden map link textbox, and the text of the hyperlink
		document.all.txtMap.innerText = "";
		document.all.hlMapLink.innerText = "";
	}
	document.all.lblOpenTo.innerText = row.getCellFromKey('TournamentOpenTo').getValue();
	document.all.lblFormats.innerText = row.getCellFromKey('Formats').getValue();
	// if the players/teams is NOT null...
	if (row.getCellFromKey('NumberOfPlayersTeams').getValue() != null) 
	{
		// load the players/teams field
		document.all.lblPlayersTeams.innerText = row.getCellFromKey('NumberOfPlayersTeams').getValue();
	}
	// if the players/teams IS null...
	else
	{
		// clear the players/teams field
		document.all.lblPlayersTeams.innerText = "";
	}
	document.all.lblFees.innerText = row.getCellFromKey('Fees').getValue();
	// if the sign up cut off date HAS been set...
	if (row.getCellFromKey('SignUpCutOffDate').getValue() != '01/01/1900')
	{
		// load the sign up cut off date
		document.all.lblSignUpCutOff.innerText = row.getCellFromKey('SignUpCutOffDate').getValue();
	}
	// if the sign up cut off date has NOT been set...
	else
	{
		// clear the sign up cut off date
		document.all.lblSignUpCutOff.innerText = "";
	}
	document.all.lblHostedBy.innerText = row.getCellFromKey('HostName').getValue();
	// if the phone is NOT null...
	if (row.getCellFromKey('HostPhone').getValue() != null) 
	{
		// load the phone field
		document.all.lblPhone.innerText = row.getCellFromKey('HostPhone').getValue();
	}
	// if the phone IS null...
	else
	{
		// clear the phone field
		document.all.lblPhone.innerText = "";
	}
	// if the fax is NOT null...
	if (row.getCellFromKey('HostFax').getValue() != null) 
	{
		// load the fax field
		document.all.lblFax.innerText = row.getCellFromKey('HostFax').getValue();
	}
	// if the fax IS null...
	else
	{
		// clear the fax field
		document.all.lblFax.innerText = "";
	}
	// if the email is NOT null...
	if (row.getCellFromKey('HostEmail').getValue() != null) 
	{
		// load the email field
		document.all.lblEmail.innerText = row.getCellFromKey('HostEmail').getValue();
	}
	// if the email IS null...
	else
	{
		// clear the email field
		document.all.lblEmail.innerText = "";
	}
	// if the additional information is NOT null...
	if (row.getCellFromKey('AdditionalInformation').getValue() != null) 
	{
		// load the additional information field
		document.all.lblAdditionalInfo.innerText = row.getCellFromKey('AdditionalInformation').getValue();
	}
	// if the additional information IS null...
	else
	{
		// clear the additional information field
		document.all.lblAdditionalInfo.innerText = "";
	}
}

