window.addEvent('domready', function() {

	// tool tips
	var Tips1 = new Tips($$('.Tips1'), {
		initialize:function(){
			this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0);
		},
		onShow: function(toolTip) {
			this.fx.start(1);
		},
		onHide: function(toolTip) {
			this.fx.start(0);
		}
	});
	
	// calculator AJAX
	$('calc').addEvent('submit', function(e) {
		/**
		 * Prevent the submit event
		 */
		new Event(e).stop();

		/**
		 * This empties the log and shows the spinning indicator
		 */
		var log = $('result').empty().addClass('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('loading');
			}
		});
	});
	
});