var smsajurl="/aj/south-georgia-and-the-south-sandwich-islands/leith-harbour/sms/";var smsajformurl="/aj/sea-route/form/";google.load("maps","2");function map_loaded(mapobj,el,opt){add_port_marker(-54.141,-36.688,'Leith Harbour')
load_map_locations();}
function load_map_locations(){url="/aj/south-georgia-and-the-south-sandwich-islands/leith-harbour/locations/"
$.getJSON(url,function(data,status){if(status=="error"){var msg="Sorry but there was an error: ";alert(msg)}
else{$.each(data,function(i,item){var icon=new GIcon();icon.image='/static/images/icons/pin.png'
icon.iconSize=new GSize(24,24);icon.iconAnchor=new GPoint(16,37);icon.infoWindowAnchor=new GPoint(16,10);jQuery('#port-map').jmap('AddMarker',{'pointLatLng':[item.coords[1],item.coords[0]],'pointHTML':_get_location_bubble(item),'pointTitle':item.title,'pointOpenHTMLEvent':'click','pointIcon':icon,},function(marker,options){jQuery('.location-map-'+i).click(function(e){e.preventDefault();bubble_html=_get_location_bubble(item)
marker.openInfoWindowHtml(bubble_html);});});});}});}
$(document).ready(function(){jQuery('#port-map').jmap('init',{'mapType':G_HYBRID_MAP,'mapCenter':[-54.141,-36.688],mapZoom:13},map_loaded);$('#flag-it').cluetip({cluetipClass:'jtip',arrows:true,dropShadow:false,hoverIntent:false,sticky:true,mouseOutClose:true,closePosition:'title',local:true,hideLocal:true,closeText:'<img src="/static/images/cross.png" alt="close"  />'});$('#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=5134&b="+to_port_id+"&c=Leith Harbour, South Georgia and the South Sandwich Islands&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:0,matchCase:false,}).result(function(event,item){to_port_id=item[1]});},fx:{open:'fadeIn',openSpeed:400}});$("#cue-action").ajaxStart(function(){$(this).block({message:'<img src="/static/images/loading.gif" alt="Loading content ..."  />',centerY:0,css:{border:'none',padding:'15px',backgroundColor:'#000','-webkit-border-radius':'10px','-moz-border-radius':'10px',opacity:.5,color:'#fff',top:'20px'},});});$("#cue-action").ajaxComplete(function(){$(this).unblock();});$('#inaccurate-report').click(function(){$('.inaccurate-report').remove()
$('.cue-action').load("/aj/south-georgia-and-the-south-sandwich-islands/leith-harbour/report/",function(response,status,xhr){if(status=="error"){var msg="Sorry but there was an error: ";alert(msg)}});});$('#wikilink').click(function(e){e.preventDefault();$('#wikioverlay').overlay({effect:'default',top:'center',expose:{color:'#000',loadSpeed:200,opacity:0.8},onBeforeLoad:function(){var wrap=this.getContent().find(".contentWrap");wrap.attr('src',$('#wikilink').attr("href"));},api:true}).load();});$('.places').click(function(e){if((e.target.nodeName=='P')||($(e.target).hasClass('small'))){$('.places-summary').toggleClass('hide')
$('.places-full').toggleClass('hide')}})
$('#btn-sms').live('click',function(){send_sms();});$('#sms-close-msg').live('click',function(){sms_reset_form();});});
