/*
 * mootools 1.2
 * 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 sira() {
	//var mnActive

	// Funione transizioni
	function fx(el, tmp, type) {el.set(type, {duration: tmp, transition: Fx.Transitions.linear})}	
	
	//target blank
	var lnk = $$('a.blank')
	//var txt = ''
	
	lnk.addEvent('click', $lambda(false))
	lnk.each(function(item, index){
		//var title = item.getProperty('title')
		//item.setProperty('title', title+' '+txt)
		item.addEvent('click', function(event){
			window.open(this)
		})
	})
	
	
	// Effetti menu Principale
	var mn = $$('.mn 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) }
			})
		}
	})


	var opc = 0.6
	var lnk = $$('a.lnk', '.lnk a')
	lnk.set('opacity', opc)
	lnk.each(function(item, index){
		fx(item, 150, 'tween')
		item.addEvents({
				'mouseover': 	function(){ this.tween('opacity', 1) },
				'mouseleave': 	function(){ this.tween('opacity', opc) }
		})
	})

	// Effetti rollover rivista
	var lnk2	= $$('a.lnk2')
	fx(lnk2, 250, 'tween')
	var opc2 = 0.46
	lnk2.set('opacity', 1)
	lnk2.addEvents({
		'mouseover': 	function(){ 
			lnk2.tween('opacity', opc2)
			this.tween('opacity', 1)
		},
		'mouseleave': 	function(){ 
			lnk2.tween('opacity', 1)
			this.tween('opacity', 1)
		}
	})
	
	
	// Effetti menu di secondo livello
	var mnII = $$('.mnII a');
	mnII.removeProperty('title')
	mnII.set('morph', {duration: 500, transition: Fx.Transitions.Expo.easeOut})
	mnII.addEvents({
		'mouseover': 	function(){ if(!this.hasClass('active')) this.morph('.mnIIOver') },
		'mouseleave': 	function(){ if(!this.hasClass('active')) this.morph('.mnIIOut') }
	})
}
window.addEvent('domready', sira)
