function load()
{
    colourCurrentTab();
}

function colourCurrentTab()
{
    var file_name = document.location.href;
    var end = (file_name.indexOf("?") == -1) ? file_name.length : file_name.indexOf("?");
    var file = file_name.substring(file_name.lastIndexOf("/")+1, end);
    
    var links = document.getElementsByTagName('a')
    
    for (i=0; i<links.length; i++)
    {
	if (links[i].getAttribute("href") == file && links[i].getAttribute("class") == "nav")
	{
	    links[i].style.color = "white";
	    links[i].style.background = "black";
	}
    }
}

function clicker(image, alt)
{    
    var thediv=document.getElementById('displaybox');
    var darken=document.getElementById('darkenBG');
    
    if(thediv.style.display == "none")
    {
	thediv.style.display = "";
	darken.style.display = "";
	
	thediv.style.top = (coords()+50)+"px";  //set the top of the pop-up div to be 50px below the top of the screen
	
	thediv.innerHTML = "<img src='images/gallery/" + image + "' alt=\"" + alt + "\" class=\"large\" /><br /><p class=\"largeImageCaption\">" + alt + "</p><div class=\"closebox\" onclick='return clicker();'></div>";
    }
    else
    {
	thediv.style.display = "none";
	darken.style.display = "none";
	thediv.innerHTML = "";
    }
    return false;
}

// gets how far down the page is scrolled
function coords()
{
    var coords;

    if(/msie/i.test(navigator.userAgent))
    {
	coords = document.documentElement.scrollTop;
    }
    else
    {
	coords = window.pageYOffset;
    }
	
    return coords;
}
