
			
	function validatesubs()
	{
	
	var finalmessage = "You have not entered the following details:-\n\n";
	var message = "";
	var myform = document.addsubs;
	
	// do validation
		
		if  (myform.s_Subs_Name.value =='your name') 
			{
			myform.s_Subs_Name.value = '';
			}
			
		if  (myform.s_Subs_Email.value =='email address') 
			{
			myform.s_Subs_Email.value = '';
			}	
		
		if  (!myform.s_Subs_Name.value ) 
			{
			message += "your name\n" ; 
			}
		
		if  (!myform.s_Subs_Email.value ) 
			{
			message += "Your email address\n" ; 
			}
		else
			{
			var i = 1;
			var TextLength = myform.s_Subs_Email.value.length;
			var text = myform.s_Subs_Email.value
			var invalidemail = 0
			
			// look for @
			while ((i < TextLength) && (text.charAt(i) != "@"))
			{ i++
			}
			if ((i >= TextLength) || (text.charAt(i) != "@"))
				{
				invalidemail = 1 ; 
				}
				
			else i += 2;
			
			 // look for .
			while ((i < TextLength) && (text.charAt(i) != "."))
			{ i++
			}
			
			// there must be at least one character after the .
           if ((i >= TextLength - 1) || (text.charAt(i) != ".")) 
				{
				invalidemail = 1 ; 
				}
			
			
			if (invalidemail == 1)
				{
				message += "You have entered an invalid email address\n";
				}
			}	
				
			
			
		//	handle errors

		if (message)
			{
			alert(finalmessage + message);
			}
		else
			{
			myform.submit();
			}
	}