<?php

	if (isset($_GET["groupnamesort"]) && !empty($_GET["groupnamesort"])){
		if ($_GET["groupnamesort"] === "ORDER BY group_name asc") {
		     $groupNameSort = "ORDER BY group_name asc";
		     $groupNameSortNext = "ORDER BY group_name desc";
		     $groupNameLabel = "Sort Down";
		} else {
		     $groupNameSort = "ORDER BY group_name desc";
		     $groupNameSortNext = "ORDER BY group_name asc";
		     $groupNameLabel = "Sort Up";
		}
	}
	else {
	      $groupNameSort = "";
	      $groupNameSortNext = "ORDER BY group_name desc";
	      $groupNameLabel = "Sort Down";
	}
	
	if (isset($_GET["institutionnamesort"]) && !empty($_GET["institutionnamesort"])){
		if ($_GET["institutionnamesort"] === "ORDER BY expiration_date asc") {
		     $institutionNameSort = "ORDER BY expiration_date asc";
		     $institutionNameSortNext = "ORDER BY expiration_date desc";
		     $institutionNameLabel = "Sort Down";
		} else {
		     $institutionNameSort = "ORDER BY expiration_date desc";
		     $institutionNameSortNext = "ORDER BY expiration_date asc";
		     $institutionNameLabel = "Sort Up";
		}
	}
	else {
	      $institutionNameSort = "";
	      $institutionNameSortNext = "ORDER BY expiration_date desc";
	      $institutionNameLabel = "Sort Down";
	}
	
	if (isset($_GET["adminnamesort"]) && !empty($_GET["adminnamesort"])){
		if ($_GET["adminnamesort"] === "ORDER BY group_admin asc") {
		     $adminNameSort = "ORDER BY group_admin asc";
		     $adminNameSortNext = "ORDER BY group_admin desc";
		     $adminNameLabel = "Sort Down";
		} else {
		     $adminNameSort = "ORDER BY group_admin desc";
		     $adminNameSortNext = "ORDER BY group_admin asc";
		     $adminNameLabel = "Sort Up";
		}
	}
	else {
	      $adminNameSort = "";
	      $adminNameSortNext = "ORDER BY group_admin desc";
	      $adminNameLabel = "Sort Down";
	}
	
	if (isset($_GET["adminemailsort"]) && !empty($_GET["adminemailsort"])){
		if ($_GET["adminemailsort"] === "ORDER BY group_email asc") {
		     $adminEmailSort = "ORDER BY group_email asc";
		     $adminEmailSortNext = "ORDER BY group_email desc";
		     $adminEmailLabel = "Sort Down";
		} else {
		     $adminEmailSort = "ORDER BY group_email desc";
		     $adminEmailSortNext = "ORDER BY group_email asc";
		     $adminEmailLabel = "Sort Up";
		}
	}
	else {
	      $adminEmailSort = "";
	      $adminEmailSortNext = "ORDER BY group_email desc";
	      $adminEmailLabel = "Sort Down";
	}
	
	if  (!isset($_GET["groupnamesort"]) && !isset($_GET["institutionnamesort"]) && !isset($_GET["adminnamesort"])) {
	      $groupNameSort = "ORDER BY group_name asc";
	      $groupNameSortNext = "ORDER BY group_name desc";
	      $groupNameLabel = "Sort Down";
	}

?>	