  $(document).ready(function(){
    $(function() {
      $("#menu img").add("#footer img").hover(function() {
        if ($(this).attr('rollover')!="none") {
          $(this).attr("src", $(this).attr("src").split(".").join("b."));
        }
        }, function() {
        if ($(this).attr('rollover')!="none") {
          $(this).attr("src", $(this).attr("src").split("b.").join("."));
        }
        });
    });  

    //home_services
    $(function() {
    $("#home_services .rollover").hover(function() {
          $(this).find('.title').find('img').attr("src", $(this).find('.title').find('img').attr("src").split(".").join("-hover."));
          $(this).find('.img').find('img').attr("src", $(this).find('.img').find('img').attr("src").split(".").join("-hover."));
        }, function() {
          $(this).find('.title').find('img').attr("src", $(this).find('.title').find('img').attr("src").split("-hover.").join("."));
          $(this).find('.img').find('img').attr("src", $(this).find('.img').find('img').attr("src").split("-hover.").join("."));
        });
    });  
    
    //pdf downloads
    $('#pdf_dnld .button').toggle(

      function(){
        $('#pdf_dnld .pdfs').show('medium');
        $('#pdf_dnld .button').attr('src','/images/buttons/pdf-open.png');
      }, function() {
        $('#pdf_dnld .pdfs').hide('medium');
        $('#pdf_dnld .button').attr('src','/images/buttons/pdf-closed.png');
    });

    //quick links
    $('#quick_links .button').toggle(
      function(){
        $('#quick_links .links').show('medium');
        $('#quick_links .button').attr('src','/images/buttons/links-open.png');
      }, function() {
        $('#quick_links .links').hide('medium');
        $('#quick_links .button').attr('src','/images/buttons/links-closed.png');
    });

    //news archive
    $('#news_archive .button').toggle(
      function(){
        var y=$(this).attr('year');
        $('#news_archive .archive'+y).show('medium');
        $('#news_archive .button'+y).attr('src','/images/buttons/button-news'+y+'-open.jpg');
      }, function() {
        var y=$(this).attr('year');
        $('#news_archive .archive'+y).hide('medium');
        $('#news_archive .button'+y).attr('src','/images/buttons/button-news'+y+'.jpg');
    });


   
    //reveal content
    $(".reveal_link").click(function() {
      $(".reveal").toggle();
    });
     
    //search
    $("#search_link").click(function() {
      $("#search_bar").toggle('medium');
    }); 
  
  
    //minimenu
    $("#minimenu .title").click(function() {
      $("#minimenu .links").toggle('medium');
    });
    
    $('#search').click(function() {
      if ($('#search').val()=="Type here...") {
        $('#search').val('');
      }
    });  
  });
  
$(document).ready(function(){

  $(".glossary").click(function(){
    var popup_url="/glossary-a/";
    if (popup_url!=undefined) {
      overlay();
      //$("#popup").load(popup_url);
      change_glossary(popup_url);
      
      $("#popup").show();
    }
    return false;
  });
});


function change_glossary(url) {
  if (url!=undefined) {
    $.ajax({
    type: "GET",
    url: url,
    contentType: "text/html;charset=iso-8859-1",
    success: function(data){
      $("#popup").html(data);
    }
    });  
  }
}

function overlay() {
  var h=($('#main').height());
  $('#main').append('<div id="overlay" style="height:'+h+'px;">&nbsp;</div>');
  $('#overlay').bind('click', function() {
    $('#overlay').remove();
    $('#popup').hide();
  });

}