dojo.declare("com.mgh.Location",null, {
	constructor : function(id,name) {
		this.id = id;
		this.name = name;
		this.type = 'Location';
		this.selectEvent = 'locationClicked';
		this.deselectEvent = 'showAllLocations';
		this.centerDataEvent = 'requestCentersData';
		
		this.formatString = '<a href="#" ${css} id="${id}" onclick="dojo.publish(\'${selectEvent}\',[\'${id}\',\'${name}\',\'${type}\'])">${name}</a>';			
		//show all locations for a selected center
		this.showCenterLocationsString = '<a href="#" class="goBack" id="${id}" onclick="dojo.publish(\'${deselectEvent}\',[\'${id}\',\'${name}\',\'${type}\'])">Show all locations</a>';
		
		//show all locations
		this.showAllLocations = '<a href="#" class="goBack" id="${id}" onclick="dojo.publish(\'${deselectEvent}\',[\'\',\'\',\'${type}\'])">Show all locations</a>';
		this.selectedFormatString = '<p class="title">${name}</p>';				
		this.css = '';
	},
			
	Format : function(){
		//Make boston bold
		if (this.name.toLowerCase() == 'boston'){			
			this.css = 'class="boston"';			
		}
		return dojo.string.substitute(this.formatString,this);		
	},
	
	SelectedFormat : function(){	
		return dojo.string.substitute(this.selectedFormatString + this.showAllLocations,this);
	},
	
	SelectedCenterFormat : function(){		
		return dojo.string.substitute(this.selectedFormatString + this.showCenterLocationsString,this);
	}		
});
