// JavaScript Document
function required() //requires something to be put in each phone number box
{
	with (document.hughesTell) //the 'with' takes the place of writing document.object in this case the onject is the form dishtvform
	{
		if (senderName.value==""){
			alert("Please enter your name, this will be sent to your friend along with the information.");
			document.getElementById("senderNameError").innerHTML="required* ";
			senderName.select();
			return false;
			}
		//BEGIN Email Validation
		if(-1 == senderEmail.value.indexOf("@")) { 
		   senderEmail.select(); 
		   alert("Your email must have a '@'."); 
		   return false; 
       }
		if(-1 != senderEmail.value.indexOf(",")) { 
		   senderEmail.select(); 
		   alert("Your email must not have a ',' in it"); 
		   return false; 
		   }
		if(-1 != senderEmail.value.indexOf("#")) { 
		   senderEmail.select(); 
		   alert("Your email must not have an '#' in it." ); 
		   return false; 
		   }
		if(-1 != senderEmail.value.indexOf("!")) { 
		   senderEmail.select(); 
		   alert("Your email must not have a '!' in it." ); 
		   return false; 
		   }
		if(-1 != senderEmail.value.indexOf(" ")) { 
		   senderEmail.select(); 
		   alert("Your email must not have a space in it." ); 
		   return false; 
		   }
		if(senderEmail.value.length == (senderEmail.value.indexOf("@")+1) ) {
		   senderEmail.select();
		   alert("Your email must have a domain name after the '@'.");
		   return false;
		   }
	
		if(senderEmail.value.length == 0) { 
		  senderEmail.select(); 
		  alert("Please enter your email."); 
		  return false; 
		  }
		if(3 > senderEmail.value.indexOf("@")){
			senderEmail.select(); 
		  	alert("Please enter a valid email address."); 
			return false;
			} else if (senderEmail.value.indexOf(".")<8){
				senderEmail.select(); 
			  	alert("Please enter a valid email address."); 
				return false;
				} else if (senderEmail.value.length < (senderEmail.value.indexOf(".")+3)){
					senderEmail.select();
					alert("It is important you leave us a valid email address.");
					return false;
				} 
		//END Email Validation
		if (recName.value==""){
			alert("Please enter your friend's name so we can properly address your friend with this message.");
			document.getElementById("recNameError").innerHTML="required* ";
			recName.select();
			return false;
			}
		//BEGIN Email Validation
		if(-1 == recEmail.value.indexOf("@")) { 
		   recEmail.select(); 
		   alert("Your email must have a '@'."); 
		   return false; 
       }
		if(-1 != recEmail.value.indexOf(",")) { 
		   recEmail.select(); 
		   alert("Your email must not have a ',' in it"); 
		   return false; 
		   }
		if(-1 != recEmail.value.indexOf("#")) { 
		   recEmail.select(); 
		   alert("Your email must not have an '#' in it." ); 
		   return false; 
		   }
		if(-1 != recEmail.value.indexOf("!")) { 
		   recEmail.select(); 
		   alert("Your email must not have a '!' in it." ); 
		   return false; 
		   }
		if(-1 != recEmail.value.indexOf(" ")) { 
		   recEmail.select(); 
		   alert("Your email must not have a space in it." ); 
		   return false; 
		   }
		if(recEmail.value.length == (recEmail.value.indexOf("@")+1) ) {
		   recEmail.select();
		   alert("Your email must have a domain name after the '@'.");
		   return false;
		   }
	
		if(recEmail.value.length == 0) { 
		  recEmail.select(); 
		  alert("Please enter your email."); 
		  return false; 
		  }
		if(3 > recEmail.value.indexOf("@")){
			recEmail.select(); 
		  	alert("Please enter a valid email address."); 
			return false;
			} else if (recEmail.value.indexOf(".")<8){
				recEmail.select(); 
			  	alert("Please enter a valid email address."); 
				return false;
				} else if (recEmail.value.length < (recEmail.value.indexOf(".")+3)){
					recEmail.select();
					alert("It is important you leave us a valid email address.");
					return false;
				} 
		//END Email Validation
		if (custNotes.value==""){
			alert("Please enter a message to your friend.");
			document.getElementById("custNotesError").innerHTML="required* ";
			custNotes.select();
			return false;
			}
		if(securityQuestion.value!=="6"){
			securityQuestion.focus();
			alert("Please answer the security question. This prevents SPAM and helps to keep your information safe from hackers.");
			return false;
		}
		else
		
		document.hughesTell.action="tellReceived.asp";
		return true
	}
}
