I would have an array called displayed with two variables, each with a key 'right' and 'left'
Code:
var displayed = [];
displayed['right'] = ""; //id of the current displayed side on the right or nothing, if none
displayed['left'] = ""; // -------------------------------------------- left ---------------------
When the user clicks a link that opens something on the right side, the javascript would check the displayed['right'] for emptiness or an ID of the element that is there. I would then get that element, if any, and tell it to slide back into the unknown depths of side of your browser. After that, the link clicked would display the corresponding page.
Code:
if(displayed[$(this).data('side')].length != 0){
$(displayed[$(this).data('side']).toggle(500);
}
$($(this).attr('href')+'-page').toggle(500);
Bookmarks