window.addEvent('domready',function(){
	$$('a[href^=http]').addEvent('click',function(e){
		var l = this.href;
		if(l.substr(0,7)=='http://' && l.substr(0,20)!='http://www.matriz.it'){
			new Event(e).stop();
			if($chk(l)){
				window.open(l);
			}
		}
	});
	$$('a[rel=enclosure]').addEvent('click',function(){
		pageTracker._trackPageview('/download/'+this.get('href'));
	});
	$$('.menu ul li').each(function(li){
		var ul = li.getElement('ul');
		if($chk(ul)){
			li.addEvent('mouseover',function(){
				ul.setStyle('display','');
			}).addEvent('mouseout',function(){
				ul.setStyle('display','none');
			});
		}
	});
	var accordion_freelance = $('accordion_freelance');
	if($chk(accordion_freelance)){
		new Fx.Accordion(accordion_freelance,'div#accordion_freelance h3','div#accordion_freelance div.portfoliocontent',{
			show: 0,
			opacity: false,
			onActive: function(toggler){
				new Fx.Morph(toggler,{
					duration: 1000,
					transition: Fx.Transitions.linear
				}).start({
					'background-color': '#FFFFFF',
					'color': '#000000'
				});
			},
			onBackground: function(toggler){
				toggler.setStyles({
					'background-color': '#003300',
					'color': '#FFFFFF'
				});
			}
		});
	}
	$$('img.reflect').reflect({'height': 0.3, 'opacity': 0.5});
	/*if(Browser.Engine.trident && Browser.Engine.version<=5){
		$('content-dx').adopt(new Element('div',{'class': 'menu'}).adopt(
			new Element('h2',{'html': 'Hai un browser obsoleto!'}),
			new Element('ul').adopt(
				new Element('li',{'html': '<a href="http://www.microsoft.com/italy/windows/downloads/ie/getitnow.mspx" title="Internet Explorer" onclick="window.open(this.href);return false;">Aggiorna Internet Explorer</a>'}),
				new Element('li',{'html': '<a href="http://www.mozilla-europe.org/it/firefox/" title="Firefox" onclick="window.open(this.href);return false;">Scarica Firefox</a>'}),
				new Element('li',{'html': '<a href="http://www.opera.com/" title="Opera" onclick="window.open(this.href);return false;">Scarica Opera</a>'})
			)
		));
	}*/
});