pu_scriptloaded = 1; // indicates whether this script has already been loaded, so it is not loaded more than once on the same page.
windowactive = 0; // indicates if there is a popup window initiated within this page open.

function open_popup(projectname, xdim, ydim) {
		if ((xdim < (screen.width - 20)) || (ydim < (screen.height - 100))) {
			popx = xdim;
			popy = ydim;
			popscrolls = 0;
		}
		else {
			popx = (screen.width - 20);
			popy = (screen.height - 100);
			popscrolls = 1;
		}
	
  features = "width="+popx+",height="+popy;
  features += ",scrollbars="+popscrolls+",resizable=1,";
  features += "toolbar=0,location=0,directories=0,status=0,menubar=0";
  
  fbUrl = "/Projects/ProjectImages/Bigpopup.asp?fb=" + projectname;
  
  if (windowactive == 1) {
	ProjPopWin.close();
  }	

  ProjPopWin=window.open(fbUrl, 'ProjPopWin', features);
  
}

function open_popup_url(url, xdim, ydim) {
	popscrolls = 0;
	popx=screen.width - 20;
	popy=screen.height - 100;
	if (xdim < popx) {
		popx = xdim;
	} else {
		popscrolls = 1;
	}
	if (ydim < popy) {
		popy = ydim;
	} else {
		popscrolls = 1;
	}
/*
	if ((xdim < (screen.width - 20)) || (ydim < (screen.height - 100))) {
			popx = xdim;
			popy = ydim;
			popscrolls = 0;
		}
		else {
			popx = (screen.width - 20);
			popy = (screen.height - 100);
			popscrolls = 1;
		}
*/
  features = "width="+popx+",height="+popy;
  features += ",scrollbars="+popscrolls+",resizable=1,";
  features += "toolbar=0,location=0,directories=0,status=0,menubar=0";
  
//  fbUrl = "/2004/Projects/ProjectImages/Bigpopup.asp?fb=" + projectname;
  
  if (windowactive == 1) {
	ProjPopWin.close();
  }	

  ProjPopUrl=window.open(url, 'ProjPopUrl', features);
  
}
function test_alert (msg) {
	alert(msg);
}
function open_popup_bigpic(projectname, xdim, ydim) {
	xdim += 68;
	ydim += 150;
//	open_popup(projectname, xdim, ydim);

		if ((xdim < (screen.width - 20)) || (ydim < (screen.height - 100))) {
			popx = xdim;
			popy = ydim;
			popscrolls = 0;
		}
		else {
			popx = (screen.width - 20);
			popy = (screen.height - 100);
			popscrolls = 1;
		}
	
	  features = "width="+popx+",height="+popy;
	  features += ",scrollbars="+popscrolls+",resizable=1,";
	  features += "toolbar=0,location=0,directories=0,status=0,menubar=0";
	  
	  fbUrl = "/Projects/ProjectImages/Bigpopup.asp?fb=" + projectname;
	  
	  if (windowactive == 1) {
		ProjPopWin.close();
	  }	
	
	  ProjPopWin=window.open(fbUrl, 'ProjPopWin', features);
}
function open_popup_bigpic2(projectname, xdim, ydim) {
	xdim += 68;
	ydim += 150;

		if ((xdim < (screen.width - 20)) || (ydim < (screen.height - 100))) {
			popx = xdim;
			popy = ydim;
			popscrolls = 0;
		}
		else {
			popx = (screen.width - 20);
			popy = (screen.height - 100);
			popscrolls = 1;
		}
	
	  features = "width="+popx+",height="+popy;
	  features += ",scrollbars="+popscrolls+",resizable=1,";
	  features += "toolbar=0,location=0,directories=0,status=0,menubar=0";
	  
	  fbUrl = "/Projects/ProjectImages/bigpopup.php?fb=" + projectname;
	  
	  if (windowactive == 1) {
		ProjPopWin.close();
	  }	
	
	  ProjPopWin=window.open(fbUrl, 'ProjPopWin', features);
}

function popup_flipbook(url, xdim, ydim) {
	xdim += 68;
	ydim += 150;

	if ((xdim < (screen.width - 20)) || (ydim < (screen.height - 100))) {
		popx = xdim;
		popy = ydim;
		popscrolls = 0;
	}
	else {
		popx = (screen.width - 20);
		popy = (screen.height - 100);
		popscrolls = 1;
	}

	features = "width="+popx+",height="+popy;
	features += ",scrollbars="+popscrolls+",resizable=1,";
	features += "toolbar=0,location=0,directories=0,status=0,menubar=0";

	if (windowactive == 1) {
		ProjPopWin.close();
	}	

	ProjPopWin=window.open(url, 'ProjPopWin', features);
}
