/*
 * Created on October 15, 2009
 *
 * Default Google Map marker.
 * 
 * @copyright 2009 Capraro Technologies, Inc.
 * @author Dan Klockowski
 *
 */
function BusinessMarker(attributes) {
	this.latitude = attributes.getNamedItem("jsxlocationlatitude").value;
	this.longitude = attributes.getNamedItem("jsxlocationlongitude").value;
	
	this.id = attributes.getNamedItem("jsxbusinessid").value;
	this.title = attributes.getNamedItem("jsxbusinessname").value;
	this.image = "/map/images/google_pushpin.png";
	
	var lDesc = attributes.getNamedItem("jsxlocationname").value;
	var lMarker = attributes.getNamedItem("jsxlocationmarker").value;
	
	if(lMarker){
		this.image = lMarker;
	}
	
	if(lDesc){
		this.title += " - "+lDesc;
	} 
}	

/*
 * Initializes the overlay
 *
 * @param point    latitude/longitude of overlay
 * @param ct_info  see above
 *
 */
BusinessMarker.prototype.addMarker = function() {
	var myLatlng = new google.maps.LatLng(this.latitude, this.longitude);
	
    this.marker = new google.maps.Marker({
        position: myLatlng, 
        map: map,
        title: this.title,
        icon: this.image
    });
    
    var bID = this.id;
	google.maps.event.addListener(this.marker, 'click', function() {
		openBusinessInformation(bID);
    });
}

/*
 * Clears the overlay
 *
 * @param point    latitude/longitude of overlay
 * @param ct_info  see above
 *
 */
BusinessMarker.prototype.remove = function() {
	this.marker.setMap(null);
}
