function expand_section(section_id)
{
	var section;
	var image;
	var display_type;
	section = document.getElementById(section_id);
	image = document.getElementById(section_id + "-img");
	display_type = section.style.display;
	
	// Toggle display style property between "block" and "none"
	if (display_type == "none") section.style.display = "block";
	else section.style.display = "none";
	// Toggle between images for expand / collapse
	if (image.src.indexOf("images/expand.gif") > -1) image.src = "images/collapse.gif";
	else image.src = "images/expand.gif";
	
	return;
}

// Function to validate the date form...
function validator(theForm)
{
  if (theForm.format.value == "choose")
  {
    alert("You must select a project format before continuing.");
    theForm.format.focus();
    return (false);
  }
  if (theForm.monthone.value == "" || theForm.dayone.value == "" || theForm.yearone.value == "")
  {
    alert("You must specify a beginning date before continuing.");
    theForm.monthone.focus();
    return (false);
  }
  if (theForm.monthtwo.value == "" || theForm.daytwo.value == "" || theForm.yeartwo.value == "")
  {
    alert("You must specify an ending date before continuing.");
    theForm.monthtwo.focus();
    return (false);
  }
  // Verify that the two email addresses match...
  if (theForm.email.value != "" || theForm.emailconfirm.value != "")
  {
	if (theForm.email.value != theForm.emailconfirm.value)
	{
		alert("The email addresses you entered do not match. Please check them before continuing.");
		theForm.emailconfirm.value = "";
		theForm.email.focus();
		return (false);
	}
  }

  return(true);
}

// Additional date validation functions...
function checkmonths(monthinput)
{
  // Don't allow months greater than 12
  if (monthinput.value > 12)
  {
	monthinput.value = 12;
	monthinput.focus();
	return(false);
  }
  return (true);
}
function checkyears(yearinput)
{
	// Don't allow years less than the current year
	var d = new Date();
	if (yearinput.value < d.getFullYear())
	{
		yearinput.value = d.getFullYear();
		yearinput.focus();
		return(false);
	}
	return(true);
}

function getElementsByClassName(clsName,htmltag)
{
	var arr = new Array();
	var elems = document.getElementsByTagName(htmltag);
	for ( var cls, i = 0; ( elem = elems[i] ); i++ ){
		if ( elem.className == clsName )
		{
			arr[arr.length] = elem;
		}
	}
	return arr;
}

function expand_all(class_name, html_tag_name)
{
	var obj_to_expand;
	var i = 0;
	obj_to_expand = getElementsByClassName(class_name, html_tag_name);
	for (i=0; i<obj_to_expand.length; i++)
	{
		obj_to_expand[i].style.display = "block";
	}
}
function collapse_all(class_name, html_tag_name)
{
	var obj_to_expand;
	var i = 0;
	obj_to_expand = getElementsByClassName(class_name, html_tag_name);
	for (i=0; i<obj_to_expand.length; i++)
	{
		obj_to_expand[i].style.display = "none";
	}
}
function size_all(class_name, html_tag_name, size)
{
	var obj_to_expand;
	var i = 0;
	obj_to_expand = getElementsByClassName(class_name, html_tag_name);
	for (i=0; i<obj_to_expand.length; i++)
	{
		obj_to_expand[i].style.width = size;
	}
}