Programming Style for JQuery (javascript) functionality with database user settings

Programming Style for JQuery (javascript) functionality with database user settings

Not sure where else to put this.

Using jQuery with my coding now and converting much of the plain JavaScript code over.  Would like to know what suggestions people have on organizing or controlling jQuery functions and changes it makes to a site based on a member's custom settings from a database pull? 

Programming through PHP, and right now I pull the user account from the database, along with their custom page settings (icons they want, colors, page changes, etc) and display to the page through the Smarty template engine.  javascript (and jQuery functions) are all include files.  

For me to customize some of the features in the JS files (such as popups, callbacks, page changes, etc) I need to convert the php/smarty variables into javascript (json) and then create a smarty loop in the page header inside a <script> tag.  

.. Just looks sloopy.  Really could grow into a lot of variables in the header just for customization.... 

Any suggestions you have with transferring user settings to customize the jQuery (and javascript) functions?


example
------------------------------
{* Includes Smarty Variables inside Javascript *}
<script type="text/javascript" language="javascript">
    var page_name = '{$page_name}'
    var page_id = '{$memberInfo4JQuery}'
    var browser = {$browser}
    var hasSeenAlerts = {if $dialog=='None'}0{else}1{/if}

    {foreach from=$SmartyVars item=V key=K}
        var {$K} = {$V};
    {/foreach}
</script>