
if (document.layers)
{
    var ww = window.innerWidth, wh = window.innerHeight;
    
    window.onresize = function()
    {
        if (ww!=this.innerWidth || wh!=this.innerHeight)
            this.location.reload();
    }
    
    Layer.prototype.onload = function()
    {
        document.layers[this.id] = this;
        with (this.document)
        {
       		for (var i=0; i<images.length; i++)
        	{
				if (images[i].name) 
				{
					document.images[images[i].name] = images[i];
				}
			}
		}
        
        if (this.id.indexOf("Nav")!=-1)
        {
            this.onmouseout = function()
            {
                CloseNav(this.id.substring(0,this.id.length-3));
            }           
        }
    }
}

function imgOn(name)
{	
	if (document.images[name]) document.images[name].src = window[name+"on"].src;
}

function imgOff(name)
{
	if (document.images[name]) document.images[name].src = window[name+"off"].src;
}

// randomise the text in the Did You Know <span>
var noOfTexts = 5;
function chooseText() {
	value = Math.ceil(Math.random() * noOfTexts) - 1; // for 0 based array
	document.getElementById('didYouKnow').innerHTML = didYouKnowArray[value];
}
