// Help fend off spam spiders
document.write('<a name="clean_contact"></a><form method="post" action="#clean_contact" name="clean_contact" id="clean_contact" onsubmit="return clean_contact_validate(this)">');
document.write('<input type="hidden" name="clean_contact_token" value="<?=clean_contact_token()?>">');
document.write('<fieldset class="clean-contact">');
document.write('<label style="float:left; margin:0px 0px 0px 20px; ">Your name: </label><input style="float:right; margin:0px 150px 0px 0px; " size="30" type="text" name="clean_contact_from_name" id="clean_contact_from_name" onchange="clean_contact_msg_clr()" /><br clear=all />');
document.write('<label style="float:left; margin:10px 0px 20px 20px; ">Email address: </label><input style="float:right; margin:10px 150px 20px 0px; " size="30" type="text" name="clean_contact_from_email" id="clean_contact_from_email"  onchange="clean_contact_msg_clr()"  /><br clear=all />');
document.write('<label style="float:left; margin:10px 0px 10px 20px; ">Your comments: </label><textarea style="float:right; margin:0px 150px 0px 0px; " name="clean_contact_body" cols="40" rows="6" onchange="clean_contact_msg_clr()" ></textarea><br clear=all /><br />');
document.write('<div class="clean-contact-msg err" id="clean_contact_msg"></div>');
document.write('<input style="margin:0px 20px 0px 20px; " type="submit" name="submit" value="Send Comments">');
document.write('</fieldset>');
document.write('</form>');
function clean_contact_validate() {
    var email  = /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/;
    var str =   /\w+/;
    if(!str.test(document.getElementById('clean_contact_from_name').value)) {
        clean_contact_msg('Please supply your Name');
        return false;
    }
    if(!email.test(document.getElementById('clean_contact_from_email').value)) {
        clean_contact_msg('Please supply a valid E-mail Address');
        return false;
    }

    if(!str.test(document.getElementById('clean_contact_body').value)) {
        clean_contact_msg('Please supply a message');
        return false;
    }
    return true;
}   
    
function clean_contact_msg(msg) {
    em = document.getElementById('clean_contact_msg');
    em.innerHTML = msg;
    em.style.display = 'block';
}   

function  clean_contact_msg_clr() {
    document.getElementById('clean_contact_msg').style.display = 'none';
    
}
function clean_contact_sent(msg,url) {
    for (var elm, i = 0; ( elm = document.clean_contact.elements[i] ); i++) {
        elm.disabled = true;
    }
    document.getElementById('clean_contact_msg').className = 'clean-contact-msg ok';
    document.getElementById('clean_contact_send').style.display = 'none';
    clean_contact_msg(msg);
    if(url) window.location = url;
}

