// See http://gr0w.com/articles/code/ajax_vs_rpc_javascript_with_livesearch_example/
var Myhead, MyscrNum=0;
var Myurl="http://www.cpkp.co.uk/mail1.php"; 	//url="http://localhost/web/cpkp/rpc/rpc.php";

function MyMail(MyMail)
{	Myhead=document.getElementsByTagName('head').item(0);
	script=document.createElement('script');
	script.id='scr'+MyscrNum;
	// Create a path to the server and params peg, site_name and script_id ( required by function removeScript(scriptid) )
	script.src=Myurl + "?" + "MyMail=" + MyMail + "&" + "script_id=" + script.id;	
	script.type='text/javascript';
	script.defer=true;
	MyscrNum++;
	void(Myhead.appendChild(script));
}

function MyRemove(scriptid){	// called dynamically when PHP script "calls" it
	var old=document.getElementById(scriptid);
 	if(old){Myhead.removeChild(old);}
}