jQuery.createCenteredPopup = function(width, height, contentUrl, disablePage){
    var popupContainer = document.createElement('div');

    popupContainer.style.position="fixed"
    popupContainer.style.width = width + 'px';
    popupContainer.style.height = height + 'px';
    popupContainer.style.top = '50%';
    popupContainer.style.left = '50%';
    popupContainer.style.marginLeft = width/2*-1 + 'px';
    popupContainer.style.marginTop = height/2*-1 + 'px';
    //popupContainer.style.backgroundColor = "red";
    popupContainer.style.zIndex = '20000';
    popupContainer.id = 'popupContainer'

    jQuery(popupContainer).load(contentUrl);

    //popup background page                
    if(disablePage)
    {
        var popupBackgroundObj = document.createElement('div');

        popupBackgroundObj.id = 'popupBackground'
        popupBackgroundObj.style.position = 'fixed';
        popupBackgroundObj.style.width = '100%';
        popupBackgroundObj.style.height = '100%';
        popupBackgroundObj.style.top = '0';
        popupBackgroundObj.style.left = '0';
        popupBackgroundObj.style.zIndex = '19999';

        document.body.appendChild(popupBackgroundObj);
    }

    document.body.appendChild(popupContainer);
}

jQuery('#popupContainer').find('.popupClose').live('click', function(){
    document.body.removeChild(document.getElementById('popupContainer'));

    var popupBackgroundObj = document.getElementById('popupBackground');

    if(popupBackgroundObj)
    {
        document.body.removeChild(popupBackgroundObj);
    }
});
