// JScript 文件
//打开窗口的集合
var openerList  = new Array();
function ShowDialog(title,url,width,height,top,left)
{

    var clone = new Array();
    for(var i =0;i<openerList.length;i++){
        var win = openerList[i];
        if(win!=null && !win.closed){
            clone.push(win);
        }
    }
    openerList = clone;
    for(var i =0;i<openerList.length;i++){
        var win = openerList[i];
        if(win.name == title){
            win.close();
            break;
        }
    }
    
    width = width == null?600:width;
    height = height == null?600:height;
    
    var top2 = parseInt(top);
    var left2 = parseInt(left);
    
    if(isNaN(top2)){
        top2=0;
    }
    
    if(isNaN(left2)){
        left2 = 0;
    }
    var topWindow = window;
    
    while(topWindow.opener!=null){
       topWindow = topWindow.opener
    }
    
    top2 += ($(topWindow).height()-height)/2; //获得窗口的垂直位置;
    left2 += ($(topWindow).width()-width)/2; //获得窗口的水平位置;
    
    
    


    var opener = window.open(url, title,'width='+width+' , height='+height+', top='+top2+', left='+left2+', toolbar=no, menubar=no,scrollbars=yes, resizable=yes,location=yes, status=no');


    openerList.push(opener);
    return opener; 
}
