window.onload = function(){
	/*


	This file defines the functions to be applied to all the DOM elements of the page.

	CSS Selector : function(element){
		// Apply Javascript here
		element.onclick = function(){
			alert(this.innerHTML);
		}
	}

	The Behaviour.register(myfunctions) at the bottom of this file calls these functions.
	*/
	var myfunctions = {
		'.genericTable td' : function(element){
			/*

			This function ...
			*/
			element.onmouseover = function(){

				// highlight the td's with the alt class
				$A(element.parentNode.getElementsByTagName('td')).each(function(n, i){
					Element.addClassName(n, 'alt');
				});

				return false;
			}
			element.onmouseout = function(){

				// remove -highlight the td's with the alt class
				$A(element.parentNode.getElementsByTagName('td')).each(function(n, i){
					Element.removeClassName(n, 'alt');
				});

				return false;
			}
		},
		'h4.searchProfiles a' : function(element){
			/*

			toggles the visibility of the search profiles form
			*/
			element.onclick = function(){
				Element.toggle('searchProfilesHandle');
				this.blur();
				return false;0
			}
		},
		'.mainForm input' : function(element){
			
			element.onfocus = function(){
				Element.addClassName(this, 'active');
			}
			element.onblur = function(){
				Element.removeClassName(this, 'active');
			}
			
		},
		'.mainForm textarea' : function(element){
			
			element.onfocus = function(){
				Element.addClassName(this, 'active');
			}
			element.onblur = function(){
				Element.removeClassName(this, 'active');
			}
			
		},
		'#side form input' : function(element){
			element.onfocus = function(){
				Element.addClassName(this, 'focus');
			}
			element.onblur = function(){
				Element.removeClassName(this, 'focus');
			}
		}
	}


	/*

	Final commands
	*/
	Behaviour.register(myfunctions);
	Behaviour.apply(myfunctions)
}
