function initRadios(){
	var planForm = $('planForm');
	if(!planForm) return;
	var radios = planForm.getElements('input[type=radio]');
	radios.each(function(rad){
		[rad, rad.getNext()].each(function(el){
			el.addEvent('click', function(){
				planForm.getElements('.btnAdd').addClass('invisible');
				this.getParent().getParent().getElement('.btnAdd').removeClass('invisible');
			});
		});
	});	
}

function initQuickHelp(){
	var tips = $$('.tips');
	if(!tips.length) return;
	var quickHelp = $('quickHelp');
	if(!quickHelp) return;
	quickHelp.fx = new Fx.Morph(quickHelp, {link: 'cancel'});
	tips.each(function(tip){
		tip.addEvents({
			'mouseenter': function(){
				quickHelp.getElement('.quickHelpContent').set('html', tip.getNext().get('html'));
				quickHelp.fx.cancel().set({'top':  tip.getCoordinates().top + 13, 'left': tip.getCoordinates().left});
				quickHelp.fx.cancel().start({
					'opacity': 1										
				});
			},
			'mouseleave': function(){
				quickHelp.fx.start({
					'opacity': 0					
				});
			}
		});
	});
}

function openPopup(url, w, h){
	var win = window.open(url, 'display', 'left=20,top=20,scrollbars=yes,resizable=yes,width=' + w + ',height=' + h);
}

window.addEvent('domready', function(){
	initRadios();
	initQuickHelp();
});