<!--

// Check browser type and version

var bname = navigator.appName;
var bvers = navigator.appVersion;
bvers = parseFloat(bvers.substring(0,4));

//alert(bname+", "+bvers);

// Check the users screen resolution

if (bvers >= 4.0) {
	windowW = screen.width;
	windowH = screen.height;
	}
else {
	windowW = 640;
	windowH = 480;
}

var objPicWin, width, height, dir;

function OpenWin(width, height, file, dir) {

    width = new Number(width);
    height = new Number(height);
    dir = new String(dir);
    
    //determine X and Y coordinates
    X = (windowW - width) / 2;
    Y = (windowH - height) / 2;

	if (dir.length == 0 || dir == "undefined") {
        strURL = "/amps/includes/openimage.php?file=" + file;
	}
    else {
        strURL = dir + "images/openimage.php?file=" + file;
    }
    
    //compensate for low resolutions
    if (width >= (windowW - 50) || height >= (windowH - 50)) {
        //compensate width
        if (width >= (windowW - 50)) {
            width = windowW - 50;
            X = 30;
        }
        //compensate height
        if (height >= (windowH - 50)) {
            height = windowH - 50;
        }
        strFeatures = "width="+width+",height="+height+",top=30,left="+X+",scrollbars";
    }
    else {
        strFeatures = "width="+width+",height="+height+",top=30,left="+X;
    }
    
    if (objPicWin == null || objPicWin.closed == true) {
        objPicWin = window.open(strURL,"PicWin",strFeatures);
        objPicWin.outerWidth = width;
        objPicWin.outerHeight = height;
        objPicWin.moveTo(X,30);
        objPicWin.focus();
	}
	else {
        objPicWin.close();
        objPicWin = window.open(strURL,"PicWin",strFeatures);
        objPicWin.outerWidth = width;
        objPicWin.outerHeight = height;
        objPicWin.moveTo(X,30);
        objPicWin.focus();
	}

}
//-->

