// pop_image (fileName, width, height, txt) will pop up a new window,
//    width and height of the picture, with pop_image.asp as the web code.
//    The txt describes the picture.
var newwin;

function pop_image(imgName, w, h, txt) {
  var w20=w+50, h40 = h+70;
  //if (h40>550) h40=550;
  //if (newwin != null) newwin.close();
  //alert (newwin + ", " + newwin.closed);
  if (newwin!=null && !newwin.closed) newwin.close();
  newwin=null;
  newwin=window.open('../pop_image.asp?imgName=' + imgName + '&width=' + w + '&height=' + h + '&txt=' + txt,'newwindow','directories=no, location=no, menubar=yes, resizable=yes, scrollbars=yes, status=no, toolbar=no, width=' + w20 + ', height=' + h40);
  newwin.focus();
}

// pop(fileName, windowName, list-o-stuff)
// Pops a window open
// <a href="javascript:pop('fileName', <-- Note, use the quotes, your file goes in place of "fileName"
//						'PDP',
//						'directories=0,
//						  location=0,
//						    menubar=0,
//							  resizable=1,
//							    scrollbars=1,
//								  status=1,
//								    toolbar=0,
//									  width=400,
//									    height=610')">
// Note: help is just a pop specifically calling the help file with an anchor
// Note: pop2 just pops a second window off the first popped window - can't have both using pop
//   cuz they have the same name of pw

function pop(u,n,f){
  var d = "default";
  var sf = "directories,location,menubar,resizable,scrollbars,status,toolbar";
  if (!n){n = d}
  if (!f){f = sf}
  pw = window.open(u,n,f);
  pw.focus();
}

function pop_help(fileName){
  var windowName="Help"
  var listOfStuff="directories=0,location=0,menubar=0,resizable=1,scrollbars=1,status=1,toolbar=0,width=400,height=400"

  var d = "";
  if (!d){dir = d}
  pw = window.open(fileName, windowName, listOfStuff);
  pw.focus();
}

function pop2(u,n,f){
  var d = "default";
  var sf = "directories,location,menubar,resizable,scrollbars,status,toolbar";
  if (!n){n = d}
  if (!f){f = sf}
  pw2 = window.open(u,n,f);
  pw2.focus();
}

function closeWinUpdateParent() {
  //alert ('inside closeWinUpdateParent');
  self.close();
  window.opener.location.replace('./calendar.asp?date=" & dt & "');
}

// +---------------------+
// | DEBUGGING SCRIPTS   +
// +---------------------+

// pop_debug (fileName)
// creates a pop-up window of name windowName showing the HTML file of filename
// where your debug text will be written.
var windowName="DebugWin"
var pd
function pop_debug (fileName) {
  var listOfStuff="directories=0,location=0,menubar=0,resizable=1,scrollbars=1,status=1,toolbar=0,width=400,height=600"
  var d = "";
  if (!d){dir = d}
  pd = window.open(fileName, windowName, listOfStuff);
  pd.document.write (txt)
  pd.focus();
}

function refresh_debug (txt) {
  pd.document.write (txt)
}
// writeDebug(x)
// write text x into the above pop-up debugging windwo
function writeDebug (formName, txtArea, txt) {
  //alert ("t: " + txtArea + ", F: " + formName + ", txt: " + txt + ", win: " + windowName)
  pop_debug("../debugger.html")
  DebugWin.document.debugForm.debugTxt.value=txt
//  if (windowName && !windowName.Closed) {
//    alert (windowName.document.debugForm)
//    //windowName.document.debugForm.debugTxt.value=txt
//  } else {
//    alert (windowName + " isn't open.")
//  }
}
