function initScrolls(maxPages){

	var scrollBarHeight = 5; 
	var simpleScroll = false; 
	var showBarArrow = true; 
	var showPagesTotal = 0; 
	
	var i,scrollWrap,scrollBar,scrollPage,pagesTotal,scrollBarWidth,scrollPageWidth,scrollWrapWidth,IE,numPages,curPage,content,pageScroll;IE=/*@cc_on!@*/false;content=document.getElementById("content");pageScroll=document.getElementById("pageScroll");function getPageInformation(){var b,a,c,e;b=document.getElementById("pagesBlock1");if(!b){c=document.getElementsByTagName("span");for(var d=0;d<c.length;d++){if(/pagesBlock(uz)?1/.test(c[d].className)){b=c[d]}}}a=b.getElementsByTagName("*");for(e=0;e<a.length;e++){if(/(A|B)/.test(a[e].tagName)&&a[e].innerHTML!="»"){numPages=a[e].innerHTML}}curPage=b.getElementsByTagName("b")[0].innerHTML;setContent(numPages,curPage)}getPageInformation();function setContent(a,c){var b,d;for(b=1;b<=a;b++){d=b==c?'class="curPage" ':"";content.innerHTML=content.innerHTML+"<a "+d+'href="javascript://" onclick="spages('+b+');return false;">'+b+"</a>"}pageBlockWidth=content.offsetWidth/numPages;scrollBarWidth=Math.round((maxPages*pageBlockWidth/numPages)*maxPages);scrollPageWidth=Math.round(maxPages*pageBlockWidth/numPages);scrollWrapWidth=maxPages*pageBlockWidth;createScrolls()}function createScrolls(){if(numPages<=maxPages){pageScroll.style.width=numPages*pageBlockWidth+"px"}else{content.style.position="absolute";var a=document.createElement("DIV");a.style.height=content.offsetHeight+"px";pageScroll.appendChild(a);pageScroll.style.width=maxPages*pageBlockWidth+"px";scrollWrap=document.createElement("DIV");scrollBar=document.createElement("DIV");scrollPage=document.createElement("DIV");scrollWrap.style.cssText="width:"+scrollWrapWidth+"px;height:"+scrollBarHeight+"px;";scrollWrap.className="scrollWrap";scrollBar.style.cssText="width:"+scrollBarWidth+"px;height:"+scrollBarHeight+"px;";scrollBar.className="scrollBar";if(showBarArrow){scrollBar.innerHTML="<div style='position:absolute;left:50%;margin-left:-2px;top:-1px;width:5px;height:1px;' class='scrollBar'></div><div style='position:absolute;left:50%;margin-left:-1px;top:-2px;width:3px;height:1px;' class='scrollBar'></div><div style='position:absolute;left:50%;top:-3px;width:1px;height:1px;' class='scrollBar'></div>"}scrollPage.style.cssText="width:"+scrollPageWidth+"px;height:"+scrollBarHeight+"px;";scrollPage.className="scrollPage";pageScroll.appendChild(scrollWrap);scrollWrap.appendChild(scrollPage);scrollWrap.appendChild(scrollBar);if(showPagesTotal){pagesTotal=document.createElement("DIV");pagesTotal.className="pagesTotal";pagesTotal.innerHTML=numPages+" страниц";pageScroll.appendChild(pagesTotal)}setScrollsFirst()}}function setEvents(){scrollWrap.onclick=function(c){if(IE){c=window.event}var b=IE?c.srcElement:c.target;if(b==scrollWrap||b==scrollPage){setScroll(Math.round(getMouse(c)-getElm(pageScroll)-scrollBarWidth/2))}};addHandler(document,"mouseup",function(){i=false});scrollBar.onmousedown=function(b){var d,c;if(IE){b=window.event}i=true;d=scrollBar.offsetLeft;if(!IE){b.preventDefault()}c=getMouse(b);addHandler(document,"mousemove",function(e){if(i){if(IE){e=window.event}if(IE){e.returnValue=false}setScroll(Math.round(getMouse(e)-c+d))}})};function a(c){var b=0;if(IE){c=window.event}if(c.wheelDelta){b=c.wheelDelta/120}else{if(c.detail){b=-c.detail/3}}if(b){setScroll(Math.round(scrollBar.offsetLeft+b*(scrollWrapWidth/numPages)))}if(IE){c.returnValue=false}else{c.preventDefault()}}if(!IE){pageScroll.addEventListener("DOMMouseScroll",a,false)}pageScroll.onmousewheel=a}function setScrollsFirst(){var b,a;b=Math.round(scrollWrapWidth/numPages*(curPage-1));a=scrollWrapWidth-scrollPageWidth;if(b<0){b=0}else{if(b>a){b=a}}scrollPage.style.left=b+"px";setScroll(Math.round((scrollWrapWidth/numPages)*(curPage-0.5)-scrollBarWidth/2));setEvents()}function setScroll(b){var c,a;c=scrollWrapWidth-scrollBarWidth;if(b<0){b=0}else{if(b>c){b=c}}scrollBar.style.left=b+"px";a=Math.round((content.offsetWidth-pageScroll.offsetWidth)/c*-scrollBar.offsetLeft);a=simpleScroll?a:Math.round(a/pageBlockWidth)*pageBlockWidth;content.style.left=a+"px"}function getMouse(a){return a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft}function getElm(b){var a=b.offsetLeft;while(b.offsetParent!=null){b=b.offsetParent;a+=b.offsetLeft;if(b.tagName=="BODY"){break}}return a}function addHandler(a,c,b){if(a.addEventListener){a.addEventListener(c,b,false)}else{if(a.attachEvent){a.attachEvent("on"+c,b)}else{a["on"+c]=b}}};

	}