var NETSCAPE4 = (document.layers);
var theWin
var theWin1
var theWin2
var theWin3

function viewImage (thePic,theWidth,theHeight) {
if (NETSCAPE4) {
alert('Image Viewer Incompatible with Netscape 4');
} else {
        if (theWin && !theWin.closed) {
         // alert(theWin);
          theWin.document.close();
        }
	addScrolls="no";
	theWinWidth = theWidth+10;
	theWinHeight = theHeight+129;
	if(screen && theWinWidth>screen.width){
		winw=screen.width-30;
		xoff=15;
		addScrolls="yes";
	}else{
		winw=theWinWidth;
		xoff=(screen.width/2)-(theWinWidth/2);
	}
	if(screen && theWinHeight>screen.height){
		winh=screen.height-20;
		yoff=10;
		addScrolls="yes";
	}else{
		winh=theWinHeight;
		yoff=(screen.height/2)-(theWinHeight/2);
	}
	newWin="scrollbars="+addScrolls+",menubar=no,status=no,resizable=no,width="+winw+",height="+winh+",screenX="+xoff+",screenY="+yoff+",top="+yoff+",left="+xoff;
  	theWin=window.open("","Crendo",newWin);
 
  	theWin.document.write('<HTML><title>Crendo Image Viewer</title><style>body { margin:0px; }</style><BODY bgcolor="#FFFFFF"><center><br><a href="javascript:window.close()"><img src="/images/closewinbut.gif" border="0" width="89" height="10" alt="close window"></a></center><br><a href="javascript:close()"><img src="' + thePic + '" border=0></a></BODY></HTML>');
 
  	//theWin.document.title = "Foo";
  	//theWin.document.bgColor = "#CCCCCC"
	theWin.resizeTo(winw,winh);
	theWin.focus();
	}
}

function viewPage (thePage,theWidth,theHeight) {
//alert('width: ' + theWidth + ' height: ' + theHeight);
if (NETSCAPE4) {
alert('Image Viewer Incompatible with Netscape 4');
} else {
 if (theWin1 && !theWin1.closed) {
         // alert(theWin1);
          theWin1.document.close();
        }
	addScrolls="no";
	xoff = 100; yoff = 100;
	winw = theWidth;
	winh = theHeight;
	addScrolls="no";
	newWin="scrollbars="+addScrolls+",menubar=no,resizable=no,width="+winw+",height="+winh+",screenX="+xoff+",screenY="+yoff+",top="+yoff+",left="+xoff;
  	theWin1=window.open(thePage,"DImages",newWin);
	theWin1.resizeTo(winw,winh);
	theWin1.focus();
	}
}

function viewPage1 (thePage,theWidth,theHeight) {
//alert('width: ' + theWidth + ' height: ' + theHeight);
if (NETSCAPE4) {
alert('Image Viewer Incompatible with Netscape 4');
} else {
 if (theWin2 && !theWin2.closed) {
         // alert(theWin2);
          theWin2.document.close();
        }
	addScrolls="no";
	xoff = 100; yoff = 100;
	winw = theWidth;
	winh = theHeight;
	if (screen && screen.height) {
	  winh = screen.height - 130
        }
	addScrolls="yes";
	newWin="scrollbars="+addScrolls+",menubar=no,resizable=no,width="+winw+",height="+winh+",screenX="+xoff+",screenY="+yoff+",top="+yoff+",left="+xoff;
  	theWin2=window.open(thePage,"DImages1",newWin);
	theWin2.resizeTo(winw,winh);
	theWin2.focus();
	}
}

function viewPage2 (thePage,theWidth,theHeight) {
//alert('width: ' + theWidth + ' height: ' + theHeight);
if (NETSCAPE4) {
alert('Image Viewer Incompatible with Netscape 4');
} else {
 if (theWin3 && !theWin3.closed) {
         // alert(theWin3);
          theWin3.document.close();
        }
	addScrolls="no";
	xoff = 100; yoff = 100;
	winw = theWidth;
	winh = theHeight;
	addScrolls="no";
	newWin="scrollbars="+addScrolls+",menubar=no,resizable=no,width="+winw+",height="+winh+",screenX="+xoff+",screenY="+yoff+",top="+yoff+",left="+xoff;
  	theWin3=window.open(thePage,"DImages2",newWin);
	theWin3.resizeTo(winw,winh);
	theWin3.focus();
	}
}


function viewPageScroll (thePage,theWidth,theHeight) {
if (NETSCAPE4) {
alert('Image Viewer Incompatible with Netscape 4');
} else {
 if (theWin1 && !theWin1.closed) {
         // alert(theWin1);
          theWin1.document.close();
        }
	addScrolls="no";
	xoff = 100; yoff = 100;
	winw = theWidth;
	winh = theHeight;
	addScrolls="yes";
	newWin="scrollbars="+addScrolls+",menubar=no,resizable=no,width="+winw+",height="+winh+",screenX="+xoff+",screenY="+yoff+",top="+yoff+",left="+xoff;
  	theWin1=window.open(thePage,"DImages3",newWin);
	theWin1.resizeTo(winw,winh);
	theWin1.focus();
	}
}

function openWebWin (theURL, width) {
    height = screen.height - 300;
    features = 'resizable=no, scrollbars=yes, location=yes, toolbar=no, status=yes, menubar=no, left=100, top=100, width=' + width + ', height=' + height;
    //  alert(features);
    theWin = window.open(theURL, 'theWin', features);
    theWin.focus();
}

