$(function() {
	$('.error').hide();
	$("input#email").focus(function(){
		if (this.value == this.defaultValue) {
			this.value = ''
		} 
		if(this.value != this.defaultValue) {
				this.select();
		}
	});
	$('input#email').blur(function() {
		if ($.trim(this.value =='')){
				this.value = (this.defaultValue ? this.defaultValue : '');
		}
	});
	
	$('#submit').click(function(){
	//validate and process form here
	
	$('.error').hide();  
      var email = $("input#email").val();  
        if (email == "") {  
		  $("label#email_error").show();  
		  $("input#email").focus();  
		  return false;  
    	} 
		var dateCreated = $('input#dateCreated').val();	
		
	  var dataString = 'email='+ email + '&dateCreated=' + dateCreated;
	  //alert (dataString);return false;
	  $.ajax({
		type: "POST",
		url: "registration/process.php",
		data: dataString,
		success: function() {
		  $('#signup').html("<div id='message'></div>");
		  $('#message').html("<p>Thank you! We'll be in touch soon.</p>")
		  .hide()
		  .fadeIn(1500);
		}
	  });
	  return false;
  	
							
	});	   
		   
});
