var Tdb=new Object();Tdb.UI=new Object();Tdb.String=new Object();Tdb.String.strip=function(str) {return str.replace(/^\s+/g,"").replace(/\s+$/g,"");}
Tdb.UI.AjxLdr=new Object();Tdb.UI.AjxLdr.count=0;Tdb.UI.AjxLdr.DEF = "http://static.eventoni.com/c/images_new/sml-ldr.1324265216.gif";Tdb.UI.AjxLdr.ARR = "http://static.eventoni.com/c/images_new/arr-ldr.1324265216.gif";Tdb.UI.AjxLdr.BIG = "http://static.eventoni.com/c/images_new/big-ldr.1324265216.gif";Tdb.UI.AjxLdr.add=function(jquery,type) {Tdb.UI.AjxLdr.count++;$(jquery).append("<img class=\"ldr\" id=\"ajx-ldr-"+Tdb.UI.AjxLdr.count+"\" src=\""+type+"\" alt=\"Daten werden geladen ...\" />");return Tdb.UI.AjxLdr.count;}
Tdb.UI.AjxLdr.remove=function(handle) {$("#ajx-ldr-"+handle).remove();}
Tdb.GMaps=new Object();Tdb.GMaps.icon=new google.maps.MarkerImage(
"http://static.eventoni.com/c/images_new/map-baloon-glow.1324265216.png",
new google.maps.Size(30,45),
new google.maps.Point(0,0),
new google.maps.Point(15,43));Tdb.GMaps.shadow=new google.maps.MarkerImage(
"http://static.eventoni.com/c/images_new/map-baloon-shadow.1324265216.png",
new google.maps.Size(45,45),
new google.maps.Point(0,0),
new google.maps.Point(15,43));Tdb.GMaps.markerOptions = {icon: Tdb.GMaps.icon,
shadow: "http://static.eventoni.com/c/images_new/map-baloon-shadow.1324265216.png",
draggable: false,
bouncy: true};Tdb.GMaps.defaultMarker=new google.maps.Marker(
new google.maps.LatLng(0,0),
Tdb.GMaps.markerOptions
);Tdb.GMaps.Widget=function(element,latlng,zoom,options) {var self=this;this.id = "google-map-"+Tdb.GMaps.Widget.instances;this.latlng=latlng;this.zoom=zoom;this.clickedPoint=null;this.clickedArea=null;this.clickedAddress=null;this.options=options;this.found=function(){}
this.semaphor=false;this.geocoder=new google.maps.ClientGeocoder();this.marker=new google.maps.Marker(
latlng,
Tdb.GMaps.markerOptions
);this.setMarker=function(){self.map.removeOverlay(self.marker);self.marker.setLatLng(self.clickedPoint);
self.map.addOverlay(self.marker);}
this.drawCircle=function(center) {var proj=self.map.getCurrentMapType().getProjection();var centerPoint=proj.fromLatLngToPixel(center,7);var radius=8;if(self.clickedArea!=null){self.map.removeOverlay(self.clickedArea);}
self.clickedArea=new GPolygon([
proj.fromPixelToLatLng(new google.maps.Point(centerPoint.x+radius,centerPoint.y-radius),7,true),
proj.fromPixelToLatLng(new google.maps.Point(centerPoint.x+radius,centerPoint.y+radius),7,true),
proj.fromPixelToLatLng(new google.maps.Point(centerPoint.x-radius,centerPoint.y+radius),7,true),
proj.fromPixelToLatLng(new google.maps.Point(centerPoint.x-radius,centerPoint.y-radius),7,true),
proj.fromPixelToLatLng(new google.maps.Point(centerPoint.x+radius,centerPoint.y-radius),7,true)
], "#005F04", 1, 1, "#00FF0B", 0.3,{clickable:false});self.map.addOverlay(self.clickedArea);}
this.find=function(response) {if(!response || response.Status.code != 200){alert(response.Status.code);}else{var place=response.Placemark[0];var point=new google.maps.LatLng(place.Point.coordinates[1],place.Point.coordinates[0]);self.clickedAddress=new Tdb.GMaps.Address(place);self.found();if(self.options.area){self.drawCircle(self.clickedPoint);}
self.options.onfound(self);}
self.semaphor=false;}
$(element).after("<div id=\""+this.id+"\" class=\"google-map\"><div class=\"widget\"></div></div>");$("#"+this.id+".google-map div.widget").each(function(){self.map=new google.maps.Map2(this,{size:new google.maps.Size(550,280)});self.map.addMapType(G_PHYSICAL_MAP);
self.map.addControl(new google.maps.SmallMapControl());self.map.addControl(new google.maps.HierarchicalMapTypeControl());self.map.setCenter(self.latlng, self.zoom);self.marker.setLatLng(self.latlng);
self.map.addOverlay(self.marker);});

google.maps.Event.addListener(this.marker, "dragend", function(latlng) {if(self.semaphor) return;if(latlng!=null){self.semaphor=true;self.clickedPoint=latlng;self.found=function(){}
self.geocoder.getLocations(latlng, self.find);}});self.clickedPoint=latlng;self.found=function(){}
self.geocoder.getLocations(latlng, self.find);Tdb.GMaps.Widget.instances+=1;}
Tdb.GMaps.Widget.instances=0;Tdb.GMaps.Algorithms=new Object();Tdb.GMaps.Address=function(placemark) {this.country=null;this.province=null;this.region=null;this.city=null;this.district=null;this.zip=null;this.street=null;this.placemark=placemark;this.accuracy=0;if(typeof(this.placemark.AddressDetails)!="undefined"){if(typeof(this.placemark.AddressDetails.Country) != "undefined") {this.country=this.placemark.AddressDetails.Country.CountryNameCode;}}if(this.country!=null){this.algorithm=Tdb.GMaps.Algorithms["DE"];if(typeof(Tdb.GMaps.Algorithms[this.country])!="undefined"){this.algorithm=Tdb.GMaps.Algorithms[this.country];}
this.algorithm.analyze(this);}}
Tdb.GMaps.Algorithms.DE=new Object();Tdb.GMaps.Algorithms.DE.zipPattern = /^\s*([0-9]{5}\s+)?/g;Tdb.GMaps.Algorithms.DE.analyze=function(address) {if(typeof(address.placemark.AddressDetails)!="undefined"){address.accuracy=address.placemark.AddressDetails.Accuracy;if(typeof(address.placemark.AddressDetails.Country) != "undefined" && address.accuracy >= 1){address.country=address.placemark.AddressDetails.Country.CountryNameCode;if(typeof(address.placemark.AddressDetails.Country.AdministrativeArea) != "undefined" && address.accuracy >= 2){address.province=address.placemark.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;if(typeof(address.placemark.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea) != "undefined" && address.accuracy >= 3){address.region=address.placemark.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.SubAdministrativeAreaName;if(typeof(address.placemark.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality) != "undefined" && address.accuracy >= 4){address.city=address.placemark.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName;if(typeof(address.placemark.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode) != "undefined" && address.accuracy >= 5){address.zip=address.placemark.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode.PostalCodeNumber;}}}}
var parts=address.placemark.address.split(",");if(parts.length==3){if(address.city==null) address.city=parts[1].replace(this.zipPattern,"");if(address.zip==null) address.zip=Tdb.String.strip(parts[1].match(this.zipPattern)[0]);if(address.street==null) address.street=parts[0];}else if(parts.length==2){if(address.city==null) address.city=parts[0].replace(this.zipPattern,"");}}}}
Tdb.GMaps.Algorithms.NL=new Object();Tdb.GMaps.Algorithms.NL.zipPattern = /^\s*([0-9]{4}\s+)?/g;Tdb.GMaps.Algorithms.NL.analyze=Tdb.GMaps.Algorithms.DE.analyze;Tdb.GMaps.Algorithms.CH=new Object();Tdb.GMaps.Algorithms.CH.zipPattern=Tdb.GMaps.Algorithms.NL.zipPattern;Tdb.GMaps.Algorithms.CH.analyze=Tdb.GMaps.Algorithms.DE.analyze;Tdb.GMaps.Algorithms.AT=new Object();Tdb.GMaps.Algorithms.AT.zipPattern=Tdb.GMaps.Algorithms.NL.zipPattern;Tdb.GMaps.Algorithms.AT.analyze=Tdb.GMaps.Algorithms.DE.analyze;Tdb.GeoIp=new Object();$(function(){$(".object").mouseenter(function(){$(this).addClass("hover");});
$(".object").mouseleave(function(){$(this).removeClass("hover");});});Tdb.Form=new Object();Tdb.Form.switchField=function(field) {var id = $(field).attr("id");var replId=id+"_repl";var cleanedVal = $(field).val();var domObj=document.getElementById(id);if($("#"+replId).size()==0){$(field).parent().append("<div id=\""+replId+"\" class=\"replacement\"></div>");}if(domObj.nodeName.toLowerCase()=="select"){text = $("#"+id+" option[value='"+$("#"+id).val()+"']").text();}else{text=cleanedVal;}if(cleanedVal==""){$("#"+replId).hide();$(field).show();
$(field).effect("highlight",{color: '#009900'},"slow");}else{$(field).hide();$("#"+replId).html(text);
$("#"+replId).show();$("#"+replId).effect("highlight",{color: '#009900'},"slow");}}
$(function(){$("input.button").mouseover(function(){$(this).addClass("hover");});
$("input.button").mouseout(function(){$(this).removeClass("hover");});
$(".fieldset").click(function(){$(".fieldset").removeClass("active");$(this).addClass("active");});$(".fieldset :input").focus(function(){$(this).parents(".fieldset").addClass("active");});
$(".fieldset :input").blur(function(){$(this).parents(".fieldset").removeClass("active");});});Tdb.Form.Event=new Object();Tdb.Form.Location=new Object();Tdb.Form.Location.switchFields=function(gaddress) {if(gaddress==null){$("#id_country, #id_province, #id_region, #id_city, #id_district, #id_zip").each(function(){Tdb.Form.switchField(this);});
$("#id_street").effect("highlight",{color: '#009900'},"slow");}else{$("#id_country, #id_province, #id_region, #id_city, #id_district, #id_zip").each(function(){var name = $(this).attr("id").replace("id_","");if(gaddress[name]!=null){$(this).val(gaddress[name]);}
Tdb.Form.switchField(this);});if(gaddress.street!=null){$("#id_street").val(gaddress.street);$("#id_street").effect("highlight",{color: '#009900'},"slow");}}}
Tdb.Form.Location.showChoose=function(){$(//"#google-map-0, " +
"#id_name_element, " +
"#id_country_element, " +
"#id_province_element, " +
"#id_region_element, " +
"#id_city_element, " +
"#id_district_element, " +
"#id_zip_element, " +
"#id_street_element").hide();$("#id_locations_element").show();
$("#id_location_choice").val("1");}
Tdb.Form.Location.showNew=function(){$(//"#google-map-0, " +
"#id_name_element, " +
"#id_country_element, " +
"#id_province_element, " +
"#id_region_element, " +
"#id_city_element, " +
"#id_district_element, " +
"#id_zip_element, " +
"#id_street_element").show();$("#id_locations_element").hide();
$("#id_location_choice").val("0");}
