////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Park Springs Communities Javascript Functions
// This file includes a collection of functions for use on the Park Springs Communities site
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

$(function()
{
	// member contacts widget
	if($('#member_contacts').length > 0) {
		$('#mc_thumbs .thumb').click(show_profile);
		$('#mc_profiles div .close').click(hide_profile);
	}

	if($('#continuum_collapser').length > 0) {
		$('#continuum_collapser strong').click(show_care);
		$('#continuum_collapser p span').click(hide_care);
	}

	if($('.healthcare_collapser').length > 0) {
		$('.healthcare_collapser strong').click(show_care);
		$('.healthcare_collapser span').click(hide_care);
	}

	if($('#services').length > 0) {
		$('#services li h3 span').click(show_service);
		$('#services li p span').click(hide_service);
	}

	if($('.clubs_groups').length > 0) {
		$('.clubs_groups ul li strong').click(show_club);
		$('.clubs_groups ul li span').click(hide_club);
	}

	// clear email updates input
	$('#email_updates input[name="email_update"]').click(clear_field);

});

function show_profile()
{
	var title = $(this).attr('title');

	$('#mc_profiles div').hide();
	$('#mc_profiles div[title="'+title+'"]').show();
}

function hide_profile()
{
	$(this).parent().hide();
}

function show_care()
{
	$(this).siblings().slideDown();
}

function hide_care()
{
	$(this).siblings('p').slideUp();
	$(this).parent('p').slideUp();
	$(this).parent('p').siblings('ul').slideUp();
	$(this).parent('p').siblings('p').slideUp();
}

function show_service()
{
	$(this).parent().siblings('p').slideDown();
}

function hide_service()
{
	$(this).parent('p').slideUp();
}

function clear_field()
{
	$(this).attr('value','');
}

function show_club()
{
	$(this).siblings().show();
}

function hide_club()
{
	$(this).parent().hide();
}
