// Álbum
// Adiciona evento a um objeto
function addEvent(obj, evType, fn){
    if (obj.addEventListener)
        obj.addEventListener(evType, fn, true)
	if (obj.attachEvent)
        obj.attachEvent("on"+evType, fn)
}
function centralizaJanela(w,h){
	if(document.all)
	return 'width='+w+',height='+h+',left='+((window.screen.width-w)/2) +',top='+ ((((window.screen.height)-h)-60)/2);
	return 'width='+w+',height='+h+',left=50,top=50';
}

function abreFoto(e){
	if(typeof(e)=='undefined')var e=window.event;
	source=e.target?e.target:e.srcElement;
	var fotoNome = source.src.substring(source.src.lastIndexOf('/')+1,source.src.length).replace('.','')
	var IDAlb = document.formAlb.IDAlb.value
	//var dirAlbum = source.src.substring(0,source.src.lastIndexOf('/'))
	//var srcFotoN = source.src.replace('/p/','/n/');
	window.open('foto.asp?IDAlb='+IDAlb+'&fotoNome='+fotoNome,'Foto',centralizaJanela(500,500))
}
var album
function iniAlbum(){
	lnkAlbum = document.getElementsByTagName("img")
	for(var x=0;x<lnkAlbum.length;x++){
		if(lnkAlbum[x].className=="alb"){
			addEvent(lnkAlbum[x],"click",abreFoto);
			//addEvent(lnkAlbum[x],"mouseover",linhaDestacada);
			//addEvent(lnkAlbum[x],"mouseout",linhaNormal);
		}
	}
}

