/**
 * @author Ed Slocombe
 */

function Practice (id, name, address, town, county, description, lat, lng) {
	this.id = id;
	this.name = name;
	this.address = address;
	this.town = town;
	this.county = county;
	this.description = description;
	this.lat = lat;
	this.lng = lng;
	
	this.toString = function() {
		return this.name+", "+this.town;
	}
	
	this.toHTML = function() {
	
		var fullAddress = "";
		if (this.address) fullAddress += this.address+", ";
		if (this.town) fullAddress += this.town+", ";
		if (this.county) fullAddress += this.county+", ";
		fullAddress = fullAddress.substring(0, fullAddress.length-2);
		
		var html = "<div class=\"gm_title\">"+this.name+"</div>\n" +
				   "<div class=\"gm_address\">"+fullAddress+"</div>\n";
		if (this.description) html += "<div class=\"gm_description\">"+this.description+"</div>";
		html += "<!--div class=\"gm_btn\"><span class=\"button\">Full details</span></div-->";
		return html;
		
	}
	
}

