function createCell(pop,n,id,oTr,inner){
	var oTd= document.createElement("TD");
	oTd.setAttribute("id",pop + n + id);
	document.getElementById(pop).tBodies[0].appendChild(oTr).appendChild(oTd).innerHTML=inner;
}
function createTd(oTrNew,inner,id){
	var oTd=document.createElement("TD");
	if (createTd.arguments.length >2) {
		oTd.setAttribute("id",id);
	}
	oTrNew.appendChild(oTd).innerHTML=inner;
}

// for Netscape 4+ and IE 4+
var popWin = null    // use this when referring to pop-up window
var winCount = 0
var winName = "popWin"

function getTxtExt(pop,n,id,txt,display,title){
  var d_winLeft = 20  // default, pixels from screen left to window left
  var d_winTop = 20   // default, pixels from screen top to window top
  closePopWin()           // close any previously opened pop-up window
  //Default
  if (display.length == 0) {
    display = 'GetTxtExt';
  }	
  if (title.length == 0) {
    title = 'Add/Update';
  }	
  //Make text URL safe
  title = encodeURIComponent(title);
  txt = encodeURIComponent(txt);
  //Open
  var winString=winName;
  popWin = window.open("index.cfm?fuseaction=popup." + display + "&pop=" + pop + "&n=" + n + "&id=" + id + "&txt=" + txt + "&title=" + title, "popup", "width=450,height=400,scrollbars=yes,resizable=yes,status=yes,location=yes")
}  
  
function InfoExt(display,title){
  var d_winLeft = 20  // default, pixels from screen left to window left
  var d_winTop = 20   // default, pixels from screen top to window top
  closePopWin()           // close any previously opened pop-up window
  //Make text URL safe
  title = encodeURIComponent(title);
  //Open
  var winString=winName;
  popWin = window.open("index.cfm?fuseaction=popup." + display + "&title=" + title, "popup", "width=600,height=400,resizable=yes,status=yes,location=yes,scrollbars=yes,location=no")
}    

function goLink(where) {
	window.name="MainWindowHSP";
	popWin = window.open(where, "popup", "width=550,height=400,scrollbars=yes,resizable=yes,status=yes,location=no")
}

  
function openModalWindow(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
  var d_winLeft = 20  // default, pixels from screen left to window left
  var d_winTop = 20   // default, pixels from screen top to window top
  //winName = "popWin" + winCount++ //unique name for each pop-up window
  //closePopWin()           // close any previously opened pop-up window
  if (openModalWindow.arguments.length >= 4)  // any additional features? 
    winFeatures = "," + winFeatures
  else 
    winFeatures = "" 
  if (openModalWindow.arguments.length == 6)  // location specified
    winFeatures += getLocation(winWidth, winHeight, winLeft, winTop)
  else
    winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop)
    window.showModalDialog(winURL, "dialogWidth:100px,dialogHeight:100px" + winHeight + winFeatures)
}


function openPopWin(winName, winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
  var d_winLeft = 20  // default, pixels from screen left to window left
  var d_winTop = 20   // default, pixels from screen top to window top
  //winName = "popWin" + winCount++ //unique name for each pop-up window
  closePopWin()           // close any previously opened pop-up window
  if (openPopWin.arguments.length >= 5)  // any additional features? 
    winFeatures = "," + winFeatures
  else 
    winFeatures = "" 
  if (openPopWin.arguments.length == 7)  // location specified
    winFeatures += getLocation(winWidth, winHeight, winLeft, winTop)
  else
    winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop)
    
    var winString=winName;
    popWin = window.open("index.cfm?display=" + winString + "&subFolder=popup", "popup", "width=" + winWidth + ",height=" + 
    winHeight + winFeatures + ",resizable=yes")
  }
function closePopWin(){    // close pop-up window if it is open 
  if (navigator.appName != "Microsoft Internet Explorer" 
      || parseInt(navigator.appVersion) >=4) //do not close if early IE
    if(popWin != null) if(!popWin.closed) popWin.close() 
  }
function getLocation(winWidth, winHeight, winLeft, winTop){
  return ""
  }

function getLocation(winWidth, winHeight, winLeft, winTop){
  var winLocation = ""
  if (winLeft < 0)
    winLeft = screen.width - winWidth + winLeft
  if (winTop < 0)
    winTop = screen.height - winHeight + winTop
  if (winTop == "cen")
    winTop = (screen.height - winHeight)/2 - 20
  if (winLeft == "cen")
    winLeft = (screen.width - winWidth)/2
  if (winLeft>0 & winTop>0)
    winLocation =  ",screenX=" + winLeft + ",left=" + winLeft	
                + ",screenY=" + winTop + ",top=" + winTop
  else
    winLocation = ""
  return winLocation
}

function getModalLocation(winWidth, winHeight, winLeft, winTop){
  var winLocation = ""
  if (winLeft < 0)
    winLeft = screen.width - winWidth + winLeft
  if (winTop < 0)
    winTop = screen.height - winHeight + winTop
  if (winTop == "cen")
    winTop = (screen.height - winHeight)/2 - 20
  if (winLeft == "cen")
    winLeft = (screen.width - winWidth)/2
  if (winLeft>0 & winTop>0)
    winLocation =  ",screenX=" + winLeft + ",left=" + winLeft	
                + ",screenY=" + winTop + ",top=" + winTop
  else
    winLocation = ""
  return winLocation
}  
  
function NewWindow(mypage, myname, w, h) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl;
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { 
	  win.window.focus(); 
	}
}

