dojo.declare("com.mgh.Center",null, {
	constructor : function(id,name,type) {
		this.id = id;
		this.name = name;
		this.type = type;
		this.css = '';		
		this.formatString = '<a href="#" ${css} onclick="dojo.publish(\'centerClicked\',[\'${id}\',\'${name}\',\'${type}\'])">${name}</a>';
		this.deselectFormatString = '<a href="#" class="goBack" id="${id}" onclick="dojo.publish(\'showAllCenters\',[\'\',\'\',\'${type}\']); dojo.publish(\'requestCentersData\',[\'\',\'Centers\',\'\'])">Show all centers / departments</a>';
		this.selectedFormatString = '<p class="title">${name}</p>' + this.deselectFormatString;
		this.preSelectedFormatString = '<p class="selected">${name}</p>';				
	}, 
	
	Format : function(){
		if (this.type.toLowerCase() == 'center'){
			this.css = 'class="center"';
		}
		return dojo.string.substitute(this.formatString,this);		
	},
	
	SelectedFormat : function(){
		return dojo.string.substitute(this.selectedFormatString,this);
	},
	
	PreSelectedFormat : function(){
		return dojo.string.substitute(this.preSelectedFormatString,this);
	}
});