var gal = {    init : function() {        document.getElementById('album_thumbs').id = 'album_thumbs';        var li = document.getElementById('album_thumbs').getElementsByTagName('li');		var a = document.getElementById('album_thumbs').getElementsByTagName('a');		var theid = li[0].getElementsByTagName('img')[0].className;		        li[0].className = 'active';        for (i=0; i<li.length; i++) {            li[i].style.backgroundImage = 'url(' + li[i].getElementsByTagName('img')[0].src + ')';            li[i].style.backgroundRepeat = 'no-repeat';            li[i].title = li[i].getElementsByTagName('img')[0].alt;                                    gal.addEvent(li[i],'click',function() {                var im = document.getElementById('jgal').getElementsByTagName('li');                for (j=0; j<im.length; j++) {                    im[j].className = '';                }                this.className = 'active';				theid = this.getElementsByTagName('img')[0].className;				if (theid == '') {theid = 0};            });          					        }		gal.addEvent(a[1],'click',function() {			if (theid == '') {theid = 0};						 var current = parseInt(theid);			 var prev = current-1;			  var im2 = document.getElementById('jgal').getElementsByTagName('li');			 for (k=0; k<im2.length; k++) {                    if (theid != 0) {					im2[current].className = '';}                }			  im2[prev].className = 'active';			theid = prev;			});								gal.addEvent(a[2],'click',function() {			if (theid == '') {theid = 0};			 var current = parseInt(theid);			 var next = current+1;			 var im2 = document.getElementById('jgal').getElementsByTagName('li');			 for (k=0; k<im2.length; k++) {			 if (theid != im2.length-1) {                    im2[current].className = '';}                }			  im2[next].className = 'active';			theid = next;			});		    },    addEvent : function(obj, type, fn) {        if (obj.addEventListener) {            obj.addEventListener(type, fn, false);        }        else if (obj.attachEvent) {            obj["e"+type+fn] = fn;            obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }            obj.attachEvent("on"+type, obj[type+fn]);        }    }}gal.addEvent(window,'load', function() {gal.init();});
