$(function() {
	$('.error').hide();
	$('.text-input').css({backgroundColor:"#000"});
	$('.text-input').focus(function(){
	$(this).css({backgroundColor:"#111"});
	});
  $('.text-input').blur(function(){
    $(this).css({backgroundColor:"#000"});
  });

    $("#contact-form .button").click(function() {
		$('error').hide();
		var name = $("input#name").val();
			if (name == "") {
				$("label#name-error").show();
				$("input#name").focus();
				return false;
			}
		var email = $("input#email").val();
			if (email == "") {
				$("label#email-error").show();
				$("input#email").focus();
				return false;
			}
		var http = $("input#http").val();
			if (http == "") {
				$("label#http-error").show();
				$("textarea#http").focus();
				return false;
			}
		var message = $("textarea#message").val();
			if (message == "") {
				$("label#message-error").show();
				$("textarea#message").focus();
				return false;
			}
	
		var dataString = 'name='+ name + '&email=' + email + '&http=' + http + '&message=' + message;
//alert (dataString);return false;
		
		$.ajax({
			type: "POST",
			url: "bin/config.php",
			data: dataString,
			success: function() {
				$('#contact-form').html("<div id='message-sent'></div>");
				$('#message-sent').html("<h2>Telepathy Sent!</h2>")
			.append("<p>The universal vibrations have changed.</p><p>Isn't it exciting!</p>")
			.hide()
			.fadeIn(800, function() {
				$('#message-sent');
			});
			}
			});
		return false;
	});
});

$(document).ready(function(){
$('#name').autofill({value: 'Name:',});
$('#email').autofill({value: 'Email:',});
$('#http').autofill({value: 'http://',});
$('#message').autofill({value: 'Practice Tech Enhanced Telepathy:',});
});

(function($){$.fn.autofill=function(options){var defaults={value:'Input:',defaultTextColor:"#eee",activeTextColor:"#fff"};var options=$.extend(defaults,options);return this.each(function(){var obj=$(this);obj.css({color:options.defaultTextColor}).val(options.value).focus(function(){if(obj.val()==options.value){obj.val("").css({color:options.activeTextColor});}}).blur(function(){if(obj.val()==""){obj.css({color:options.defaultTextColor}).val(options.value);}});});};})(jQuery);
