var scrollLinks=function() {var linksDiv,isIE,scrollTimer,scrollPixelMove,linksElement,linksElementArray,linksElementList,maxElement,swidth,idirection; linksDiv=document.getElementById('thumbs'); linksElement=linksDiv.getElementsByTagName('li'); isIE=document.all ? true : false; scrollPixelMove=1; maxElement=4; idirection=1; scrollTimer=30; return {init: function() {linksDiv.onmousemove=function() {clearTimeout(linksDiv.timer);}; linksDiv.onmouseout=function() {scrollLinks.postion; if (idirection == 1) {scrollLinks.scroll(-1);} else {scrollLinks.scroll(1);};}; ys=this.topPostion(linksDiv); ye=ys + linksDiv.offsetHeight; len=linksElement.length; linksElementArray=[]; for (i=0; i < len; i++) {var id=linksElement[i].value; linksElementArray[i]=id;}; linksElementList=linksElementArray.length; swidth=(linksElement[linksElementList - 1].offsetLeft - (linksDiv.parentNode.offsetWidth - linksElement[linksElementList - 1].offsetWidth) + 10);},scroll: function(direction) {idirection=direction; clearInterval(linksDiv.timer); var l=(direction == -1) ? 0 : swidth; linksDiv.timer=setInterval(function() {scrollLinks.move(direction,l);},scrollTimer);},move: function(direction,l) {linksDiv.style.left=linksDiv.style.left || '0px'; var left=linksDiv.style.left.replace('px',''); if (direction == 1) {if (l - Math.abs(left) <= scrollPixelMove) {this.changeDirection(direction); linksDiv.style.left='-' + l + 'px';} else {linksDiv.style.left=left - scrollPixelMove + 'px';};} else {if (Math.abs(left) - l <= scrollPixelMove) {this.changeDirection(direction); linksDiv.style.left=l + 'px';} else {linksDiv.style.left=parseInt(left) + scrollPixelMove + 'px';};};},changeDirection: function(direction) {clearTimeout(linksDiv.timer); setTimeout(function() {if (direction == 1) {scrollLinks.scroll(-1);} else {scrollLinks.scroll(1);}},3000);},limit: function() {var linksDivWidth,linksDivWidthAverage,len; linksDivWidth=linksDiv.parentNode.offsetWidth; linksDivWidthAverage=linksDivWidth / maxElement; linksDivLeftSide=scrollLinks.leftPostion(linksDiv); linksDivMiddlePostion=linksDivLeftSide + linksDivWidthAverage; linksDivRightSide=linksDivLeftSide + linksDivWidth; fxs=linksDivRightSide - linksDivWidthAverage;},postion: function(e) {postion_x=isIE ? event.clientX + document.documentElement.scrollLeft : e.pageX; postion_y=isIE ? event.clientY + document.documentElement.scrollTop : e.pageY; if (postion_x > linksDivLeftSide && postion_x < linksDivMiddlePostion) {scrollLinks.scroll(-1);} else {if (postion_x > fxs && postion_x < linksDivRightSide) {scrollLinks.scroll(1);}};},leftPostion: function(linksElement) {var l=0; if (linksElement.offsetParent) {while (1) {l += linksElement.offsetLeft; if (!linksElement.offsetParent) {break;}; linksElement=linksElement.offsetParent;}} else {if (linksElement.x) {l += linksElement.x;}}; return l;},topPostion: function(linksElement) {var p=0; if (linksElement.offsetParent) {while (1) {p += linksElement.offsetTop; if (!linksElement.offsetParent) {break;}; linksElement=linksElement.offsetParent;}} else if (linksElement.y) {p += linksElement.y;} return p;}};} ();window.onload=function(){scrollLinks.init(); scrollLinks.limit(); setTimeout(function(){scrollLinks.scroll(1);},3000);};