
var _win;

function pop_up( _url, _name, _width, _height, _center, _resize, _posleft, _postop, _menubar ) {
         
    var _x, _y = 0;
    var _offset = 20;
        
    _width = parseInt(_width) + _offset;
    _height = parseInt(_height)  + _offset;

    if ( ( parseInt(navigator.appVersion) >= 4 ) && ( _center != 0 ) )
    {
        _x = ( ( screen.width - _width ) / 2 );
        _y = ( ( screen.height -_height ) / 2 );
    }

    else
    {
        _x = _posleft;
        _y = _postop;
    }

    _menubar = _menubar ? "menubar=yes" : "menubar=no";

    if ( typeof _win != 'undefined' || _win != null )
    {
        if ( !_win.closed )
        {
            _win.location    =  _url;
            _win.resizeTo(_width, _height);

            var _scrWidth = _win.innerWidth || _win.document.body.clientWidth;
            var _scrHeight = _win.innerHeight || _win.document.body.clientHeight;

            _width = ( _scrWidth >= _width ) ? ( _scrWidth - _width ) : ( _width - _scrWidth );
            _height = ( _scrHeight >= _height ) ? ( _scrHeight - _height ) : ( _height - _scrHeight );
                        
            _win.resizeBy( _width, _height );
        }

        else
        {
            _win = window.open( _url, _name, 'width='+_width+', height='+_height+', top='+_y+', left='+_x+', resizable=yes, scrollbars=yes, location=no, directories=no, status=no, '+_menubar+', toolbar=no');
        }
    }

    else
    {
        _win = window.open( _url, _name, 'width='+_width+', height='+_height+', top='+_y+', left='+_x+', resizable=yes, scrollbars=yes, location=no, directories=no, status=no, '+_menubar+', toolbar=no');
    }

    _win.opener  =   self;
    _win.focus();
}
