var http = getHTTPObject();
var targ = "";
var strHTML = "";

function AddMeToEmailList(){
	targ = "processes.asp?Process=AddMeToList&ms=" + new Date().getTime();
	http.open('GET',targ,false);
	http.send(null);
	strHTML = http.responseText;
	document.getElementById("divEmailMe").innerHTML = strHTML;
}

function SubmitEmail(){
	var thisName = document.frmEmailAddy.myName.value;
	var thisEmail = document.frmEmailAddy.myEmail.value;
	var thisValue = InStr(thisEmail, "@")
	
	if(thisName.length < 2){
		alert("This is not a valid name.");
		document.frmEmailAddy.myName.focus();
		return;
	}
	if(thisValue == -1){
		alert("This is not a valid email.");
		document.frmEmailAddy.myEmail.focus();
		return;
	}
	
	thisValue = InStr(thisEmail, ".")
	if(thisValue == -1){
		alert("This is not a valid email.");
		document.frmEmailAddy.myEmail.focus();
		return;
	}
	
	if(thisEmail.length < 8){
		alert("This is not a valid email");
		return;
	}
	
	targ = "processes.asp?Process=AddEmailAddy&myEmail="+thisEmail+
		"&myName="+thisName+"&ms=" + new Date().getTime();
		
	http.open('GET',targ,false);
	http.send(null);
	strHTML = http.responseText;
	document.getElementById("divEmailMe").innerHTML = "<strong>Thank you, I look forward to keeping you informed!</strong>";
	//document.getElementById("divEmailMe").innerHTML = strHTML;
}

function InStr(strSearch, charSearchFor){
	for(i=0; i < strSearch.length; i++){
    	if(charSearchFor == Mid(strSearch, i, 1)){
        	return i;
      	}
	}
    return -1;
}

function Mid(str, start, len){
    if (start < 0 || len < 0) return "";
    var iEnd, iLen = String(str).length;
    if(start + len > iLen)
    	iEnd = iLen;
    else
        iEnd = start + len;
    return String(str).substring(start,iEnd);
}