document.write('<script language="javascript" src="/includes/javascript_s/swfobject.js"></script>');
document.write('<script language="javascript" src="/includes/javascript_s/zzads.js"></script>');
document.write('<script language="javascript" src="/includes/javascript_s/ajaxroutine.js"></script>');

function CompareEmails( email, email_confirm, id_for_result ) {

	// this function may be called when the person fills in the email or the comparison email.
	// if this function is called when the person fills in the comparison email, then we need to 
	// compare to the first email.
	// if this function is called when the person fills in the first email, then we only want to
	// compare to the comparison email if the person has already entered something in the 
	// comparison email.
	
	email.value = email.value.replace(/^\s+|\s+$/g, '') ; // trim
	email_confirm.value = email_confirm.value.replace(/^\s+|\s+$/g, '') ;	// trim
	
	
	if (email_confirm.value!='') {  // i.e. if the confirmation email has been filled out, then we need to do the comparison
	
		if ( email.value == email_confirm.value ) {
			document.getElementById(id_for_result).innerHTML = ' ';
			return true;
		} else {
			document.getElementById(id_for_result).innerHTML = 'Email addresses do not match';
			return false;
		}
		
	} else return false;
		
}

