
jQuery.fn.selectautocertificazione = function (tecnico,ordinario,itemdiv) {
	var tiposocio=$(this);
	if(tiposocio.val() != tecnico && tiposocio.val() != ordinario){
		//alert(99);
		$('#autocertificazione').dialog({
		autoOpen: true,
		modal: true,
		resizable: false,
		width: 580,
		height: 300,
		title:"Autocertificazione per soci ordinari o specializzandi non strutturati",

		buttons: {
			'ANNULLA': function() {
				tiposocio.val(controllo)
				$(this).dialog('close');
				//$("#accordion").accordion( "activate" , indexAccordion );
			},
			'DICHIARO DI ESSERE SOCIO NON STRUTTURATO': function() {
				//tiposocio.val(controllo)
				//$(this).dialog('close');
				//$("#accordion").accordion( "activate" , indexAccordion );
				//window.location.href = 'http://windows.microsoft.com/it-IT/windows/home';
				document.location = "/index/rinnova/tiposocio/"+tiposocio.val();
			}
		}

		});
	}else{
		document.location = "/index/rinnova/tiposocio/"+tiposocio.val();	
	}
}

$(document).ready(function(){

	$("button, a.button").button();
	
	/*GESTIONE BC elenco */
	$( "#bcAccordion" ).accordion();
	/*GESTIONE BC elenco */
	
	
	/*GESTIONE BC non autorizzato */
	$('#bcNonsocio').dialog({
		autoOpen: false,
		modal: true,
		resizable: false,
		width: 580,
		height: 300,
		title:"Biochimica Clinica: ACCESSO NON AUTORIZZATO!",

		buttons: {
			'Chiudi': function() {
				$(this).dialog('close');
			}
		}

	});		
	
	$('a.bcnoaccesso').click(function(event) {
		event.preventDefault();
		$('#bcNonsocio').dialog("open" );
	});


	
	/*FINE GESTIONE BC non autorizzato */
			
/* GESTIONE ERRORI NEI MODULI*/
	$('div.formErrors').dialog({
		autoOpen: true,
		modal: true,
		resizable: false,
		width: 580,
		height: 300,
		title:"Attenzione Errore!",

		buttons: {
			'Riprova': function() {
				$(this).dialog('close');
				//$("#accordion").accordion( "activate" , indexAccordion );
			}
		}

	});	
	

/*
	$("a.inevidenza").each(function (i) {
		$this.replaceWith($('#d'+$this.attr('id')));
      });
      

//	$('a.inevidenza').append($('div.daaggiungere'));
*/
//$('div.inevidenzahref').click(function(e) {document.location.href = $(this).attr('id');});


    var bloccoAperto = $("#a1");
    maxWidth = 370;
    minWidth = 35; 
 
 	$(bloccoAperto).animate({width: maxWidth+"px"}, { queue:false, duration:400, complete: function() {}});
 	$(bloccoAperto).addClass('funziona');
    $("ul li div").mouseenter(
      function(){
      	$(bloccoAperto).removeClass('funziona');
       $(bloccoAperto).animate({width: minWidth+"px"}, { queue:false, duration:400, complete: function() {
   		
  }});
        $(this).addClass('funziona');
    	$(this).animate({width: maxWidth+"px"}, { queue:false, duration:400, complete: function() {
    
  }});
    	bloccoAperto = this;
    	
      }
    );
    
    
    
    
/* GESTIONE RINNOVO QUOTE */

	$("#tipoSocio").change(function(){$(this).selectautocertificazione('19','3');});	


/* FINE GESTIONE QUOTE */    
    
});
