function validate_entry(){
	if (validate_submission()){
		document.tagform.submit();
		Clear_Last_Message_on_Submit(); 
	}
	return false;
}


function validate_submission(){
	var name = document.tagform.tagname.value;
	var location = document.tagform.taglocation.value;
	var message = document.tagform.message.value;

	if(name == ""){
		alert("Please enter your Name.")
		return false;
	}
	if(location == ""){
		alert("Please enter your Location.")
		return false;
	}
	if(message == ""){
		alert("Please enter your Shout-Out.")
		return false;
	}	
	else{
		var dd = message.substring(0,34);
		if(dd == "Your Shout Out has been Submitted!"){
			alert("Please enter your Shout-Out.")
			return false;
		}
	}
	return true;
}

//selects all text and refocuses text box after submit
//chosen over clearing the message as some messages dont go through
//due to flood controls, character limits, etc
//this gives the user an option of changing the text, or simply overwriting it
function clear_message()
{
  document.tagform.message.focus();
  document.tagform.message.select();
}

//clear the message after it is submitted.  pause 0.2 seconds to be sure
//that the message has been submitted first
function Clear_Last_Message_on_Submit() 
{ 	
  document.tagform.message.value = "Your Shout Out has been Submitted!\nOnce Approved it would be Posted.";
  setTimeout("clear_message()",200);
  return false;
}


 	var isChecked = "no";
 	var i;
	
function checkAll(){
	var messageCount = document.forms['deleteRecords'].elements['record[]'].length;
	if (messageCount){
			//start: do this when there's more than one entry
			if (isChecked == "no"){
				for(i = 0; i < messageCount; i++){
				document.forms['deleteRecords'].elements['record[]'][i].checked=true;
				}
				isChecked = "yes";
			}
			else{
				for(i = 0; i < messageCount; i++){
				document.forms['deleteRecords'].elements['record[]'][i].checked=false;
				}
				isChecked = "no";
			}
			//end: do this when there's more than one entry
	}
	else{
			//start: do this when there's only one entry
				if (isChecked == "no"){
				document.forms['deleteRecords'].elements['record[]'].checked=true;
				isChecked = "yes";
			}
			else{
				document.forms['deleteRecords'].elements['record[]'].checked=false;
				isChecked = "no";
			}
			//start: do this when there's only one entry			
	}
}



