// AidArena Tips
// By: David Rugendyke

// Scan for tips and add them if found

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

	// Initialise the tips class
	var tips = new formTips();
	
});


// Tips Class
var formTips = new Class({
	
	// Initialise the class
    initialize: function(){
		
		// Defaults
		
		// Now add the mouseover events
		this.tipEvents();
    },
	
	// Adds events to all the main menu items
	tipEvents: function(){

		var Ob = this;
		var tipItem = $$('.fieldText'); 
		
		// Attach events to each tip
		tipItem.each(function(tipEl) {
			
			// Attach an event to the input field
			$(tipEl).getElement('input').addEvents({						   
					 	'focus': function(){
							// Click on the field, show the tip
							if($(tipEl).getElement('.fieldTip')) {
								$(tipEl).getElement('.fieldTip').setStyle('display', 'block');
							}
						},
						'blur': function(){
							// Hide tip on blur
							if($(tipEl).getElement('.fieldTip')) {
								$(tipEl).getElement('.fieldTip').setStyle('display', 'none');
							}
						}	
			});
			
						
		}); // End Menu Loop
	
	}
	
});
