
function add()
{
    r=1;

    t=0;

    k="Please fill out these fields or correct errors:";

    if (
            document.forms[0].desir[0].checked
        ||  document.forms[0].desir[1].checked
        ||  document.forms[0].desir[2].checked
        ||  document.forms[0].desir[3].checked
        ||  document.forms[0].desir[4].checked
        ||  document.forms[0].desir[5].checked
        ||  document.forms[0].desir[6].checked
        
        ){}else{r=0;k=k+"\n Select a condo";t=1;document.forms[0].desir[0].focus();}

    if (document.forms[0].date_of_arrival.value==""){r=0;k=k+"\n Enter arrival date"; if(t==0){document.forms[0].date_of_arrival.focus();t=1}}else{

        var re = new RegExp("^([0-9]{2})/([0-9]{2})/([0-9]{4})$", 'i');
        
        if(!re.test(document.forms[0].date_of_arrival.value))
        {
            r=0;k=k+"\n Select a valid arrival date (mm/dd/yyyy)"; if(t==0){document.forms[0].date_of_arrival.focus();t=1}
        }else{
            arr = re.exec(document.forms[0].date_of_arrival.value);
            
            today = new Date;
            formArrivalDate = new Date (RegExp.$3, (RegExp.$1-1), RegExp.$2);
            if(formArrivalDate < today)
            {
                r=0;k=k+"\n Select a valid arrival date"; if(t==0){document.forms[0].date_of_arrival.focus();t=1}
            }
        }

        
    }

    if (document.forms[0].smoke[0].checked||document.forms[0].smoke[1].checked){}else{r=0;k=k+"\n Enter smoking preference";t=1;document.forms[0].smoke[0].focus();}

    if (document.forms[0].name.value==""){r=0;k=k+"\n Enter your name";if(t==0){document.forms[0].name.focus();t=1;}}

    if (document.forms[0].phone.value==""){r=0;k=k+"\n Enter phone #";if(t==0){document.forms[0].phone.focus();t=1;}}

    if (document.forms[0].street.value==""){r=0;k=k+"\n Enter street address";if(t==0){document.forms[0].street.focus();t=1;}}

    if (document.forms[0].city.value==""){r=0;k=k+"\n Enter city";if(t==0){document.forms[0].city.focus();t=1;}}

    if (document.forms[0].state.value==""){r=0;k=k+"\n Enter state";if(t==0){document.forms[0].state.focus();t=1;}}

    var reg = new RegExp("^[a-z0-9_\\.\\-]+@+[a-z0-9_\\.\\-]+(\\.[a-z]{2,4})$","gi");

    if (document.forms[0].zipcode.value==""){r=0;k=k+"\n Enter zip code";if(t==0){document.forms[0].zipcode.focus();t=1;}}

    if (document.forms[0].email.value=="" ){r=0;k=k+"\n Enter email address";if(t==0){document.forms[0].email.focus();t=1;}}else

        if (!reg.test(document.forms[0].email.value)){r=0;k=k+'\n Enter valid email address';if(t==0){document.forms[0].email.focus();t=1;}}

    if (r==1) {document.forms[0].submit();}else{alert(k);}
}

