
window.addEvent('domready', TB_init);
 

// add smoothbox to href elements that have a class of .smoothbox
function TB_init(){
    $$(".modale").each(function(el){
    
	  
		el.onclick = TB_ApriModale;
    });
}

function TB_ApriModale(event){
    
    var event = new Event(event);
    // stop default behaviour
    event.preventDefault();       
    // remove click border
	tmIMG =new Image();
	   tmIMG.src="../img/struttura/layer.png";
    // get caption: either title or name attribute
    var caption = this.title || this.name || "";
    		var ajax = new Request( 
		{
		url:this.href, 
		method: 'get',
		data: {NumeroRand:Math.random()},		
	    onComplete: function(RisPageAjax) {
			DDa = RisPageAjax.substr(0,RisPageAjax.indexOf('<!--fine-->')-11);
			
			
			
			$$('#cellModalea #contenuto').set('html',DDa);
	$('cellModalea').setStyle('display','block');
			$('overMod').setStyle('display','block');
	
			
			var hideM = new Fx.Morph('overMod', { 'duration': '500',
			onComplete: function(){
				
				if (Browser.Engine.trident4 ) 
					cellModalea.setStyle('opacity', 1);
				else {
					var hide = new Fx.Morph('cellModalea', {
						'duration': '500'
					});
					hide.start({
						'opacity': [0, 1]
					});
				}
			}
			 });
				hideM.start({
					'opacity': [0,0.6]
				});		
		
			$('cellModalea').setStyle('z-index','100');
		
			
			//$('cellModale').fade(1);
			}		 
 	 	}	); 
	ajax.send();	
	return false;
}
function vaiModale(caption, url, rel){
  //var INPUTDIVcrea = new Element('div' , {id: "overLayerModale"});



}

function chiudiModale(){
			var hide = new Fx.Morph('cellModalea', { 'duration': '500' });
				hide.start({
					'opacity': [1,0]
				});	
			var hideM = new Fx.Morph('overMod', { 'duration': '500' });
				hideM.start({
					'opacity': [0.6,0]
				});		
		$('cellModalea').setStyle('display','none');
			$('overMod').setStyle('display','none');
}

