function $(elementId)
{
  return document.getElementById(elementId);
}

function flashDisplay(id, width, height, wmode){
  document.write('<object\n');	document.write('type="application/x-shockwave-flash"');
  document.write('data="http://advocatesforum.com/flash/' + id + '.swf"');
  document.write('width="' + width + '" height="' + height + '">\n');
  document.write('<param name="loop" value="false" />\n');
  document.write('<param name="wmode" value="' + wmode + '" />\n');
  document.write('<param name="movie" value="http://advocatesforum.com/flash/' + id + '.swf" />\n');
  document.write('</object>\n');
}

function showHide(numId)
{
  for(i = 1; i <= 19; i++)
  {
    var divVar = 'article'+i;
    if(i == numId)
      $(divVar).style.display = 'block';
    else
      $(divVar).style.display = 'none';
  }
}

/*
 *	Function: charCount
 *
 *  Parameters:
 *  textInput = id of input[type='text'] or id of textarea containing
 *              text to be counted.
 *  displayArea = id of the element to display the character count
 *  maxChars = the maximum amount of characters allowed for this field
 *
 *  When the maximum amount of characters are exceeded by the user,
 *  the display turns dark red, and the size increases.
*/
function charCount(textInput, displayArea, maxChars)
{
	var textElement = document.getElementById(textInput);
	var displayElement = document.getElementById(displayArea);
	
	var totalCharacters = 0;
	
	if (textElement.value != "")
		totalCharacters = textElement.value.length;
	
	displayElement.innerHTML = "Character Count: " + totalCharacters;
	
	if (totalCharacters >= maxChars)
	{
		displayElement.style.color = "#900";
		displayElement.style.fontSize = "12px";
	}
	else
	{
		displayElement.style.color = "#000";
		displayElement.style.fontSize = "11px";
	}
}