var map;
var geocoder=null;
var markerList=new Array();
var markerListOld=new Array();
function createURL(_1,_2){
var _3;
var _4=map.getBounds();
var _5=_4.getSouthWest();
var _6=_4.getNorthEast();
if(map.getZoom()==0||map.getZoom()==1){
_5=new GLatLng(-90,-180);
_6=new GLatLng(90,180);
}
filtersuburl="";
filter=getCookie("filter");
if(filter!=null){
filtersuburl="&filter="+filter;
}
wasthere_wannago_suburl="";
wasthere=getCookie("wasthere");
wannago=getCookie("wannago");
if(wasthere==1){
wasthere_wannago_suburl="&wasthere=1";
}
if(wannago==1){
wasthere_wannago_suburl=wasthere_wannago_suburl+"&wannago=1";
}
if(_1=="coord"){
_3="/mapsapi?op=spotlist-xml&northeastLng="+_6.lng()+"&northeastLat="+_6.lat()+"&southwestLng="+_5.lng()+"&southwestLat="+_5.lat()+"&page="+_2+filtersuburl+wasthere_wannago_suburl;
}else{
if(_1=="content"){
_3="/mapsapi?op=spotlist-html&northeastLng="+_6.lng()+"&northeastLat="+_6.lat()+"&southwestLng="+_5.lng()+"&southwestLat="+_5.lat()+"&page="+_2+filtersuburl+wasthere_wannago_suburl;
}else{
if(_1=="tomtom"||_1=="kml"){
_3="/de/poi/type/"+_1+"/?e="+_6.lng()+"&n="+_6.lat()+"&w="+_5.lng()+"&s="+_5.lat()+wasthere_wannago_suburl;
}
}
}
return _3;
};
var baseIcon=new GIcon();
baseIcon.shadow="/img/marker-shadow.png";
baseIcon.iconSize=new GSize(32,32);
baseIcon.shadowSize=new GSize(49,32);
baseIcon.iconAnchor=new GPoint(7,29);
baseIcon.infoWindowAnchor=new GPoint(15,0);
baseIcon.infoShadowAnchor=new GPoint(0,31);
function getMarkerUrl(_7){
url="/img/marker"+(_7+1)+".png";
return url;
};
function createMarker(_8,_9,_a){
var _b=new GIcon(baseIcon);
_b.image=getMarkerUrl(_a);
markerOptions={icon:_b};
var _c=new GMarker(_8,markerOptions);
GEvent.addListener(_c,"mouseover",function(){
showPopup(_9);
});
GEvent.addListener(_c,"mouseout",function(){
showPopup(false);
});
return _c;
};
function findExistingMarker(_d){
ret=-1;
for(var i=0;i<markerListOld.length;i++){
if(markerListOld[i]!=null&&_d.lat()==markerListOld[i].getLatLng().lat()&&_d.lng()==markerListOld[i].getLatLng().lng()){
ret=i;
i=100;
}
}
return ret;
};
function loadSpotsCoord(_f,_10){
var xml=GXml.parse(_f);
var _12=xml.documentElement.getAttribute("counter");
var _13=(_10*10-9);
var _14=(_10*10);
if(_12<_14){
_14=_12;
}
var _15=_10-1;
var _16=(_10*1)+1;
if(_15<1){
_15=1;
}
var _17="<a class=\"portalnav\" href=\"javascript:update("+_15+", 0)\">« Zurück</a>";
var _18="<a class=\"portalnav\" href=\"javascript:update("+_16+", 0)\">Vor »</a>";
if(_10==1){
_17="<span style=\"color:#cccccc\">« Zurück</span>";
}
if((_10*10)>=_12){
_18="<span style=\"color:#cccccc\">Vor »</span>";
}
var _19;
if(_12!=0){
_19="Spots <span class=\"spotcounter\">"+_13+"-"+_14+"</span> von <span class=\"spotcounter\">"+_12+"</span> im Kartenausschnitt";
}else{
_19="Keine Spots vorhanden!";
}
document.getElementById("spotcount").innerHTML="<table width=\"560px\"><tr><td align=\"left\" width=\"420px\" style=\"color:#4e4e4e;\">"+_19+"</td><td class=\"pagenav\">"+_17+"</td><td class=\"pagenav\">"+_18+"</td></tr></table>";
document.getElementById("exportcounter").innerHTML=_12;
var _1a=xml.documentElement.getElementsByTagName("marker");
markerListOld.length=0;
for(var i=0;i<markerList.length;i++){
markerListOld[i]=markerList[i];
}
markerList.length=0;
for(var i=0;i<_1a.length;i++){
var _1c=new GLatLng(parseFloat(_1a[i].getAttribute("lat")),parseFloat(_1a[i].getAttribute("lng")));
pos=findExistingMarker(_1c);
if(pos==-1){
var _1d=_1a[i].getAttribute("name");
var _1e=createMarker(_1c,_1d,i);
map.addOverlay(_1e);
markerList[i]=_1e;
}else{
markerList[i]=markerListOld[pos];
markerListOld[pos]=null;
markerList[i].setImage(getMarkerUrl(i));
}
}
for(var i=0;i<markerListOld.length;i++){
if(markerListOld[i]!=null){
map.removeOverlay(markerListOld[i]);
}
}
};
function loadSpotsList(_1f){
showLoadIndicator(false);
if(getCookie("donotupdate")==0&&document.getElementById("spotlist").innerHTML!=_1f){
document.getElementById("spotlist").innerHTML=_1f;
document.getElementById("pagetitle").innerHTML="<h1 class=\"title\">Finde Spots ...</h1>";
document.getElementById("tomtom-link").href=createURL("tomtom",0);
document.getElementById("kml-link").href=createURL("kml",0);
}
saveInCookie("donotupdate",0);
};
function searchSpot(){
filter=document.getElementById("spotsearch").value;
if(filter=="Suchbegriff"){
filter="";
}
if(env_loggedin==true){
resetWasThereWannoGo();
}
saveFilterInCookie(filter);
document.getElementById("spotsearch").value="";
map.setCenter(new GLatLng(31.353636941500987,-2.8125),1);
};
function resetWasThereWannoGo(){
saveWasThereInCookie(0);
saveWannaGoInCookie(0);
document.getElementById("wt").className=="spotvisit-none";
document.getElementById("wg").className=="spotvisit-none";
document.getElementById("wta").style.color="#A9A9A9";
document.getElementById("wga").style.color="#A9A9A9";
};
function searchSpotReset(){
document.getElementById("spotsearch").value="";
saveFilterInCookie("");
update(1,0);
};
function showWasThereSpots(){
saveFilterInCookie("");
document.getElementById("spotsearch").value="";
if(document.getElementById("wt").className=="spotvisit-none"){
saveWasThereInCookie(1);
document.getElementById("wt").className="spotvisit-wasthere";
document.getElementById("wta").style.color="#FFFFFF";
}else{
saveWasThereInCookie(0);
document.getElementById("wt").className="spotvisit-none";
document.getElementById("wta").style.color="#A9A9A9";
}
map.setZoom(1);
};
function showWannaGoSpots(){
saveFilterInCookie("");
document.getElementById("spotsearch").value="";
if(document.getElementById("wg").className=="spotvisit-none"){
saveWannaGoInCookie(1);
document.getElementById("wg").className="spotvisit-wannago";
document.getElementById("wga").style.color="#FFFFFF";
}else{
saveWannaGoInCookie(0);
document.getElementById("wg").className="spotvisit-none";
document.getElementById("wga").style.color="#A9A9A9";
}
map.setZoom(1);
};
function loadMapFromCookie(){
var _20=getCookie("mapLat");
var _21=getCookie("mapLng");
var _22=getCookie("mapZoom");
var _23=getCookie("mapType");
if(_20!=null&&_21!=null&&_22!=null&&_23!=null){
document.getElementById("lat").value=_20;
document.getElementById("lon").value=_21;
document.getElementById("mapzoom").value=_22;
document.getElementById("maptype").value=_23;
}
};
function readMapAndSaveInCookie(_24){
var _25=map.getCenter();
var _26;
if(map.getCurrentMapType()==G_NORMAL_MAP){
_26="G_NORMAL_MAP";
}else{
if(map.getCurrentMapType()==G_SATELLITE_MAP){
_26="G_SATELLITE_MAP";
}else{
if(map.getCurrentMapType()==G_HYBRID_MAP){
_26="G_HYBRID_MAP";
}
}
}
saveMapInCookie(_25.lat(),_25.lng(),map.getZoom(),_26,_24);
};
function saveMapInCookie(lat,lng,_29,_2a,_2b){
saveInCookie("mapLat",lat);
saveInCookie("mapLng",lng);
saveInCookie("mapZoom",_29);
saveInCookie("mapType",_2a);
saveInCookie("pageNo",_2b);
};
function saveInCookie(_2c,_2d){
var ts=new Date();
ts=new Date(ts.getTime()+1000*60*60*2);
document.cookie=_2c+"="+_2d+"; path=/";
};
function saveFilterInCookie(_2f){
saveInCookie("filter",_2f);
};
function saveWasThereInCookie(_30){
saveInCookie("wasthere",_30);
};
function saveWannaGoInCookie(_31){
saveInCookie("wannago",_31);
};
function saveCookiesActivated(_32){
saveInCookie("cookiesactivated",_32);
};
function showLoadIndicator(_33){
if(_33==true){
document.getElementById("loadindi").style.display="";
}else{
document.getElementById("loadindi").style.display="none";
}
};
function showPopup(_34){
if(_34==false){
document.getElementById("popup").style.display="none";
}else{
document.getElementById("popup").innerHTML=_34;
document.getElementById("popup").style.display="";
}
};
function update(_35,_36){
showLoadIndicator(true);
GDownloadUrl(createURL("coord",_35),function(_37){
var _38=getCookie("lastupdate");
if(_36==0||_38==_36){
loadSpotsCoord(_37,_35);
}
});
GDownloadUrl(createURL("content",_35),function(_39){
var _3a=getCookie("lastupdate");
if(_36==0||_3a==_36){
loadSpotsList(_39);
}
});
readMapAndSaveInCookie(_35);
if(env_sys=="spotlocs.com"){
pageTracker._trackPageview("/listupdate");
}
};
function initUpdateTimer(){
var now=new Date();
var _3c=now.getSeconds()+":"+now.getMilliseconds();
saveInCookie("lastupdate",_3c);
methodCall="updateTimer('"+_3c+"')";
window.setTimeout(methodCall,750);
};
function updateTimer(_3d){
var _3e=getCookie("lastupdate");
if(_3e==_3d){
update(1,_3d);
}
};
function GMinit(_3f){
var div=document.getElementById(_3f);
if(!div){
alert("Map region not found");
return null;
}
if(!GBrowserIsCompatible()){
div.innerHTML="<p>Sorry, your browser is not compatible with Google Maps.</p>";
return null;
}
map=new GMap2(div);
saveInCookie("donotupdate",1);
if(parseInt(div.style.height)>=350){
map.addControl(new GScaleControl());
}else{
map.addControl(new GSmallMapControl());
}
map.addControl(new GMapTypeControl());
lat=document.getElementById("lat").value;
lon=document.getElementById("lon").value;
mapzoom=document.getElementById("mapzoom").value;
maptype=document.getElementById("maptype").value;
if(maptype=="G_NORMAL_MAP"){
maptype=G_NORMAL_MAP;
}
if(maptype=="G_SATELLITE_MAP"){
maptype=G_SATELLITE_MAP;
}
if(maptype=="G_HYBRID_MAP"){
maptype=G_HYBRID_MAP;
}
if(mapzoom==0){
mapzoom=0;
}
if(mapzoom==1){
mapzoom=1;
}
if(mapzoom==2){
mapzoom=2;
}
if(mapzoom==3){
mapzoom=3;
}
if(mapzoom==4){
mapzoom=4;
}
if(mapzoom==5){
mapzoom=5;
}
if(mapzoom==6){
mapzoom=6;
}
if(mapzoom==7){
mapzoom=7;
}
if(mapzoom==8){
mapzoom=8;
}
if(mapzoom==9){
mapzoom=9;
}
if(mapzoom==10){
mapzoom=10;
}
if(mapzoom==11){
mapzoom=11;
}
if(mapzoom==12){
mapzoom=12;
}
if(mapzoom==13){
mapzoom=13;
}
if(mapzoom==14){
mapzoom=14;
}
if(mapzoom==15){
mapzoom=15;
}
if(mapzoom==16){
mapzoom=16;
}
if(mapzoom==17){
mapzoom=17;
}
if(mapzoom==18){
mapzoom=18;
}
if(mapzoom==19){
mapzoom=19;
}
if(mapzoom==20){
mapzoom=20;
}
map.setCenter(new GLatLng(lat,lon),mapzoom,maptype);
map.enableScrollWheelZoom();
GEvent.addListener(map,"zoomend",function(_41,_42){
document.getElementById("mapzoom").value=map.getZoom();
});
GEvent.addListener(map,"moveend",function(){
initUpdateTimer();
});
GEvent.addListener(map,"maptypechanged",function(){
if(map.getCurrentMapType()==G_NORMAL_MAP){
document.getElementById("maptype").value="G_NORMAL_MAP";
}else{
if(map.getCurrentMapType()==G_SATELLITE_MAP){
document.getElementById("maptype").value="G_SATELLITE_MAP";
}else{
if(map.getCurrentMapType()==G_HYBRID_MAP){
document.getElementById("maptype").value="G_HYBRID_MAP";
}
}
}
});
geocoder=new GClientGeocoder();
window.onunload=GUnload;
var _43=getCookie("pageNo");
if(_43==null){
_43=1;
}
update(_43,0);
return map;
};
window.onload=function(){
if(getCookie("cookiesactivated")!=1){
saveCookiesActivated(1);
if(getCookie("cookiesactivated")!=1){
document.getElementById("div-cookies").style.display="";
}
}
if(document.URL.split(".de")[1]=="/"||document.URL.split(".com")[1]=="/"){
loadMapFromCookie();
}else{
saveInCookie("pageNo",1);
if(env_loggedin==true){
resetWasThereWannoGo();
}
}
if(env_loggedin==true){
if(getCookie("wasthere")==1){
document.getElementById("wt").className="spotvisit-wasthere";
document.getElementById("wta").style.color="#FFFFFF";
}
if(getCookie("wannago")==1){
document.getElementById("wg").className="spotvisit-wannago";
document.getElementById("wga").style.color="#FFFFFF";
}
}else{
saveWasThereInCookie(0);
saveWannaGoInCookie(0);
}
gmap=GMinit("map");
};

