function AccoMarker(name,price,id, title, lat, lng,im,issmallmap,accotitle)
{
this.accotitle = accotitle;
this.price = price;
this.id=id;
this.name = name;
this.title = '<a href="/accommodation/index.html?acco_id='+id+'">'+title+'<\/a>';
this.tabs=[];
this.location = new google.maps.LatLng(lat, lng);
this.letteredIcon = new google.maps.Icon(baseIcon);
this.issmallmap=issmallmap;
if(im)this.letteredIcon.image = im;
else this.letteredIcon.image = "http://www.google.com/mapfiles/markerA.png";
map.addOverlay(this.createMarker());
bounds.extend(this.location);
this.info = document.getElementById(name);
this.infoMax = document.getElementById(name + "-max");
}
AccoMarker.prototype.showInfo = function()
{
if(this.issmallmap){
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 -= 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="";
document.getElementById('infowindowdata').innerHTML=this.title;}
}else{
this.marker.openInfoWindow(this.title);
}
}
AccoMarker.prototype.createMarker = function()
{
var marker = new google.maps.Marker(this.location, { icon:this.letteredIcon, title:this.name+" "+this.accotitle});
var project = this;
GEvent.addListener(marker, 'mouseover', function() { project.accoMouseover(); });
this.marker = marker;
gmarkers.push(marker);
accomarkers.push(this);
return marker;
}
AccoMarker.prototype.accoMouseover = function(){
if(this.marker.overlay==null)
this.marker.overlay = new InfoWindow(this, 87, 45, 'map-info-window', 91, -24);
if(activemarker)
map.removeOverlay(activemarker.marker.overlay);
activemarker=this;
map.addOverlay(this.marker.overlay);
}
function accoMouseout(){
_timeout = setTimeout('clearActive()', 1000);
}
function clearActive(){
if(activemarker)
map.removeOverlay(activemarker.marker.overlay);
}
function reinittimeout(){
clearTimeout(_timeout);
_timeout=false;
}
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];
}
function InfoWindow(marker, divWidth, divHeight, divClassName, anchorOffsetX, anchorOffsetY)
{
this.marker = marker;
this.divHeight = divHeight;
this.divWidth = divWidth;
this.divClassName = divClassName;
this.anchorOffsetX = anchorOffsetX;
if (null == this.anchorOffsetX)
{
this.anchorOffsetX = 0;
}
this.anchorOffsetY = anchorOffsetY;
if (null == this.anchorOffsetY)
{
this.anchorOffsetY = 0;
}
}
InfoWindow.prototype = new GOverlay();
InfoWindow.prototype.initialize = function(map)
{
var div = document.createElement("div");
div.style.position = "absolute";
div.style.height = this.divHeight + 'px';
div.style.width = this.divWidth + 'px';
div.onmouseover = function() {
reinittimeout();
}
div.onmouseout = function() {
accoMouseout();
}
div.className = this.divClassName;
var prspan = document.createElement("span");
prspan.className = this.divClassName+'-price';
prspan.innerHTML = this.marker.price+'&#8364;';
div.innerHTML = this.marker.title+'- ';
div.appendChild(prspan);
div.style.left  = (map.fromLatLngToDivPixel(this.marker.marker.getPoint()).x - this.anchorOffsetX)+ 'px';
div.style.top  = (map.fromLatLngToDivPixel(this.marker.marker.getPoint()).y - this.divHeight - this.anchorOffsetY) + 'px';
map.getPane(G_MAP_FLOAT_PANE).appendChild(div);
this.map_ = map;
this.div_ = div;
}
InfoWindow.prototype.remove = function()
{
this.div_.parentNode.removeChild(this.div_);
}
InfoWindow.prototype.redraw = function(force)
{
this.div_.style.left  = (this.map_.fromLatLngToDivPixel(this.marker.marker.getPoint()).x - this.anchorOffsetX)+ 'px';
this.div_.style.top = (this.map_.fromLatLngToDivPixel(this.marker.marker.getPoint()).y - this.divHeight - this.anchorOffsetY) + 'px';
}
/*6197->4061*/
