
var myTWin = window.myTWin; //objekt okna



function OpenMyWin(link,winName,width,height)
{
    var retValue=true;
    if (myTWin!=null && !myTWin.closed){
        myTWin.focus();
        myTWin.location.href=link.href;
    }else{
        if (width > window.screen.width-100){
            width = window.screen.width-100;
        }
        if (height > window.screen.height-100){
            height = window.screen.height-100;
        }
        
        iwidth = (window.screen.width/2) - (width/2);
        iheight = (window.screen.height/2) - (height/2);
        //iwidth = 30;
        //iheight = 150;
        
        myTWin=window.open(link.href,winName,"menubar=no,location=no,resizable=yes,scrollbars=no,status=no,width="+width+",height="+height+",left="+iwidth+",top="+iheight+",screenX="+iwidth+",screenY="+iheight);
        
        if (myTWin==null || typeof(myTWin)=="undefined"){
            retValue=false;
        }else{
            link.target=winName;
            myTWin.focus();
        }
    }
    return retValue;
}

