// Show and Hide V2.1

function setupShowHide() {
	//Add various event handlers to elements of the page if present with correct classes.
	$('.showHideControls').each(function() { $(this).addClass("showHideVisible"); });
	$('.showHideControls p').each(function() { $(this).addClass("controlsSetup");});
	$('.showHideControls p').hover(function() { $(this).css('color', 'red'); $(this).css('text-decoration', 'none');
	},function(){ 
		$(this).css('color', 'black'); 
		$(this).css('text-decoration', 'underline'); 
		$(this).css('cursor', 'pointer');			
	});	
	$('.showHideControls p.show-all').click(function() {
		$('.showHideContent').each(function() { $(this).show(); });
		$('.showHideTitle').each(function() { $(this).css('background-image', 'url(/css/images/showhide/open.gif)'); });					
	});
	$('.showHideControls p.hide-all').click(function() {
		$('.showHideContent').each(function() { $(this).hide(); });
		$('.showHideTitle').each(function() { $(this).css('background-image', 'url(/css/images/showhide/closed.gif)'); });					
	});
	$('.showHideContent').each(function() { $(this).addClass("setContent"); });
	$('.showHideTitle').each(function() { $(this).addClass("hideClick"); });		
	$('.showHideTitle').hover(function() { 							   
		var cssChecka = $(this).css('background-image');
		if(cssChecka.match("open.gif") == "open.gif"){ $(this).css('background-image', 'url(/css/images/showhide/open.gif)');	
		} else { $(this).css('background-image', 'url(/css/images/showhide/closed.gif)');
		}
		$(this).css('color', 'red');
	},function(){ 
		var cssCheckb = $(this).css('background-image');
		if(cssCheckb.match("open.gif") == "open.gif"){ $(this).css('background-image', 'url(/css/images/showhide/open.gif)');	
		} else { $(this).css('background-image', 'url(/css/images/showhide/closed.gif)');
		}
		$(this).css('color', '#124265'); });		
	$('.showHideTitle').click(function() {
		var cssCheck = $(this).css('background-image');
		if(cssCheck.match("open.gif") == "open.gif"){ $(this).css('background-image', 'url(/css/images/showhide/closed.gif)');	
		} else { $(this).css('background-image', 'url(/css/images/showhide/open.gif)');
		}
		$(this).next('.showHideContent:visible').slideUp('fast');
		$(this).next('.showHideContent:hidden').slideDown('fast');
	});
}

$(document).ready(function() { //Wait until document has loaded until we start.
	setupShowHide();
});
