﻿<!-- 
var idArrScroll=new Array ( );
var maxArrS=0;
var scroll_break=1;
var cCh=0;


var time_whait=100;
var minSpeed=110;
var maxSpeed=110;
var whaitCh=0;
var axeleration=0;
var cSpeed=minSpeed;


function scroll_breaker(){
    if (scroll_break==2){
    	scroll_break=0;
    	cCh=0;
   	cSpeed=minSpeed;
    }

}

function scroll_left(id){
var retr="scroll_left('"+id+"');";
var pos=checkIdArr(id);
	idArrScroll[pos][1]-=cSpeed;
	chSpeed();
    if(idArrScroll[pos][1]<0)
    {
       idArrScroll[pos][1]=0;
       document.getElementById("photo_scroll_left").className = "arrow-rew-disabled"
    }
    else
    {
        document.getElementById("photo_scroll_right").className = "arrow-frw"
    }
    document.getElementById(id).scrollLeft=idArrScroll[pos][1];
    if (scroll_break){
        setTimeout(retr, time_whait);
        scroll_break=2;
   }else
        scroll_break=1;

}


function scroll_right(id){
var retr="scroll_right('"+id+"');";
var pos=checkIdArr(id);
	idArrScroll[pos][1]+=cSpeed;
	chSpeed();
    if(idArrScroll[pos][1]>document.getElementById(id).scrollWidth-document.getElementById(id).clientWidth)
    {
       idArrScroll[pos][1]=document.getElementById(id).scrollWidth-document.getElementById(id).clientWidth;
       document.getElementById("photo_scroll_right").className = "arrow-frw-disabled"
    }
    else
    {
        document.getElementById("photo_scroll_left").className = "arrow-rew"
    }
    document.getElementById(id).scrollLeft=idArrScroll[pos][1];
    if (scroll_break){
        setTimeout(retr, time_whait);
        scroll_break=2;
    }else
        scroll_break=1;
}


function checkIdArr(id){
	for (var i=0;i<maxArrS;i++){
		if (idArrScroll[i][0]==id)
		  return i;
	}
	idArrScroll[maxArrS]=new Array (2);
	idArrScroll[maxArrS][0]=id;
	idArrScroll[maxArrS][1]=0;
	maxArrS++;
	return maxArrS-1;
}

function chSpeed(){
	if (maxSpeed>cSpeed){
		cCh++;
			if (cCh>whaitCh){
				cCh=0;
			if (maxSpeed>cSpeed)
		  		cSpeed+=axeleration;
			if (maxSpeed<cSpeed) cSpeed=maxSpeed;
		}
	}
}

function toUp(id){
	var pos=checkIdArr(id);
	idArrScroll[pos][1]=0;
	document.getElementById(id).scrollTop=0;

}
//-->   