window.addEvent('domready',function() {
	/* start menu mouseover, mouseout and click script */
	if($$('.buttonOff')) {
		/* loop through all divs to detect events */
		$$('.buttonOff .center').each(function(el) { 
			/* get parent table object */
			var t = el.getParent().getParent().getParent().getParent();
			/* set transition state */
			t.trans = false;
			/* mouseover event */
			el.addEvent('mouseover',function() {
				if(t.hasClass('buttonOff')&&t.trans==false) {
					/* set classes */
					t.removeClass('buttonOff');
					t.toggleClass('buttonOn');
					t.trans=false;
				}
			});
			/* mouseout event */
			el.addEvent('mouseout',function() {
				if(t.hasClass('buttonOn')&&t.trans==false) {
					t.trans=true;
					/* fade out and set classes */
					try { var myFx = new Fx.Style(t, 'opacity').start(1,0.1); } catch(err) {};
					(function() { t.removeClass('buttonOn'); t.toggleClass('buttonOff'); t.setOpacity(1); t.trans=false; }).delay(550); 
				}
			});
			/* click event */
			el.addEvent('click',function() {
				/* get the text within the div and format it as a link */
				try{ var str = el.getText(); } catch(err) { if(err) { var str = el.get('text'); } }
				str = str.toLowerCase();
				window.location = "/" + str.replace(" ","") + "/";
			});
		}); 
	};
	/* stop menu mouseover, mouseout and click script */
});