window.addEvent('domready', function(){
	scrolling = false;
	if ($('form_container'))
	{
		var scroller = new Fx.Scroll(window, {duration: 600, wait: false, transition: Fx.Transitions.sineInOut});
		
		// Disclaimer link
		$$('#form_container h2').each(function(h2){
			var text = h2.getText();
			var container = h2.getNext();
			var trigger = new Element('a', {
				'href': '#'
			});
			trigger.setText(text);
			h2.empty();
			trigger.injectInside(h2);
			var slider = new Fx.Slide(container, {duration: 700});
			slider.hide();
			h2.addEvent('click', function(e){
				scrolling = true;
				e = new Event(e).stop();
				slider.toggle().chain(function(){
					if (h2.getNext().getStyle('height').toInt() > 0)
					{
						//scroller.toElement(h2);
					}
				});
			});
		});
		
		// Error alert
		function error(el, message)
		{
			alert(message);
			el.value = '';
		}
		
		// Amount text field
		$('pf_cost').addEvent('blur', function(){
			if ((isNaN($('pf_cost').value - 1) == false) && ($('pf_cost').value < 500) && ($('pf_cost').value != '') && ($('pf_cost').value != null))
			{
				//error($('pf_cost'), 'Please enter an amount over 499');
			}
		});
		
		// Resize positioning for ie
		if ((window.ie) && (scrolling == false))
		{
			window.addEvent('resize', function(){
				//history.go(0);
			});
		}
	}
});