$(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"});
  });

  $(".button").click(function() {
		// validate and process form
		// first hide any error messages
    $('.error').hide();
		
	  var userstofollow = $("input#userstofollow").val();
	  var baseurl = $("input#baseurl").val();
	 
		if (userstofollow == "") {
		$("label#userstofollow_error").fadeIn(3000);           
		$("input#userstofollow").focus();
		$("label#userstofollow_error").fadeOut(1000);
      return false;
    }
				
		var dataString = 'userstofollow='+ userstofollow + '&baseurl=' + baseurl;
		//alert (dataString);return false;
		$.ajax({
		type: "POST",
		url: baseurl +"action.php",
		data: dataString,
		success: function(data) {
		$('#contact_form').html("<div id='message'>" + data + "</div>");
      return false;
      }
     });
    return false;
	});
});
runOnLoad(function(){
  $("input#userstofollow").select().focus();
});
