Ecco, così funziona, l'unica cosa che non riesco a fare con l'attuale codice è personalizzare il messaggio del box, sarà sicuramente una svista... qualche suggerimento?

Codice PHP:
<?php
    
if(isset($_SESSION['cart']) && sizeof($_SESSION['cart']) > 0){
    
?>
       <script type="text/javascript">
        $(document).ready(function(){
            var goingout = true;
            $('#headerPan a').click(function(){goingout = false});
            $('#leftPan a').click(function(){goingout = false});
            $('#rightPan a').click(function(){goingout = false});
            $('#footerPan ul li a').click(function(){goingout = false});
            $('#copyright a').click(function(){goingout = true});
            
            window.onbeforeunload = function (evt) {
              var lang = '<?php echo($_SESSION['settings']['language'])?>';
              var message = vocabulary[lang]['general_7'];
              if (typeof evt == 'undefined') {
                evt = window.event;
              }
              if (evt && goingout) {
                evt.returnValue = message;
                return message;
              }
            }
        });
    </script>
    <?php    
    
}
?>