jsversion = 2;

 

function reload() {

  sl = document.body.scrollLeft;

  st = document.body.scrollTop;       

  if (shouldScroll == false) {

    sl = 0;

    st = 0;

  }

  currentDate = new Date();

  self.location = servlet + "editview?siteid=" +

    siteID + "&pageid=" + pageID + "&sl=" + sl + "&st=" + st +

    "&albumid=" + albumID + "&photo=" + imageIndex + "&c=" + endingCoverPageID +

    "&pagenum=" + pageNumber + "&r=" + currentDate.getTime();

}

 

function reloadToPhoto (album, photo) {

  currentDate = new Date();

  self.location   = servlet + "editview?siteid=" +

    siteID + "&pageid=" + pageID + "&c=" + endingCoverPageID +

    "&albumid=" + album + "&photo=" + photo + "&noadj=y" +

    "&r=" + currentDate.getTime();

}

 

function reloadToHomePage () {

  currentDate = new Date();

  self.location   = servlet + "editview?siteid=" +

    siteID + "&r=" + currentDate.getTime();

}

 

function reloadSafeMode() {

  currentDate = new Date();

  self.location = servlet + "editview?siteid=" +

    siteID + "&pageid=" + pageID +

    "&albumid=" + albumID + "&photo=" + imageIndex + "&c=" + endingCoverPageID +

    "&pagenum=" + pageNumber + "&safe=y&r=" + currentDate.getTime();

}

 

function reloadFromPhotoDeletion () {

  sl = document.body.scrollLeft;

  st = document.body.scrollTop;       

  if (shouldScroll == false) {

    sl = 0;

    st = 0;

  }

  currentDate = new Date();

  self.location   = servlet + "editview?wasdel=y&siteid=" +

    siteID + "&pageid=" + pageID + "&c=" + endingCoverPageID +

    "&albumid=" + albumID + "&photo=" + imageIndex + "&noadj=y" +

    "&sl=" + sl + "&st=" + st +

    "&pagenum=" + pageNumber + "&r=" + currentDate.getTime();

}

 

function openPictureList () {

  currentDate = new Date();

  if (isHomePage)

    parent.location = servlet + "piclist?r=" + currentDate.getTime();

  else if (albumID == "")

    parent.location = servlet + "piclistdetail?dt=page&g=" + pageID +

      "&r=" + currentDate.getTime();

  else

    parent.location = servlet + "piclistalbum?album=" + albumID +

      "&pg=" + pageNumber + "&r=" + currentDate.getTime() + "#page" + pageNumber;

}

 

function showDeadenedLinkAlert () {

  alert ("That link points outside of your member pages.");

}

 

function addText(isCaption) {

  sl = document.body.scrollLeft;

  st = document.body.scrollTop;       

  currentDate = new Date();

  newLocation = ("addTextPopup.html")

    // pageID + "&siteid=" + siteID + "&newtext=y" + "&sl=" + sl + "&st=" + st +

    // "&albumid=" + albumID + "&photo=" + imageIndex +

    // "&r=" + currentDate.getTime();

  if (isCaption == true)

    newLocation = newLocation + "&caption=y";    

  numLoads = numLoads + 1;

  if (numLoads >= MaxLoads)

    self.location = newLocation;

  else

    self.location = newLocation;

}

 

function addImage() {

  sl = document.body.scrollLeft;

  st = document.body.scrollTop;

  bw = document.body.clientWidth;

  bh = document.body.clientHeight;

  h = 420;

  w = 420;

  currentDate = new Date();

  addImagePopup = window.open ("addImage.html", 

    // pageID + "&siteid=" + siteID + "&sl=" + sl + "&st=" + st + "&bw=" + bw + "&bh=" + bh +

    // "&album=" + albumID + "&basealbum=" + albumID + "&photo=" + imageIndex + "&popup=y" +

    // "&ep=" + epval + "&r=" + currentDate.getTime(),

      "AddImagePopup" + currentDate.getTime(), "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w +

      ",height=" + h + "," + "top=" + ((screen.height-h)/2) +

      ",left=" + ((screen.width-w)/2));

  if (addImagePopup != null)

    addImagePopup.focus();

}

 

function openAddPicturePopup() {

  sl = document.body.scrollLeft;

  st = document.body.scrollTop;       

  h = 450;

  w = 556;

  currentDate = new Date();

  addImagePopup = window.open ("addPictures.html",

    // pageID + "&siteid=" + siteID + "&sl=" + sl + "&st=" + st + "&album=" +

    // albumID + "&basealbum=" + albumID + "&photo=" + imageIndex +

    // "&chooseUploadOrPlace=y&popup=y&r=" + currentDate.getTime(),

      "AddImagePopup" + currentDate.getTime(), "toolbar=no,scrollbars=yes,location=no,width=" + w +

      ",height=" + h + "," + "top=" + ((screen.height-h)/2) +

      ",left=" + ((screen.width-w)/2));

  if (addImagePopup != null)

    addImagePopup.focus();

}

 

function openPageStatsPopup () {

  h = 420;

  w = 400;

  currentDate = new Date();

  pageStatsPopup = window.open (servlet + "pagestats?pageid=" + pageID +

    "&popup=y" + "&r=" + currentDate.getTime(),

      "PageStatsPopup" + currentDate.getTime(), "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w +

      ",height=" + h + "," + "top=" + ((screen.height-h)/2) +

      ",left=" + ((screen.width-w)/2));

  if (pageStatsPopup != null)

    pageStatsPopup.focus();

}

function openHiResPopup (i, k, showUpgrade, showPrints, hiResHeight, hiResWidth) {

  widthDelta = 12;

  h = hiResHeight;

  w = hiResWidth + widthDelta;

  if (h > screen.height)

    h = screen.height - 108;

  if (w > (screen.width - widthDelta))

    w = screen.width - widthDelta;

  currentDate = new Date();

  hiResPopup = window.open (servlet + "hires?img=" + i + "&k=" + k +

    "&shup=" + showUpgrade + "&prints=" + showPrints, "HiResPopup" + currentDate.getTime(),

    "toolbar=no,scrollbars=yes,menubar=yes,location=no,status=no,resizable=yes,fullscreen=yes," +

    "width=" + w + ",height=" + h + "," +

    "top=0,left=" + ((screen.width - w) / 2));

  if (hiResPopup != null)

    hiResPopup.focus();

}

 

function openClipartPopup () {

  sl = document.body.scrollLeft;

  st = document.body.scrollTop;       

  h = 370;

  w = 556;

  currentDate = new Date();

  addClipartPopup = window.open ("addClipart.html", 

    // pageID + "&siteid=" + siteID + "&sl=" + sl + "&st=" + st + "&album=" +

    // albumID + "&photo=" + imageIndex + "&popup=y" + "&ep=" + epval +

    // "&r=" + currentDate.getTime(),

      "AddClipartPopup" + currentDate.getTime(), "toolbar=no,scrollbars=yes,location=no,width=" + w +

      ",height=" + h + "," + "top=" + ((screen.height-h)/2) +

      ",left=" + ((screen.width-w)/2));

  if (addClipartPopup != null)

    addClipartPopup.focus();

}

 

function openEditPagePopup () {

  h=370;

  w=556;

  currentDate = new Date();

  editPagePopup = window.open ("editPage.html", 

    // pageID + "&siteid=" + siteID + "&album=" + albumID +

    // "&photo=" + imageIndex + "&r=" + currentDate.getTime() + "&popup=y",

    "EditPagePopup" + currentDate.getTime(),

    "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

    "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

  if (editPagePopup != null)

    editPagePopup.focus();

}

 

function openEditMusicPopup () {

  h=370;

  w=556;

  currentDate = new Date();

  editMusicPopup = window.open (servlet + "editmusicbg?pageid=" +

    pageID + "&siteid=" + siteID + "&album=" + albumID +

    "&photo=" + imageIndex + "&r=" + currentDate.getTime() + "&popup=y",

    "EditMusicPopup" + currentDate.getTime(),

    "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

    "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

  if (editMusicPopup != null)

    editMusicPopup.focus();

}

 

function openThemePopup () {

  h=370;

  w=556;

  currentDate = new Date();

  editThemePopup = window.open (servlet + "edittheme?pageid=" +

    pageID + "&siteid=" + siteID + "&album=" + albumID +

    "&photo=" + imageIndex + "&r=" + currentDate.getTime() + "&popup=y",

    "EditThemePopup" + currentDate.getTime(),

    "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

    "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

  if (editThemePopup != null)

    editThemePopup.focus();

}

 

function openAddPagePopup () {

  sl = document.body.scrollLeft;

  st = document.body.scrollTop;       

  h = 370;

  w = 556;

  currentDate = new Date();

  addPagePopup = window.open ("addPage.html", 

    // pageID + "&siteid=" + siteID + "&album=" + albumID + "&photo=" + imageIndex +

    // "&sl=" + sl + "&st=" + st + "&r=" + currentDate.getTime() + "&popup=y",

    "AddPagePopup" + currentDate.getTime(),

    "toolbar=no,scrollbars=no,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

    "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

  if (addPagePopup != null)

    addPagePopup.focus();

}

 

function openPreviewPopup (url) {

  h=400;

  w=780;

  currentDate = new Date();

  welcomePopup = window.open (url, "PreviewPage" + currentDate.getTime(),

    "toolbar=no,scrollbars=yes,location=yes,resizable=yes,status=yes,menubar=no," +

    "width=" + w + ",height=" + h + "," +

    "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width - (w + 12))/2));

  if (welcomePopup != null)

    welcomePopup.focus();

}

 

function createText (isCaption) {

  sl = document.body.scrollLeft;

  st = document.body.scrollTop;       

  bw = document.body.clientWidth;

  bh = document.body.clientHeight;

  isCaptionParam = "";

  if (isCaption)

    isCaptionParam = "&iscaption=y";

  h = 405;

  w = 880;

  if ((screen.availWidth > 880) && isPiczo && (0 == 1)) {

    w = 880;

    adTag = "&tag=y";

  } else {

    adTag = "";

  }

  currentDate = new Date();

  editTextPopup = window.open ("addTextPopup.html", 

    // sl + "&st=" + st + "&bw=" + bw + "&bh=" + bh + "&pageid=" + pageID + isCaptionParam + "&r=" +

    // currentDate.getTime() + "&popup=y" + adTag, 
"EditTextPopup" + currentDate.getTime(),

    "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

    "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));
 
  if (editTextPopup != null)

    editTextPopup.focus();

}

 

function addObjectToPage (objectTag) {

  sl = document.body.scrollLeft;

  st = document.body.scrollTop;

  bw = document.body.clientWidth;

  bh = document.body.clientHeight;

  h = 500; //370;

  w = 660; //556;

  currentDate = new Date();

  addObjectPopup = window.open ("addObject.html", 

    // sl + "&st=" + st + "&bw=" + bw + "&bh=" + bh + "&pageid=" + pageID + "&obj=" + objectTag +

    // "&r=" + currentDate.getTime() + "&popup=y", 
"AddObjectPopup" + currentDate.getTime(),

    "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

    "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

  if (addObjectPopup != null)

    addObjectPopup.focus();

}

 

function addCallout () {

  sl = document.body.scrollLeft;

  st = document.body.scrollTop;       

  bw = document.body.clientWidth;

  bh = document.body.clientHeight;

  h = 400;

  w = 866;

  currentDate = new Date();

  addCalloutPopup = window.open ("addCallout.html", 

 //   sl + "&st=" + st + "&bw=" + bw + "&bh=" + bh + "&pageid=" + pageID + "&isnew=y&iscaption=y&r=" +

 //   currentDate.getTime() + "&popup=y",

 "AddCalloutPopup" + currentDate.getTime(),

    "toolbar=no,scrollbars=no,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

    "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

  if (addCalloutPopup != null)

    addCalloutPopup.focus();

}

 

function addPost (plid) {

  h = 400;

  w = 700;

  currentDate = new Date();

  editPostPopup = window.open (servlet + "editpost?plid=" + plid + "&isnew=y&r=" +

    currentDate.getTime() + "&popup=y&sv=n", "EditPostPopup" + currentDate.getTime(),

    "toolbar=no,scrollbars=no,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

    "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

  if (editPostPopup != null)

    editPostPopup.focus();

}

 

function editPost (plpid) {

  h = 400;

  w = 700;

  currentDate = new Date();

  editPostPopup = window.open (servlet + "editpost?plpid=" + plpid + "&r=" +

    currentDate.getTime() + "&popup=y", "EditPostPopup" + currentDate.getTime(),

    "toolbar=no,scrollbars=no,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

    "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

  if (editPostPopup != null)

    editPostPopup.focus();

}

 

function editPostApproval (plpid) {

  h = 300;

  w = 380;

  currentDate = new Date();

  editPostApprovalPopup = window.open (servlet + "editpostapproval?plpid=" + plpid + "&r=" +

    currentDate.getTime() + "&popup=y", "EditPostApprovalPopup" + currentDate.getTime(),

    "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

    "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

  if (editPostApprovalPopup != null)

    editPostApprovalPopup.focus();

}

 

function editText(divItem, textID, hrefURL) {

  if (( ! n) && (((parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft)) > 60) ||

    ((event.clientY + parseInt (document.body.scrollTop) - parseInt (divItem.style.top)) > 20))) {

    currentDate = new Date();

    if (hrefURL != "")

      self.location = hrefURL + "&r=" + currentDate.getTime();

    return;

  }

  if ( ! hasItemMoved) {

    clickItem = divItem;       

    h = 405;

    w = 880;

    currentDate = new Date();

    editTextPopup = window.open ("addTextPopup.html",
      "EditTextPopup",
      "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +
      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));
    if (editTextPopup != null)
      editTextPopup.focus();
  }

}

function editRatingViewer(divItem, componentID) {
  if ( ! hasItemMoved) {
    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);
    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);
    if ((deltaX > 40) || (deltaY > 20)) {
      return;
    }
    h = 640;
    w = 720;
    currentDate = new Date();
    editRatingViewerPopup = window.open ("editratingviewer.html", 
 "EditRatingViewerPopup" + currentDate.getTime(),
      "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +
      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));
    if (editRatingViewerPopup != null)
      editRatingViewerPopup.focus();
  }
}
 
function openAddVideoPopup() {
  sl = document.body.scrollLeft;
  st = document.body.scrollTop;	   
  h = 520;
  w = 780;
  currentDate = new Date();
  addVideoPopup = window.open ("browsevideoPopup.html", 
	"AddVideoPopup" + currentDate.getTime(), "toolbar=no,scrollbars=yes,location=no,width=" + w +
	",height=" + h + "," + "top=" + ((screen.height-h)/2) + 
	",left=" + ((screen.width-w)/2));
  if (addVideoPopup != null)
    addVideoPopup.focus();
}

function applyTextEdit(text, backgroundColor) {

  clickItem.innerHTML = text;

  clickItem.style.backgroundColor = backgroundColor;

  numLoads = numLoads + 1;

  if (numLoads >= MaxLoads)

    reload();

}

 

function editImage(divItem, divID, hrefURL, shouldOpenNewWindow) {

  deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

  if (( ! n) && ((deltaX > 60) || ((event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop)) > 20))) {

    currentDate = new Date();

    if (hrefURL != "") {

      if (hrefURL.indexOf ("mailto:") == 0) {

        self.location = hrefURL;

      } else if (shouldOpenNewWindow) {

        h = 500;

        w = 760;

        imageLinkWindow = window.open ("editimage.html", 
		"ImageLinkWindow" + currentDate.getTime(),

          "toolbar=yes,scrollbars=yes,location=yes,resizable=yes,width=" + w + ",height=" + h + "," +

          "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

        if (imageLinkWindow != null)

          imageLinkWindow.focus();

      } else {

        self.location = hrefURL + "&r=" + currentDate.getTime();

      }

    }

    return;

  }

  if ((deltaX > 20) && (deltaX < 40)) {

    rotateParam = "&rotate=y";

    h = 300;

    w = 420;

  } else {

    rotateParam = "";

    h = 300;

    w = 420;

  }

  if ( ! hasItemMoved) {

    currentDate = new Date();

    editImagePopup = window.open ("addImage.html", 

     // divID + "&albumid=" + albumID + "&pageid=" + pageID + "&r=" + currentDate.getTime() +

     // "&popup=y&ep=" + epval + "&pageid=" + pageID, 

"EditImagePopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=no,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editImagePopup != null)

      editImagePopup.focus();

  }

}

 

function editPhotoAlbumListBox(divItem, photoAlbumListID) {

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      return;

    }

    h = 370;

    w = 556;

    currentDate = new Date();

    editPhotoAlbumListPopup = window.open (servlet + "editpal?id=" +

      photoAlbumListID + "&r=" + currentDate.getTime() + "&popup=y&ep=" + epval,

      "EditPhotoAlbumListPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=no,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editPhotoAlbumListPopup != null)

      editPhotoAlbumListPopup.focus();

  }

}

 

function editPhotoLog(divItem, componentID) {

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      return;

    }

    h = 470;

    w = 556;

    currentDate = new Date();

    editPhotoLogPopup = window.open (servlet + "editphotolog?id=" +

      componentID + "&r=" + currentDate.getTime() + "&popup=y",

      "EditPhotoLogPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=no,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editPhotoLogPopup != null)

      editPhotoLogPopup.focus();

  }

}

 

function editAlbumNav(divItem, componentID, photoNavLinkTo, photoNavLinkToHome) {

  deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

  if (deltaX > 40) {

    if (deltaX > 100)

      url = photoNavLinkToHome;

    else if (deltaX > 70)

      url = photoNavLinkTo + "&nav=prev";

    else

      url = photoNavLinkTo + "&nav=next";

    currentDate = new Date();

    self.location = url + "&r=" + currentDate.getTime();

    return;

  }

  if ( ! hasItemMoved) {

    h = 370;

    w = 556;

    currentDate = new Date();

    editAlbumNavPopup = window.open (servlet + "editalbumnav?id=" +

      componentID + "&r=" + currentDate.getTime() + "&popup=y&pageid=" + pageID,

      "EditAlbumNavPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editAlbumNavPopup != null)

      editAlbumNavPopup.focus();

  }

}

 

function editPageNumberBox(divItem, componentID) {

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      return;

    }

    h = 300;

    w = 380;

    currentDate = new Date();

    editPageNumberBoxPopup = window.open (servlet + "editpagenumbox?id=" +

      componentID + "&album=" + albumID + "&r=" + currentDate.getTime() + "&popup=y&pageid=" + pageID,

      "EditPageNumberBoxPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=no,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editPageNumberBoxPopup != null)

      editPageNumberBoxPopup.focus();

  }

}

 

function editPhotoAlbumTitleIIBox(divItem, componentID) {

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      return;

    }

    clickItem = divItem;       

    h = 370;

    w = 556;

    currentDate = new Date();

    editPhotoAlbumTitleIIBoxPopup = window.open (servlet + "editalbumtitle2box?id=" +

      componentID + "&album=" + albumID + "&pageid=" + pageID + "&r=" + currentDate.getTime() + "&popup=y",

      "EditPhotoAlbumTitleIIBoxPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=no,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editPhotoAlbumTitleIIBoxPopup != null)

      editPhotoAlbumTitleIIBoxPopup.focus();

  }

}

 

function editCameraPhoneIcon(divItem, componentID, hrefURL) {

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      currentDate = new Date();

      if (hrefURL != null)

        self.location = hrefURL + "&r=" + currentDate.getTime();

      return;

    }

    h = 300;

    w = 380;

    currentDate = new Date();

    editCameraPhoneIconPopup = window.open (servlet + "editcameraphoneicon?id=" +

      componentID + "&pageid=" + pageID + "&r=" + currentDate.getTime() + "&popup=y",

      "EditCameraPhoneIconPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=no,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editCameraPhoneIconPopup != null)

      editCameraPhoneIconPopup.focus();

  }

}

 

function editGeneralBox(divItem, componentID) {

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      return;

    }

    h = 300;

    w = 380;

    currentDate = new Date();

    editGeneralBoxPopup = window.open (servlet + "editbox?id=" +

      componentID + "&pageid=" + pageID + "&r=" + currentDate.getTime() + "&popup=y",

      "EditGeneralBoxPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=no,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editGeneralBoxPopup != null)

      editGeneralBoxPopup.focus();

  }

}

 

function slideshow() {

  h = 600;

  w = 800;

  slideshowPopup = window.open (servlet + "slides?b=" + albumID + "&p=" + imageIndex +

    "&site=" + siteName + "&isfirst=y" + "&sw=" + screen.width + "&sh=" + screen.height, "SlideshowPopup",

    "toolbar=no,scrollbars=yes,menubar=yes,location=no,status=no,resizable=yes,fullscreen=yes," +

    "width=" + w + ",height=" + h + "," +

    "top=0,left=" + ((screen.width - w) / 2));

  if (slideshowPopup != null)

    slideshowPopup.focus();

}

 

function editSlideshow(divItem, componentID, albumID) {

  if ( ! hasItemMoved) {

    h = 300;

    w = 380;

    currentDate = new Date();

    editSlideshowPopup = window.open (servlet + "editslideshow?id=" + componentID + "&album=" +

      albumID + "&r=" + currentDate.getTime() + "&popup=y&pageid=" + pageID, "EditSlideshowPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=no,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editSlideshowPopup != null)

      editSlideshowPopup.focus();

  }

}

 

function editPayPalButton(divItem, componentID) {

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      return;

    }

    h = 370;

    w = 556;

    currentDate = new Date();

    editPayPalButtonPopup = window.open (servlet + "editpaypalbutton?id=" + componentID + "&pageid=" + pageID +

      "&r=" + currentDate.getTime() + "&popup=y", "EditPayPalButtonPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editPayPalButtonPopup != null)

      editPayPalButtonPopup.focus();

  }

}

 

function editHTMLBox(divItem, componentID) {

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      return;

    }

    h = 430;

    w = 820;

    currentDate = new Date();

    editHTMLBoxPopup = window.open (servlet + "edithtmlbox.html" ,

    "EditHTMLBoxPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editHTMLBoxPopup != null)

      editHTMLBoxPopup.focus();

  }

}

 

function editPhotobucketImage(divItem, componentID) {

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      return;

    }

    h = 300;

    w = 420;

    currentDate = new Date();

    editPhotobucketImagePopup = window.open (servlet + "editphotobucketimage?id=" + componentID +

      "&r=" + currentDate.getTime() + "&popup=y", "EditPhotobucketImagePopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editPhotobucketImagePopup != null)

      editPhotobucketImagePopup.focus();

  }

}

 

function editHitCounter(divItem, componentID) {

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      return;

    }

    h = 370;

    w = 556;

    currentDate = new Date();

    editHitCounterPopup = window.open (servlet + "edithitcounter?id=" + componentID + "&pageid=" + pageID +

      "&r=" + currentDate.getTime() + "&popup=y", "EditHitCounterPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editHitCounterPopup != null)

      editHitCounterPopup.focus();

  }

}

 

function openPiczoProsPopup () {

  h = 580;

  w = 880;

  currentDate = new Date();

  piczoProsPopup = window.open ("http://info.piczo.com/piczopros/new/prosMain.asp" +

    "?r=" + currentDate.getTime(),

    "piczoProsPopup" + currentDate.getTime(),

    "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

    "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

  if (piczoProsPopup != null)

    piczoProsPopup.focus();

}

 

function addTextGraphic () {

  sl = document.body.scrollLeft;

  st = document.body.scrollTop;       

  bw = document.body.clientWidth;

  bh = document.body.clientHeight;

  h = 520;

  w = 780;

  currentDate = new Date();

  addTextGraphicPopup = window.open ("addTextGraphicPopup.html", 
//  + "?tgskip=y&pageid=" + pageID +

   // "&r=" + currentDate.getTime() + "&popup=y&sl=" + sl + "&st=" + st + "&bw=" + bw + "&bh=" + bh + "&shouldval=y",

    "AddTextGraphicPopup" + currentDate.getTime(),

    "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

    "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

  if (addTextGraphicPopup != null)

    addTextGraphicPopup.focus();

}

 

function editTextGraphic(divItem, componentID, hrefURL, shouldOpenNewWindow) {

  deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

  if (( ! n) && ((deltaX > 40) || ((event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop)) > 20))) {

    currentDate = new Date();

    if (hrefURL != "") {

      if (hrefURL.indexOf ("mailto:") == 0) {

        self.location = hrefURL;

      } else if (shouldOpenNewWindow) {

        h = 500;

        w = 760;

        textGraphicLinkWindow = window.open (hrefURL, "TextGraphicLinkWindow" + currentDate.getTime(),

          "toolbar=yes,scrollbars=yes,location=yes,resizable=yes,width=" + w + ",height=" + h + "," +

          "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

        if (textGraphicLinkWindow != null)

          textGraphicLinkWindow.focus();

      } else {

        self.location = hrefURL + "&r=" + currentDate.getTime();

      }

    }

    return;

  }

  if ((deltaX > 20) && (deltaX < 40)) {

    rotateParam = "&rotate=y";

    h = 300;

    w = 420;

  } else {

    rotateParam = "";

    h = 300;

    w = 420;

  }

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      return;

    }

    h = 520;

    w = 780;

    currentDate = new Date();

    editTextGraphicPopup = window.open ("editTextGraphicPopup.html", 
// + "edittextgraphic?id=" + componentID + "&pageid=" + pageID +

//      "&r=" + currentDate.getTime() + "&popup=y", 
"EditTextGraphicPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editTextGraphicPopup != null)

      editTextGraphicPopup.focus();

  }

}

function editPageList(divItem, componentID) {

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      return;

    }

    h = 440;

    w = 556;

    currentDate = new Date();



    editPageListPopup = window.open ("editPageList.html",

//    editPageListPopup = window.open (servlet + "editpagelist?id=" + componentID +

//      "&r=" + currentDate.getTime() + "&popup=y",

      "EditPageListPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editPageListPopup != null)

      editPageListPopup.focus();

  }

}

 

function editFriendsList(divItem, componentID) {

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      return;

    }

    h = 430;

    w = 556;

    currentDate = new Date();

    editFriendsListPopup = window.open ("editFriendsList.html", 

    //  "&r=" + currentDate.getTime() + "&popup=y", 
"EditFriendsListPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editFriendsListPopup != null)

      editFriendsListPopup.focus();

  }

}

 

function editFriendsListWithPics(divItem, componentID) {

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      return;

    }

    h = 430;

    w = 556;

    currentDate = new Date();

    editFriendsListWithPicsPopup = window.open ("editPictureFriendsList.html", 

      // "&r=" + currentDate.getTime() + "&popup=y", 
	  "EditFriendsListWithPicsPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editFriendsListWithPicsPopup != null)

      editFriendsListWithPicsPopup.focus();

  }

}

 

function editCommunityGroupMemberList(divItem, componentID) {

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      return;

    }

    h = 370;

    w = 556;

    currentDate = new Date();

    editCommunityGroupMemberListPopup = window.open (servlet + "editcmtygroupmemberlist?id=" + componentID +

      "&r=" + currentDate.getTime() + "&popup=y", "EditCommunityGroupMemberListPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editCommunityGroupMemberListPopup != null)

      editCommunityGroupMemberListPopup.focus();

  }

}

 

function editHomePageIcon(divItem, componentID, hrefURL) {

  if (((parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft)) > 60) ||

    ((event.clientY + parseInt (document.body.scrollTop) - parseInt (divItem.style.top)) > 20)) {

    currentDate = new Date();

    if (hrefURL != "")

      self.location = hrefURL + "&r=" + currentDate.getTime();

    return;

  }

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      return;

    }

    h = 370;

    w = 556;

    currentDate = new Date();

    editHomePageIconPopup = window.open (servlet + "edithomepageicon?id=" + componentID +

      "&pageid=" + pageID + "&r=" + currentDate.getTime() + "&popup=y", "EditHomePageIconPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editHomePageIconPopup != null)

      editHomePageIconPopup.focus();

  }

}

 

function editShoutbox(divItem, componentID) {

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      return;

    }

    h = 470;

    w = 600;

    currentDate = new Date();

    editShoutboxPopup = window.open (servlet + "editshoutbox?id=" + componentID +

      "&pageid=" + pageID + "&r=" + currentDate.getTime() + "&popup=y", "EditShoutboxPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editShoutboxPopup != null)

      editShoutboxPopup.focus();

  }

}

 

function editCommentBoard(divItem, componentID) {

  if ( ! hasItemMoved) {

    deltaX = parseInt (divItem.style.left) + parseInt (divItem.style.width) - event.clientX - parseInt (document.body.scrollLeft);

    deltaY = event.clientY - parseInt (divItem.style.top) + parseInt (document.body.scrollTop);

    if ((deltaX > 40) || (deltaY > 20)) {

      return;

    }

    h = 550;

    w = 600;

    currentDate = new Date();

    editCommentBoardPopup = window.open ("editCommentBoard.html", 

    //  "&pageid=" + pageID + "&r=" + currentDate.getTime() + "&popup=y", 
	"EditCommentBoardPopup" + currentDate.getTime(),

      "toolbar=no,scrollbars=yes,location=no,resizable=yes,width=" + w + ",height=" + h + "," +

      "top=" + ((screen.height-h)/2) + ",left=" + ((screen.width-w)/2));

    if (editCommentBoardPopup != null)

      editCommentBoardPopup.focus();

  }

}

 

function inviteFriend () {

  h = 370;

  w = 556;

  currentDate = new Date();

  inviteFriendPopup = window.open (servlet + "invitefriend?popup=y&r=" + currentDate.getTime(),

      "InviteFriendPopup" + currentDate.getTime(), "toolbar=no,scrollbars=yes,location=no,width=" + w +

      ",height=" + h + "," + "top=" + ((screen.height-h)/2) +

      ",left=" + ((screen.width-w)/2));

  if (inviteFriendPopup != null)

    inviteFriendPopup.focus();

}

 

function mouseWentDown(divItem, markerDiv, resizeDiv, captionDiv, divNumber, e, isResize, imageDiv, imageSlope,

  captionMultX, captionMultY, captionOffsetMultX, captionOffsetMultY, componentType) {

  mouseX = event.clientX;

  mouseY = event.clientY;

  if (isResize == true) {    

    if (((parseInt (resizeDiv.style.left) + parseInt (resizeDiv.style.width) - (mouseX + document.body.scrollLeft)) > 60) ||

      ((mouseY - parseInt (resizeDiv.style.top)) > 20))

    return;

  } else {

    if (((parseInt (divItem.style.left) + parseInt (divItem.style.width) - (mouseX + document.body.scrollLeft)) > 60) ||

      ((mouseY - parseInt (divItem.style.top)) > 20))

    return;

  }        

  mouseDownItem = divItem;

  mouseDownImage = imageDiv;

  mouseDownSlope = imageSlope;

  mouseDownNumber = divNumber;

  mouseDownMarker = markerDiv;

  mouseDownResizer = resizeDiv;

  mouseDownCaptionMultX = captionMultX;

  mouseDownCaptionMultY = captionMultY;

  mouseDownCaptionOffsetMultX = captionOffsetMultX;

  mouseDownCaptionOffsetMultY = captionOffsetMultY;

  mouseDownComponentType = componentType;

  mouseDeltaX = mouseX - (parseInt (mouseDownItem.style.left) - parseInt (document.body.scrollLeft));

  mouseDeltaY = mouseY - (parseInt (mouseDownItem.style.top) - parseInt (document.body.scrollTop));

  if (isResize == true)

    mouseDownIsResize = true;

  else

    mouseDownIsResize = false;       

  if (captionDiv != null) {

      mouseDownCaption = captionDiv;

  } else {

    mouseDownCaption = false;  

  }

  hasItemMoved = false;

  if ((mouseDownComponentType == 21) || (mouseDownComponentType == 24)) {  // for now we change the z-index of the resizers only for the shoutbox and comment board

    previousResizeDivZIndex = resizeDiv.style.zIndex;

    previousMarkerDivZIndex = markerDiv.style.zIndex;

    resizeDiv.style.zIndex = 11;

    markerDiv.style.zIndex = 11;

    markerDiv.style.height = mouseDownItem.style.height; // see comment in jsp -- height of shoutbox editing div

  }

}

 

function mouseWentDownNS(e) {

  chooseElemFromCoord (e.pageX, e.pageY);

  if (chosenDiv == null) {

    routeEvent (e);

    return;

  }

 

  mouseWentDown (chosenDiv, chosenMarkerDiv, chosenResizeDiv, null, chosenTextID, e, chosenIsResize);

}    

 

function mouseWentUp() {

  if (mouseDownItem == false)

    return;

  leftCoord = parseInt (mouseDownItem.style.left);

  topCoord = parseInt (mouseDownItem.style.top);

  sl = document.body.scrollLeft;

  st = document.body.scrollTop;       

  if (hasItemMoved) {

      if (leftCoord < 0)

        leftCoord = 0;

      if (topCoord < 0)

        topCoord = 0;

      if (mouseDownIsResize && (mouseDownImage != null))

      newLocation = servlet + "resizeimg";

    else

      newLocation = servlet + "editposition";

    newLocation = newLocation +

      "?id=" + mouseDownNumber + "&left=" + (leftCoord + 1) +

      "&top=" + (topCoord + 1) +

      "&siteid=" + siteID +

      "&pageid=" + pageID;

    if (mouseDownImage != null) {

      if (mouseDownCaption == false) {

        newLocation = newLocation +

          "&width=" + mouseDownImage.clientWidth +

          "&height=" + mouseDownImage.clientHeight;

        mouseDownItem.style.width = mouseDownImage.clientWidth;

        mouseDownItem.style.height = mouseDownImage.clientHeight;

        mouseDownMarker.style.width = mouseDownImage.clientWidth;

        mouseDownMarker.style.height = mouseDownImage.clientHeight;

        mouseDownResizer.style.left = leftCoord + mouseDownImage.clientWidth - 15;

        mouseDownResizer.style.top = topCoord + mouseDownImage.clientHeight - 15;

      } else {

        newLocation = newLocation +

          "&calloutwidth=" + mouseDownImage.clientWidth +

          "&calloutheight=" + mouseDownImage.clientHeight;

      }

    } else if (mouseDownIsResize) {

      newLocation = newLocation +        

        "&width=" + parseInt (mouseDownItem.style.width) +

        "&height=" + parseInt (mouseDownItem.style.height);

    }

    numLoads = numLoads + 1;

    // if ((numLoads >= MaxLoads) || ((mouseDownIsResize) && (mouseDownCaption != false)) ||

    //  (mouseDownComponentType == 21) || (mouseDownComponentType == 24))  // always reload when a shoutbox or comment board was resized

    //  self.location = newLocation + "&sl=" + sl + "&st=" + st +

    //    "&albumid=" + albumID + "&photo=" + imageIndex;

    //  else

    //  self.parent.loader.location = newLocation + "&load=n";

  }

  if ((mouseDownComponentType == 21) || (mouseDownComponentType == 24)) {  // for now we change the z-index of the resizers only for the shoutbox and comment board

    mouseDownResizer.style.zIndex = previousResizeDivZIndex;

    mouseDownMarker.style.zIndex = previousMarkerDivZIndex;

    mouseDownMarker.style.height = 22; // see comment in jsp -- height of shoutbox editing div

  }

  mouseDownItem = false;

  mouseDownImage = null;

  mouseDownMarker = false;

  mouseDownResizer = false;

  mouseDownCaption = false;

  mouseDownIsResize = false;

}

 

function mouseMoved() {

  event.returnValue = false;

  if (mouseDownItem != false) {

    currentClientX = event.clientX;

    currentClientY = event.clientY;

    outOfViewDelta = 0;

    if (currentClientY > document.body.clientHeight)

      outOfViewDelta = 1;

    else if (currentClientY < 0)

      outOfViewDelta = -1;

    if (currentClientX < 0) currentClientX = 0;

    if (currentClientY < 0) currentClientY = 0;

    if (currentClientX > document.body.clientWidth) currentClientX = document.body.clientWidth;

    if (currentClientY > document.body.clientHeight) currentClientY = document.body.clientHeight;

    if (mouseDownIsResize) {

      diffX = currentClientX - mouseX;

      diffY = currentClientY - mouseY;

    } else {

      diffX = currentClientX - mouseX;

      //diffX = currentClientX - mouseDeltaX - (parseInt (mouseDownItem.style.left) - parseInt (document.body.scrollLeft));

      diffY = currentClientY - mouseDeltaY - (parseInt (mouseDownItem.style.top) - parseInt (document.body.scrollTop));

    }

    if ((!hasItemMoved) && (Math.abs(diffX) < 10) && (Math.abs(diffY) < 10))

      return;

    mouseDownItem.backgroundImage = "none";

    if (mouseDownIsResize) {

      minWidth = 75;

      minHeight = 20;

      if (mouseDownImage != null) {

        minWidth = 100;

        minHeight = 100;

      }

      if ((parseInt (mouseDownItem.style.width) >= minWidth) && ((parseInt (mouseDownItem.style.width) + diffX) < minWidth))

        diffX = 0;

      if ((parseInt (mouseDownItem.style.height) >= minHeight) && ((parseInt (mouseDownItem.style.height) + diffY) < minHeight))

        diffY = 0;

      newX = parseInt (mouseDownResizer.style.left) + diffX;

      newY = parseInt (mouseDownResizer.style.top) + diffY;

      newWidth = parseInt (mouseDownItem.style.width) + diffX;     

      newHeight = parseInt (mouseDownItem.style.height) + diffY;

      mouseDownResizer.style.left = newX;

      mouseDownResizer.style.top = newY;

      mouseDownItem.style.width = newWidth;

      mouseDownItem.style.height = newHeight;

      if (mouseDownSlope != 0) {

        if (Math.abs (newHeight / newWidth) > mouseDownSlope) {

          newImageHeight = newWidth * mouseDownSlope;

          newImageWidth = newWidth;

        } else {

          newImageWidth = newHeight / mouseDownSlope;

          newImageHeight = newHeight;

        }

        if (mouseDownCaption != false) {

          newImageWidth = newImageWidth * mouseDownCaptionMultX;

          newImageHeight = newImageHeight * mouseDownCaptionMultY;

          mouseDownCaption.style.left = parseInt (mouseDownItem.style.left) - (newWidth * mouseDownCaptionOffsetMultX);

          mouseDownCaption.style.top = parseInt (mouseDownItem.style.top) - (newHeight * mouseDownCaptionOffsetMultY);

        }

        if (mouseDownImage != null) {

          mouseDownImage.style.width = newImageWidth;

          mouseDownImage.style.height = newImageHeight;

        }

      }

      mouseDownMarker.style.width = parseInt (mouseDownMarker.style.width) + diffX;

      mouseDownMarker.style.height = parseInt (mouseDownMarker.style.height) + diffY;

      mouseX = currentClientX;

      mouseY = currentClientY;

        hasItemMoved = true;

    } else {           

      if ((diffY == 0) && (outOfViewDelta != 0)) {

        diffY = outOfViewDelta;

        outOfViewCounter = 1;

        window.scrollBy (0, outOfViewDelta);

        window.setTimeout ("mouseMovedTimer()", 100);

        mouseDownIsTimer = true;

      } else {

        mouseDownIsTimer = false;

      }

      newX = parseInt (mouseDownItem.style.left) + diffX;

      newY = parseInt (mouseDownItem.style.top) + diffY;

      mouseDownItem.style.left = newX;

      mouseDownItem.style.top = newY;

      mouseDownMarker.style.left = newX;

      mouseDownMarker.style.top = newY;

      if (mouseDownResizer != null) {

        newX = parseInt (mouseDownResizer.style.left) + diffX;

        newY = parseInt (mouseDownResizer.style.top) + diffY;

        mouseDownResizer.style.left = newX;

        mouseDownResizer.style.top = newY;       

      }          

      if (mouseDownCaption != false) {

        newX = parseInt (mouseDownCaption.style.left) + diffX;

        newY = parseInt (mouseDownCaption.style.top) + diffY;

        mouseDownCaption.style.left = newX;

        mouseDownCaption.style.top = newY;       

      }

      mouseX = currentClientX;

      mouseY = currentClientY;

        hasItemMoved = true;

    }

  }

}

 

function mouseMovedTimer() {

  if (mouseDownItem == false) {

    mouseDownIsTimer = false;

    return;

  }

  if (mouseDownIsTimer == false)

    return;

  if ((outOfViewDelta < 0) && (parseInt (document.body.scrollTop) == 0)) {

    mouseDownIsTimer = false;

    return;

  }

  if (outOfViewCounter < 5.0)

    outOfViewCounter = outOfViewCounter + 0.1;

  if (outOfViewDelta > 0)

    outOfViewDelta = Math.floor (outOfViewCounter);

  else

    outOfViewDelta = Math.floor (outOfViewCounter) * -1;

  window.scrollBy (0, outOfViewDelta);

  newY = parseInt (mouseDownItem.style.top) + outOfViewDelta;

  mouseDownItem.style.top = newY;

  mouseDownMarker.style.top = newY;

  if (mouseDownResizer != null)

    mouseDownResizer.style.top = parseInt (mouseDownResizer.style.top) + outOfViewDelta;

  if (mouseDownCaption != false)

    mouseDownCaption.style.top = parseInt (mouseDownCaption.style.top) + outOfViewDelta;

  window.setTimeout ("mouseMovedTimer()", 100);

}

 

function showObjectProperties(obj) {

  var names = "";

  for (var i in obj)

    names += i + "  ";

  alert (names);

}

 

function findObj(n, d) {

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}

 

function swapImage() {

  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

 

function swapImgRestore() {

  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}

 

function floatTools() {

  document.all['toolsDiv'].style.top = document.body.scrollTop;

}

 

function toolsDivMouseOut() {

  if ((event.clientX < (parseInt (document.all['toolsDiv'].style.left) - parseInt (document.body.scrollLeft))) ||

    (event.clientX > (parseInt (document.all['toolsDiv'].style.left) - parseInt (document.body.scrollLeft) + 129)) ||

    (event.clientY < 1) ||

    (event.clientY > (parseInt (document.all['toolsDiv'].style.top) + parseInt (document.all['toolsDiv'].style.height) - 1))) {

    document.all['toolsDiv'].style.visibility = "hidden";

    parent.menubar.isToolsOpen = false;

  }

}
