var map;
var directionDisplay;
var directionsService;

(function($){
	
	$('.clientblock').mouseover(function() {
		$(this).animate({
			backgroundPosition: '0 -235px'
		});
	});
	$('.clientblock').mouseout(function() {
		$(this).animate({
			backgroundPosition: '0 0'
		});
	});
	
	if( $('#map_canvas').length ) {
		
		directionsService = new google.maps.DirectionsService();
		directionsDisplay = new google.maps.DirectionsRenderer();
		
		var myLatlng = new google.maps.LatLng(52.023042, 4.684500);
		var myOptions = {
			zoom: 14,
			center: myLatlng,
			mapTypeId: google.maps.MapTypeId.ROADMAP
		}
		map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
		
		directionsDisplay.setMap(map);
		directionsDisplay.setPanel(document.getElementById("directions"));
		//directionsDisplay.setOptions({suppressMarkers: true});
		
		$('#frmDirections').submit(function(e) {
			e.preventDefault();
			
			var start = $('#startingpoint').val();
			var end = $('#destination').val();
	     	
	     	var request = {
				origin:start, 
				destination:end,
				travelMode: google.maps.DirectionsTravelMode.DRIVING
			};
			directionsService.route(request, function(response, status) {
				if (status == google.maps.DirectionsStatus.OK) {
					directionsDisplay.setDirections(response);
				}
			});
		});
	}
	
	if( $('ul.tabs').length ) {
		$('ul.tabs').tabs();
	}
	
})(this.jQuery);


window.log = function(){
  log.history = log.history || [];   
  log.history.push(arguments);
  if(this.console){
    console.log( Array.prototype.slice.call(arguments) );
  }
};
(function(doc){
  var write = doc.write;
  doc.write = function(q){ 
    log('document.write(): ',arguments); 
    if (/docwriteregexwhitelist/.test(q)) write.apply(doc,arguments);  
  };
})(document);



