var counties = new Array(); var parks = new Array(); counties['Bedfordshire'] = new Array( '52.1358333', '-0.4680556000000706' ); counties['Cambridgeshire'] = new Array( '52.2761928', '0.09653750000006767' ); counties['Cornwall'] = new Array( '50.3226691', '-5.019578799999977' ); counties['Cumbria'] = new Array( '54.5772323', '-2.7974834999999985' ); counties['Devon'] = new Array( '50.7772135', '-3.9994609999999966' ); counties['Dorset'] = new Array( '50.7390661', '-2.3382345999999643' ); counties['East Sussex'] = new Array( '50.9285982', '0.2764899000000014' ); counties['Essex'] = new Array( '51.7659078', '0.667366500000071' ); counties['Gloucestershire'] = new Array( '51.746774', '-2.2257855999999947' ); counties['Gwent'] = new Array( '51.789', '-3.018000000000029' ); counties['Hampshire'] = new Array( '51.0895203', '-1.2168440000000373' ); counties['Hertfordshire'] = new Array( '51.8097823', '-0.2376744000000599' ); counties['Kent'] = new Array( '51.260145', '0.8442801999999574' ); counties['Lincs'] = new Array( '53.2178821', '-0.1999702000000525' ); counties['Oxfordshire'] = new Array( '51.7612056', '-1.2464674000000286' ); counties['Powys'] = new Array( '52.1430868', '-3.3736820999999964' ); counties['Somerset'] = new Array( '51.0587013', '-2.949906599999963' ); counties['Suffolk'] = new Array( '52.1872472', '0.9707800999999563' ); counties['Surrey'] = new Array( '51.2622513', '-0.4672517000000198' ); counties['Sussex'] = new Array( '51.0304014', '-0.03696249999995871' ); counties['Vale of Glamorgan'] = new Array( '51.4443584', '-3.415116600000033' ); var click_count = 0; function click_map(){ click_count++; } var map; var geocoder; var current_location = ''; var markersArray = []; var icon = 'media/col-2/google-map-icon.png'; $(function(){ var viewportwidth; var viewportheight; // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight if (typeof window.innerWidth != 'undefined') { viewportwidth = window.innerWidth, viewportheight = window.innerHeight } // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document) else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) { viewportwidth = document.documentElement.clientWidth, viewportheight = document.documentElement.clientHeight } // older versions of IE else { viewportwidth = document.getElementsByTagName('body')[0].clientWidth, viewportheight = document.getElementsByTagName('body')[0].clientHeight } var container_height; container_height = $("#container").height(); if(viewportheight > container_height){ $("#container").css("height", "100%"); $("#inner-container").css("height", "100%"); $("#footer").css("position", "absolute"); $("#footer").css("bottom", "0"); } var win = $.browser.win(); // Microsoft Windows if(win){ $("#search").css("font-size", "95%"); } // Incrase font sizes if mac //if( $.browser.mac() ) { // $("body").css("font-size","100%"); //} if ($("p.expandable").length > 0){ $('p.expandable').expander({ slicePoint: 490, userCollapseText: '[close]', expandText: '[read more]', expandPrefix: '', expandEffect: 'fadeIn' }); } $("#content .enquiry-form input,#content .enquiry-form textarea").corner("3px"); $("#content .map-container").corner("8px"); $(".home-photo img, .result .photo img").corner("4px"); $(".testimonials-container").corner("6px"); $(".testimonials-content").corner("4px"); $("#transport .free-quote").corner("8px"); $("#transport .features-container").corner("6px"); $("#transport .features-content").corner("4px"); if( !$.browser.msie() ) { $("#footer input.text, #footer textarea").corner("round 5px"); } $("#postcode").keypress( function(e) { if( e.which == 13 ) { $("#park-locator-btn").click(); } }); $("#park-locator-btn").click( function() { click_count++; var postcode = $("#postcode").val(); geocoder.geocode( { 'address': postcode}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { var location = results[0].geometry.location; var loc1 = new google.maps.LatLng(location.Na, location.Oa); // Find closest county var distance = 9999999999; var current_distance = 0; for( var i in counties ) { var loc2 = new google.maps.LatLng(counties[i][0], counties[i][1]); current_distance = loc1.distanceFrom( loc2 ) / 1000; if( current_distance < distance ) { distance = current_distance current_location = i; } } map.setCenter( new google.maps.LatLng( counties[current_location][0], counties[current_location][1] ) ); map.setZoom(9); show_parks( current_location ); } else { alert( "Are you sure you entered a correct address or postcode?" ); } }); }); if ($("#home-carousel").length > 0){ jQuery('#carousel').jcarousel({ auto: 4, wrap: 'last', initCallback: mycarousel_initCallback, scroll: 1 }); } var safari = $.browser.safari(); if(safari){ if ($("#home-carousel2").length > 0){ jQuery('#carousel-home').jcarousel({ auto: 5, wrap: 'last', scroll: 1, animation: "slow", size: 2 }); } }else if(!safari){ if ($("#home-carousel2").length > 0){ jQuery('#carousel-home').jcarousel({ auto: 5, wrap: 'circular', scroll: 1, animation: "slow", size: 2 }); } } }); function mycarousel_initCallback(carousel) { // Disable autoscrolling if the user clicks the prev or next button. carousel.buttonNext.bind('click', function() { carousel.startAuto(0); }); carousel.buttonPrev.bind('click', function() { carousel.startAuto(0); }); // Pause autoscrolling if the user moves with the cursor over the clip. carousel.clip.hover(function() { carousel.stopAuto(); }, function() { carousel.startAuto(); }); }; // Googly Mapples google.maps.LatLng.prototype.distanceFrom = function(latlng) { var lat = [this.lat(), latlng.lat()] var lng = [this.lng(), latlng.lng()] var R = 6378137; var dLat = (lat[1]-lat[0]) * Math.PI / 180; var dLng = (lng[1]-lng[0]) * Math.PI / 180; var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(lat[0] * Math.PI / 180 ) * Math.cos(lat[1] * Math.PI / 180 ) * Math.sin(dLng/2) * Math.sin(dLng/2); var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); var d = R * c; return Math.round(d); } function show_parks( location ) { $("#park-locator-list").html( "

Please Wait... Searching

" ); $.ajax({ type: "POST", url: "ajax/get-parks.php", data: "county=" + location, success: function(msg){ $("#park-locator-list").html( msg ); } }); } function park_map( address ) { geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(52.273119202640635, -1.51923828125); var myOptions = { zoom: 20, center: latlng, mapTypeControl: true, mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}, navigationControl: true, mapTypeId: google.maps.MapTypeId.TERRAIN }; map = new google.maps.Map(document.getElementById("map"), myOptions); geocoder.geocode( { 'address': address + ', UK' }, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { if (status != google.maps.GeocoderStatus.ZERO_RESULTS) { map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ position: results[0].geometry.location, map: map, title:address }); } else { alert("No results found"); } } else { alert("Geocode was not successful for the following reason: " + status); } }); } function initialize() { geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(52.273119202640635, -1.51923828125); var myOptions = { zoom: 6, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map"), myOptions); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(52.1358333, -0.4680556000000706), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(52.1358333, -0.4680556000000706) ); map.setZoom(9); show_parks( 'Bedfordshire' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Bedfordshire"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(52.2761928, 0.09653750000006767), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(52.2761928, 0.09653750000006767) ); map.setZoom(9); show_parks( 'Cambridgeshire' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Cambridgeshire"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(50.3226691, -5.019578799999977), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(50.3226691, -5.019578799999977) ); map.setZoom(9); show_parks( 'Cornwall' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Cornwall"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(54.5772323, -2.7974834999999985), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(54.5772323, -2.7974834999999985) ); map.setZoom(9); show_parks( 'Cumbria' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Cumbria"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(50.7772135, -3.9994609999999966), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(50.7772135, -3.9994609999999966) ); map.setZoom(9); show_parks( 'Devon' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Devon"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(50.7390661, -2.3382345999999643), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(50.7390661, -2.3382345999999643) ); map.setZoom(9); show_parks( 'Dorset' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Dorset"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(50.9285982, 0.2764899000000014), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(50.9285982, 0.2764899000000014) ); map.setZoom(9); show_parks( 'East Sussex' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("East Sussex"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(51.7659078, 0.667366500000071), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(51.7659078, 0.667366500000071) ); map.setZoom(9); show_parks( 'Essex' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Essex"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(51.746774, -2.2257855999999947), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(51.746774, -2.2257855999999947) ); map.setZoom(9); show_parks( 'Gloucestershire' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Gloucestershire"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(51.789, -3.018000000000029), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(51.789, -3.018000000000029) ); map.setZoom(9); show_parks( 'Gwent' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Gwent"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(51.0895203, -1.2168440000000373), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(51.0895203, -1.2168440000000373) ); map.setZoom(9); show_parks( 'Hampshire' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Hampshire"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(51.8097823, -0.2376744000000599), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(51.8097823, -0.2376744000000599) ); map.setZoom(9); show_parks( 'Hertfordshire' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Hertfordshire"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(51.260145, 0.8442801999999574), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(51.260145, 0.8442801999999574) ); map.setZoom(9); show_parks( 'Kent' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Kent"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(53.2178821, -0.1999702000000525), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(53.2178821, -0.1999702000000525) ); map.setZoom(9); show_parks( 'Lincs' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Lincs"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(51.7612056, -1.2464674000000286), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(51.7612056, -1.2464674000000286) ); map.setZoom(9); show_parks( 'Oxfordshire' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Oxfordshire"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(52.1430868, -3.3736820999999964), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(52.1430868, -3.3736820999999964) ); map.setZoom(9); show_parks( 'Powys' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Powys"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(51.0587013, -2.949906599999963), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(51.0587013, -2.949906599999963) ); map.setZoom(9); show_parks( 'Somerset' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Somerset"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(52.1872472, 0.9707800999999563), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(52.1872472, 0.9707800999999563) ); map.setZoom(9); show_parks( 'Suffolk' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Suffolk"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(51.2622513, -0.4672517000000198), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(51.2622513, -0.4672517000000198) ); map.setZoom(9); show_parks( 'Surrey' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Surrey"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(51.0304014, -0.03696249999995871), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(51.0304014, -0.03696249999995871) ); map.setZoom(9); show_parks( 'Sussex' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Sussex"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(51.4443584, -3.415116600000033), icon: icon }); google.maps.event.addListener(marker, 'click', function() { map.setCenter( new google.maps.LatLng(51.4443584, -3.415116600000033) ); map.setZoom(9); show_parks( 'Vale of Glamorgan' ); }); google.maps.event.addListener(marker, 'mouseover', function() { if(click_count == 0){ $("#park-locator-list h4").html("Vale of Glamorgan"); } }); google.maps.event.addListener(marker, 'mouseout', function() { if(click_count == 0){ $("#park-locator-list h4").html("Click a marker on the map to list the parks we have in that county."); } }); markersArray.push(marker); } $('a.top').click(function(){ $('html, body').animate({scrollTop: '0px'}, 300); return false; }); function button_change(el){ if(el.value == "1"){ $("#change_but_joint").addClass("block"); $("#change_but_joint").removeClass("none"); $("#change_but_submit").addClass("none"); $("#change_but_submit").removeClass("block"); }else{ $("#change_but_submit").addClass("block"); $("#change_but_submit").removeClass("none"); $("#change_but_joint").addClass("none"); $("#change_but_joint").removeClass("block"); } }