	//make the window smaller
   function setupScreen(w,h)
     {
		self.resizeTo(w,h);
	}

//validation subroutines included even though we might not use all of them
	//returns true <==> one email address is entered
	function singleEmail(str){
		if( str.indexOf('@') > 0 && (str.indexOf('@') <= str.lastIndexOf('@')) ){
			return true;
		} else {
			return false;
		}
	}
	//make sure that text entered is in valid email address format
	function isEmail(str){
		if(str.lastIndexOf('.')>=3){
			var pattern = /\w+([\w_\-\.]+\w)?\@(\w)+([\w_\-\.]+\w)?\w+/i;
			if(pattern.exec(str) != null){
				return true;
			} else {
				return false;
			}
		} else {
			return false;
		}
	}
	//if comments exist, add an introductory statement
	function ammendComments(str){
		if(str.length>1){
			str = "\n"+document.getElementById('sendername').value+"'s comments:\n\t";
			document.getElementById('comments').value = document.getElementById('comments').value+"\n";
		} else {
			str = "";
		}
		document.getElementById('eaf').commenttag.value = str;
	}

//main validation routine
	function validateEntries(){
		var messageStr = "";
		var oneAddress = "";
		var validFormat = "";
		var namesExist = "";
		if(document.getElementById('sendername').value.length>=1 && document.getElementById('recipname').value.length>=1){
			namesExist = "";
		} else {
			namesExist = "Please enter your name and your friend's name.\n";
		}
		if(singleEmail(document.getElementById('recipemail').value)==true && singleEmail(document.getElementById('senderemail').value)==true){
			oneAddress = "";
		} else {
			oneAddress = "Please enter one email address for yourself and one email address for your friend.\n";
		}
		if(oneAddress==""){
			if(isEmail(document.getElementById('recipemail').value)==true && isEmail(document.getElementById('senderemail').value)==true){
				validFormat = "";
			} else {
				validFormat = "You have entered an invalid email address for yourself.\n";
			}
		}
		messageStr = namesExist+oneAddress+validFormat;
		if(messageStr==""){
			ammendComments(document.getElementById('comments').value);
			document.getElementById('eaf').submit();
		} else {
			alert(messageStr);
			return false;
		}
	}