function YIcon(d,e,g){d=d||G_DEFAULT_ICON.image;this.icon=new GIcon(G_DEFAULT_ICON,d);this.icon.shadow="http://maps.gstatic.com/intl/it_ALL/mapfiles/transparent.png";if(e!=undefined&&g!=undefined)this.icon.iconSize=new GSize(e,g)}(function(d){d.prototype.getImage=function(){return this.icon.image};d.prototype.getIcon=function(){return this.icon}})(YIcon);function YMarker(d,e,g){this.marker=new GMarker(d,e.getIcon(),true);this.redIcon=e;this.blueIcon=g}
(function(d){d.prototype.switchToRed=function(){this.marker.setImage(this.redIcon.getImage())};d.prototype.switchToBlue=function(){this.marker.setImage(this.blueIcon.getImage())};d.prototype.getMarker=function(){return this.marker}})(YMarker);function redYIcon(d){return new YIcon("/images/markers/normal/"+d+".png",40,40)}function blueYIcon(d){return new YIcon("/images/markers/hover/"+d+".png",40,40)}
(function(d){var e;function g(a){for(var b=-90,c=90,h=180,j=-180,f=0;f<a.length;f++){if(a[f].lat>b)b=a[f].lat;if(a[f].lat<c)c=a[f].lat;if(a[f].lng<h)h=a[f].lng;if(a[f].lng>j)j=a[f].lng}return{n:b,s:c,w:h,e:j}}function v(a,b){for(var c=g(a),h=0,j=0;j<a.length;j++)h++;return b.getBoundsZoomLevel(new GLatLngBounds(new GLatLng(c.s,c.w),new GLatLng(c.n,c.e)))}function w(a){var b=g(a);a=b.n;var c=b.s,h=b.w;b=b.e;return new GLatLng((a+c)/2,(b+h)/2)}function x(a){for(var b=0;b<a.length;b++)a[b].marker=new YMarker(new GLatLng(a[b].lat,
a[b].lng),redYIcon(a[b].index),blueYIcon(a[b].index))}function y(a){for(var b=0;b<e.length;b++)a==b?e[b].marker.switchToBlue():e[b].marker.switchToRed()}var k=0,i=null,n=null,l=null,o=null,p=null,q=null,m=$(d);function r(){var a=s(),b=Math.abs(a.top-k),c=Math.abs(a.bottom-k);a=a.bottom-a.top>=0?b<c?Math.max(a.top,k):Math.min(a.bottom,k):m.scrollTop()>l.offset().top?a.bottom:a.top;t(a)}function s(){var a=m.scrollTop(),b=l.offset().top;return{top:Math.max(0,a-b),bottom:Math.min(l.height(),m.height()+
a-b)-i.outerHeight()}}function t(a){var b=Math.round(i.css("top"));b!=a&&i.stop().animate({top:a},{easing:"swing"})}function z(a){var b=$(this),c=s();k=b=Math.round(b.position().top+b.outerHeight()/2-i.outerHeight()/2);if(c.bottom-c.top>=0)if(b<c.top)k=b=c.top;else{if(b>c.bottom)b=c.bottom}else b=m.scrollTop()>l.offset().top?c.bottom:c.top;t(b);A.apply(n,[a])}function A(a){if(B!=a){y(a);this.panTo(new GLatLng(e[a].lat,e[a].lng))}}var u=0,B=-1;function C(){i=$(p);l=i.parent();o=$(q);if(GBrowserIsCompatible){var a=
n=new GMap2(i.get(0));a.setMapType(G_NORMAL_MAP);a.addControl(new GLargeMapControl3D);x(e);for(var b=0;b<e.length;b++)a.addOverlay(e[b].marker.getMarker());a.setCenter(w(e),v(e,a));o.each(function(c){e[c]!=undefined&&$(this).hover(function(){z.apply(this,[c])},function(){})});m.scroll(function(){clearTimeout(u);u=setTimeout(r,50)}).resize(r)}}d.loadMap=function(a,b,c){e=a;p=b||"#map";q=c||"li.buttons";return C}})(window);

