var SCROLL_PHOTO = 4; var ONE_FRAME = 100; var SCROLL_STEP = 5; var PADDING = 30; var BGCOLOR = '#cfffff'; var _dom = document.all?(document.getElementById?2:1):(document.getElementById?4:(document.layers?3:0)); function start() { var ss = getScreenSize(); var h = ss.y - (PADDING * 2); var w = 80; var cont_l = document.createElement('div'); cont_l.style.position = 'absolute'; cont_l.id = 'cont_lId'; cont_l.style.left = 0 + 'px'; cont_l.style.top = PADDING + 'px'; cont_l.style.width = w + 'px'; cont_l.style.height = h + 'px'; cont_l.style.zIndex = 100; document.body.appendChild(cont_l); var innerCont = ''; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; var inner = '
'; inner += '
'; inner += '
' + innerCont +'
'; cont_l.innerHTML = inner; var cont_r = document.createElement('div'); cont_r.style.position = 'absolute'; cont_r.id = 'cont_rId'; cont_r.style.right = 0 + 'px'; cont_r.style.top = PADDING + 'px'; cont_r.style.width = w + 'px'; cont_r.style.height = h + 'px'; cont_r.style.zIndex = 100; document.body.appendChild(cont_r); var innerCont = ''; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; innerCont += '
'; var inner = '
'; inner += '
'; inner += '
' + innerCont +'
'; cont_r.innerHTML = inner; window.onscroll = function() { if(!f_scroll) scroll(); } onscroll(); } var f_btn_l = false; function up_l() { obj = document.getElementById('cont_lImgId'); if(obj.scrollTop != (obj.scrollHeight - obj.offsetHeight)) { if(obj.scrollTop + SCROLL_PHOTO <= (obj.scrollHeight - obj.offsetHeight)) obj.scrollTop = obj.scrollTop + SCROLL_PHOTO; else { obj.scrollTop = (obj.scrollHeight - obj.offsetHeight); f_btn_l = false; } } if(f_btn_l == 'up') setTimeout(up_l, 1); } function down_l() { obj = document.getElementById('cont_lImgId'); if(obj.scrollTop != 0) { if(obj.scrollTop - SCROLL_PHOTO > 0) obj.scrollTop = obj.scrollTop - SCROLL_PHOTO; else { obj.scrollTop = 0; f_btn_l = false; } } if(f_btn_l == 'down') setTimeout(down_l, 1); } var f_btn_r = false; function up_r() { obj = document.getElementById('cont_rImgId'); if(obj.scrollTop != (obj.scrollHeight - obj.offsetHeight)) { if(obj.scrollTop + SCROLL_PHOTO <= (obj.scrollHeight - obj.offsetHeight)) obj.scrollTop = obj.scrollTop + SCROLL_PHOTO; else { obj.scrollTop = (obj.scrollHeight - obj.offsetHeight); f_btn_r = false; } } if(f_btn_r == 'up') setTimeout(up_r, 1); } function down_r() { obj = document.getElementById('cont_rImgId'); if(obj.scrollTop != 0) { if(obj.scrollTop - SCROLL_PHOTO > 0) obj.scrollTop = obj.scrollTop - SCROLL_PHOTO; else { obj.scrollTop = 0; f_btn_r = false; } } if(f_btn_r == 'down') setTimeout(down_r, 1); } var f_scroll = false; function scroll() { obj = document.getElementById('cont_lId'); obj_r = document.getElementById('cont_rId'); if(parseInt(obj.style.top) != (PADDING + document.body.scrollTop)) { if(parseInt(obj.style.top) > PADDING + document.body.scrollTop) if(parseInt(obj.style.top) - SCROLL_STEP < PADDING + document.body.scrollTop) { obj.style.top = PADDING + document.body.scrollTop; obj_r.style.top = PADDING + document.body.scrollTop; } else { obj.style.top = parseInt(obj.style.top) - SCROLL_STEP; obj_r.style.top = parseInt(obj.style.top) - SCROLL_STEP; } else if(parseInt(obj.style.top) < PADDING + document.body.scrollTop) if(parseInt(obj.style.top) + SCROLL_STEP > PADDING + document.body.scrollTop) { obj.style.top = PADDING + document.body.scrollTop; obj_r.style.top = PADDING + document.body.scrollTop; } else { obj.style.top = parseInt(obj.style.top) + SCROLL_STEP; obj_r.style.top = parseInt(obj.style.top) + SCROLL_STEP; } setTimeout(scroll, 1); f_scroll = true; } else f_scroll = false; } function getScreenSize() { var width = 0, height = 0; if(typeof(window.innerWidth) == 'number') { //Non-IE width = window.innerWidth - 4; height = window.innerHeight - 4; } else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { //IE 6+ in 'standards compliant mode' width = document.documentElement.clientWidth; height = document.documentElement.clientHeight; } else if(document.body && (document.body.clientWidth || document.body.clientHeight)) { //IE 4 compatible width = document.body.clientWidth; height = document.body.clientHeight; } return { x : width, y : height }; }