NXcreatePopup = function(div_id, width, height) {
    div_node = $(div_id);
    // save inner html of this div in a temp variable;
    temp_inner_html = div_node.innerHTML;
    // create table with css
    table = '<table class="popup" cellspacing="0" cellpading="0">'+
                '<tr class="top">'+
                    '<td class="left"></td><td class="middle"></td><td class="right"></td>'+
                '</tr>'+
                '<tr class="middle">'+
                    '<td class="left"></td><td class="middle">'+temp_inner_html+'</td><td class="right"></td>'+
                '</tr>'+
                '<tr class="bottom">'+
                    '<td class="left"></td><td class="middle"></td><td class="right"></td>'+
                '</tr>'+
            '</table>';

    //div_node.innerHTML = table;
    body = document.body;
    new_div = document.createElement('div');
    div_node.parentNode.removeChild(div_node);
    new_div.id = div_id;
    new_div.innerHTML = table;
    body.appendChild(new_div);
    div_node = new_div;
    // applying css options for the popup:
    div_node.style.position = 'absolute';
    div_node.style.zIndex = '10002';
    
    // calculating left position:
    div_node.style.top = '-9999px';
    div_node.style.left = '50%';
    div_node.style.display = 'block';
    calculatedLeftPosition = div_node.offsetWidth/2;
    div_node.style.display = 'none';

    div_node.style.top = '70px';
    div_node.style.marginLeft = -calculatedLeftPosition + 'px';
}
