// JavaScript Document
$(document).ready(function(){
$("#sendmail").click(function(){
var valid = '';
var isr = ' is required.';
var name = $("#name").val();
var email = $("#email").val();
var phone = $("#phone").val();
var comment = $("#comment").val();
if (name.length<1) {
valid += '<br />Name'+isr;
}
if (!email.match(/^([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4}$)/i)) {
valid += '<br />A valid Email'+isr;
}
if (phone.length<1) {
valid += '<br />Phone'+isr;
}
if (comment.length<1) {
valid += '<br />Comment'+isr;
}
if (valid!='') {
$("#response").fadeIn("slow");
$("#response").html("<strong>Error</strong>:"+valid);
}
else {
var datastr ='name=' + name + '&email=' + email + '&phone=' + phone + '&comment=' + comment;
$("#response").css("display", "block");
$("#response").html("Sending order assistance request to hampers & Co. now …. ");
$("#response").fadeIn("slow");
setTimeout("send('"+datastr+"')",4000);
}
return false;
});
});
function send(datastr){
$.ajax({
type: "POST",
url: "../order-assist-email.php",
data: datastr,
cache: false,
success: function(html){
$("#response").fadeIn("slow");
$("#response").html(html);
setTimeout('$("#response").fadeOut("slow")',4000);
}
});
}