function ASidebar(container){
	this._container = arguments[0];

	this._init();
}

ASidebar.prototype._init = function(){
	this.setContent("");
}

ASidebar.prototype.setContent = function(content){
	this._container.innerHTML = arguments[0];
}

ASidebar.prototype.getContent = function(){
	return this._container.innerHTML;
}

//Function to highlight a certain item in the list based on a marker id
ASidebar.highlightItem = function(markerId){
	if (document.getElementById("marker" + markerId)){
		var elmt = document.getElementById("marker" + markerId);
        	elmt.style.background = "#ffe97f";
	}
}

//Function to restore the bg color of an item in the sidebar
ASidebar.restoreHighlightedItem = function(markerId){
	if(document.getElementById("marker" + markerId)){
		var elmt = document.getElementById("marker" + markerId);
		elmt.style.background = "#ffffff";
	}
}

ASidebar.prototype.addItem = function(aSidebarItem){
	this._container.innerHTML += aSidebarItem.getContent();
}

ASidebar.prototype.clear = function(){
	this._container.innerHTML = "";
}

ASidebarItem = function (marker){
	this.myHTML = "";
	var mid = marker.id;

	if (marker._type == MARKER_TYPE_CAMPING_BOOKABLE || marker._type == MARKER_TYPE_CAMPING_NONBOOKABLE ||
	    marker._type == MARKER_TYPE_BEDANDBREAKFAST_RESERVABLE || marker._type == MARKER_TYPE_BEDANDBREAKFAST_NONRESERVABLE){
	    this.myHTML +='<div id="marker' + mid  + '">-';
		this.myHTML += '<a href="javascript:void(this);" ';
		this.myHTML += 'onclick="markerManager.showMarkerInfo('+ mid + ');';
		this.myHTML += 'markerManager.restoreMarker(' + mid + ');"';
		if (marker.uniqueId != CURRENT_ITEM_ID) {
			this.myHTML += 'onmouseout="markerManager.restoreMarker(' + mid + ');"';
			this.myHTML += 'onmouseover="markerManager.highlightMarker(' + mid + ');"';
		}
		this.myHTML += '>';
		this.myHTML +=  marker.label  + '</a></div>';

	} else if (marker._type == MARKER_TYPE_COUNTRY){
		this.myHTML += '<div id="marker' + mid + '">-';
		this.myHTML += '<a href="javascript:void(this);" ';
		this.myHTML += 'onmouseout="markerManager.restoreMarker(' + mid + ');"';
		this.myHTML += 'onmouseover="markerManager.highlightMarker(' + mid + ');" ';
		this.myHTML += 'onclick="markerManager.centerMapOnMarker(' + mid + ');'
		this.myHTML += 'markerManager.restoreMarker(' + mid + ');">';
		this.myHTML += marker.label + '</a></div>';		
	}
}

ASidebarItem.prototype.getContent = function(){
	return this.myHTML;
}