$(function(){
  // Document is ready
  set_up_nav_rollovers();
});

function set_up_nav_rollovers() {
  $('img#about').hover(function () {
      $(this).attr("src","/images/about_us_2.gif");}, function () {
      $(this).attr("src","/images/about_us_1.gif");});
      
  $('img#services').hover(function () {
      $(this).attr("src","/images/services_2.gif");}, function () {
      $(this).attr("src","/images/services_1.gif");});
      
  $('img#news').hover(function () {
      $(this).attr("src","/images/news_2.gif");}, function () {
      $(this).attr("src","/images/news_1.gif");});
      
  $('img#faqs').hover(function () {
      $(this).attr("src","/images/faqs_2.gif");}, function () {
      $(this).attr("src","/images/faqs_1.gif");});
      
  $('img#community').hover(function () {
      $(this).attr("src","/images/community_2.gif");}, function () {
      $(this).attr("src","/images/community_1.gif");});
      
  $('img#useful').hover(function () {
      $(this).attr("src","/images/useful_info_2.gif");}, function () {
      $(this).attr("src","/images/useful_info_1.gif");});
      
  $('img#client').hover(function () {
      $(this).attr("src","/images/client_corner_2.gif");}, function () {
      $(this).attr("src","/images/client_corner_1.gif");});
}

// from: http://ozmm.org/posts/jquery_and_respond_to.html
jQuery.ajaxSetup({ 
  'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} 
})

// from: http://henrik.nyh.se/2008/05/rails-authenticity-token-with-jquery
$(document).ajaxSend(function(event, request, settings) {
  if (typeof(AUTH_TOKEN) == "undefined") return;
  // settings.data is a serialized string like "foo=bar&baz=boink" (or null)
  settings.data = settings.data || "";
  settings.data += (settings.data ? "&" : "") + "authenticity_token=" + encodeURIComponent(AUTH_TOKEN);
});