function makeScrollbar(content,scrollbar,handle,horizontal,ignoreMouse){
	var steps = (horizontal?(content.getScrollSize().x - content.getSize().x):(content.getScrollSize().y - content.getSize().y))
	var slider = new Slider(scrollbar, handle, {	
		steps: steps,
		mode: (horizontal?'horizontal':'vertical'),
		onChange: function(step){
			// Scrolls the content element in x or y direction.
			var x = (horizontal?step:0);
			var y = (horizontal?0:step);
			content.scrollTo(x,y);
		}
	}).set(0);
	if( !(ignoreMouse) ){
		// Scroll the content element when the mousewheel is used within the 
		// content or the scrollbar element.
		$$(content, scrollbar).addEvent('mousewheel', function(e){	
			e = new Event(e).stop();
			var step = slider.step - e.wheel * 30;	
			slider.set(step);					
		});
	}
	// Stops the handle dragging process when the mouse leaves the document body.
	document.addEvent('mouseleave',function(){slider.drag.stop()});
}


function CloseBrowser(){
    $get('br1').innerHTML='';
}



/*   Анимация */

var sel=1;
var step=180;

function GoNext(){
    $get('SS_'+sel).style.fontWeight='bold';
    step=180;
    setTimeout(GoStep,100);
}


function GoStep(){
    var SSdiv=$get('SSdiv');
  
    if(step<0){
        setTimeout(GoImg,2000);
        return;
    }

    SSdiv.style.width=(260-step)+'px';
    SSdiv.style.paddingLeft=step+'px';
    SSdiv.style.height=(260-step)+'px';
    SSdiv.style.paddingTop=step+'px';
  
    if(step==0){
        SSdiv.style.background='url('+$get('SSpic').src+') no-repeat';
        SSdiv.style.width=0+'px';
        SSdiv.style.paddingLeft=260+'px';
        SSdiv.style.height=0+'px';
        SSdiv.style.paddingTop=260+'px';
    }
    
    step=step-20;
    setTimeout(GoStep,50);
}

function GoImg(){
    $get('SS_'+sel).style.fontWeight='';
    sel=sel+1;
    if($get('SS_'+sel)==null) sel=1;
    $get('SSpic').src=$get('SS_'+sel).attributes['pic'].value;
}


