// JavaScript Document
function ShowMenu(n)
    {
      	var menublock;
	  	menublock = document.getElementById(n);
	  if( menublock.style.display == 'none')
      {
	   		menublock.style.display = 'block';
      }
      else
      {
			menublock.style.display = 'block'; 
      }
    }
function ShowMenu2(n)
    {
      	var menublock;
	  	menublock = document.getElementById(n);
	  if( menublock.style.display == 'none')
      {
	   		menublock.style.display = 'block';
      }
      else
      {
			menublock.style.display = 'none'; 
      }
    }
function changelisting_textchars()
		{
				var theForm = document.ventformdata ;
				var maxWordCount = 100 ;		
				
				countWords( theForm.vent_comment, maxWordCount ) ;			
		}
		function countWords( textbox,  maxWordCount )
		{
				var theForm = document.ventformdata ;
				
				var wordCount  =  0 ;
				var text = textbox.value.replace( '\n', ' ' ) ;
				// Words Array
				text = text.split( ' ' ) ;
				// Word Count
				for ( i = 0 ; i < text.length ; i++ ) 
						if ( text[ i ].length > 0 ) 
								wordCount++ ;
						
				wordsLeft = maxWordCount - wordCount ;
				
				if ( wordsLeft < 0 )
						wordsLeft = 0 ;
				
				// Display Word Left
				document.getElementById('vent_textchars').innerHTML = wordsLeft + ' words';
				theForm.vent_textchars.value = wordsLeft ;
				
				oldLength  =  textbox.value.length ;
				newLength  =  oldLength - 1 ;
				
				if( wordsLeft == 0 )
				{
						textbox.value = textbox.value.substring( 0, newLength ) ;
				}
		}
function validateventform()
{
if(document.ventformdata.vent_comment.value == '')
{
 alert('Please enter comments for your vent');
}
else
{
document.ventformdata.submit();
}
}
function validatesearch()
{
	if(document.searchvents.search.value == '')
	{
	alert('Please enter a search phrase');
	}
	else
	{
	document.searchvents.submit();
	}
}
