// bubblegumking.com main JavaScript Document
var bubbles = {	
	
	makeNewsletter: function () {
		var fx = new Fx.Styles($('log_res'), {duration:1000, wait:false, transition:Fx.Transitions.Back.easeInOut});
		
		$('newsletterForm').addEvent('submit', function(e) {
			/** Prevent the submit event */
			new Event(e).stop();
			$('newsletterForm').addClass('ajax-clear');
			/** This empties the log and shows the spinning indicator */
			var log = $('log_res').empty().addClass('ajax-loading');
			/** send takes care of encoding and returns the Ajax instance.
			 *  onComplete removes the spinner from the log. */
			this.send({
				update: log,
				onComplete: function() {
					log.removeClass('ajax-loading');
					/*if($('email').getValue().test(' ')){
						
						$('newsletterForm').setStyles({
							opacity: 1,
							height: 20
						});
						
						fx.start({
						'color': '#990000'
						});
					}*/
				}
			});
		});
	},
	init: function(){		
		this.makeNewsletter();		
	}
};
//window.onDomReady will call my bubbles.init on page load
window.onDomReady(bubbles.init.bind(bubbles));
