function DisplayForm(Form){j=Form.elements.length;var s=new String;for(i=0;i<j;i++)s+=i+', '+Form.elements[i].name+': '+Form.elements[i].value+'\n';s+='Action: '+Form.action+'\n';alert(s);}function highlight(Form){Form.focus();Form.select();}function isEmpty(Form,error){if(Form.value==""){alert(error);highlight(Form);return true}if(Form.value==" "){alert(description);highlight(Form);return true}return false}function isEmailValid(Form,error){if(isEmpty(Form,error))return false;badKeys=" /:;$%^&*()!|\~`=+'><";for(i=0;i<badKeys.length;i++){badChar=badKeys.charAt(i);if(Form.value.indexOf(badChar,0)>-1){alert("There is an invalid character in the email address. Please try again.");highlight(Form);return false}}atPos=Form.value.indexOf("@",0);if(atPos==-1){alert("There must be a @ within your customer's email address. Please try again.");highlight(Form);return false}if(atPos<1){alert("The @ character can not be your first character within the email address. Please try again.");highlight(Form);return false}if(Form.value.indexOf("@",atPos+1)!=-1){alert("Only one @ within the email address is allowed. Please try again.");highlight(Form);return false}periodPos=Form.value.indexOf(".",atPos);if(periodPos<=atPos+2){alert("Invalid email address. There should be at least 2 characters after the period. Please try again.");highlight(Form);return false}if(periodPos<atPos+1){alert("There should be at least one '.' after the @ symbol in the email address. Please try again.");highlight(Form);return false}return true}
