var map={hook:"",pref:"",target:"_blank",lang:["Personen","Zimmer","mehr...","zur�ck","weiter","Auf Karte anzeigen"],list:null,cluster:null,styles:null,groups:{"all":{},"property":{}},gmap:null,tabs:new Array(1),divs:null,isOpen:false,init:function(){
},prev:function(_1){
this.show(_1-1);
},next:function(_2){
this.show(_2+1);
},show:function(_3){
this.tabs[0]=new GInfoWindowTab("",this.divs[_3]);
this.gmap.updateInfoWindow(this.tabs);
},createMarker:function(_4,_5,_6){
var _7=new GMarker(_4,{icon:_5});
this.addMarker(_7,_6);
GEvent.addListener(_7,"mouseover",function(){
map.showMarker(_7,_6);
});
return _7;
},addMarker:function(_8,_9){
if(_9!=null){
var _a=_9.group;
var _b=this.groups[_9.group];
if(_b==null){
_a="all";
}
}else{
_a="property";
}
this.groups[_a].marker.push(_8);
},onOpenInfoWindow:function(){
if(map.isOpen==false){
map.isOpen=true;
map.gmap.updateInfoWindow(map.tabs);
}
},showMarker:function(_c,_d){
var _e=_c.getLatLng();
this.tabs[0]=new GInfoWindowTab("","<div id=\"map-info\"><div class=\"ajaxloader\"><img src=\""+this.pref+"/image/catalog/map_ajaxloader.gif\" alt=\"\" /></div></div>");
this.gmap.openInfoWindowTabsHtml(_e,this.tabs,{onOpenFn:map.onOpenInfoWindow,pixelOffset:new GSize(5,5)});
if(_d==null){
GDownloadUrl(this.hook+"/search/"+"?gps_lo="+_e.lng()+"&gps_la="+_e.lat()+"&template=catalog_map_json",function(_f,_10){
if(_10==200){
_f=eval("("+_f+")");
map.createInfoWindowHtml(_f.items);
}else{
if(_10==-1){
alert("Data request timed out. Please try later.");
}else{
alert("Request resulted in error. Check XML file is retrievable.");
}
}
});
}else{
map.createInfoWindowHtml([_d]);
}
},createInfoWindowHtml:function(_11){
var _12="";
if(this.target=="_blank"){
_12=" target=\"_blank\"";
}
var _13=_11.length;
this.divs=new Array(_13);
for(var i=0;i<_13;i++){
var _14=-1;
var _15=-1;
if(_11.length>1){
_14=i-1;
_15=i+1;
if(i==0){
_14=-1;
}else{
if(_11.length-i==1){
_15=-1;
}
}
}
var s="<div id=\"map-info\"><div class=\"info\">";
s+="<h2>"+_11[i].title+"</h2>";
if(_11[i].image!=null&&_11[i].image.length>0){
var _16="<img src=\""+_11[i].image+"\"";
if(_11[i].width!=null){
_16+="width=\""+_11[i].width+"\" ";
}
if(_11[i].height!=null){
_16+="height=\""+_11[i].height+"\" ";
}
_16+="alt=\""+_11[i].title+"\" />";
if(_11[i].url!=null){
_16="<a href=\""+_11[i].url+"\""+_12+">"+_16+"</a>";
}
s+="<div class=\"image\">"+_16+"</div>";
}
s+="<div class=\"keyfacts\">";
if(_11[i].rooms!=null){
if(_11[i].city.length>0){
s+="<strong>"+_11[i].city+"</strong><br />";
}
s+=_11[i].type+"<br />";
if(_11[i].beds>0){
s+=_11[i].beds+" "+this.lang[0]+"<br />";
}
var _17=parseInt(_11[i].rooms);
if(_17>0){
s+=_17+" "+this.lang[1]+"<br />";
}
}
s+="</div>";
s+="<div class=\"description\">";
s+=_11[i].description;
if(_11[i].url!=null){
s+=" <a href=\""+_11[i].url+"\" "+_12+">"+this.lang[2]+"</a>";
}
s+="</div>";
var _18="";
_18+="<div class=\"prev\">";
if(_14!=-1){
_18+="<a class=\"prev\" href=\"javascript:map.prev("+i+")\">"+this.lang[3]+"</a>";
}else{
_18+="&#160;";
}
_18+="</div>";
_18+="<div class=\"num\">"+(i+1)+" / "+_13+"</div>";
_18+="<div class=\"next\">";
if(_15!=-1){
_18+="<a class=\"next\" href=\"javascript:map.next("+i+")\">"+this.lang[4]+"</a>";
}else{
_18+="&#160;";
}
_18+="</div>";
if(_18.length>0){
s+="<div class=\"navigation\">"+_18+"</div>";
}
s+="</div></div>\n";
this.divs[i]=s;
}
this.show(0);
},createIcon:function(_19){
var _1a=new GIcon(G_DEFAULT_ICON);
_1a.image=this.pref+"/image/catalog/"+_19;
_1a.shadow="";
_1a.iconSize=new GSize(32,37);
return _1a;
},load:function(){
if(GBrowserIsCompatible()){
this.init();
var _1b=new GLatLngBounds();
this.gmap=new GMap2(document.getElementById("map"));
this.gmap.setCenter(new GLatLng(0,0),0);
this.gmap.setUIToDefault();
this.gmap.addControl(new GOverviewMapControl());
var _1c=this.createIcon("map_home.png");
this.groups["property"].marker=new Array();
var _1d=new Array(this.list.length);
for(var i=this.list.length-1;i>=0;i--){
var _1e=new GLatLng(this.list[i][0],this.list[i][1]);
var _1f=this.createMarker(_1e,_1c);
_1d[i]=_1f;
_1b.extend(_1e);
}
this.cluster=new MarkerClusterer(this.gmap,_1d,{maxZoom:17,gridSize:20,styles:this.styles});
this.gmap.setZoom(this.gmap.getBoundsZoomLevel(_1b));
this.gmap.setCenter(_1b.getCenter());
if(this.countObjectKeys(this.groups)>2){
this.createGroupbar();
}
this.createPois();
this.initMarkers();
}
},createGroupbar:function(){
var _20=document.createElement("div");
this.createAttributNode(_20,"id","map-groupbar");
var _21=document.createElement("div");
this.createAttributNode(_21,"class","inner");
var _22=document.createElement("h3");
_22.appendChild(document.createTextNode(this.lang[5]));
var _23=document.createElement("ul");
for(var v in this.groups){
var li=this.createListEntry(v);
_23.appendChild(li);
if(this.groups[v].marker==null){
this.groups[v].marker=new Array();
}
}
_21.appendChild(_22);
_21.appendChild(_23);
_20.appendChild(_21);
var map=document.getElementById("map");
map.appendChild(_20);
},createListEntry:function(_24){
var _25=this.groups[_24];
var img=document.createElement("img");
this.createAttributNode(img,"src",_25.icon).createAttributNode(img,"alt",_25.title).createAttributNode(img,"width",_25.width).createAttributNode(img,"height",_25.height);
var a=document.createElement("a");
var _26="javascript:map.toggleGroup('"+_24+"')";
this.createAttributNode(a,"href",_26).createAttributNode(a,"id",_24);
this.createAttributNode(a,"class",(_25.visible)?"active":"inactive");
a.appendChild(document.createTextNode(_25.title));
var li=document.createElement("li");
li.appendChild(img);
li.appendChild(a);
return li;
},createAttributNode:function(_27,_28,_29){
var _28=document.createAttribute(_28);
_28.nodeValue=_29;
_27.setAttributeNode(_28);
return this;
},toggleGroup:function(_2a){
var _2b=this.groups[_2a];
_2b.visible=!_2b.visible;
this.updateGroupVisibility(_2a);
if(_2a=="all"){
this.toggleAll(_2b.visible);
}else{
if(_2a=="property"){
if(_2b.visible==true){
this.cluster.addMarkers(this.groups.property.marker);
}else{
this.cluster.clearMarkers();
}
}
}
},toggleAll:function(_2c){
for(var g in this.groups){
if(this.groups[g].visible!=_2c){
this.toggleGroup(g);
}
}
},updateGroupVisibility:function(_2d){
var _2e=this.groups[_2d];
for(var m in _2e.marker){
var _2f=_2e.marker[m];
if(_2e.visible){
_2f.show();
}else{
_2f.hide();
}
}
this.createAttributNode(document.getElementById(_2d),"class",_2e.visible?"active":"inactive");
},createPois:function(){
if(typeof pois!="undefined"){
for(var i=pois.items.length-1;i>=0;i--){
var _30=this.createIcon(pois.items[i].icon);
var _31=this.createMarker(new GLatLng(pois.items[i].gps_la,pois.items[i].gps_lo),_30,pois.items[i]);
this.gmap.addOverlay(_31);
}
}
},initMarkers:function(){
for(var g in this.groups){
if(this.groups[g].visible!="all"&&this.groups[g].visible==false){
this.updateGroupVisibility(g);
}
}
},countObjectKeys:function(obj){
var _32=0;
for(var _33 in obj){
_32++;
}
return _32;
},unload:function(){
GUnload();
}};


