$(document).ready(function(){   
    $('#assistenza_modal').click(function() { 
     
        $.blockUI({ 
            //theme:     true, // true to enable jQuery UI support 
            draggable: true, // draggable option is only supported when jquery UI script is included 
            //title:    'This is your title', // only used when theme == true 
            message:  $('#assistenza_pri'),
            css: { 
                width: '800px', 
                top: '150',
                left: '50%',
                border: 'none', 
                padding: '5px',
                backgroundColor: '#ffffff', 
                '-webkit-border-radius': '10px', 
                'border-radius': '10px', 
                color: '#fff',
                margin: '0 0 0 -400px' 
            } 
            //timeout:   8000   // close block after 3 seconds (good for demos, etc) 
        }); 
     
    });
    
    $('#close_primo').click(function() {  
        $.unblockUI();
    });
    
    $('#close_conse').click(function() {  
        $.unblockUI();
    });
    
    $('#torna_mes').click(function() {  
        $.blockUI({ 
            //theme:     true, // true to enable jQuery UI support 
            draggable: true, // draggable option is only supported when jquery UI script is included 
            //title:    'This is your title', // only used when theme == true 
            message:  $('#assistenza_pri'),
            css: { 
                width: '800px', 
                top: '150',
                left: '50%',
                border: 'none', 
                padding: '5px',
                backgroundColor: '#ffffff', 
                '-webkit-border-radius': '10px', 
                'border-radius': '10px', 
                color: '#fff',
                margin: '0 0 0 -400px' 
            } 
            //timeout:   8000   // close block after 3 seconds (good for demos, etc) 
        }); 
    });
    
    $('#conse_modal').click(function() {  
        $.blockUI({ 
            //theme:     true, // true to enable jQuery UI support 
            draggable: true, // draggable option is only supported when jquery UI script is included 
            //title:    'This is your title', // only used when theme == true 
            message:  $('#consegna_pri'),
            css: { 
                width: '800px', 
                top: '150',
                left: '50%',
                border: 'none', 
                padding: '5px',
                backgroundColor: '#ffffff', 
                '-webkit-border-radius': '10px', 
                'border-radius': '10px', 
                color: '#fff',
                margin: '0 0 0 -400px' 
            } 
            //timeout:   8000   // close block after 3 seconds (good for demos, etc) 
        }); 
    });
     
    $('#scrivi_open').click(function() {  
        $.blockUI({ 
            //theme:     true, // true to enable jQuery UI support 
            draggable: true, // draggable option is only supported when jquery UI script is included 
            //title:    'This is your title', // only used when theme == true 
            message:  $('#assistenza_sec'),
            css: { 
                width: '700px', 
                top: '150',
                left: '50%',
                border: 'none', 
                padding: '5px',
                backgroundColor: '#ffffff', 
                '-webkit-border-radius': '10px', 
                '-moz-border-radius': '10px', 
                color: '#000000',
                margin: '0 0 0 -400px' 
            } 
            //timeout:   8000   // close block after 3 seconds (good for demos, etc) 
        }); 
    });
  
    $("#accountformx").validate({
        rules: {
            nome_mes: "required",
            cognome_mes: "required",
            testo_mes: "required",
            mail_mes: {
                required: true,
                email: true
            },
            confermamail_mes: {
                required: true,
                email: true,
                equalTo: "#mail_mes"
            }
        },
        messages: {
            nome_mes: "Campo obbligatorio",
            cognome_mes: "Campo obbligatorio",
            confermamail_mes: {
                required: "Inserisci un email",
                equalTo: "Email differente"
            }
        }
    });
    
    $("#formvalid_mes").click(function () {
       if ($("#accountformx").valid()) {
        $('#accountformx').submit();
       }
    });
     
});
