var winhndl;
function openw(url,width,height,scrollbars){
    var newX = 20;
    var newY = 20;
    if(scrollbars==null)scrollbars = 0;
    var wTgt = "newW";
    var wPars = "toolbar=0, scrollbars="+scrollbars+", menubar=0, status=0, resizable=1";
	
    var useragent = window.navigator.userAgent;
    var isMac = (useragent.indexOf("Mac") > -1);
    var isOpera = (useragent.indexOf("Opera") > -1);
    var operaV;
	
    newX	= parseInt((window.screen.height - height)/2);
    newY	= parseInt((window.screen.width - width)/2);
	
    if (isMac && url.indexOf("http") != 0) {
        url = location.href.substring(0,location.href.lastIndexOf('\/')) + "/" + url;
    }
	
    if (isOpera) {
        var i = useragent.indexOf("Opera");
        operaV = parseFloat(useragent.substring(i + 6, useragent.indexOf(" ", i + 8)));
        if (operaV > 7.00) {
            var isAccessible = false;
            eval("try { isAccessible = ( (winhndl != null) && !winhndl.closed ); } catch(exc) { } ");
            if (!isAccessible) {
                winhndl = null;
            }
        }
    }
    if ( (winhndl == null) || winhndl.closed ) {
		
        if (isOpera && (operaV < 7)) {
            if (url.indexOf("http") != 0) {
                winhndl = window.open(url,wTgt,wPars + ((!isFullScreen) ? ", width=" + width +", height=" + height : ""));
                if (!isFullScreen) {
                    winhndl.moveTo(newY, newX);
                }
                winhndl.focus();
                return;
            }
        }
        if (!(window.navigator.appName == "Netscape" && !document.getElementById)) {
            wPars += ", width=" + width +", height=" + height + ", left=" + newY + ", top=" + newX;
        } else {
            wPars += ", left=" + newY + ", top=" + newX;
        }
        winhndl = window.open("",wTgt,wPars);
        winhndl.resizeTo(width, height);
        winhndl.moveTo(newY, newX);
        winhndl.focus();
        with (winhndl.document) {
            open();
            write("<ht"+"ml><he"+"ad><\/he"+"ad><bo"+"dy onLoad=\"window.location.href='" + url + "'\"><\/bo"+"dy><\/ht"+"ml>");
            close();
            }
    } else {
        if (isOpera && (operaV > 7.00)) {
            eval("try { winhndl.focus();	winhndl.location.href = url; } catch(exc) { winhndl = window.open(\""+ url +"\",\"" + wTgt +"\",\""+ wPars + ", width=" + width +", height=" + height +"\"); } ");
        } else {
            winhndl.focus();
            winhndl.location.href = url;
        }
    }
}
