//routines for tella friend
	var cachefoil='';;
	var DisplaySpans = new Array('TAFButtonSpan','TAFFormSpan');
	function ShowSpan(SpanToShow){
		//alert ('ok');
		for (var idx in DisplaySpans){
			//alert (DisplaySpans[idx]);
			document.getElementById(DisplaySpans[idx]).style.display = 'none';
		}
		if (SpanToShow != ''){
			document.getElementById(SpanToShow).style.display = 'inline';
		}
	}
	function ajaxSetRequest(){
		cachefoil= cachefoil + randomString();
		try{
		  // Firefox, Opera 8.0+, Safari
		  xmlHttp=new XMLHttpRequest();
		}
		catch (e){
		  // Internet Explorer
		  try{
		    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		  catch (e){
		    try{
		      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		    }
		    catch (e){
		      alert("Your browser does not support AJAX!");
		      return false;
		    }
		  }
		}
		//alert ('test ok');
		return true;
	}
	
	function randomString() {
		var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
		var string_length = 18;
		var randomstring = '';
		for (var i=0; i<string_length; i++) {
			var rnum = Math.floor(Math.random() * chars.length);
			randomstring += chars.substring(rnum,rnum+1);
		}
		//alert ("rs " + randomstring);
		return randomstring;
	}
	function ajax_SendTAFMsg(){
		//alert ("ok, about to send TAF msg");
		var txname=document.getElementById("txname").value;
		var txemail=document.getElementById("txemail").value;
		var rxname1=document.getElementById("rxname1").value;
		var rxemail1=document.getElementById("rxemail1").value;
		var ipaddr='xxx';
		alert("Please wait, this will take a few seconds after you click on 'OK'");		
		var FormVars = "Function=ajaxTAFriend&txname=" + txname + "&txemail=" + txemail + "&rxname1=" + rxname1 + "&rxemail1="+rxemail1 + "&ipaddr=" + ipaddr;
		//alert("formvars " + FormVars);
		if (ajaxSetRequest()){
		 	xmlHttp.onreadystatechange=function(){
		 		//return false;
	    	if (xmlHttp.readyState==4){
	    		alert (xmlHttp.responseText);					
	    		ShowSpan('TAFButtonSpan');
				}			
	    }
	    UrltoCall= '/TellAFriend.cgi?+' + '++++++' + cachefoil;
			//alert("calling " + UrltoCall);
			//'post' method
			xmlHttp.open( "post", UrltoCall, false ); 
			xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8' ); 
			xmlHttp.send(FormVars);
		}
		else{
			alert("unable to set ajax request");
		}
	}
