HJ.PeopleSelectorDialog = Class.create();

HJ.PeopleSelectorDialog.prototype = Object.extend(new Af.HtmlDialog(), {

   initialize: function(title, handler, content) {
	    this._initializeDialog(title, handler, content);
	    this.myPeopleDataTable = null;
	    this.selectedPeopleList = new Array();
	    this.groupTable = null;
	    this.peopleTable = null;
	    
   },
   
   setDataList: function(myGroups, selectedPeople){
	   this.myPeopleDataTable = new Af.DataTable(myPeople);
	   this.selectedGroupList = selectedGroups;
	   this.selectedPeopleList = selectedPeople;

	   if(this.myPeopleDataList != null && this.myPeopleDataList.length > 0){
			this.myPeopleDataList.sort(sortByLastName);
	   }
	   
   },
   
   updateView: function() {
	   
   },

   templateLoaded: function() {
	   this.peopleTable = new Af.HtmlTable("peopleListTable", ",fName");
	   this.updateView();
     
   }
});

var pSelector = null;
function getPoepleSelector() {
    if (pSelector == null) {		
		pSelector = new HJ.PeopleSelectorDialog("Select a Person", this, null);			
		pSelector.width = "100px";
	}
	pSelector.showHTMLTemplate(basePageURL + "PeopleSelector.htm", "content", "peopleListBox");
	pSelector.centerDialog(400, 300);
	return pSelector;

}
