$(document).ready(function(){var a=$("#scrollContent h3, #scrollContent h2, #scrollContent h1"),c=[];$(a).each(function(b){$(this).addClass("anchor_"+b);$(this).parent().hasClass("hidden")||c.push($(this).text())});for(a=0;a<c.length;a++)$("<option value='target_"+a+"'>"+c[a]+"</option>").appendTo("#sectionNav");$("#sectionNav").change(function(){var b="anchor_"+$("#sectionNav").val().split("_")[1],e=$("#scrollContent").position();b=$("."+b).offset().top+$("#scrollContent").scrollTop()-e.top-20;$("#scrollContent").animate({scrollTop:b},
500)});$("#mainTitle").click(function(){window.location.href="twining-valley-home"});var d=false;$("#mapCanvas").each(function(){if(!d){initializeMap();d=true}});$("a[href='#print']").click(function(b){b.preventDefault();window.print()});$("a[href='#email']").click(function(b){b.preventDefault();showEmailForm()});$("a[href='#close']").click(function(b){b.preventDefault();hideEmailForm()});$("a[href='#submit']").click(function(b){b.preventDefault();submitEmailForm()});$("input[class='textInput']").keyup(function(){evaluateMessage()});
$(window).resize(centerForm)});function buildSlideshow(a){if(!$.browser.msie){$("#getFlash").html('<div id="slideShow"><ul id="galleries"></ul><div id="gallery"><div id="imageContainer"><img id="img1" /><img id="img2" /><span id="photoTitle"></span></div><ul id="nav"><li><a id="backButton" href="#back">X</a></li></ul></div></div>');JSlideshow.Main.initWithGalleryIds(a.split(","))}}function centerForm(){center($("#emailForm"))}
function submitEmailForm(){var a=true,c,d,b,e,g;$(".textInput").each(function(){switch($(this).attr("name")){case "email[friendName]":a=$(this).val()!="";c=$(this).val();break;case "email[friendEmail]":a=$(this).val()!="";b=$(this).val();break;case "email[yourName]":a=$(this).val()!="";d=$(this).val();break;case "email[yourEmail]":a=$(this).val()!="";e=$(this).val();break;case "email[openingPara]":g=$(this).val()}});var f="";if(g!="")f=" says '"+g+"', and";f={friendName:c,friendEmail:b,yourName:d,
yourEmail:e,message:"Hi "+c+",\r\n"+d+f+" has recommended this link to you: "+document.location.href};a&&$.post("/mailer.php",f,function(h){h=="1"&&hideEmailForm2()})}var wHeight,wWidth,contentHeight,contentWidth,hWidth,hHeight;function center(a){wHeight=$(window).height();wWidth=$(window).width();a.css("left",Math.floor((wWidth-a.width())*0.5)+"px");a.css("top",Math.floor((wHeight-a.height())*0.5)+"px")}
function evaluateMessage(){var a,c,d;$(".textInput").each(function(){switch($(this).attr("name")){case "email[friendName]":a=$(this).val();break;case "email[friendEmail]":$(this).val();break;case "email[yourName]":c=$(this).val();break;case "email[yourEmail]":$(this).val();break;case "email[openingPara]":d=$(this).val()}});var b="";if(d!="")b=" says '"+d+"', and";b="Hi "+a+",<br />"+c+b+" has recommended this link to you: "+document.location.href;a!=""||c!=""?$("#outputMessage").html(b):$("#outputMessage").html("")}
function showEmailForm(){centerForm();$("#outputMessage").html("");$("#emailForm").fadeIn()}function hideEmailForm(){$("#emailForm").fadeOut()}function hideEmailForm2(){$("#emailForm").fadeOut("slow");alert("Email sent successfully")}
function initializeMap(){var a=new google.maps.LatLng(-37.197591,175.106159),c={zoom:14,center:a,mapTypeId:google.maps.MapTypeId.ROADMAP,mapTypeControl:true,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.DROPDOWN_MENU}},d={zoom:8,center:new google.maps.LatLng(-37.197591,175.106159),mapTypeId:google.maps.MapTypeId.ROADMAP,mapTypeControl:true,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.DROPDOWN_MENU}},b=new google.maps.Map(document.getElementById("mapCanvas"),c),e=new google.maps.Map(document.getElementById("nzMapCanvas"),
d);b.scrollwheel=false;e.scrollwheel=false;var g=new google.maps.Marker({position:a,map:b,icon:"/images/marker-dark.png",title:"Twining Valley Nurseries"}),f=new google.maps.Marker({position:a,map:e,icon:"/images/marker-dark.png",title:"Twining Valley Nurseries"}),h=new google.maps.InfoWindow({content:"Twining Valley Nurseries<br/><b>197 Twining Rd</b><br/>(09) 233 6222",maxWidth:200});google.maps.event.addListener(g,"click",function(){h.open(b,g)});google.maps.event.addListener(f,"click",function(){h.open(e,
f)})};

