function personnel_highlight() {
   var image = $(this);
   var person_id = image.attr('id');

   $('#'+person_id).toggleClass(person_id+'_hover');
}

/* On the contact us page, load in the google map after the page has loaded fully. */
function showGoogleMap()
{
   var googleMapIframe = '<iframe id="google_frame" width="100%" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=paudie+o\'mahoney+%26+associates%23&amp;sll=37.0625,-95.677068&amp;sspn=30.323858,54.931641&amp;ie=UTF8&amp;hq=paudie+o\'mahoney+%26+associates%23&amp;hnear=&amp;radius=15000&amp;ll=52.068255,-9.517464&amp;spn=0.091761,0.214577&amp;z=12&amp;iwloc=near&amp;cid=9493274962973083027&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=paudie+o\'mahoney+%26+associates%23&amp;sll=37.0625,-95.677068&amp;sspn=30.323858,54.931641&amp;ie=UTF8&amp;hq=paudie+o\'mahoney+%26+associates%23&amp;hnear=&amp;radius=15000&amp;ll=52.068255,-9.517464&amp;spn=0.091761,0.214577&amp;z=12&amp;iwloc=near&amp;cid=9493274962973083027" style="color:#000000;text-align:left" title="Click to View Larger Map - Opens in New Window">View Larger Map</a></small>';
   var google_map_div = document.getElementById("googleMapPlaceholder");
   google_map_div.innerHTML = googleMapIframe;  
}

function getDirections() {
   var directions_url = "http://maps.google.ie/maps?f=d&source=s_d&daddr=Paudie+O%27Mahoney+and+Associates,+Consulting+Engineers+and+Architects,+Killarney&z=12";

   var start_address = new String($('#start_address').val()).replace(/ /g, '+'); // replaces spaces
   start_address = escape(start_address);

   if ($.trim(start_address) != "") {
	 var destination = directions_url + '&saddr=' + start_address;
   
	 $('#get_directions_link').attr('href', destination);
   }
}

$(document).ready(function() {

   $('#navbar li').hover(function () {
		if (!$(this).hasClass("hover_navbar"))
		   $(this).addClass("hover_navbar")
	  }, function () {
		if ($(this).hasClass("hover_navbar"))
		   $(this).removeClass("hover_navbar")
	  }
	);
	
	$('.smallPersonImg').hover(personnel_highlight);
	$('#get_directions_link').click(getDirections);
});


