// JavaScript Document
function insertEmail(subscribeType, clientId, fieldId) {
	//alert("New value = "+fieldValue);
	//alert("in updateQmoVal fieldId = "+fieldId);	
	//alert("calling GetXmlHttpObject from insertEmail");
	//alert(location.hostname);
	emailAddress=document.getElementById(fieldId).value;
	var	xmlHttp=GetXmlHttpObject();
//	alert("back in updateQmoVal");	  	
	if (xmlHttp==null)  {
  		alert ("Browser does not support HTTP Request");
  		return;
  	} 
	if (location.hostname=="localhost") {
		var url = "http://localhost/ppmld/insertEmail.php";
	}
	else {
		var url = "http://"+location.hostname+"/insertEmail.php";
	}
//	alert(url);
	url = url+'?emailAddress='+emailAddress+'&subscribeType='+subscribeType+'&clientId='+clientId;
//	alert(url);	
	xmlHttp.onreadystatechange=function() {
		//alert("in stateChanged");	
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
			//alert(xmlHttp.responseText);
			if (xmlHttp.responseText=="OK") {
				alert ("Your email address has been registered.");
			}
			else {
				alert ("Error: "+xmlHttp.responseText);	
				document.getElementById(fieldId).focus();
			}
			return;
 		}
		else {
			//alert("readyState = "+xmlHttp.readyState);
		}
	}
	//alert("back in updateQmoVal");	  	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}	