var	iScrollSpeed = 10;
var iScrollLength = 80;
var iCurrentScrollLength = 0;

function PrepareScrollTimeLine(iDirection) {
	iCurrentScrollLength = 0;
	setTimeout('DoScrollTimeLine('+iDirection+')', 10);
}

function DoScrollTimeLine(iDirection) {
	iScrollAmount = (iDirection?1:-1)*iScrollSpeed;
	iCurrentScrollLength += iScrollSpeed;
	document.getElementById("GalleryScroller").scrollLeft+=iScrollAmount;
	if(iCurrentScrollLength==iScrollLength) {
		return;
	}
	setTimeout('DoScrollTimeLine('+iDirection+')', 10);
}


/*var iScrollSpeed = 1;
var vih=0;
var iScrollLength = 30;
var iCurrentScrollLength = 0;

function PrepareScrollTimeLine(iDirection) {
	iCurrentScrollLength = 0;
	setTimeout('DoScrollTimeLine('+iDirection+')', 10);
}

function DoScrollTimeLine(iDirection) {
	iScrollAmount = (iDirection?1:-1)*iScrollSpeed;
	iCurrentScrollLength += iScrollSpeed;
	if(document.getElementById("GalleryScroller").scrollHeight<=document.getElementById("GalleryScroller").scrollTop) return;
	document.getElementById("GalleryScroller").scrollTop+=iScrollAmount;
	if(vih==1) {
		return;
	}
	setTimeout('DoScrollTimeLine('+iDirection+')', 10);
}*/


var	iScrollSpeedD = 1;
var vih=0;
var iScrollLengthD = 670;
var iCurrentScrollLengthD = 0;

function PrepareScrollTimeLineD(iDirection) {
	/*if(iDirection&&(document.getElementById("GalleryScrollerD").scrollWidth<(document.getElementById("GalleryScrollerD").scrollLeft+600*2))) return;
	if(!iDirection&&document.getElementById("GalleryScrollerD").scrollLeft<600) return;
	//alert(document.getElementById("GalleryScrollerD").scrollLeft);
	if(iCurrentScrollLengthD) return;*/
	iCurrentScrollLengthD = 0;
	setTimeout('DoScrollTimeLineD('+iDirection+')', 1);
}

function DoScrollTimeLineD(iDirection) {
	iScrollAmount = (iDirection?1:-1)*iScrollSpeedD;
	iCurrentScrollLengthD += iScrollSpeedD;
	
	if(document.getElementById("GalleryScrollerD").scrollWidth<=document.getElementById("GalleryScrollerD").scrollLeft) return;
	document.getElementById("GalleryScrollerD").scrollLeft+=iScrollAmount;
	if(vih==1) {
		return;
	}
	/*document.getElementById("GalleryScrollerD").scrollLeft+=iScrollAmount;
	if(iCurrentScrollLengthD==iScrollLengthD) {
		iCurrentScrollLengthD=0;
		return;
	}*/
	setTimeout('DoScrollTimeLineD('+iDirection+')', 1);
}


function zv(sk) {
 var i;
 for(i=1;i<6;i++)
  {
  setTimeout('', 1000);
  if(i<sk+1) document.getElementById("zv"+i).src='img/zv1.gif';	
  else document.getElementById("zv"+i).src='img/zv0.gif';
  }
 setCookie('ball',sk);
}


function setCookie (name, value, expires, path, domain, secure) {
      document.cookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}


function getCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return(setStr);
}

