/*

 * By Mario Zambon (http://www.urbangap.com)

 * Copyright (c) 2008 cody urbangap

 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php

*/



function mda() {

	

	// Funione transizioni

	function fx(el, tmp, type) {el.set(type, {duration: tmp, transition: Fx.Transitions.linear})}	


	var mnTool = $$('#tool li a')
	mnTool.set('opacity', 0.5)
	mnTool.each(function(item, index){
		if (item.hasClass('active')) {
			item.set('opacity', 1)
			item.addEvent('click', $lambda(false))
			item.setStyle('cursor', 'default')
		}
	})



	// Effetti lingue

	/*var mnLang = $$('.mnLang a')

	fx(mnLang, 300, 'morph')

	if (mnLangActive=='it') {

		mnLang[0].addClass('active')

		mnLang[0].addEvent('click', $lambda(false))

		mnLang[1].addEvents({

			'mouseover': 	function(){ this.morph('.mnLangIn')  },

			'mouseleave': 	function(){ this.morph('.mnLangOut') }

		})

	} 

	if (mnLangActive=='en') {

		mnLang[1].addClass('active')

		mnLang[1].addEvent('click', $lambda(false))

		mnLang[0].addEvents({

			'mouseover': 	function(){ this.morph('.mnLangIn')  },

			'mouseleave': 	function(){ this.morph('.mnLangOut') }

		})

	}

*/



	// Effetti menu Principale

	var mn = $$('#mnit a', '#mnen a')

	mn.removeProperty('title')

	mn.each(function(item, index){

		var i = index

		if (i==mnActive) {

			item.addClass('active')

			//item.addEvent('click', $lambda(false))

		} else {

			fx(item, 250, 'tween')

			item.addEvents({

				'mouseover': 	function(){ this.tween('opacity', 0.1) },

				'mouseleave': 	function(){ this.tween('opacity', 1) }

			})

		}

	})

	

	// Effetti menu di secondo livello

	

	var mnII = $$('.mnII a')	

	mnII.removeProperty('title')

	mnII.set('opacity', 0.4)

	mnII.each(function(item, index){

		var i = index

		if (item.hasClass('active')) {

			//item.addClass('active')

			item.addEvent('click', $lambda(false))

			item.set('opacity', 1)

		} else {

			fx(item, 250, 'tween')

			item.addEvents({

				'mouseover': 	function(){ this.tween('opacity', 1) },

				'mouseleave': 	function(){ this.tween('opacity', 0.4) }

			})

		}

	})

	

	/*var lnk = $$('a.lnk', '.lnk a')

	lnk.each(function(item, index){

		fx(item, 250, 'morph')

		item.addEvents({

			'mouseover': 	function(){ this.morph('.lnkIn') },

			'mouseleave': 	function(){ this.morph('.lnkOut')}

		})

	})

	var*/ 

	lnk = $$('a.lnk', '.lnk a', 'p.lnk')

	lnk.set('opacity', 0.6)

	lnk.each(function(item, index){

		fx(item, 150, 'tween')

		item.addEvents({

				'mouseover': 	function(){ this.tween('opacity', 1) },

				'mouseleave': 	function(){ this.tween('opacity', 0.6) }

		})

	})







}

window.addEvent('domready', mda)


