// -- Custom
var _Custom = {
	
	addFakeHover: function(els, classe) {
		classe = classe || 'hover'
		addEventDict(els, 
			{ 
				'mouseover' : function(e) { addClass(e.currentTarget, classe) },
				'focus' : function(e) { addClass(e.currentTarget, classe) },
				'mouseout' : function(e) { remClass(e.currentTarget, classe) },
				'blur' : function(e) { remClass(e.currentTarget, classe) }
			}
		)
	},
	
	PopupImagem: function(e) {
		
		e.preventDefault()
		
		var src = e.currentTarget
		
		var width = parseInt(src.getAttribute('href').split('&').filter(function(el) { if (el.substr(0, 2) == 'w=') return true })[0].substr(2))
		var height = parseInt(src.getAttribute('href').split('&').filter(function(el) { if (el.substr(0, 2) == 'h=') return true })[0].substr(2))
		var bLegenda = (src.getAttribute('href').indexOf('Legenda=') != -1)  
		
		var iWidth = 740, iHeight = 550, iTop, iLeft
		
		iWidth += 20 // scrollbars
		
		iTop = 30
		iLeft = parseInt((screen.width - iWidth) / 2)
		
		return Popup.link(src, 'width=' + iWidth + ',height=' + iHeight + ',top=' + iTop + ',left=' + iLeft + ',scrollbars=1,location=0,statusbar=0,menubar=0')

	}, 
	
	iniciar: function() {
		var o
		
		// Abre links com classe 'externo' em nova página
		addEvent(getElementsByClass('externo', 'a'), 'click', Popup.event)
		
		// Popups de imagem
		if ((o = getElem('imagens'))) addEvent(getAll('a', o), 'click', _Custom.PopupImagem)
		each(getElementsByClass('galeria'), function(el) { addEvent(getAll('a', el), 'click', _Custom.PopupImagem) })
		
	}
	
}