//-- create a PostCodes collection class based on the List class
//-- create a PostCode class with appropriate methods

		CPostCodes.prototype = new CList();
		
//=============================================================================     
		function CPostCodes()
//============================================================================= 		
		{
			
			// methods
			this.testMethod = _testMethod;
			function _testMethod(strAlert) {
				alert(strAlert);
				return true;
			}
				
		}
	

//=============================================================================     
		function CPostCode(strPostCode, strClubIDs)
//============================================================================= 		
		{
			var _PostCode = strPostCode;	
			/* accessor mappings */
			this.getPostCode = _get_PostCode;
			this.setPostCode = _set_PostCode;
			/* accessor methods */
			function _get_PostCode() { return _PostCode; }
			function _set_PostCode(val) { _PostCode = val; }

			var _ClubIDs = strClubIDs;			
			/* accessor mappings */
			this.getClubIDs = _get_ClubIDs;
			this.setClubIDs = _set_ClubIDs;
			/* accessor methods */
			function _get_ClubIDs() { return _ClubIDs; }
			function _set_ClubIDs(val) { _ClubIDs = val; }
			
			
			/* methods */
			
			this.getClubByID = _getClubByID;
			function _getClubByID(intID, colClubs) {
				//-- return matching club object
				for (var i = 0; i < colClubs.length(); i++) {
					if (colClubs.item(i).getClubID() == intID) {
						//-- found club
						return colClubs.item(i);
					}
				}
			}
			
			this.buildClubsHTML = _buildClubsHTML;
			function _buildClubsHTML() {
				
				var strHTML = '<table border="0" cellpadding="4" cellspacing="0">'
				
				
				//-- split club ids into array
				var arrClubIDs = this.getClubIDs().split(',');
				
				//-- loop through array
				for (var i = 0; i < arrClubIDs.length; i++) {
					//-- get club object
					var objClub = this.getClubByID(arrClubIDs[i], m_colClubs);
					
					//-- build HTML
					if (objClub.getName().length > 0)  strHTML += this.addTableRow('Club', objClub.getName(), true, objClub.getWebsite());
					if (objClub.getVenue().length > 0)  strHTML += this.addTableRow('Training&nbsp;Venue', objClub.getVenue(), false, '');
					if (objClub.getTrainingDay().length > 0)  strHTML += this.addTableRow('Training&nbsp;Day', objClub.getTrainingDay(), false, '');
					if (objClub.getContact1Name().length > 0)  strHTML += this.addTableRow('Contact', objClub.getContact1Name(), false, '');
					if (objClub.getContact1Email().length > 0)  strHTML += this.addTableRow('E-mail', objClub.getContact1Email(), false, 'mailto:' + objClub.getContact1Email());
					if (objClub.getContact1Phone1().length > 0)  strHTML += this.addTableRow('Phone', objClub.getContact1Phone1(), false, '');
					if (objClub.getContact1Phone2().length > 0)  strHTML += this.addTableRow('or', objClub.getContact1Phone2(), false, '');
					if (objClub.getContact2Name().length > 0)  strHTML += this.addTableRow('Contact', objClub.getContact2Name(), false, '');
					if (objClub.getContact2Email().length > 0)  strHTML += this.addTableRow('E-mail', objClub.getContact2Email(), false, 'mailto:' + objClub.getContact2Email());
					if (objClub.getContact2Phone1().length > 0)  strHTML += this.addTableRow('Phone', objClub.getContact2Phone1(), false, '');
					if (objClub.getContact2Phone2().length > 0)  strHTML += this.addTableRow('or', objClub.getContact2Phone2(), false, '');
					strHTML += this.addTableRow('&nbsp;', '&nbsp;', false, '')
				}
				
				strHTML += '</table>'
				
				return strHTML;
			}
			
			this.addTableRow = _addTableRow;
			function _addTableRow(strName, strValue, blnBold, strLink) {
				
				var strHTML = '';
				
				if (blnBold) {
					if (strLink.length > 0) {
						strHTML += '\n<tr valign="top"><td><b>' + strName + '</b></td><td><b><a href="' + strLink + '" target="_blank">' + strValue + '</a></b></td></tr>'
					} else {
						strHTML += '\n<tr valign="top"><td>' + strName + '</td><td>' + strValue + '</td></tr>'
					}
				} else {
					if (strLink.length > 0) {
						strHTML += '\n<tr valign="top"><td>' + strName + '</td><td><a href="' + strLink + '">' + strValue + '</a></td></tr>'
					} else {
						strHTML += '\n<tr valign="top"><td>' + strName + '</td><td>' + strValue + '</td></tr>'
					}
				}
				
				return strHTML;
			}
		}		