// General functions

function addLoadEvent (func) 
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function') 
	{
		window.onload = func;
	}
	else 
	{
		window.onload = function() 
		{
			oldonload();
			func();
		}
	}
}

// Gallery specific functions

function prepareGallery () 
{
	if(!document.getElementsByTagName || !document.getElementById)	
	{
		return false;
	}
	if (!document.getElementById('category-list')) 
	{
		return false;
	}
	var gallery = document.getElementById('category-list');
	var links = gallery.getElementsByTagName('a');
	for (var i=0; i < links.length; i++) 
	{
		links[i].onmouseover = function () 
		{
			return showPic(this);
		}
	}
}

function showPic (whichpic, src, width, height) 
{
	if (!document.getElementById('placeholder')) 
	{
		return true;
	}
	var placeholder = document.getElementById("placeholder");
	if (placeholder.nodeName != "IMG") 
	{
		return true;
	}
	placeholder.setAttribute("src",'/images/category-list/'+src+'.jpg');
	placeholder.setAttribute("width",width);
	placeholder.setAttribute("height",height);
	return false;
}

// Loading

// addLoadEvent(preparePlaceholder);
// addLoadEvent(prepareGallery);