window.addEvent('domready', function(){
			//inizializza dropdown
			
			new DropdownMenu($('mnu-navigazione'));	
			$$('div.nav-element').setStyle('opacity',0.9);
		   	//prodotti
			if ((document.getElementById('sel-list-prodotto'))){				
				$('selprod').addEvent('change', function(e){
				e = new Event(e).stop();
				var selIndex = $('selprod').selectedIndex;
				var index = $('selprod').options[selIndex].value; 
				var url = "prodotti.php?id="+index;
					new Ajax(url, {
						method: 'get',
						update: $('list-descrizione')
					}).request();
					var urlPhoto = "photo.php?id="+index;
					new Ajax(urlPhoto, {
						method: 'get',
						update: $('list-thumb'),
						onComplete: function(){
								$$('div.photobox').each(function(el,i){
								if (i ==0){
									var valore = el.getChildren().getProperty('src').toString();
									valore = valore.replace("allegati/thumb","allegati");
									$('list-photo').SetVariable('imgDaCaricare', valore);
									el.addClass('active-photo');

								}
									el.addEvent('mouseenter',function(){
					    				el.setStyle('background-color','#f2f2f2');
					    				});
					    			el.addEvent('mouseleave',function(){
					    				if(!el.hasClass('active-photo')){
					    				el.setStyle('background-color','transparent');
					    				}		
					    			});
					    			el.addEvent('click', function(){
					    			var valore = el.getChildren().getProperty('src').toString();
									valore = valore.replace("allegati/thumb","allegati");
									$('list-photo').SetVariable('imgDaCaricare', valore);
									el.addClass('active-photo');
									$$('div.photobox').each(function(other,j){
				    					if (i!=j){
				    						other.removeClass('active-photo');
				    						other.setStyle('background-color','transparent');
    									}
				    				});					    				
					    			});									
								});
							}
					}).request();
				} )
				
				$$('div.photobox').each(function(el,ii){
							if (ii == 0){
								var valore = el.getChildren().getProperty('src').toString();
								valore = valore.replace("allegati/thumb","allegati");
								el.addClass('active-photo');
							}
							el.addEvent('mouseenter',function(){
					    		el.setStyle('background-color','#f2f2f2');
					    	});
					    	el.addEvent('mouseleave',function(){
					    		if(!el.hasClass('active-photo')){
					    			el.setStyle('background-color','transparent');
					    		}		
					    	});
					    	el.addEvent('click', function(){
					    		var valore = el.getChildren().getProperty('src').toString();
								valore = valore.replace("allegati/thumb","allegati");
								$('list-photo').SetVariable('imgDaCaricare', valore);
								el.addClass('active-photo');
								$$('div.photobox').each(function(other,jj){
				    			if (ii!=jj){
				    				other.removeClass('active-photo');
				    				other.setStyle('background-color','transparent');
    							}
				    		});					    				
					   	});									
					});
			};
			if ((document.getElementById('notelegali'))){
				var accordion = new Accordion('h4.toggler', 'div.element', {
					opacity: false,
					onActive: function(toggler, element){
						toggler.setStyle('color', '#666666');
					},
 
					onBackground: function(toggler, element){
						toggler.setStyle('color', '#cccccc');
					}
			}, $('notelegali'));
		
			}
		
		});
