/************************************************
Document info
Auth : RedCat
Project : 
Location : 
Filename : lib_win_modal_open.js
Comment : 
window.open
modalDialog
************************************************/

function openWindow(url,config){
    if (url == '')
    {
        return false;
    }
    _name = config.name?config.name:url;
    _width = config.width?config.width:screen.availWidth;
    _height = config.height?config.height:screen.availHeight;
    _toolbar = config.toolbar!="1"?"no":"yes";
    _scroll = config.scroll!="1"?"no":"yes";
    _status = config.status!='1'?"no":"yes";
    _resize = config.resize!='1'?"no":"yes";
    _location = config.loc!='1'?"no":"yes";
    
    if(config.ismodal) {
        _center = config.center=='1'?"yes":"no";
        _help = config.help=="1"?"yes":"no";
        rtnval = window.showModalDialog(url,_name, "dialogWidth:"+_width+"px;dialogHeight:"+_height+"px; center:"+_center+"; help:"+_help+"; status:"+_status+"; scroll:"+_status+";");	
    }else {
        if (config.center!="1")
        {
            _left = (screen.availWidth/2) -( _width/2);
            _left = ",left="+_left;
            _top = (screen.availHeight/2) - (_height/2);
            _top = ",top="+_top;
            
        }else{
            _top = config.top?",top="+config.top:"";
            _left = config.left?",left="+config.left:"";
        }

        _fullscreen = config.fullscreen=="1"?"fullscreen,":"";
        
        if (config.wholescreen=="1")
        {
            _width = screen.availWidth;
            _height = screen.availHeight;
            if (_status == 'yes')
            {
                _height = _height - 50;
            }
			_top = ",top=0";
            _left = ",left=0";
        }
        
        rtnval = window.open(url,_name,_fullscreen+"width="+_width+",height="+_height+_top+_left+",toolbar="+_toolbar+",scrollbars="+_scroll+",status="+_status+",resizable="+_resize+",location="+_location);	
    }
    return rtnval;
}
/*
win = new Object();
win.name = "adf";
win.center = 1;
win.width = 400;
win.height = 400;
win.ismodal = 1;
dd = openWindow("sitefactory.html",win)
*/
