$(document).ready(function() {
	if(document.getElementById('map_canvas'))
	{
		var map;
		function initialize() {
			var myOptions = {
				zoom: 14,
				scaleControl: false,
				scrollwheel: false,
				disableDefaultUI: true,
				center: new google.maps.LatLng(52.469397,5.509644),
				mapTypeId: google.maps.MapTypeId.ROADMAP
			};
			
			map = new google.maps.Map(document.getElementById('map_canvas'),myOptions); 
			
			geocoder = new google.maps.Geocoder();  
		
			geocoder.geocode( { 'address': 'Joop Geesinkweg 128a, Amsterdam'}, function(results, status) {
				if (status == google.maps.GeocoderStatus.OK) 
				{
					map.setCenter(results[0].geometry.location);
					var marker = new google.maps.Marker({
			    		map: map, 
						position: results[0].geometry.location,
						icon: '/wp-content/themes/universalxs-css3/images/universalxs-google-maps-.png'
					});
				} else {
					alert("Geocode was not successful for the following reason: " + status);
				}
			});         
	       
			
			var uxsMarker = new google.maps.Marker({
		        map: map,
		        icon: '/wp-content/themes/universalxs-css3/images/universalxs-google-maps-.png'
		    });	
		}
		      
		function codeAddress(address) 
		{
			geocoder = new google.maps.Geocoder();
			geocoder.geocode( { 'address': address}, function(results, status) 
			{
				if (status == google.maps.GeocoderStatus.OK) 
				{
					map.setCenter(results[0].geometry.location);
					var marker = new google.maps.Marker({
						map: map, 
						position: results[0].geometry.location,
						icon: '/wp-content/themes/universalxs-css3/images/universalxs-google-maps-.png'
					});
				} else {
					alert("Geocode was not successful for the following reason: " + status);
				}
			});
		} 
		initialize();
	}

	$(".controller > a").click(function () { 
      codeAddress($(this).attr('href'));
      $(".controller > a").attr('class','');
      $(this).attr('class','active');
      return false;
    });    
});


