imageSource = "images/logo-sm.gif"
imageWidth = 42
imageHeight = 42

n = (document.layers) ? 1:0
ie = (document.all) ? 1:0

function init() {
if (n || ie) {
    // initialize objects
    createLayer("watermark",null,0,0,imageWidth,imageHeight,"<A HREF=\'" + linkTo + "\'><IMG SRC=\'" + imageSource + "\' BORDER=0></A>")
    mark = new dynLayer("watermark")
    setInterval("wtrmark()",100)
    }
}

function dynLayer(id,nestref) {
    if (n) {
            this.css = document.layers[id]
    }
    else if (ie) {
            this.css = document.all[id].style
    }

    this.moveBy = dynLayerMoveBy
    this.moveTo = dynLayerMoveTo
}

function dynLayerMoveBy(x,y) {
    this.x += x
    this.css.left = this.x
    this.y += y
    this.css.top = this.y
}
function dynLayerMoveTo(x,y) {
    this.x = x
    this.css.left = this.x
    this.y = y
    this.css.top = this.y
}

function wtrmark() {
if (n) {
    windowWidth = window.innerWidth-17
    windowHeight = window.innerHeight-17
    if (imageAlign == "topleft")    mark.moveTo(window.pageXOffset,window.pageYOffset)
    if (imageAlign == "topright")   mark.moveTo(windowWidth-imageWidth+window.pageXOffset,window.pageYOffset)
    if (imageAlign == "bottomleft") mark.moveTo(window.pageXOffset,windowHeight-imageHeight+window.pageYOffset)
    if (imageAlign == "bottomright")mark.moveTo(windowWidth-imageWidth+window.pageXOffset,windowHeight-imageHeight+window.pageYOffset)
    }

else if (ie) {
    windowWidth = document.body.clientWidth
    windowHeight = document.body.clientHeight
    if (imageAlign == "topleft")    mark.moveTo(document.body.scrollLeft,document.body.scrollTop)
    if (imageAlign == "topright")   mark.moveTo(windowWidth-imageWidth+document.body.scrollLeft,document.body.scrollTop)
    if (imageAlign == "bottomleft") mark.moveTo(document.body.scrollLeft+5,windowHeight-imageHeight+document.body.scrollTop-5)
    if (imageAlign == "bottomright")mark.moveTo(windowWidth-imageWidth+document.body.scrollLeft,windowHeight-imageHeight+document.body.scrollTop)
    }
}

function createLayer(id,nestref,left,top,width,height,content,bgColor,visibility,zIndex) {
                if (n) {
                        if (nestref) {
                                var lyr = eval("document."+nestref+".document."+id+" = new Layer(width, document."+nestref+")")
                        }
                        else {
                                var lyr = document.layers[id] = new Layer(width)
                                eval("document."+id+" = lyr")
                        }
                        lyr.name = id
                        lyr.left = left
                        lyr.top = top
                        if (height!=null) lyr.clip.height = height
                        if (bgColor!=null) lyr.bgColor = bgColor
                        lyr.visibility = (visibility=='hidden')? 'hide' : 'show'
                        if (zIndex!=null) lyr.zIndex = zIndex
                        if (content) {
                                lyr.document.open()
                                lyr.document.write(content)
                                lyr.document.close()
                        }
                }
                else if (ie) {
                        var str = '\n<DIV id='+id+' style="position:absolute; left:'+left+'; top:'+top+'; width:'+width
                        if (height!=null) {
                                str += '; height:'+height
                                str += '; clip:rect(0,'+width+','+height+',0)'
                        }
                        if (bgColor!=null) str += '; background-color:'+bgColor         
                        if (zIndex!=null) str += '; z-index:'+zIndex
                        if (visibility) str += '; visibility:'+visibility
                        str += ';">'+((content)?content:'')+'</DIV>'
                        if (nestref) {
                                index = nestref.lastIndexOf(".")
                                var nestlyr = (index != -1)? nestref.substr(index+1) : nestref
                                document.all[nestlyr].insertAdjacentHTML("BeforeEnd",str);
                        }
                        else {
                                document.body.insertAdjacentHTML("BeforeEnd",str)
                        }
                }
        }