function showBubble(a,b,i){if(i<b.length){if(typeof b[i]['zoom']!="undefined")a.setZoom(b[i]['zoom']);var c=b[i]['cords'];if(c.length)a.panTo(new google.maps.LatLng(c[0],c[1]));var d=b[i]['txt'];var e=(typeof b[i]['tmo']=="undefined")?3500:b[i]['tmo'];if(d.length){a.bubble.slideUp('slow',function(){a.bubble.html(d);a.bubble.slideDown('slow',function(){setTimeout(function(){showBubble(a,b,i+1)},e)})})}else{setTimeout(function(){showBubble(a,b,i+1)},e)}}else{a.bubble.slideUp('slow');a.returnToSavedPosition();a.anim=false}}function showPath(a,b){if(!a.anim){a.anim=true;var c=$('<div class="bubble">');a.bubble=c;a.div.append(c);a.savePosition();showBubble(a,b,0)}}function createMap(c,d){var e=document.getElementById(c);var f=new google.maps.Map2(e);f.div=$(e);f.anim=false;f.addControl(new GSmallZoomControl(),new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(3,3)));f.setCenter(new google.maps.LatLng(d['center'][0],d['center'][1]),d['zoom']);f.setMapType(d['type']);var g={};$.each(d['icons'],function(i,a){var b=new GIcon(G_DEFAULT_ICON);b.image=a['image'];b.shadow=a['shadow'];b.iconSize=new GSize(a['size'][0],a['size'][1]);if(a['ssize'])b.shadowSize=new GSize(a['ssize'][0],a['ssize'][1]);else b.shadowSize=new GSize(0,0);b.iconAnchor=new GPoint(a['anchor'][0],a['anchor'][1]);b.infoWindowAnchor=new GPoint(a['ianchor'][0],a['ianchor'][1]);g[a['id']]=b});$.each(d['spots'],function(i,s){f.addOverlay(new GMarker(new google.maps.LatLng(s['cords'][0],s['cords'][1]),{icon:g[s['icon']],title:s['txt']}))});$.each(d['polylines'],function(i,p){var a=[];$.each(p['cords'],function(j,l){a[j]=new google.maps.LatLng(l[0],l[1])});f.addOverlay(new GPolyline(a,p['color'],p['weight'],p['opacity']))});$.each(d['polygons'],function(i,p){var a=[];$.each(p['cords'],function(j,l){a[j]=new google.maps.LatLng(l[0],l[1])});createPolygon(f,i,a,p['color'],p['weight'],p['opacity'],p['fcolor'],p['fopacity'],p['txt'])});GEvent.addListener(f,"click",function(a,b){console.log(b.lat()+','+b.lng())});return f}function createPolygon(a,b,c,d,f,g,h,i,j){var k=new GPolygon(c,d,f,g,h,i);k.tooltip=$('<div class="tooltip"><nobr>'+j+'</nobr></div>').hide();k.fade=false;a.div.append(k.tooltip);a.addOverlay(k);GEvent.addListener(k,"mouseover",function(){a.div.bind('mousemove.poly'+b,function(e){k.tooltip.css("top",e.pageY-this.offsetTop+10+"px").css("left",e.pageX-this.offsetLeft+10+"px");if(!k.fade){k.fade=true;k.tooltip.fadeIn('slow')}})});GEvent.addListener(k,"mouseout",function(){if(k.fade)k.tooltip.fadeOut('slow',function(){k.fade=false});a.div.unbind('mousemove.poly'+b)});a.div.hover(null,function(){k.tooltip.fadeOut('slow',function(){k.fade=false})});return k}function initDialog(a,b){a.dialog({bgiframe:true,autoOpen:false,modal:true,draggable:true,resizable:true,title:b.text()});var c={};var d=a.find('form');d.find('input[@type=text]:last').keyup(function(e){if(e.keyCode==13)d.submit()});c[b.text()]=function(){d.submit()};a.dialog('option','buttons',c);d.attr('action',b.attr('href'));d.attr('method','post');b.attr('href','javascript:void(0)').click(function(){a.dialog('open')})}$(function(){var e=/(\w+)-(.+)/;$('.dialog').each(function(){var a=$(this).attr('id');var b=a.replace(e,'$1');initDialog($(this),$('#'+b))});var f=[];$('.map').each(function(){var b=$(this).attr('id');$.getJSON(b+'.json',[],function(a){f[b]=createMap(b,a)})}).dropShadow({top:2,left:2,blur:2});$('.path').each(function(){var b=$(this).attr('id');var c=b.replace(e,'$1.json');var d=b.replace(e,'$2');$.getJSON(c,function(a){$('#'+b).attr('href','javascript:void(0);').click(function(){showPath(f[d],a)})})});$('.linksbar').removeClass('linksbar-hover');$('.linksbar ul').lavaLamp({fx:"backout",speed:700});$('h1').dropShadow({top:2,left:2,blur:1})});