function AccoMarker(name, title, lat, lng,im,issmallmap)
{
	this.name = name;
	this.title = title;
	this.tabs=[];
	this.location = new google.maps.LatLng(lat, lng);
	this.letteredIcon = new google.maps.Icon(baseIcon);
	this.issmallmap=issmallmap;
	if(issmallmap) im=im+'&zoom=0.7'
    if(im)this.letteredIcon.image = im;
	else this.letteredIcon.image = "http://www.google.com/mapfiles/markerA.png";
    
    /* THE TAB FUNCTION*/ 
    for (var i=0;i<accomarkers.length;i++) {
        var pt = accomarkers[i];
        if(pt.location && pt.location.lat()==lat && pt.location.lng()==lng){
            if(pt.tabs.length==0)
                pt.tabs.push(new GInfoWindowTab(pt.tabs.length+1, pt.title));
            pt.tabs.push(new GInfoWindowTab(pt.tabs.length+1, this.title))
            return;
        }
    } 
	map.addOverlay(this.createMarker());
	bounds.extend(this.location);
	//map.addOverlay(this.createLabel());
	
	this.info = document.getElementById(name);
	this.infoMax = document.getElementById(name + "-max");
}

AccoMarker.prototype.showInfo = function()
{
	//this.infoMax.insertBefore(bmapElement, this.infoMax.firstChild);
	//bmapCenter = this.location;
	//infoOptions = { 
		//maxTitle:"<p><b>" + this.title + "</b></p>",
		//maxWidth:400 };
    if(this.issmallmap){
        // show info window outside the map
        var infowindow = document.getElementById('infowindow');
        if(infowindow){
            var pos = map.fromLatLngToDivPixel(this.marker.getPoint());
            pos.x += map.getContainer().offsetLeft;
            pos.y += map.getContainer().offsetTop;
            pos.y -= parseInt(infowindow.style.height);
            pos.y -= 10;
            //pos.y -= this.marker.getIcon().iconSize.height;
            if(pos.y<0)
            	pos.y=0;
            infowindow.style.left = pos.x + 'px';
            infowindow.style.top = pos.y + 'px';
            infowindow.style.display="";
            
            //var pos = findPos(document.getElementById('map'));
            //infowindow.style.left = pos[0]+10+'px';
            //var posy=pos[1];
            //if(pos[1]>100) posy=pos[1]-100;
            //infowindow.style.top = posy+'px';
            document.getElementById('infowindowdata').innerHTML=this.title;}
            
    }else{
        if(this.tabs.length>0) /*THE TAB FUNCTION*/
            this.marker.openInfoWindowTabs(this.tabs);
        else 
            this.marker.openInfoWindow(this.title);
    }
	//this.marker.openInfoWindow(this.info, infoOptions);
	//var center = map.getCenter(); var span = map.getBounds().toSpan(); var zoom = map.getZoom(); var url = "http://maps.google.com/maps?ll=" + center.lat() + "," + center.lng() + "&spn=" + shorten(span.lat()) + "," + shorten(span.lng()) + "&z=" + zoom + "&key=" + APIkey; document.location
}

AccoMarker.prototype.createMarker = function()
{
	var marker = new google.maps.Marker(this.location, { icon:this.letteredIcon, title:this.name+" Accommodation(s)"});
	var project = this;

	if(parseInt(this.name)>1)
	    //google.maps.Event.addListener(marker, "dblclick", function() {map.zoomIn()});
	    google.maps.Event.addListener( marker, "click", function() {
              //if ( map.getZoom() > 1 )
                map.setCenter( marker.getPoint(), map.getZoom() + 1 );
              //else if ( map.getZoom() == 1 )
                //map.setCenter( p, 0 );
            });
	else
	    google.maps.Event.addListener(marker, "click",
		    function() { project.showInfo(); }
	    );

	this.marker = marker;
	gmarkers.push(marker);
	accomarkers.push(this);
	return marker;
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
    return [curleft,curtop];
}