Javascript Error

Hy guys

i have this error

uncaught exception: [Exception... "Could not convert JavaScript argument" 
nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" 
location: "JS frame :: http://www.tgi.com.pt/merdo/scroll/ :: anonymous :: line 435" 
data: no]

the problem is this code


<script type="text/javascript">
var gal = {
init : function() {
if (!document.getElementById || !document.createElement || !document.appendChild) return false;
if (document.getElementById('gallery')) document.getElementById('gallery').id = 'jgal';
var li = document.getElementById('jgal').getElementsByTagNa me('li');
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],function() {
var im = document.getElementById('jgal').getElementsByTagNa me('li');
for (j=0; j<im.length; j++) {
im[j].className = '';
}
this.className = 'active';
});
}
},
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();
});
</script>

I thin this is a conflict between fancybox plug in and the script above

http://www.tgi.com.pt/merdo/scroll/

I really need help…

Thanks