function showError(errorText) {
    wb = document.getElementById('warningBox');
    wb.innerHTML = errorText;
    wb.style.display = '';
}
function hideError() {
    wb = document.getElementById('warningBox');
    wb.style.display = 'none';
}
function validateEmail() {
    emailBox = document.getElementById('emailAddy');
    if(emailBox.value != "") {
        if(emailBox.value.indexOf('@') != -1 && emailBox.value.indexOf('.') != -1) {
            checkEmailOnServer(emailBox.value);
        } else {
            showError('Please enter a valid e-mail address');
            emailBox.focus();
        }
    }
}
function checkEmailOnServer(emailAddress) {
    var soaprequest, param;
				
	param = AddXMLParameter("emailAddress", emailAddress);
	param = WrapXML("CheckEmailAddress", "xmlns='http://webservice.lifepics.com'", param);

	soaprequest = CreateSOAPRequestXML(param);
	
	SubmitSOAPRequest(soaprequest, "http://webservice.lifepics.com/CheckEmailAddress", getEmailResponse);
}
function getEmailResponse() {
    if(GotGoodResponse()) {
        var dom = http.responseXML;
        var emailStatusNode = dom.getElementsByTagName("EmailStatus")[0];
        var emailStatus = emailStatusNode.firstChild.nodeValue;

	    if(emailStatus == "valid") {
	        hideError();
	    } else {
	        showError("I'm sorry, there is no account for this e-mail address.");
	        document.getElementById('emailAddy').focus();
	    }
    }
}