window.defaultUrl = "./";

BodyLoad.onContent(function(){

	var a = document.links;
	for(var i=0; i<a.length; i++){
		if(a[i].rel && a[i].rel == "thumb"){
			a[i].onclick = ampliaHandler;
		}
	}
	
	if(!empty(p = $("menu"))) var menu = new popMenu(p);
	
});

function ampliaHandler()
{	
	ampliarImg(this.href);
	return false;
}

/* popMenu class (for UL based submenus) */
var popMenu = function(m)
{
	this.m = (typeof m == "string") ? $(m) : m;	
	this.onItemOver = null;
	this.onItemOut = null;
	this.preventDefault = false;
	this.setEvents();
}

popMenu.prototype.showMenu = function(o, v)
{
	if((ul = $t("UL", o)) != null && ul.length > 0 && (ul = ul[0]))
	{
		if(!this.preventDefault) ul.style.visibility = (typeof v == "string" && v.length > 0) ? v : "visible";
		
		if(v == undefined && this.onItemOver != null) this.onItemOver(o, ul);
		else if(this.onItemOut != null) this.onItemOut(o, ul);
		
		return true;
		
	} else {
		return void(0);
	}
}

popMenu.prototype.hideMenu = function(e){ return this.showMenu(e, "hidden"); }
popMenu.prototype.setEvents = function()
{
	this.li = $t("LI", this.m);
	if(this.li == null) return false;
	for(var i=0; i<this.li.length; i++){
		Event.add(this.li[i], "mouseover", Delegate.create(this, this.showMenu, [this.li[i]]));
		Event.add(this.li[i], "mouseout", Delegate.create(this, this.hideMenu, [this.li[i]]));
	}
}

