
function editObject(seshName,seshID,seshVarName,previewImg) {

 this.seshName = seshName;
 this.seshID = seshID;
 this.previewImg = previewImg;
 this.seshVarName = seshVarName;

 this.imgWin = "";
 this.winOpen = false;
 this.delMsg = "This will delete this record from the database";
 this.loaderURL = "imgUpload.php";
 
 this.changeFile = function() {
  var fileParams = new Object();
  fileParams[this.seshName] = this.seshID;
  fileParams['sesh'] = this.seshVarName;
  this.openPopWin("fileUpload.php?" + this.makeQS(fileParams), "fileUpload", "width=400,height=120,status=1");
 }

 this.changeImage = function(imgPos) {
  var imgParams = new Object();
  imgParams[this.seshName] = this.seshID;
  imgParams['sesh'] = this.seshVarName;
  imgParams['pos'] = imgPos;
  this.openPopWin(this.loaderURL + "?" + this.makeQS(imgParams), "upload", "width=400,height=120,status=1");
 }

 this.changeCategory = function(currCat,posID) {
  this.openPopWin("prodCatChoice.php?catID=" + currCat + "&posID=" + posID, "catSel", "width=300,height=400,status=1,scrollbars=1");
 }

 this.refreshImage = function(imgPos, strExtra) {
  var imgParams = new Object();
  imgParams[this.seshName] = this.seshID;
  imgParams['sesh'] = this.seshVarName;
  imgParams['pos'] = imgPos;
  imgParams['view'] = this.previewImg;
  imgParams['t'] = Math.random();
  if(strExtra == "remove") imgParams["remove"] = 1;
  var url = "../_img/showImg.php?";
  for(var i in imgParams) url += escape(i) + "=" + escape(imgParams[i]) + "&";
  document.images["preview_" + imgParams['pos']].src = url;
 }

 this.removeImage = function(currSection) {
   this.refreshImage(currSection, "remove");
 }

 this.openPopWin = function(url, winName, winProps) {
  if(this.winOpen) this.imgWin.close();
  this.imgWin = window.open(url, winName, winProps);
  this.winOpen = true;
 }

 this.cancelEdit = function() {
  document.forms[0].cancel.value = 1;
  document.forms[0].submit();
 }

 this.deleteRecord = function() {
  if(confirm(this.delMsg)) {
   document.forms[0].elements["delete"].value = 1;
   document.forms[0].submit();
  }
 }

 this.makeQS = function(objParams) {
  var strQS = "";
  for(var i in objParams) strQS += escape(i) + "=" + escape(objParams[i]) + "&";
  return strQS;
 }

}