var IE4 = (document.all)    ? true : false;
var NS4 = (document.layers) ? true : false;

function getWinW() {
  if (NS4) {return window.innerWidth}
  else if (IE4) {return document.body.clientWidth}
}

function getWinH() {
  if (NS4) {return window.innerHeight}
  else if (IE4) {return document.body.clientHeight}
}

function getPgScrlLeft() {
  if (NS4) {return window.pageXOffset}
  else if (IE4) {return document.body.scrollLeft}
}

function getPgScrlTop() {
  if (NS4) {return window.pageYOffset}
  else if (IE4) {return document.body.scrollTop}
}

function setPosFromLeft(id, xPos) {
  if (NS4) {eval("document." + id).left = xPos}
  else if (IE4) {eval("document.all." + id).style.left = xPos}
}

function setPosFromTop(id, yPos) {
  if (NS4) {eval("document." + id).top = yPos}
  else if (IE4) {eval("document.all." + id).style.top = yPos}
}

var winW       = 0;
var winH       = 0;
var pgScrlLeft = 0;
var pgScrlTop  = 0;
var imgW       = 57 + 10;  // img width + border padding
var imgH       = 33 + 10;  // img height + border padding

function waterMark(){
  if (navigator.appVersion.indexOf("Mac") == -1){
    oldWinW       = winW;
    oldWinH       = winH;
    oldPgScrlLeft = pgScrlLeft;
    oldPgScrlTop  = pgScrlTop;
    winW          = getWinW();
    winH          = getWinH();
    pgScrlLeft    = getPgScrlLeft();
    pgScrlTop     = getPgScrlTop();
    if ((winH != oldWinH)||(winW != oldWinW)||(pgScrlLeft != oldPgScrlLeft)|| (pgScrlTop != oldPgScrlTop)){
      setPosFromLeft("sam0", winW + pgScrlLeft - imgW);
      setPosFromTop ("sam0", winH + pgScrlTop  - imgH);
    }
  } 
}

