function getAnchorPosition(anchorname) {
  // This function will return an Object with x and y properties
  var useWindow = false;
  var coordinates = new Object();
  var x = 0, y = 0, width = 0;
  // Browser capability sniffing
  var use_gebi = false, use_css = false, use_layers = false;
  if (document.getElementById) { use_gebi = true; }
  else if (document.all) { use_css = true; }
  else if (document.layers) { use_layers = true; }
  // Logic to find position
  if (use_gebi && document.all) {
    if (anchorname.substring(0, 4).toLowerCase() == "asp_") {
      var objAnchor = parent.document.all[anchorname];
    }
    else {
      var objAnchor = document.all[anchorname];
    }
    x = AnchorPosition_getPageOffsetLeft(objAnchor);
    y = AnchorPosition_getPageOffsetTop(objAnchor);
    width = objAnchor.width;
  }
  else if (use_gebi) {
    if (anchorname.substring(0, 4).toLowerCase() == "asp_") {
      var o = parent.document.getElementById(anchorname);
    }
    else {
      var o = document.getElementById(anchorname);
    }

    x = AnchorPosition_getPageOffsetLeft(o);
    y = AnchorPosition_getPageOffsetTop(o);
    width = o.width;
  }
  else if (use_css) {
    x = AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
    y = AnchorPosition_getPageOffsetTop(document.all[anchorname]);
  }
  else if (use_layers) {
    var found = 0;
    for (var i = 0; i < document.anchors.length; i++) {
      if (document.anchors[i].name == anchorname) { found = 1; break; }
    }
    if (found == 0) {
      coordinates.x = 0; coordinates.y = 0; return coordinates;
    }
    x = document.anchors[i].x;
    y = document.anchors[i].y;
  }
  else {
    coordinates.x = 0; coordinates.y = 0; return coordinates;
  }
  coordinates.x = x;
  coordinates.y = y;
  coordinates.width = width;

  return coordinates;
}

function getAnchorPositionOfFrameControl(anchorname, CalledFrom) {
  // This function will return an Object with x and y properties

  var useWindow = false;
  var coordinates = new Object();
  var x = 0, y = 0;

  // Browser capability sniffing		
  var frameCalledFrom = document.getElementById(CalledFrom);
  var doc = frameCalledFrom.contentWindow.document;
  var use_gebi = false; use_css = false; use_layers = false;
  if (document.getElementById) { use_gebi = true; }
  else if (document.all) { use_css = true; }
  else if (document.layers) { use_layers = true; }

  // Logic to find position
  if (use_gebi && document.all) {
    x = AnchorPosition_getPageOffsetLeft(doc.all[anchorname]);
    y = AnchorPosition_getPageOffsetTop(doc.all[anchorname]);
  }
  else if (use_gebi) {
    var o = doc.getElementById(anchorname);
    x = AnchorPosition_getPageOffsetLeft(o);
    y = AnchorPosition_getPageOffsetTop(o);
  }
  else if (use_css) {
    x = AnchorPosition_getPageOffsetLeft(doc.all[anchorname]);
    y = AnchorPosition_getPageOffsetTop(doc.all[anchorname]);
  }
  else if (use_layers) {
    var found = 0;
    for (var i = 0; i < parent.document.anchors.length; i++) {
      if (doc.anchors[i].name == anchorname) { found = 1; break; }
    }
    if (found == 0) {
      coordinates.x = 0; coordinates.y = 0; return coordinates;
    }
    x = doc.anchors[i].x;
    y = doc.anchors[i].y;
  }
  else {
    coordinates.x = 0; coordinates.y = 0; return coordinates;
  }
  coordinates.x = x;
  coordinates.y = y;
  return coordinates;
}

// Functions for IE to get position of an object
function AnchorPosition_getPageOffsetLeft(el) {

  var ol = el.offsetLeft;
  while ((el = el.offsetParent) != null) { ol += el.offsetLeft; }
  return ol;
}
function AnchorPosition_getWindowOffsetLeft(el) {
  return AnchorPosition_getPageOffsetLeft(el) - document.body.scrollLeft;
}
function AnchorPosition_getPageOffsetTop(el) {
  var ot = el.offsetTop;
  while ((el = el.offsetParent) != null) { ot += el.offsetTop; }
  return ot;
}
function AnchorPosition_getWindowOffsetTop(el) {
  return AnchorPosition_getPageOffsetTop(el) - document.body.scrollTop;
}
function checkPhotoPannelPosition(isResizedWindow) {
  if (document.forms[0].txtIsOpenPhotoPannel.value == "true") {
    getAnchorPosition('swfMenuBar', 1, document.forms[0].txtCurrentThumbNumber.value, 0, isResizedWindow);
  }
}

