function OldIsEmail(email) {
var tmp = "" + email + "", s = tmp.replace(/^\s*|\s*$/g, ""), re = /^(\w|[^_]\.|[\-])+((\@){1}([^_]))(([a-z]|[\d]|[\-]|\.)+|([^_]\.[^_])*)+\.[a-z]{2,4}$/i
if (!re.test(s)) {return false;}
re = /\.(a[c-gil-oq-uwz]|b[a-bd-jm-or-tvwyz]|c[acdf-ik-orsuvx-z]|d[ejkmoz]|e[ceghr-u]|f[i-kmorx]|g[abd-ilmnp-uwy]|h[kmnrtu]|i[delm-oq-t]|j[emop]|k[eg-imnprwyz]|l[a-cikr-vy]|m[acdghk-z]|n[ace-giloprtuz]|om|p[ae-hk-nrtwy]|qa|r[eouw]|s[a-eg-ort-vyz]|t[cdf-hjkm-prtvwz]|u[agkmsyz]|v[aceginu]|w[fs]|y[etu]|z[admrw]|com|edu|net|org|mil|name)$/i
return re.test(s);
}
function IsEmail(email)
{
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
if (filter.test(email)) {return true}
else {return false};
}
function NoSpam() {
//spam protection:
document.write ('' + 'contact' + '@' +'lucianafonseca.com' + '')
}
function checkform() {
if (document.formcontact.email.value != 'anonymous')
{
mname=document.formcontact.name;
if (mname.value.length <= 0)
{
descin('Please, tell me your name...');
mname.focus();
return (false);
}
memail=document.formcontact.email;
if (memail.value.length <= 0)
{
descin('I am going to need your email in order to reply to you...');
memail.focus();
return (false);
}
if ((!IsEmail(memail.value)) && (document.formcontact.email.value != 'anonymous'))
{
descin('Bad email format...');
memail.focus();
return (false);
}
}
mbody=document.formcontact.textbody;
if (mbody.value.length <= 0)
{
descin('Don\'t you want to write me a message?... OK');
mbody.focus();
return (false);
}
descin('Data is OK. Click on the "send!" button to submit the form');
}
function descin(html){
if (document.getElementById){document.getElementById("desc_element").innerHTML=html;}; else {desc_element.innerHTML=html}
}
function validate(){
mname=document.formcontact.name;
if (mname.value.length <= 0)
{
descin('Please, tell me your name... or select anonymous');
mname.focus();
return (false);
}
memail=document.formcontact.email;
if ((memail.value.length <= 0) && (document.formcontact.email.value != 'anonymous'))
{
descin('Please, enter your email address or select anonymous');
memail.focus();
return (false);
}
if ((!IsEmail(memail.value)) && (document.formcontact.email.value != 'anonymous'))
{
descin('Bad email format... please enter a valid one');
memail.focus();
return (false);
}
document.formcontact.submit();
return(true);
}
function set_anonymous() {
if (document.formcontact.anonymous.checked) {
tempname=document.formcontact.name.value;
tempemail=document.formcontact.email.value;
document.formcontact.email.className='disabled';
document.formcontact.name.className='disabled';
document.formcontact.email.value='anonymous';
document.formcontact.name.value='anonymous';
document.formcontact.name.disabled=true;
document.formcontact.email.disabled=true;
}
else
{
document.formcontact.name.disabled=false;
document.formcontact.email.disabled=false;
document.formcontact.email.className='form';
document.formcontact.name.className='form';
document.formcontact.email.value=tempemail;
document.formcontact.name.value=tempname;
}
}