// Global Admin Utility JS


// After document loads
$(document).ready(function() 
{
	// Help popup divs
	// When help link is clicked...
	$('a.help_toggle').click(function() {		
		
		// Toggle display of div that needs to appear
		var divDisplay = $(this).next(".hidden_help").css("display");
		if( divDisplay == "none") {
			// Hide ALL help divs
			$('div.hidden_help').css({ display: "none" });
			// Show the div that needs to appear
			$(this).next(".hidden_help").css({ display: "block" });
			}
		else {
			// Hide the div that needs to hide
			$(this).next(".hidden_help").css({ display: "none" });
		}
		
		return false;

	});
	
	// When help divs are present, close by clicking anywhere on page
	if( $(".hidden_help") ) {
		$(document).click(function() {
			$(".hidden_help").css({ display: "none" });
		});
	}
	
	// Close help div onclick
	$('div.hidden_help').click(function() {
		$(this).css({ display: "none" });
		return false;
	});
	
	// Close error div onclick
	$('a#error-close').click(function() {
		$(this).parent().css({ visibility: "hidden" });
		return false;
	});
	
	// Close feddback div onclick
	$('a#feedback-close').click(function() {
		$(this).parent().css({ visibility: "hidden" });
		return false;
	});
	
	
	// Set alternating form table rows
	$(".app-form-table").find("tr:nth-child(odd)").addClass("white-row");
	
	// Set alternating data table rows
	$(".data-list-table").find("tr:nth-child(odd)").addClass("white-row");
	$(".data-list-table").find("tr:nth-child(even)").addClass("gray-row");
	$(".data-list-table").find("tr:first-child(even)").removeClass("white-row");
	
});