$(document).ready(function()
{
	$.ajax(
	{
		url: "/getGroupFooter.php",
		cache: false,
		success: function(data)
		{
			$('#groupFooter').html(data);
		}
	});

	$(function()
	{
		if($.browser.msie)
		{
			var zIndexNumber = 1000;
			$('#middle-container *').each(function() {
				$(this).css('zIndex', zIndexNumber);
				zIndexNumber -= 10;
			});
			
			$('#masthead-container *').each(function() {
				$(this).css('zIndex', "");
			});
			
			$('.zIndexFixIgnore *').each(function()
			{
				$(this).css('zIndex', "");
			});
			
			$("#magnify").css("zIndex", 1000);		
		}
	});

	$(".selectinput-trigger:not(.inActive)").live('click',(function()
	{
		$(this).closest(".selectinput").find(".selectinput-options-top").show().css('zIndex',2000);
		$(".search-option").find("*").css("zIndex", "");
		$(this).closest(".search-option").find("*").css("zIndex", 3000);
		return false;
	}));
	
	$(".selectinput-options-top").hover(function()
	{
		
	}, function()
	{
		$(this).hide();
	});
	
	$(".selectinput-option").live('click',function()
	{
		var optionVal = $(this).closest("li").find(".option").val();
		$(this).closest(".selectinput").find(".selectinput-option").removeClass("current");
		$(this).addClass("current");
		$(this).closest(".selectinput").find(".selectinput-value").attr("value", optionVal);
		$(this).closest(".selectinput").find(".selectinput-trigger").html(optionVal.substring(0, 15));
		$(this).closest(".selectinput").find(".selectinput-options-top").hide();
		$(this).closest(".selectinput").find(".selectinput-value").change();
		if(!$(this).hasClass("followLink"))
		{
			return false;
		}
	});
	
	
	
	$(".selectinput-option-alt").click(function()
	{
		var optionVal = $(this).closest("li").find(".option").val();
		$(this).closest(".selectinput").find(".selectinput-option-alt").removeClass("current");
		$(this).addClass("current");
		$(this).closest(".selectinput").find(".selectinput-value").attr("value", optionVal);
		$(this).closest(".selectinput").find(".selectinput-trigger").html(optionVal.substring(0, 15));
		$(this).closest(".selectinput").find(".selectinput-options-top").hide();
		$(this).closest(".selectinput").find(".selectinput-value").change();
	});
	
	$(".selectinput .selectinput-trigger").each(function()
	{
		var val = $(this).closest(".selectinput").find(".selectinput-value").val().substring(0, 15);
		if(val == "")
		{
			$(this).html("Select");
		}
		else
		{
			$(this).html(val);
		}
		
	});
	
	$(".goals .radio").click(function()
	{
		
		$(this).closest(".goals").find(".radio").removeClass("selected");
		$(this).addClass("selected");
		
		$(this).closest(".goals").find(".radio-input").attr("checked", "");
		$(this).closest(".checkboxinput").find(".radio-input").attr("checked", "checked");
	});
	
	$(".returnFalse").click(function()
	{
		return false;
	});
	
	/* $(".validate-form").submit(function()
	{
		var validates = true;
		$(this).find(".error").removeClass("error");
		$(this).find("validate-text").each(function()
		{
			if(!$(this).val().trim().length())
			{
				validates = false;
				$(this).addClass("error");
			}
		});
		
		
		if(!validates)
		{
			alert("false");
			return false;
		}
	}); */
});


  // Clear prompt from username field, if required.
  function clearUsernamePrompt() {
    var searchinput = document.getElementById("searchinput");
    if (searchinput.value == "Search for a PT") {
      searchinput.value = "";
	  searchinput.className="";
    }
  }

  // Set the prompt for the username field, if required.
  function setUsernamePrompt() {
    var searchinput = document.getElementById("searchinput");
    if (searchinput.value == "") {
      searchinput.value = "Search for a PT";
	  searchinput.className="inputbox";
    }
  }

