// Imagery's slideshow.
// (C) 2006 AKS <aksus-69@yandex.ru>
function applyHandler(o, e, f) { e = (e instanceof Array) ? (arguments.callee(o, e[1], f), e[0]) : e; return (o.attachEvent) ? o.attachEvent(e, f) : (o.addEventListener) ? o.addEventListener(e.substr(2), f, false) : false; } function initScroller() { var t = document.getElementById('control'), s = document.getElementById('scroller'); t.back_control = t.getElementsByTagName('span')[0]; (t.scroll_obj = s).scroll_position = s.scroll_active = 0; s.scroll_range = s.offsetWidth - s.parentNode.offsetWidth; return applyHandler(t, ['onmouseover', 'onmouseout'], scrollControl); } function scrollControl(e) { var el = (e = e || event).target || e.srcElement, t = el.tagName.toLowerCase(), p, b; if(t == 'span') { p = el.parentNode.scroll_obj; return (p.scroll_active = !p.scroll_active) ? (b = (el == el.parentNode.back_control), scrollProcess(p, b)) : false; } else return false; } function scrollProcess(o, b) { var p = o.scroll_position; o.scroll_position = (!b && p > -o.scroll_range) ? p - 5 : (b && p < 0) ? p + 5 : (o.scroll_active = 0, b) ? 0 : p; o.style.left = o.scroll_position + 'px'; return (o.scroll_active) ? window.setTimeout(function() { return scrollProcess(o, b); }, 10) : false; } applyHandler(window, 'onload', initScroller);
