
// BEGIN configuration section 

var brandImageName = "brand.gif"
var brandImageURL = "http://www.whatrain.com/examples/branding/"
var brandImageWidth = 120
var brandImageHeight = 36
var brandImageAlt = "WhatRain HomePort"
var destinationURL = "http://www.whatrain.com/"
var movementDelay = 3   // in tenths of sec
var rightEdgeFromRight = 0
var bottomEdgeFromBottom = 0

// END configure section


var brandImage = new Image(brandImageWidth,brandImageHeight)
brandImage.src = brandImageURL + brandImageName

function reloadWindow()
{
	window.location.reload() 
} 

function reloadLayer()
{ 
	if(document.layers)setTimeout("window.onresize = reloadWindow",400) 
}


function createBrand()
{
	brandLayer = new Layer(brandImageWidth)
	brandLayer.left = - ( brandImageWidth )
	brandLayer.top = brandImageHeight
	brandLayer.document.write('<a href = "' + destinationURL + '"><img src ="' + brandImage.src + '" border = 0 alt = "' + brandImageAlt + '"></a>') 
	brandLayer.document.close()
	brandLayer.visibility = "show" 
	reloadLayer() 
	setLayerWait()
}

function placeBrand()
{
	var leftPosition = document.body.scrollLeft + leftLocation
	var topPosition = document.body.scrollTop + topLocation
	brand.style.left = leftPosition
	brand.style.top = topPosition
}

function placeLayer()
{
	brandLayer.left = pageXOffset + window.innerWidth - ( brandLayer.document.width + 16 + rightEdgeFromRight )
	brandLayer.top = pageYOffset + window.innerHeight - ( brandLayer.document.height - bottomEdgeFromBottom )
}

function loadImage()
{
	brand.innerHTML = '<a href="' + destinationURL + '"><img src="' + brandImage.src + '" border = 0 alt="' + brandImageAlt + '"></a>' 
}

function setLayerWait()
{
	setInterval("placeLayer()",100 + movementDelay * 100)
}




if (document.all) document.write('<span id = "brand" style = "position:absolute;top:99;width:' + brandImage.width + ';height:' + brandImage.height + '"></span>')
if (document.layers) window.onload = createBrand;


if (document.all)
{
	var leftLocation = document.body.clientWidth - ( brand.style.pixelWidth + 10 )
	var topLocation = document.body.clientHeight - ( brand.style.pixelHeight + 10 )
	brand.style.left = leftLocation 
	brand.style.top = topLocation

	window.onscroll = placeBrand
	window.onresize = reloadWindow    
	window.onload = loadImage 
}
