/**
 * Prints the sidebars
 * 
 * @author Michael Klier <*****@*****.**>
 */
function tpl_sidebar($pos)
{
    $sb_order = $pos == 'left' ? explode(',', tpl_getConf('left_sidebar_order')) : explode(',', tpl_getConf('right_sidebar_order'));
    $sb_content = $pos == 'left' ? explode(',', tpl_getConf('left_sidebar_content')) : explode(',', tpl_getConf('right_sidebar_content'));
    // process contents by given order
    foreach ($sb_order as $sb) {
        if (in_array($sb, $sb_content)) {
            $key = array_search($sb, $sb_content);
            unset($sb_content[$key]);
            tpl_sidebar_dispatch($sb, $pos);
        }
    }
    // check for left content not specified by order
    if (is_array($sb_content) && !empty($sb_content) > 0) {
        foreach ($sb_content as $sb) {
            tpl_sidebar_dispatch($sb, $pos);
        }
    }
}
/**
 * Wrapper for tpl_sidebar_dispatch with param pos=right
 */
function tpl_sidebar_dispatch_right($sb)
{
    tpl_sidebar_dispatch($sb, 'right');
}