		function sendFriend(){
			var txtbox = "<form method='post' name='fform' onSubmit='return checkFriend();'><br /><input type='text' name='friend' onFocus=\"this.value='';this.onFocus=null;\" value='enter your name' style='font-family:arial, helvetica, sans-serif;font-size:12px;width:196px;height:15px;background:#f9ead6;'><br /><br /><input type='text' name='friendn' onFocus=\"this.value='';this.onFocus=null;\" value=\"enter your friend\'s name\" style='font-family:arial, helvetica, sans-serif;font-size:12px;width:196px;height:15px;background:#f9ead6;'><br /><br /><input type='text' name='friende' onFocus=\"this.value='';this.onFocus=null;\" value=\"enter your friend\'s email address\" style='font-family:arial, helvetica, sans-serif;font-size:12px;width:200px;height:15px;background:#f9ead6;'><br /><br /><textarea name='friendm' onFocus=\"this.value='';this.onFocus=null;\" style='font-family:arial, helvetica, sans-serif;font-size:12px;width:200px;height:60px;background:#f9ead6;'>optional message</textarea><br /><input type='image' id='sub' align='left' src='../images/invite_friend_button.png' value='Submit' alt='Submit' /><input type='hidden' name='f' value='t' /></form>";
			document.getElementById('stxtFriend').innerHTML = txtbox;
		}
		
		function checkFriend(){
			var email = emailCheck(document.fform.friende.value);
			var errmsg = '';
				if(document.fform.friend.value == 'enter your name' || document.fform.friend.value == ''){
					errmsg += '- You must enter a friends name\n';
				}
				if(document.fform.friendn.value == "enter your friend\'s name" || document.fform.friendn.value == ''){
					errmsg += '- You must enter a friends name\n';
				}
				if(email != true){
					errmsg += email;
				}
				if(errmsg){
					alert(errmsg);
					return false;
				}
			return true;
			document.getElementById('sub').disabled = true;
			setTimeout("document.getElementById('sub').disabled = false;", 3000);
			document.forms['fform'].submit();
		}
		
		function emailCheck (emailStr) {
			emailStr = emailStr.toLowerCase();
			var checkTLD=1;
			var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|us)$/;
			var emailPat=/^(.+)@(.+)$/;
			var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
			var validChars="\[^\\s" + specialChars + "\]";
			var quotedUser="(\"[^\"]*\")";
			var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
			var atom=validChars + '+';
			var word="(" + atom + "|" + quotedUser + ")";
			var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
			var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
			var matchArray=emailStr.match(emailPat);
				if (matchArray==null) {
					return("- Email address seems incorrect (check @ and .'s)\n");
			}
			var user=matchArray[1];
			var domain=matchArray[2];
				for (i=0; i<user.length; i++) {
					if (user.charCodeAt(i)>127) {
						return("- This username contains invalid characters.\n");
					}
				}
				for (i=0; i<domain.length; i++) {
					if (domain.charCodeAt(i)>127) {
						return("- This domain name contains invalid characters.\n");
					}
				}
				if (user.match(userPat)==null) {
					return("- The username doesn't seem to be valid.\n");
				}
			var IPArray=domain.match(ipDomainPat);
				if (IPArray!=null) {
					for (var i=1;i<=4;i++) {
						if (IPArray[i]>255) {
							return("- Destination IP address is invalid!\n");
						}
					}
				return true;
				}
			var atomPat=new RegExp("^" + atom + "$");
			var domArr=domain.split(".");
			var len=domArr.length;
				for (i=0;i<len;i++) {
					if (domArr[i].search(atomPat)==-1) {
						return("- The domain name does not seem to be valid.\n");
					}
				}
				if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) {
					return("- The address must end in a well-known domain or two letter " + "country.\n");
				}
				if (len<2) {
					return("- This address is missing a hostname!\n");
				}
			return true;
		}