// JavaScript Document
<!--CONTACT FORM -->

function clearText(thefield) {
	if (thefield.defaultValue==thefield.value) { thefield.value = "" }
}

function replaceText(thefield) {
	if (thefield.value=="") { thefield.value = thefield.defaultValue }
}


//@params
//obj -> submit button object
//return -> post form to contact_us_email.php
function CheckEmailForm(obj){
    var d      = document;
    var email  = d.getElementById('email').value;
    var mess   = d.getElementById('message').value;
    var v_mail = /^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/;
    d.getElementById('email').className = "input";
    d.getElementById('message').className = "CommentBox";

    if(mess == "Message:"){
        d.getElementById('message').className = "CommentBox";
		alert("Please input some message!!!");
		return false;
    }
    if( !v_mail.test(email) ){
	    d.getElementById('email').className = "input";
		alert("Email address is incorrect");
		return false;
	}
    obj.value = "Sending";
    obj.disabled = true;
    d.getElementById('mail_form').submit();
}


