function flashDisplay(id, width, height, wmode){
  var currPath = "http://" + document.location.host + "/atlasfence/";
  document.write('<object\n');	document.write('type="application/x-shockwave-flash"');
  document.write('data="' + currPath + '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="' + currPath + 'flash/' + id + '.swf" />\n');
  document.write('</object>\n');
}

function $(elementID)
{
  return document.getElementById(elementID);
}

/*
 *	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 = $(textInput);
	var displayElement = $(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";
	}
}

function clearDateField(dateFieldId)
{
  var dfi = $(dateFieldId);
  
  if (dfi)
    dfi.value = '';
  
  return;
}

function nodisplay(elemId)
{
  $(elemId).style.display = 'none';
}

function grabSubCats(getSubCatsNum)
{
  $(getSubCatsNum).click();
}