Event.observe(window, 'load', function() {
	Anico_headerRandomize();
	Anico_homeLinks();
	Anico_menuLinks();
});


function Anico_menuLinks()
{
	$('wrapper').select('.leftmenu li a').each(function(element) {
		var parente = ($(element).up(0));
		var url = $(element).href;
		parente.setStyle({
			cursor: 'pointer'
		});
		// stop link click
/*		$(element).observe('click', function(event) {
			event.stop();
			return false;
		});*/
		parente.observe('click', function(event) {
			document.location = url;
		});
	});
}

function Anico_homeLinks()
{
	$('wrapper').select('.homelink').each(function(element) {
		$(element).observe('click', function() {
			document.location = HomeLink;
		});
	});
}

function Anico_headerRandomize()
{
	var numimages=0;
	numimages=HeaderImages.length;
	if (numimages == 1) {
		randomimage=(HeaderImages[0]);
	} else {
		x=(Math.floor(Math.random()*numimages));
		randomimage=(HeaderImages[x]);
	}
	document.getElementById("headimage").style.backgroundImage = "url("+ randomimage +")";
}