siteGlobal=function(){var a=jQuery;return{init:function(){a.fn.galleriaService=this.galleriaService;a.fn.infiniteScrolling=this.infiniteScrolling;a.fn.mapLocation=this.mapLocation},galleriaService:function(b){b=a.extend({link:this,width:"auto"},b);Galleria.loadTheme(STATIC_URL+"javascripts/plugins/galleria/themes/classic/galleria.classic.min.js");a(b.link).galleria({autoplay:b.autoplay,width:b.width,height:b.height,debug:b.debug,thumbnails:b.thumbnails,_toggleInfo:b._toggleInfo,showCounter:b.showCounter,
fullscreenDoubleTap:b.fullscreenDoubleTap,transition:b.transition,carousel:b.carousel,carouselSpeed:b.carouselSpeed,carouselSteps:b.carouselSteps,clicknext:b.clicknext,lightbox:b.lightbox,showCounter:b.showCounter,showInfo:b.showInfo,data_source:b.data_source,imageCrop:b.imageCrop,thumbnails:b.thumbnails,fullscreenDoubleTap:b.fullscreenDoubleTap,description:b.description})},infiniteScrolling:function(b){b=a.extend({link:this,linkSelector:this,width:"auto"},b);a(b.link).infinitescroll({navSelector:"ol.pagination",
nextSelector:"ol.pagination a:first",itemSelector:b.linkSelector})},mapLocation:function(b){var b=a.extend({},b),c=[];name=b.name;latitude=b.latitude;longitude=b.longitude;(latitude!=void 0||longitude!=void 0)&&c.push({name:name,latitude:latitude,longitude:longitude,item:this});b.map_points=="single"?(a(".maps-wrapper.panel").append("<div id=map_canvas />"),a(".maps-wrapper.panel").append("<div class=largeMap><div id=map_canvas_large /></div>"),render_map(document.getElementById("map_canvas"),c),
render_map(document.getElementById("map_canvas_large"),c)):b.map_points!="multiple"&&b.map_points=="locations"&&render_map_single(document.getElementById("map_canvas"),c,10)},telephone:function(){if(a(".telephone").length>0){a(".telephone.reveal").each(function(){var b=a(this).text(),c=a(this).attr("href"),b=b.substring(0,b.length-3)+"...>";a(this).text(b);a(this).attr("href","#");a(this).attr("rel",c)});if(a(".page-detail").length>0){var b=a(".telephone.reveal"),c=b.parents("h3.phone").find("meta").attr("content");
b.parents("h3.phone").append("<span class='print-telephone'>"+c+"</span>")}a(".telephone.reveal").live("click",function(){var b=a(this).parents("h3.phone").find("meta").attr("content"),c=a(this).attr("rel");a(this).text(b);a(this).removeClass("reveal").addClass("unreveal");a("#smartphone").is(":visible")||a("#tablet-narrow").is(":visible")?a(this).attr("href","tel:"+b):a(".page-detail").length>0?(a(this).parents("h3.phone").append('<span class="telephone">'+b+"<span>"),a(this).remove()):a(this).attr("href",
c);business_name=a(this).parentsUntil('[itemtype="http://schema.org/LocalBusiness"]').parent().find('[itemprop="name"]').filter(":first").text();_gaq.push(["_trackEvent","Telephone","Reveal",business_name]);return false})}},printBusinessDetails:function(a){_gaq.push(["_trackEvent","Business","Print",a]);window.print()},businessList:function(){if(a(".page-listings").length>0){a(".maps-wrapper.panel").append("<div id=map_canvas />");var b=[];a("#business_list > li[itemscope]").each(function(){var c=
a(this).find('meta[itemprop="latitude"]').attr("content"),h=a(this).find('meta[itemprop="longitude"]').attr("content"),d=a(this).find('span[itemprop="name"]').text();(c!=void 0||h!=void 0)&&b.push({name:d,latitude:c,longitude:h,item:this})});var c=0;render_map(document.getElementById("map_canvas"),b.slice(0,9),function(){c++;a(this.item).prepend("<span class='map-location-number icon-numbers'>"+c+"</span>");this.marker.setIcon(STATIC_URL+"images/maps/marker_"+c+".png");this.marker.setZIndex(-c)});!a(".coordinates").length>
0&&a("#map_canvas").hide()}if(a("ol.subcategoryList").length>0){var d=0;a("ol.subcategoryList").each(function(){var b=a(this),c=b.html(),e=a(this).parents("li").find(".category-selected:first").html(),f=a(this).find("span.category-selected");b.removeClass("hide");d++;a(".overlay-container").append("<div class='overlay' id='overlay"+d+"'><h3>Category</h3><div id='column-container'><ul id='column1'></ul><ul id='column2'></ul><ul id='column3'></ul></div></div>");if(f.length>0)a(".page-listings").length>
0?(f.parents("li").find("a").attr("href"),c=f.html(),f.parents("li").find("a").attr("href")):c=f.html(),b.html("<li>"+c+"</li>");else{var f=a(c).filter("li").length,g=Math.ceil(f/3);b.html("<li class='refine'><a id='refine' href='#overlay"+d+"'>more +</a></li>");f<=14?a("#overlay"+d+" ul#column1").html(a(c)):(a("#overlay"+d+" ul#column1").html(a(c).filter("li").slice(0,g)),a("#overlay"+d+" ul#column2").html(a(c).filter("li").slice(g,g*2)),a("#overlay"+d+" ul#column3").html(a(c).filter("li").slice(g*
2,g*3)));a("#overlay"+d+" h3").html(e)}})}a("a#refine").fancybox({hideOnContentClick:true,centerOnScroll:true});siteGlobal.infiniteScrolling({link:"#business_list",linkSelector:"#business_list li"});var e=function(){business_name=a(this).parentsUntil('[itemtype="http://schema.org/LocalBusiness"]').parent().find('[itemprop="name"]').filter(":first").text();_gaq.push(["_trackEvent","Telephone","Call",business_name])};a(".phone-icon").click("click",e);a(".telephone.portable").click("click",e)},businessDetail:function(){business=
a("#business_list").first();siteGlobal.mapLocation({name:a(business).find('[itemprop="name"]').text(),latitude:a(business).find('meta[itemprop="latitude"]').attr("content"),longitude:a(business).find('meta[itemprop="longitude"]').attr("content"),map_points:"single"});siteGlobal.galleriaService({link:"#slide-show-detail",height:504,width:"auto",transition:"fadeslide",_toggleInfo:true,carousel:true,carouselSpeed:1200,carouselSteps:2,clicknext:true,lightbox:false,showCounter:false,debug:false,showInfo:false})},
home:function(){siteGlobal.galleriaService({link:"#galleria",autoplay:4E3,imageCrop:true,debug:false,thumbnails:false,fullscreenDoubleTap:false,width:1136,height:270,showInfo:true,_toggleInfo:false,showCounter:false,transition:"fadeslide",carousel:true,carouselSpeed:1200,carouselSteps:2,clicknext:true,lightbox:false,description:NaN});a("<select />").appendTo("#categories");a("<option />",{selected:"selected",value:"",text:"Choose a category"}).appendTo("#categories select");a("#categories a").each(function(){var b=
a(this);a("<option />",{value:b.attr("href"),text:b.text()}).appendTo("#categories select")});a("#categories select").change(function(){window.location=a(this).find("option:selected").val()})},locations:function(){a("<select />").appendTo("#locations-list");a("<option />",{selected:"selected",value:"",text:"Go to..."}).appendTo("#locations-list select");a("#locations-list a").each(function(){var b=a(this);a("<option />",{value:b.attr("href"),text:b.text()}).appendTo("#locations-list select")});a("#locations-list select").change(function(){window.location=
a(this).find("option:selected").val()});business=a("#map").first();siteGlobal.mapLocation({name:a(business).find('[itemprop="name"]').text(),latitude:a(business).find('meta[itemprop="latitude"]').attr("content"),longitude:a(business).find('meta[itemprop="longitude"]').attr("content"),map_points:"locations"})},categories:function(){function b(b){var d=[[],[],[]],e="",i="",h=Math.ceil(b.children.length/3),j=1,f=0;a.each(b.children,function(a,b){i=formatCategoryTitle(b.title);d[j-1].push('<li><a href="'+
b.url+'">'+i+"</a></li>");f++;f%h==0&&j++});e+='<h3><a href="'+b.url+'">'+b.title+"</a></h3>";e+='<div id="column-container">';e+='<ul id="column1">'+d[0].join("")+"</ul>";e+='<ul id="column2">'+d[1].join("")+"</ul>";e+='<ul id="column3">'+d[2].join("")+"</ul>";e+="</div>";a("#overlay").append(e)}a("a.more").fancybox({overlayColor:"#000000",overlayOpacity:0.3,centerOnScroll:true});a(".more").click("click",function(c){c.preventDefault();a("#overlay").children().remove();c=a.ajax({url:"/category/"+
a(this).attr("id")+"/children.json",dataType:"json"});c.success(function(a){b(a)});c.error(function(){})})}}}();jQuery(document).ready(function(){siteGlobal.init()});jQuery(window).load(function(){$("#desktop").is(":visible")&&($(".masthead-header").append("<iframe src='http://www.baysidebulletin.com.au/header1024' width='1024px' height='170px' scrolling='no' frameborder=0 > </iframe>"),$(".masthead-footer").append("<iframe src='http://www.baysidebulletin.com.au/footer' width='924px' height='380px' scrolling='no' frameborder=0 > </iframe>"))});
function render_map(a,b,c){if(b.length!=0){bounds=new google.maps.LatLngBounds;$(b).each(function(a,b){b.coordinates=new google.maps.LatLng(b.latitude,b.longitude);bounds.extend(b.coordinates)});var d=new google.maps.Map(a,{center:bounds.getCenter(),zoom:18,mapTypeId:google.maps.MapTypeId.ROADMAP}),e=false;d.fitBounds(bounds);google.maps.event.addListener(d,"zoom_changed",function(){e||(e=true,d.getZoom()>15&&d.setZoom(15))});$(b).each(function(a,b){b.marker=new google.maps.Marker({title:b.title,
position:b.coordinates,map:d});c&&c.call(b)})}}function render_map_single(a,b,c){bounds=new google.maps.LatLngBounds;$(b).each(function(a,b){b.coordinates=new google.maps.LatLng(b.latitude,b.longitude);bounds.extend(b.coordinates)});new google.maps.Map(a,{center:bounds.getCenter(),zoom:c,mapTypeId:google.maps.MapTypeId.ROADMAP})}function formatCategoryTitle(a){a.length>25&&(a=a.substring(0,25),a=a.charAt(a.length-1)==" "?a.substring(0,25)+"...":a.substring(0,25)+" ...");return a};

