var iScrollSpeed = 1;
var iScrollLength = 30;
var iCurrentScrollLength = 0;
var hod = 1;
var con = 0;


function Scrolling() {	
	if(hod==1)document.getElementById("GalleryScroller").scrollTop=(document.getElementById("GalleryScroller").scrollHeight-503);
	if(hod==0)document.getElementById("GalleryScroller").scrollTop=0;
	if(con) 
	 {
	 if(hod==4) hod=1;
	 else hod=0;
	 con=0;
	 }
	if(hod==0) {document.getElementById("GalleryScroller").scrollTop=document.getElementById("GalleryScroller").scrollTop+3; PrepareScrollTimeLine(1); hod=4;}
	else if(hod==1) {document.getElementById("GalleryScroller").scrollTop=document.getElementById("GalleryScroller").scrollTop-3; PrepareScrollTimeLine(0); hod=3;}
	setTimeout('Scrolling()', 1000);
}

function PrepareScrollTimeLine(iDirection) {
	iCurrentScrollLength = 0;
	setTimeout('DoScrollTimeLine('+iDirection+')', 10);
}

function DoScrollTimeLine(iDirection) {
	iScrollAmount = (iDirection?1:-1)*iScrollSpeed;
	iCurrentScrollLength += iScrollSpeed;
	if(document.getElementById("GalleryScroller").scrollTop==0)
	 {
	  con=1;
      return;
	 }
	if((document.getElementById("GalleryScroller").scrollHeight-500)<=document.getElementById("GalleryScroller").scrollTop) 
	 {
	  con=1;
      return;
	 }
	document.getElementById("GalleryScroller").scrollTop+=iScrollAmount;

	setTimeout('DoScrollTimeLine('+iDirection+')', 10);
}



//-------------------ScrollANK---------------------------//

var iScrollSpeedAnk = 1;
var vih=0;
var iScrollLengthAnk = 30;
var iCurrentScrollLengthAnk = 0;

function PrepareScrollTimeLineAnk(iDirection) {
	iCurrentScrollLengthAnk = 0;
	setTimeout('DoScrollTimeLineAnk('+iDirection+')', 10);
}

function DoScrollTimeLineAnk(iDirection) {
	iScrollAmount = (iDirection?1:-1)*iScrollSpeedAnk;
	iCurrentScrollLengthAnk += iScrollSpeedAnk;
	if(document.getElementById("GalleryScrollerAnk").scrollHeight<=document.getElementById("GalleryScrollerAnk").scrollTop) return;
	document.getElementById("GalleryScrollerAnk").scrollTop+=iScrollAmount;
	if(vih==1) {
		return;
	}
	setTimeout('DoScrollTimeLineAnk('+iDirection+')', 10);
}
