//Creates a queue of functions to be executed when the page loads using addLoadEvent(functionName);function addLoadEvent(func) {	var oldonload = window.onload;	if (typeof window.onload != 'function') {		window.onload = func;		} else {			window.onload = function() {				oldonload();				func();			}		}	}//Creates a "selected" class when the thumbnail is clicked.tbgclickMenu = function() {	var getEls = document.getElementById("tbg_views").getElementsByTagName("li");	var getAgn = getEls; 	for (var i=0; i<getEls.length; i++) {			getEls[i].onclick=function() {				for (var x=0; x<getAgn.length; x++) {				getAgn[x].className=getAgn[x].className.replace("selected", "");				}				this.className+=" selected";				}			}		}//Loops through all the links in the image tbg_views list and when the link is activated calls the tbgshowPic function.function prepare_tbgGallery() {	if (!document.getElementsByTagName) return false;	if (!document.getElementById) return false;	if (!document.getElementById("tbg_views")) return false;	var tbg_views = document.getElementById("tbg_views");	var links = tbg_views.getElementsByTagName("a");	for ( var i=0; i < links.length; i++) {		links[i].onclick = function() {		return tbgshowPic(this);		}	links[i].onkeypress = links[i].onclick; 	} }//Swaps out the tbg_gallery image for an image in the linked from the tbg_views list.function tbgshowPic(tbgwhichpic) {	if(!document.getElementById("tbg_gallery")) return true;	var source = tbgwhichpic.getAttribute("href");	var tbg_gallery = document.getElementById("tbg_gallery");	tbg_gallery.setAttribute("src", source);	if (!document.getElementById("description")) return false;	if (tbgwhichpic.getAttribute("title")) {		var text = tbgwhichpic.getAttribute("title");	} else {		var text = "";	}	return false;}// Load functions when the page loads.addLoadEvent(prepare_tbgGallery);addLoadEvent(tbgclickMenu);