(function($) {

	$(document).ready(function () 
	{
		contact.init();
	});
	
	var contact = function()
	{
		var private = {};
		var public = {};

		public.init = function()
		{
			private.addEvents();
		}

		private.addEvents = function () 
		{

			$('#contact').submit(function (){
				if($("#email").attr("value") != $("#email2").attr("value")){
					alert("E-mails must match");
				}else{
					jQuery.post('/contact/sendEmail.php', $('#contact').serialize(), private.responseHandler);
				}
			})
		}

		private.callback = function ()
		{
			
		}

		private.responseHandler = function (data)
		{
			//$('html').animate({scrollTop:0}, 500); 
			//var thanks = $('<p></p>').html("Thank you for your inquiry. I will contact you shortly to rewiew your insurance needs.").attr({id: 'thanks'}).css({'display': 'none'})
			$('#contact').animate({opacity: 1.0}, 500).slideUp(500);
			$("#thankyou").show(500);
		}

		return public;
	}();

// end of closure
})(jQuery);
