google.load("maps","2");var galleryobj=false;$.address.change(function(event){if(($.address.path()=='/show-gallery')){if(PortGallery.gallery){if(!PortGallery.gallery.isOpened()){PortGallery.splay=event.parameters.o
galleryobj.load();}}
if(!galleryobj){galleryobj=$('body');$.extend(galleryobj,PortGallery);if(event.parameters.o){galleryobj.init(event.parameters.o);}
else{galleryobj.init();}
galleryobj.url='/aj/canada/lockeport-harbour/gallery/'
galleryobj.load();}
else if(event.parameters.o&&(galleryobj.getxitem()!=event.parameters.o)){}}});function load_map_images(){$("#port-map").ajaxStart(function(){$(this).block({message:'<img src="/static/images/loading.gif" alt="Loading photos ..."  /> Loading photos ...',centerY:0,css:{border:'none',padding:'15px',backgroundColor:'#000','-webkit-border-radius':'10px','-moz-border-radius':'10px',opacity:.5,color:'#fff',top:'20px'},});});$("#port-map").ajaxStop(function(){$(this).unblock();});url="/aj/canada/lockeport-harbour/photos/"
$.getJSON(url,function(data,status){if(status=="error"){var msg="Sorry but there was an error: ";alert(msg)}
else{$.each(data.photos.photos,function(i,item){var icon=new GIcon();icon.image=_tr_image_url(item.photo_file_url,'mini_square')
icon.iconSize=new GSize(32,37);icon.iconAnchor=new GPoint(16,37);icon.infoWindowAnchor=new GPoint(16,10);bubble_html=_get_photo_bubble(item.photo_title,item.photo_url,item.photo_file_url,'photo-map-med-'+i)
jQuery('#port-map').jmap('AddMarker',{'pointLatLng':[item.latitude,item.longitude],'pointHTML':bubble_html,'pointTitle':item.photo_title,'pointOpenHTMLEvent':'click','pointIcon':icon,},function(marker,options){jQuery('#photo-map-'+i).hover(function(){bubble_html=_get_photo_bubble(item.photo_title,item.photo_url,item.photo_file_url,'photo-map-med-'+i)
marker.openInfoWindowHtml(bubble_html);});});});$.each(data.videos,function(i,item){if((parseInt(item.geo[0])==0)&&(parseInt(item.geo[1])==0)){return;}
var icon=new GIcon();icon.image=item.thumbnail,icon.iconSize=new GSize(40,30);icon.iconAnchor=new GPoint(20,30);icon.infoWindowAnchor=new GPoint(20,10);bubble_html=_get_video_bubble(item.title,item.player_url)
jQuery('#port-map').jmap('AddMarker',{'pointLatLng':[item.geo[0],item.geo[1]],'pointHTML':bubble_html,'pointTitle':item.title,'pointOpenHTMLEvent':'click','pointIcon':icon,},function(marker,options){jQuery('#video-map-'+i).hover(function(){bubble_html=_get_video_bubble(item.title,item.player_url)
marker.openInfoWindowHtml(bubble_html);});});});}});}
function map_loaded(mapobj,el,opt){add_port_marker(43.7,-65.1166666667,'Lockeport Harbour');load_map_images();}
google.setOnLoadCallback(function(){$(document).ready(function(){jQuery('#port-map').jmap('init',{'mapType':G_HYBRID_MAP,'mapCenter':[43.7,-65.1166666667],mapZoom:13},map_loaded);$('.map-gallery').click(function(e){e.preventDefault();$.address.value('show-gallery?o='+$(this).find('img').attr('id').replace('map-',''))});$('.bubble-photo').live('click',function(e){e.preventDefault();$.address.value('show-gallery?o='+$(this).attr('id').replace('map-med-',''))});});$('#inline-distance').cluetip({cluetipClass:'jtip',width:285,arrows:true,dropShadow:true,hoverIntent:false,sticky:true,mouseOutClose:false,closePosition:'title',local:true,hideLocal:true,positionBy:'bottomTop',activation:'click',titleAttribute:'',closeText:'<img src="/static/images/cross.png" alt="close"  />',onShow:function(ct,c){c.find('#distance-destination').focus();c.find('#distance-calc-submit').click(function(){if(to_port_id&&c.find('#distance-destination').attr('value')!=''){redirto="/sea-route/#/?a=1566&b="+to_port_id+"&c=Lockeport Harbour, Canada&d="+c.find('#distance-destination').attr('value')
window.location.href=redirto}
else{c.find('#distance-destination').focus();c.find('#distance-destination').select();}});c.find('#distance-destination').autocomplete("/aj/findport/",{delay:50,cacheLength:1,}).result(function(event,item){to_port_id=item[1]});},fx:{open:'fadeIn',openSpeed:400}});});
