$(function() {
	  $("#twitterBox").getTwitter({
		  userName: "bcpci",
		  numTweets: 5,
		  loaderText: "Loading tweets...",
		  slideIn: true,
		  slideDuration: 750,
		  showHeading: false,
		  headingText: "Latest Tweets",
		  showProfileLink: false,
		  showTimestamp: true
	  });
  });

//tutorial

$(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 name = $("input#name").val();
		if (name == "") {
      $("label#name_error").show();
      $("input#name").focus();
      return false;
    }
	var company = $("input#company").val();
		if (company == "") {
      $("label#company_error").show();
      $("input#company").focus();
      return false;
    }
		var email = $("input#email").val();
		if (email == "") {
      $("label#email_error").show();
      $("input#email").focus();
      return false;
    }
		var phone = $("input#phone").val();
		if (phone == "") {
      $("label#phone_error").show();
      $("input#phone").focus();
      return false;
    }
	var message = $("textarea#message").val();
		if (message == "") {
      $("label#message_error").show();
      $("textarea#message").focus();
      return false;
    }
		
		var dataString = 'name='+ name + '&company=' + company + '&email=' + email + '&phone=' + phone + '&message=' + message;
		//alert (dataString);return false;
		
		$.ajax({
      type: "POST",
      url: "./bin/process.php",
      data: dataString,
      success: function() {
        $('.contentRight').html("<div id='thankyou'></div>");
        $('#thankyou').html("<h2>Contact Form Submitted!</h2>")
        .append("<p>We will be in touch soon.</p>")
        .hide()
        .fadeIn(1500, function() {
          $('#thankyou').append("<img id='checkmark' src='images/check.png' />");
        });
      }
     });
    return false;
	});
});


