function form_contact_us_check(){
	var pass = true;
	//alert( $("#sysmessage_email").html().trim() );
	
	if ($("#username").val()==""){
		$("#message").html("<p>Please enter the username!</p>");
		pass = false;
	}else if ($("#password").val()==""){
		$("#message").html("<p>Please check the password!</p>");
		pass = false;
	}else if ($("#profile").val()==""){
		$("#message").html("<p>Please select the profile!</p>");
		pass = false;
	}
	return pass;
}


function form_contact_us_submit(){
		
	var error		= 0;
	var msg			= "";
	var emailReg	= /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

	var form		= $("form[id='form_contact_us']");	
	var name		= $.trim($(form).find("input[id='name']").val());
	var email		= $.trim($(form).find("input[id='email']").val());
	var comments	= $.trim($(form).find("textarea[id='comments']").val());

	if (name==""){
		error = 1;
		msg = "Please enter your name.";
	}else if ( !emailReg.test( email ) ){
		error = 1;
		msg = "Please enter a valid email address.";
	}else if (comments == ""){
		error = 1;
		msg = "Please enter your comments.";
	}
	
	$("#form_contact_us_msg").html(msg);

	if (error == 1){
		
	}else{
		var data = $(form).serialize();

		$.ajax({
			url		: "ajax_request.php?action=contact_us_process",
			data	: data,
			type	: "post",
			dataType: "json",
			async	: false,
			cache	: false,
			success : function(data) {
				if (data.STATUS=="1"){
					$("#form_contact_us_container").html("Thank you for submitting your contact us form. We will contact you as soon as possible.");
				}else{
					msg = "fail";
					$("#form_contact_us_msg").html(msg);
				}				
			}
		});
	}

	
}
