var geocoder;
var map;
var gmapsZoom = 12;
	
$(document).ready(function () {
	
	var deviceAgent = navigator.userAgent.toLowerCase();
	var agentID = deviceAgent.match(/(iphone|ipod|ipad)/);
	if (agentID) {
	} else{
		$('a[href*=#]').click(function() {
			if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
				var $target = $(this.hash);
				$target = $target.length && $target || $('[id=' + this.hash.slice(1) + ']');
				if ($target.length) {
					var targetOffset = $target.offset().top;
					$('html,body').animate({scrollTop: targetOffset}, 1000);
					return false;
				}
			}
		});
 
	}
	


});


/* Setup Google Maps */

function initializeGmapsV2() {
	if (GBrowserIsCompatible()) {
	
		
		map = new GMap2(document.getElementById("gmaps"));
		map.setCenter(new GLatLng(45.179859, 5.76896), gmapsZoom);
		map.setUIToDefault();
		
		map.disableScrollWheelZoom();
		
		codeAddressV2();
		
	}
}


/* Code Address Block */

function codeAddressV2() {
	var address = document.getElementById("address").textContent;
	geocoder = new GClientGeocoder();
	
	if (geocoder) {
		geocoder.getLatLng(address,
		function(point) {
			if (point) {
				map.setCenter(point, gmapsZoom);
				var marker = new GMarker(point);
				map.addOverlay(marker);
			}
		});
	}
}


