// Popup
function showPopup(obj,wt){
// wt = width
    if (wt == null || wt == ''){
        wt = '650';
    }
    wt = wt + 'px';
    
    // transparent
    var blockHeight = window.getScrollHeight() + 'px';
    new Element('div', {'id': 'block'}).inject(document.body);
    $('block').setStyle('height', blockHeight)
    $('block').setOpacity('0.7');
    $('block').addEvent('click', function(){
        removeEl()
    });
    
    // loading
    new Element('img', {'id': 'loading', 'src': '/Images/Loading.gif', 'alt': 'loading', 'tilte': 'loading'}).injectAfter('block');
    
    // popup
    var iframe = new Element('iframe', {'id': 'cntPop', 'frameborder': '0', 'scrolling': 'no'});
    iframe.setStyles({'width': wt, 'height': '350px', 'position': 'absolute', 'top': '110px', 'left': '50%', 'border':'0', 'z-index': '150'});
    var marginLeft = (($(iframe).getStyle('width').toInt() / 2) * (-1) + 'px');
    iframe.setStyle('marginLeft', marginLeft);
    iframe.inject(document.body);
    iframe.src = obj;
    
    // esc
    document.addEvent('keypress', function(e){
        ie=(document.all)?true:false;
        var evt=(e)?e:(window.event)?window.event:null;
        if(evt){
            var key=(evt.charCode)?evt.charCode: ((evt.keyCode)?evt.keyCode:((evt.which)?evt.which:0));
            if(key=="27")
                removeEl()
        }
    });
}

// update property
function updateProperty(height){
    if($('cntPop') != undefined)
        $('cntPop').setStyles({'height': height, 'border': '0'})
    if($('loading') != undefined)
        $('loading').remove();
}

// remove
function removeEl(redirect){
    document.removeEvents();
    if($('loading') != null)
        $('loading').remove();
    $('cntPop').remove();
    $('block').remove();
    if(redirect != undefined)
        window.location = redirect;
}