function LSNewMemberList( dataSource, parent, divid, width, height )
{
	var self = this;

	this.width = ( width == null ) ? 50 : width;
	this.height = ( height == null ) ? 50 : height;
	this.divid = divid;
	this.dataSource = dataSource;
	this.dataSource.callback = function( data ) { self.setRecord( data.items ); }
	this.parent = parent;
	if ( parent )
		this.place( parent );
}

LSNewMemberList.prototype = new LSUIElement();

LSNewMemberList.prototype.getDataSource = function()
{
	return this.dataSource;
}

LSNewMemberList.prototype.buildJavascript = function()
{
	var html = "";
	html += "new LSNewMemberList( ";
	html += this.dataSource.buildJavascript();
	html += ", "+(( this.parent != null ) ? "document.getElementById( '"+this.parent.id+"' ) " : "null" );
	html += ", "+(( this.divid != null ) ? "'"+this.divid+"'" : "null" );
	html += " )";
	return html;
}

LSNewMemberList.prototype.getHTMLContainerID = function()
{
	return this.parent.id;
}

LSNewMemberList.prototype.setRecord = function( data )
{
	this.loading.hide();
	
	var tblGrid = document.createElement( 'table' );
	this.container.appendChild(tblGrid);
	tblGrid.width = '100%';
	tblGrid.cellpadding = '5';
	tblGrid.cellspacing = '0';
	
	var tblGridBdy = document.createElement( 'tbody' );
	tblGrid.appendChild(tblGridBdy);
	var currentRow;

	currentRow = document.createElement( 'tr' );
	tblGridBdy.appendChild(currentRow);
	
	for( var i in data )
	{
		var currentCell = document.createElement( 'td' );
		currentRow.appendChild(currentCell);
		
		var elDiv = document.createElement( 'div' );
		currentCell.appendChild(elDiv);
		elDiv.className = 'imagelist-item';
		elDiv.style.textAlign = 'center';

		var titleLink = document.createElement('a');
		titleLink.href = data[ i ].link;
		titleLink.className = 'ls-table-element-link';
		titleLink.appendChild( document.createTextNode( data[ i ].title ) );
		elDiv.appendChild( titleLink );
		elDiv.appendChild(document.createElement('br'));
		
		var elAnchor = document.createElement( 'a' );
		elAnchor.href = data[ i ].link;
		elDiv.appendChild( elAnchor );

		var elImage = document.createElement( 'img' );
		elImage.src = LSResizeImage( data[ i ].MediaUrl, this.width, this.height );
		elImage.border = '0';
		elImage.className = 'imagelist-image';
		elImage.galleryImg = false;
		elImage.style.margin = '5px';
		elAnchor.appendChild( elImage );

		// If this is an odd row, then close and create a new row
		if ((i % 2 != 0) && (i != 0))
		{
			currentRow = document.createElement( 'tr' );
			tblGridBdy.appendChild(currentRow);
		}
	}
}

LSNewMemberList.prototype.place = function( parent )
{
	if ( parent == null )
		parent = document.body;
	else
		parent.innerHTML = '';
	this.parent = parent;

	this.loading = new LSLoadingGraphic();
	this.loading.place( parent );

	this.container = document.createElement( 'div' );
	if ( this.styleName != null )
	this.container.className = 'imagelist-container';
	if ( this.divid != null )
		this.container.id = this.divid;
	
	parent.appendChild( this.container );

	this.dataSource.start();
}