// this tells jquery to run the function below once the DOM is ready
$(document).ready(function() {

// choose text for the show/hide link - can contain HTML (e.g. an image)
var showText="Contact Info";
var hideText="Close Info";

// append show/hide links to the element directly preceding the element with a class of "toggle"
$(".contactinfo").prev().append('<a href="#" class="contactinfoLink">'+showText+'</a>');

// hide all of the elements with a class of 'contactinfo'
$('.contactinfo').hide();

// capture clicks on the toggle links
$('a.contactinfoLink').click(function() {

// change the link text depending on whether the element is shown or hidden
if ($(this).text()==showText) {
$(this).text(hideText);
$(this).parent().next('.contactinfo').slideDown('slow');
}
else {
$(this).text(showText);
$(this).parent().next('.contactinfo').slideUp('slow');
}

// toggle the display - uncomment the next line for a basic "accordion" style
//$('.contactinfo').hide();
//$(this).parent().next('.contactinfo').contactinfo('slow');



// return false so any link destination is not followed
return false;

});
});

