$(function() {
  $('.error').hide();
/*  $('input.text-input').css({backgroundColor:"#FFFFFF"});
  $('input.text-input').focus(function(){
    $(this).css({backgroundColor:"#FFDDAA"});
  });
  $('input.text-input').blur(function(){
    $(this).css({backgroundColor:"#FFFFFF"});
  });*/

  $(".button123").click(function() {
		// validate and process form
		// first hide any error messages
    $('.error').hide();
		
	  	var nme = $("input#nme").val();
		if (nme == "" || nme == "Name...." ) {
      $("label#nme_error").show();
      $("input#nme").focus();
      return false;
    }
				var mail = $("input#mail").val();
				var mailpattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;  
				if (mail == "" || mail == "Email-ID....") {
				  $("label#mail_error").show();
				  $("input#mail").focus();
				  return false;
				}
				if(mailpattern.test(mail) != true)
				{
					$("label#mail_error1").show();
					$("input#mail").focus();
					return false;	
				}
	
	var msg = $("textarea#msg").val();
		if (msg == "" || msg == "Query...." ) {
      $("label#msg_error").show();
      $("textarea#msg").focus();
      return false;
    }
		
		//var dataString = 'fname='+ fname + '&lname='+ lname + '&email=' + email + '&phone=' + phone + '&skype='+ skype + '&yahoo=' + yahoo + '&gtalk=' + gtalk + '&msn='+ msn + '&comments=' + comments;
		var dataString = 'nme='+ nme + '&mail='+ mail + '&msg=' + msg;
		//alert (dataString);return false;
		
		$.ajax({
      type: "POST",
      url: "bin/footer_process.php",
      data: dataString,
      success: function() {
        $('#contact_form123').html("<div id='message123'></div>");
		$('#message123').html("<div style='float:right;'><h3>You will get reply within 24hours.<br>Thank You</h3></div>")/*.append("") */  
        .hide()
        .fadeIn(1500, function() {
          $('#message123').append("<div style='float:left;'></div>");
        });
		
      }
     });
    return false;
	});
});
runOnLoad(function(){
  $("input#nme").select().focus();
});

